forked from saniainf/CorelDraw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
allFilesPlaceToPW.bas
87 lines (77 loc) · 2.25 KB
/
allFilesPlaceToPW.bas
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
Attribute VB_Name = "allFilesPlaceToPW"
Sub SaveAndClose()
Dim doc As Document
Dim aPage As Page
For Each doc In Application.Documents
doc.Save
doc.Close
Next doc
End Sub
Sub PlaceToPW()
Application.Optimization = True
Dim doc As Document
Dim aPage As Page
For Each doc In Application.Documents
doc.Activate
doc.Unit = cdrMillimeter
For Each aPage In doc.Pages
aPage.Activate
PlaceAllToPowerClip aPage
Next aPage
Next doc
Application.Optimization = False
ActiveWindow.Refresh
Application.Refresh
End Sub
Sub ChangePageSize()
Dim height As Integer
Dim width As Integer
Set height = 127
Set width = 47
Application.Optimization = True
Dim doc As Document
Dim aPage As Page
For Each doc In Application.Documents
doc.Activate
doc.Unit = cdrMillimeter
For Each aPage In doc.Pages
aPage.Activate
aPage.SizeHeight = height
aPage.SizeWidth = width
Next aPage
Next doc
Application.Optimization = False
ActiveWindow.Refresh
Application.Refresh
End Sub
Sub PlaceAllToPowerClip(aPage As Page)
Dim aSel As ShapeRange
Dim shPowerClip As Shape
Dim sL As Integer
Dim sT As Integer
Dim sR As Integer
Dim sB As Integer
Dim aLayer As Layer
Dim guideL As Boolean
guideL = False
If aPage.GuidesLayer.Editable Then
guideL = True
aPage.GuidesLayer.Editable = False
aPage.GuidesLayer.Printable = False
End If
sL = aPage.BoundingBox.Left
sT = aPage.BoundingBox.Top
sR = aPage.BoundingBox.Right
sB = aPage.BoundingBox.Bottom
For Each aLayer In aPage.Layers
If aLayer.Editable Then
If aLayer.Shapes.All.Count > 0 Then
Set aSel = aLayer.Shapes.All
Set shPowerClip = aLayer.CreateRectangle(sL, sT, sR, sB)
shPowerClip.Outline.SetNoOutline
aSel.AddToPowerClip shPowerClip, cdrFalse
End If
End If
Next aLayer
aPage.GuidesLayer.Editable = guideL
End Sub