~sword-devel/jsword/trunk

« back to all changes in this revision

Viewing changes to jsword/java/map/org/crosswire/jsword/map/model/VBAExport.java

  • Committer: joe
  • Date: 2002-10-08 21:36:18 UTC
  • Revision ID: svn-v4:a88caf3b-7e0a-0410-8d0d-cecb45342206:trunk:80
big config and comment update

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
import org.crosswire.common.util.LogicError;
9
9
 
10
10
/**
11
 
* VBAExport takes a Map and exports the data to a Word VBA file.
12
 
* This was developed from a VB macro that looked something like this:
13
 
* <pre>
14
 
* Attribute VB_Name = "NumberLine"
15
 
16
 
* Option Explicit
17
 
18
 
* Dim shape As FreeformBuilder
19
 
20
 
* Private Const box_width As Single = 20#
21
 
* Private Const box_height As Single = 20#
22
 
23
 
24
 
* '-------------------------------------------------------------------------------
25
 
26
 
* Public Sub RouteMain()
27
 
28
 
*   RouteStart 100#, 100#, "1"
29
 
30
 
*   RouteContinue 110#, 110#, "2"
31
 
*   RouteContinue 120#, 120#, "3"
32
 
*   RouteContinue 130#, 120#, "4"
33
 
*   RouteContinue 130#, 130#, "5"
34
 
*   RouteContinue 100#, 130#, "6"
35
 
*   RouteContinue 90#, 100#, "7"
36
 
37
 
*   RouteEnd
38
 
39
 
* End Sub
40
 
41
 
42
 
* '-------------------------------------------------------------------------------
43
 
44
 
* Private Sub RouteStart(x As Single, y As Single, display As String)
45
 
46
 
*   Set shape = ActiveDocument.Shapes.BuildFreeform(msoEditingAuto, x, y)
47
 
*   RouteAddText x, y, display
48
 
49
 
* End Sub
50
 
51
 
52
 
* '-------------------------------------------------------------------------------
53
 
54
 
* Private Sub RouteContinue(x As Single, y As Single, display As String)
55
 
56
 
*   shape.AddNodes msoSegmentLine, msoEditingAuto, x, y
57
 
*   RouteAddText x, y, display
58
 
59
 
* End Sub
60
 
61
 
62
 
* '-------------------------------------------------------------------------------
63
 
64
 
* Private Sub RouteEnd()
65
 
66
 
*   Dim route As ShapeRange
67
 
68
 
*   shape.ConvertToShape.Select
69
 
*   Set route = Selection.ShapeRange
70
 
71
 
*   route.Fill.Visible = msoFalse
72
 
*   route.Fill.Transparency = 0#
73
 
*   route.Line.Weight = 0.75
74
 
*   route.Line.DashStyle = msoLineSolid
75
 
*   route.Line.Style = msoLineSingle
76
 
*   route.Line.Transparency = 0#
77
 
*   route.Line.Visible = msoTrue
78
 
*   route.Line.ForeColor.RGB = RGB(255, 0, 0)
79
 
*   route.Line.BackColor.RGB = RGB(255, 255, 255)
80
 
*   route.Line.BeginArrowheadLength = msoArrowheadLengthMedium
81
 
*   route.Line.BeginArrowheadWidth = msoArrowheadWidthMedium
82
 
*   route.Line.BeginArrowheadStyle = msoArrowheadNone
83
 
*   route.Line.EndArrowheadLength = msoArrowheadLengthMedium
84
 
*   route.Line.EndArrowheadWidth = msoArrowheadWidthMedium
85
 
*   route.Line.EndArrowheadStyle = msoArrowheadNone
86
 
87
 
*   'route.LockAspectRatio = msoFalse
88
 
*   'route.Height = 115.35
89
 
*   'route.Width = 333.05
90
 
*   'route.Rotation = 0#
91
 
*   'route.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
92
 
*   'route.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
93
 
94
 
*   'route.LockAnchor = False
95
 
*   'route.WrapFormat.AllowOverlap = True
96
 
*   'route.WrapFormat.Side = wdWrapBoth
97
 
*   'route.WrapFormat.DistanceTop = CentimetersToPoints(0)
98
 
*   'route.WrapFormat.DistanceBottom = CentimetersToPoints(0)
99
 
*   'route.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
100
 
*   'route.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
101
 
*   'route.WrapFormat.Type = 3
102
 
103
 
*   route.ZOrder msoSendToBack
104
 
*   route.IncrementLeft box_width / 2
105
 
*   route.IncrementTop box_height / 2
106
 
107
 
* End Sub
108
 
109
 
110
 
* '-------------------------------------------------------------------------------
111
 
112
 
* Private Sub RouteAddText(x As Single, y As Single, display As String)
113
 
114
 
*   Dim box As shape
115
 
116
 
*   Set box = ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, x, y, box_width, box_width)
117
 
118
 
*   box.TextFrame.TextRange.Text = display
119
 
*   box.Fill.Visible = msoFalse
120
 
*   box.Fill.Transparency = 0#
121
 
*   box.Line.Weight = 0.75
122
 
*   box.Line.DashStyle = msoLineSolid
123
 
*   box.Line.Style = msoLineSingle
124
 
*   box.Line.Transparency = 0#
125
 
*   box.Line.Visible = msoFalse
126
 
127
 
*   'box.ScaleWidth 0.38, msoFalse, msoScaleFromTopLeft
128
 
*   'box.ScaleHeight 0.25, msoFalse, msoScaleFromTopLeft
129
 
130
 
*   'box.LockAspectRatio = msoFalse
131
 
*   'box.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
132
 
*   'box.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
133
 
*   'box.LockAnchor = False
134
 
135
 
*   'box.WrapFormat.AllowOverlap = True
136
 
*   'box.WrapFormat.Side = wdWrapBoth
137
 
*   'box.WrapFormat.DistanceTop = CentimetersToPoints(0)
138
 
*   'box.WrapFormat.DistanceBottom = CentimetersToPoints(0)
139
 
*   'box.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
140
 
*   'box.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
141
 
*   'box.WrapFormat.Type = 3
142
 
143
 
*   'box.ZOrder 5
144
 
145
 
*   'box.TextFrame.MarginLeft = 7.09
146
 
*   'box.TextFrame.MarginRight = 7.09
147
 
*   'box.TextFrame.MarginTop = 3.69
148
 
*   'box.TextFrame.MarginBottom = 3.69
149
 
150
 
*   'box.IncrementLeft 47.7
151
 
*   'box.IncrementTop 47.7
152
 
*   'box.Left = CentimetersToPoints(1)
153
 
*   'box.Top = CentimetersToPoints(0.23)
154
 
*   'box.Height = 18.15
155
 
*   'box.Width = 26.95
156
 
157
 
* End Sub
158
 
159
 
* '-------------------------------------------------------------------------------
160
 
* </pre>
161
 
*
162
 
* <table border='1' cellPadding='3' cellSpacing='0' width="100%">
163
 
* <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
164
 
* Distribution Licence:<br />
165
 
* Project B is free software; you can redistribute it
166
 
* and/or modify it under the terms of the GNU General Public License,
167
 
* version 2 as published by the Free Software Foundation.<br />
168
 
* This program is distributed in the hope that it will be useful,
169
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
170
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
171
 
* General Public License for more details.<br />
172
 
* The License is available on the internet
173
 
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
174
 
* <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
175
 
* MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
176
 
* The copyright to this program is held by it's authors.
177
 
* </font></td></tr></table>
178
 
* @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
179
 
* @see <{docs.Licence}>
180
 
* @author Joe Walker
181
 
* @version D0.I0.T0
182
 
*/
 
