1' ************************************************************* 2' 3' Licensed to the Apache Software Foundation (ASF) under one 4' or more contributor license agreements. See the NOTICE file 5' distributed with this work for additional information 6' regarding copyright ownership. The ASF licenses this file 7' to you under the Apache License, Version 2.0 (the 8' "License")' you may not use this file except in compliance 9' with the License. You may obtain a copy of the License at 10' 11' http://www.apache.org/licenses/LICENSE-2.0 12' 13' Unless required by applicable law or agreed to in writing, 14' software distributed under the License is distributed on an 15' "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16' KIND, either express or implied. See the License for the 17' specific language governing permissions and limitations 18' under the License. 19' 20' ************************************************************* 21Sub Main 22 23Dim oSettings(11) as new com.sun.star.beans.PropertyValue 24oSettings(0).Name = "JPEGCompression" 25oSettings(0).Value= True 26oSettings(1).Name = "JPEGQuality" 27oSettings(1).Value= 25 28oSettings(2).Name = "RemoveCropArea" 29oSettings(2).Value= True 30oSettings(3).Name = "ImageResolution" 31oSettings(3).Value= 90 32oSettings(4).Name = "OLEOptimization" 33oSettings(4).Value= False 34oSettings(5).Name = "OLEOptimizationType" 35oSettings(5).Value= 1 36oSettings(6).Name = "DeleteUnusedMasterPages" 37oSettings(6).Value= True 38oSettings(7).Name = "DeleteHiddenSlides" 39oSettings(7).Value= True 40oSettings(8).Name = "DeleteNotesPages" 41oSettings(8).Value= True 42oSettings(9).Name = "SaveAs" 43oSettings(9).Value= true 44oSettings(10).Name = "EmbedLinkedGraphics" 45oSettings(10).Value = false 46oSettings(11).Name = "SaveAsURL" 47oSettings(11).Value = "" 48oSettings(12).Name = "FilterName" 49oSettings(12).Value = "impress8" 50 51 52 53Dim oArg(0) as new com.sun.star.beans.PropertyValue 54oArg(0).Name = "Settings" 55oArg(0).Value= oSettings 56 57Dim url As String 58Dim oPresentations(17) as String 59oPresentations( 0)="d:\data\sunpresentations\01-22-07SunIntelAnnouncementPresentation,01-22-2007.star_impress_8x.odp" 60oPresentations( 1)="d:\data\sunpresentations\01_Schwartz_SAS_VF.odp" 61oPresentations( 2)="d:\data\sunpresentations\CorporateSocialResponsibilityCustomerPresentation,02-12-2007.star_impress_8x.odp" 62oPresentations( 3)="d:\data\sunpresentations\Current-ProjectBlackboxCustomerPresentation,03-07-2007.star_impress_8x.odp" 63oPresentations( 4)="d:\data\sunpresentations\JavaSE6CustomerPresentation,12-11-2006(2).star_impress_8x.odp" 64oPresentations( 5)="d:\data\sunpresentations\JavaSE6CustomerPresentation,12-11-2006.star_impress_8x.odp" 65oPresentations( 6)="d:\data\sunpresentations\NetworkComputingLaunchPresentation,Q22006,Washington,DC,05-08-2006.star_impress_8x.odp" 66oPresentations( 7)="d:\data\sunpresentations\ProjectBlackboxTechnicalPresentation-NDAONLY,11-09-2006.star_impress_8x.odp" 67oPresentations( 8)="d:\data\sunpresentations\ScottMcNealy,IntlAssocofPrivacyProfessionals)ConferenceOpeningKeynote,'PlayingonSunday-GettingPrivacyRight',March,8,2007,Washington,DC,,03-08-2007.star_impress_8x.odp" 68oPresentations( 9)="d:\data\sunpresentations\Sun'sStoragetekAcademy-JonathanSchwartzTheSky'sTheLimit!,February,292007,SanFrancisco,CA,02-28-2007.star_impress_8x.odp" 69oPresentations(10)="d:\data\sunpresentations\SunAnalystSummit2007(SAS)-DonGranthamExecutingonStrategy,February,6,2007,SanFrancisco,CA,02-07-2007.star_impress_8x.odp" 70oPresentations(11)="d:\data\sunpresentations\SunConsultingServicesPortfolio-Presentation,03-17-2006.star_impress_6x.sxi" 71oPresentations(12)="d:\data\sunpresentations\SunFedOpenYourMindandSunFedTechDayatGTSI,ScottMcNealy,January23and24,2007,Washington,DC,01-23-2007.star_impress_8x.odp" 72oPresentations(13)="d:\data\sunpresentations\SunFedTechDaysatAccenture,ScottMcNealy,January24,2007,Washington,DC,01-24-2007.star_impress_8x.odp" 73oPresentations(14)="d:\data\sunpresentations\SunManagedServicesGoldenPitch,03-22-2007.star_impress_8x.odp" 74oPresentations(15)="d:\data\sunpresentations\SunServicesEducationServicesGeneralPresentation,01-11-2006.star_impress_6x.sxi" 75oPresentations(16)="d:\data\sunpresentations\SunSystemPacks-CustomerReadyPresentation,01-23-2007.star_impress_8x.odp" 76oPresentations(17)="d:\data\sunpresentations\U.S.SalesMeetingCustomerPresentation(08-01-2006),08-01-2006.odp" 77 78FOR I = 0 TO 17 79url=oPresentations( I ) 80oSettings(11)=url+string( I, 2 ) 81url=converttourl( url ) 82optimize( url, oArg() ) 83NEXT I 84 85End Sub 86 87Sub Optimize( url as String, oArg ) 88 89Dim oPPPOptimizerDialog as Object 90Dim oUrl as new com.sun.star.util.URL 91Dim oTrans as Object 92oTrans = createUNOService("com.sun.star.util.URLTransformer") 93oUrl.Complete = "vnd.com.sun.star.comp.PPPOptimizer:optimize" 94oTrans.parsestrict(oUrl) 95 96Dim oDoc As Object 97Dim FileProperties(0) As New com.sun.star.beans.PropertyValue 98oSM = CreateObject("com.sun.star.ServiceManager") 99oDesk = oSM.createInstance("com.sun.star.frame.Desktop") 100oDoc = oDesk.loadComponentFromURL( url, "_blank", 0, FileProperties() ) 101 102Dim oInitialization( 0 ) as Object 103oInitialization(0) = oDoc.getCurrentController.getFrame 104oPPPOptimizerDialog = createUNOservice("com.sun.star.comp.presentation.PresentationOptimizer") 105oPPPOptimizerDialog.initialize( oInitialization ) 106oPPPOptimizerDialog.dispatch(oURL, oArg) 107odoc.dispose 108End Sub 109 110