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
|
Attribute VB_Name = "Preparation"
'
' This file is part of the LibreOffice project.
'
' This Source Code Form is subject to the terms of the Mozilla Public
' License, v. 2.0. If a copy of the MPL was not distributed with this
' file, You can obtain one at http://mozilla.org/MPL/2.0/.
'
' This file incorporates work covered by the following license notice:
'
' Licensed to the Apache Software Foundation (ASF) under one or more
' contributor license agreements. See the NOTICE file distributed
' with this work for additional information regarding copyright
' ownership. The ASF licenses this file to you under the Apache
' License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
'
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
|