11
 * VBAExport takes a Map and exports the data to a Word VBA file.
 
12
 * This was developed from a VB macro that looked something like this:
 
13
 * <pre>
 
14
 * Attribute VB_Name = "NumberLine"
 
15
 * 
 
16
 * Option Explicit
 
17
 * 
 
18
 * Dim shape As FreeformBuilder
 
19
 * 
 
20
 * Private Const box_width As Single = 20#
 
21
 * Private Const box_height As Single = 20#
 
22
 * 
 
23
 * 
 
24
 * '-------------------------------------------------------------------------------
 
25
 * 
 
26
 * Public Sub RouteMain()
 
27
 * 
 
28
 *   RouteStart 100#, 100#, "1"
 
29
 * 
 
30
 *   RouteContinue 110#, 110#, "2"
 
31
 *   RouteContinue 120#, 120#, "3"
 
32
 *   RouteContinue 130#, 120#, "4"
 
33
 *   RouteContinue 130#, 130#, "5"
 
34
 *   RouteContinue 100#, 130#, "6"
 
35
 *   RouteContinue 90#, 100#, "7"
 
36
 * 
 
37
 *   RouteEnd
 
38
 * 
 
39
 * End Sub
 
40
 * 
 
41
 * 
 
42
 * '-------------------------------------------------------------------------------
 
