1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
Attribute VB_Name = "Preparation"
'/*************************************************************************
' *
' * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
' *
' * Copyright 2008 by Sun Microsystems, Inc.
' *
' * OpenOffice.org - a multi-platform office productivity suite
' *
' * $RCSfile: Preparation.bas,v $
' *
' * This file is part of OpenOffice.org.
' *
' * OpenOffice.org is free software: you can redistribute it and/or modify
' * it under the terms of the GNU Lesser General Public License version 3
' * only, as published by the Free Software Foundation.
' *
' * OpenOffice.org is distributed in the hope that it will be useful,
' * but WITHOUT ANY WARRANTY; without even the implied warranty of
' * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' * GNU Lesser General Public License version 3 for more details
' * (a copy is included in the LICENSE file that accompanied this code).
' *
' * You should have received a copy of the GNU Lesser General Public License
' * version 3 along with OpenOffice.org. If not, see
' * <http://www.openoffice.org/license.html>
' * for a copy of the LGPLv3 License.
' *
' ************************************************************************/
Option Explicit
Function Prepare_HeaderFooter_GraphicFrames(docAnalysis As DocumentAnalysis, myIssue As IssueInfo, _
var As Variant, currDoc As Document) As Boolean
On Error GoTo HandleErrors
Dim currentFunctionName As String
currentFunctionName = "Prepare_HeaderFooter_GraphicFrames"
Dim myPrepInfo As PrepareInfo
Set myPrepInfo = var
Dim smove As Long
Dim temp As Single
Dim ELength As Single
Dim PageHeight As Single
Dim Snum As Integer
Dim Fnum As Integer
Dim I As Integer
Dim myshape As Shape
Dim shapetop() As Single
Dim temptop As Single
With currDoc.ActiveWindow 'change to printview
If .View.SplitSpecial = wdPaneNone Then
.ActivePane.View.Type = wdPrintView
Else
.Panes(2).Close
.ActivePane.View.Type = wdPrintView
.View.Type = wdPrintView
End If
End With
PageHeight = currDoc.PageSetup.PageHeight
PageHeight = PageHeight / 2
Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, _
count:=myPrepInfo.HF_OnPage
currDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Snum = myPrepInfo.HF_Shapes.count
If Snum <> 0 Then
ReDim shapetop(Snum)
ReDim top(Snum)
I = 0
For Each myshape In myPrepInfo.HF_Shapes
If myshape.Type = msoPicture Then
If myshape.RelativeVerticalPosition <> wdRelativeVerticalPositionPage Then
shapetop(I) = myshape.top + myshape.Anchor.Information(wdVerticalPositionRelativeToPage)
Else
shapetop(I) = myshape.top
End If
ElseIf myshape.Type = msoTextBox Then
myshape.TextFrame.TextRange.Select
shapetop(I) = Selection.Information(wdVerticalPositionRelativeToPage)
End If
I = I + 1
Next myshape
End If
currDoc.Content.Select
Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, _
count:=myPrepInfo.HF_OnPage 'set frametop might change the selection position
If myPrepInfo.HF_inheader Then
currDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.MoveStart
ELength = 0
While ELength < myPrepInfo.HF_extendLength
Selection.TypeParagraph
ELength = ELength + Selection.Characters.First.Font.Size
Wend
Else
currDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.MoveStart
ELength = 0
While ELength < myPrepInfo.HF_extendLength
Selection.TypeParagraph
ELength = ELength + Selection.Characters.First.Font.Size
Wend
End If
If Snum <> 0 Then
I = 0
For Each myshape In myPrepInfo.HF_Shapes
If myshape.Type = msoPicture Then
If myshape.RelativeVerticalPosition <> wdRelativeVerticalPositionPage Then
temptop = myshape.top + myshape.Anchor.Information(wdVerticalPositionRelativeToPage)
Else
temptop = myshape.top
End If
ElseIf myshape.Type = msoTextBox Then
myshape.TextFrame.TextRange.Select
temptop = Selection.Information(wdVerticalPositionRelativeToPage)
End If
Selection.GoTo what:=wdGoToPage, Which:=wdGoToAbsolute, _
count:=myPrepInfo.HF_OnPage
If myPrepInfo.HF_inheader Then
currDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Else
currDoc.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
End If
Selection.HeaderFooter.Shapes(myshape.name).Select
Selection.ShapeRange.IncrementTop shapetop(I) - temptop
I = I + 1
Next myshape
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Prepare_HeaderFooter_GraphicFrames = True
FinalExit:
Exit Function
HandleErrors:
WriteDebug currentFunctionName & " : " & docAnalysis.name & ": " & Err.Number & " " & Err.Description & " " & Err.Source
Resume FinalExit
End Function
'Stub for Excel Prepare SheetName
Function Prepare_WorkbookVersion() As Boolean
Prepare_WorkbookVersion = False
End Function
|