43
 * 
 
44
 * Private Sub RouteStart(x As Single, y As Single, display As String)
 
45
 * 
 
46
 *   Set shape = ActiveDocument.Shapes.BuildFreeform(msoEditingAuto, x, y)
 
47
 *   RouteAddText x, y, display
 
48
 * 
 
49
 * End Sub
 
50
 * 
 
51
 * 
 
52
 * '-------------------------------------------------------------------------------
 
53
 * 
 
54
 * Private Sub RouteContinue(x As Single, y As Single, display As String)
 
55
 * 
 
56
 *   shape.AddNodes msoSegmentLine, msoEditingAuto, x, y
 
57
 *   RouteAddText x, y, display
 
58
 * 
 
59
 * End Sub
 
60
 * 
 
61
 * 
 
62
 * '-------------------------------------------------------------------------------
 
63
 * 
 
64
 * Private Sub RouteEnd()
 
65
 * 
 
66
 *   Dim route As ShapeRange
 
67
 * 
 
68
 *   shape.ConvertToShape.Select
 
69
 *   Set route = Selection.ShapeRange
 
70
 * 
 
71
 *   route.Fill.Visible = msoFalse
 
72
 *   route.Fill.Transparency = 0#
 
73
 *   route.Line.Weight = 0.75
 
74
 *   route.Line.DashStyle = msoLineSolid
 
75
 *   route.Line.Style = msoLineSingle
 
76
 *   route.Line.Transparency = 0#
 
77
 *   route.Line.Visible = msoTrue
 
78
 *   route.Line.ForeColor.RGB = RGB(255, 0, 0)
 
79
 *   route.Line.BackColor.RGB = RGB(255, 255, 255)
 
80
 *   route.Line.BeginArrowheadLength = msoArrowheadLengthMedium
 
81
 *   route.Line.BeginArrowheadWidth = msoArrowheadWidthMedium
 
82
 *   route.Line.BeginArrowheadStyle = msoArrowheadNone
 
83
 *   route.Line.EndArrowheadLength = msoArrowheadLengthMedium
 
84
 *   route.Line.EndArrowheadWidth = msoArrowheadWidthMedium
 
85
 *   route.Line.EndArrowheadStyle = msoArrowheadNone
 
86
 * 
 
87
 *   'route.LockAspectRatio = msoFalse
 
88
 *   'route.Height = 115.35
 
89
 *   'route.Width = 333.05
 
90
 *   'route.Rotation = 0#
 
91
 *   'route.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
 
92
 *   'route.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
 
93
 * 
 
94
 *   'route.LockAnchor = False
 
95
 *   'route.WrapFormat.AllowOverlap = True
 
96
 *   'route.WrapFormat.Side = wdWrapBoth
 
97
 *   'route.WrapFormat.DistanceTop = CentimetersToPoints(0)
 
98
 *   'route.WrapFormat.DistanceBottom = CentimetersToPoints(0)
 
99
 *   'route.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
 
100
 *   'route.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
 
101
 *   'route.WrapFormat.Type = 3
 
102
 * 
 
103
 *   route.ZOrder msoSendToBack
 
104
 *   route.IncrementLeft box_width / 2
 
105
 *   route.IncrementTop box_height / 2
 
106
 * 
 
107
 * End Sub
 
108
 * 
 
109
 * 
 
110
 * '-------------------------------------------------------------------------------
 
111
 * 
 
112
 * Private Sub RouteAddText(x As Single, y As Single, display As String)
 
113
 * 
 
114
 *   Dim box As shape
 
115
 * 
 
116
 *   Set box = ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, x, y, box_width, box_width)
 
117
 * 
 
118
 *   box.TextFrame.TextRange.Text = display
 
119
 *   box.Fill.Visible = msoFalse
 
120
 *   box.Fill.Transparency = 0#
 
121
 *   box.Line.Weight = 0.75
 
122
 *   box.Line.DashStyle = msoLineSolid
 
123
 *   box.Line.Style = msoLineSingle
 
124
 *   box.Line.Transparency = 0#
 
125
 *   box.Line.Visible = msoFalse
 
126
 * 
 
127
 *   'box.ScaleWidth 0.38, msoFalse, msoScaleFromTopLeft
 
128
 *   'box.ScaleHeight 0.25, msoFalse, msoScaleFromTopLeft
 
129
 * 
 
130
 *   'box.LockAspectRatio = msoFalse
 
131
 *   'box.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
 
132
 *   'box.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
 
133
 *   'box.LockAnchor = False
 
134
 * 
 
135
 *   'box.WrapFormat.AllowOverlap = True
 
136
 *   'box.WrapFormat.Side = wdWrapBoth
 
137
 *   'box.WrapFormat.DistanceTop = CentimetersToPoints(0)
 
138
 *   'box.WrapFormat.DistanceBottom = CentimetersToPoints(0)
 
139
 *   'box.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
 
140
 *   'box.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
 
141
 *   'box.WrapFormat.Type = 3
 
142
 * 
 
143
 *   'box.ZOrder 5
 
144
 * 
 
145
 *   'box.TextFrame.MarginLeft = 7.09
 
146
 *   'box.TextFrame.MarginRight = 7.09
 
147
 *   'box.TextFrame.MarginTop = 3.69
 
148
 *   'box.TextFrame.MarginBottom = 3.69
 
149
 * 
 
150
 *   'box.IncrementLeft 47.7
 
151
 *   'box.IncrementTop 47.7
 
152
 *   'box.Left = CentimetersToPoints(1)
 
153
 *   'box.Top = CentimetersToPoints(0.23)
 
154
 *   'box.Height = 18.15
 
155
 *   'box.Width = 26.95
 
156
 * 
 
157
 * End Sub
 
158
 * 
 
159
 * '-------------------------------------------------------------------------------
 
160
 * </pre>
 
161
 * 
 
162
 * <p><table border='1' cellPadding='3' cellSpacing='0'>
 
163
 * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
 
164
 *
 
165
 * Distribution Licence:<br />
 
166
 * JSword is free software; you can redistribute it
 
167
 * and/or modify it under the terms of the GNU General Public License,
 
168
 * version 2 as published by the Free Software Foundation.<br />
 
169
 * This program is distributed in the hope that it will be useful,
 
170
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
171
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
172
 * General Public License for more details.<br />
 
173
 * The License is available on the internet
 
174
 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, or by writing to:
 
175
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
176
 * MA 02111-1307, USA<br />
 
177
 * The copyright to this program is held by it's authors.
 
178
 * </font></td></tr></table>
 
179
 * @see docs.Licence
 
180
 * @author Joe Walker [joe at eireneh dot com]
 
181
 * @version $Id$
 
182
 */
183
183
public class VBAExport
184
184
{
185
185
    /**