Kaydet (Commit) c15bd97d authored tarafından Oliver Bolte's avatar Oliver Bolte

CWS-TOOLING: integrate CWS mba30fixes02

üst ad332997
#*************************************************************************
#
# 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: makefile.mk,v $
#
# $Revision: 1.1.2.2 $
#
# 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.
#
#*************************************************************************
PRJ=..$/..$/..
PRJNAME=sdext
TARGET=xpdftest
TARGETTYPE=CUI
ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
.IF "$(ENABLE_PDFIMPORT)" == "NO"
@all:
@echo "PDF Import extension disabled."
.ENDIF
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
#ALLTAR : $(MISC)$/test_0_succeeded $(MISC)$/test_1_succeeded
$(MISC)$/test_0_succeeded: $(BIN)$/xpdfimport$(EXECPOST) binary_0_out.def text_0_out.def testinput.pdf
$(BIN)$/xpdfimport -f $(MISC)$/binary_0_out testinput.pdf > $(MISC)$/text_0_out
diff --strip-trailing-cr $(MISC)$/binary_0_out binary_0_out.def
diff --strip-trailing-cr $(MISC)$/text_0_out text_0_out.def
$(TOUCH) $@
$(MISC)$/test_1_succeeded: $(BIN)$/xpdfimport$(EXECPOST) binary_1_out.def text_1_out.def book.pdf
$(BIN)$/xpdfimport -f $(MISC)$/binary_1_out book.pdf > $(MISC)$/text_1_out
diff --strip-trailing-cr $(MISC)$/binary_1_out binary_1_out.def
diff --strip-trailing-cr $(MISC)$/text_1_out text_1_out.def
$(TOUCH) $@
This diff is collapsed.
This diff is collapsed.
#*************************************************************************
#
# 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: makefile.mk,v $
#
# $Revision: 1.1.2.2 $
#
# 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.
#
#*************************************************************************
PRJ=..$/..$/..
PRJNAME=sdext
TARGET=xpdfimport
TARGETTYPE=CUI
ENABLE_EXCEPTIONS=TRUE
EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
.IF "$(ENABLE_PDFIMPORT)" == "NO"
@all:
@echo "PDF Import extension disabled."
.ENDIF
.IF "$(SYSTEM_POPPLER)" == "YES"
CFLAGS += $(POPPLER_CFLAGS) -DSYSTEM_POPPLER
.ELSE
CFLAGS += -I$(SOLARINCDIR)$/xpdf
.ENDIF
# --- Files --------------------------------------------------------
UWINAPILIB:=
APP1TARGET=$(TARGET)
APP1LIBSALCPPRT=
APP1OBJS= \
$(OBJ)$/wrapper_gpl.obj $(OBJ)/pdfioutdev_gpl.obj
.IF "$(SYSTEM_POPPLER)" == "YES"
APP1STDLIBS+=$(POPPLER_LIBS)
.ELSE
.IF "$(GUI)" == "WNT"
.IF "$(COM)"=="GCC"
APP1STDLIBS+=-lxpdf -lfofi -lGoo -lgdi32 -ladvapi32
.ELSE
APP1STDLIBS+=xpdf.lib fofi.lib Goo.lib gdi32.lib advapi32.lib
.ENDIF
.ELSE
.IF "$(OS)" == "MACOSX" && "$(GUIBASE)"=="unx"
APP1STDLIBS+=-lobjc
.ENDIF
APP1STDLIBS+=-lxpdf -lfofi -lGoo
.ENDIF
.ENDIF
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: wrapper_gpl.cxx,v $
*
* $Revision: 1.1.2.1 $
*
* last change: $Author: cmc $ $Date: 2008/08/25 16:17:55 $
*
* The Contents of this file are made available subject to
* the terms of GNU General Public License Version 2.
*
*
* GNU General Public License, version 2
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
************************************************************************/
#include "pdfioutdev_gpl.hxx"
//#include "SecurityHandler.h"
#ifdef WNT
# include <io.h>
# include <fcntl.h> /*_O_BINARY*/
#endif
FILE* g_binary_out=stderr;
#ifndef SYSTEM_POPPLER
static char ownerPassword[33] = "\001";
static char userPassword[33] = "\001";
static char outputFile[256] = "\001";
static ArgDesc argDesc[] = {
{"-f", argString, outputFile, sizeof(outputFile),
"output file for binary streams"},
{"-opw", argString, ownerPassword, sizeof(ownerPassword),
"owner password (for encrypted files)"},
{"-upw", argString, userPassword, sizeof(userPassword),
"user password (for encrypted files)"},
{NULL, argString, NULL, 0, NULL }
};
#else
static const char *ownerPassword = "\001";
static const char *userPassword = "\001";
static const char *outputFile = "\001";
#endif
int main(int argc, char **argv)
{
#ifndef SYSTEM_POPPLER
// parse args; initialize to defaults
if( !parseArgs(argDesc, &argc, argv) )
return 1;
#else
int k = 0;
while (k < argc)
{
if (!strcmp(argv[k], "-f"))
{
outputFile = argv[k+1];
--argc;
for (int j = k; j < argc; ++j)
argv[j] = argv[j+1];
}
else if (!strcmp(argv[k], "-opw"))
{
ownerPassword = argv[k+1];
--argc;
for (int j = k; j < argc; ++j)
argv[j] = argv[j+1];
}
else if (!strcmp(argv[k], "-upw"))
{
userPassword = argv[k+1];
--argc;
for (int j = k; j < argc; ++j)
argv[j] = argv[j+1];
}
++k;
}
#endif
if( argc < 2 )
return 1;
// read config file
globalParams = new GlobalParams(
#ifndef SYSTEM_POPPLER
""
#endif
);
globalParams->setErrQuiet(gTrue);
#if !defined(SYSTEM_POPPLER) || defined(_MSC_VER)
globalParams->setupBaseFonts(NULL);
#endif
// PDFDoc takes over ownership for all strings below
GooString* pFileName = new GooString(argv[1]);
GooString* pTempErrFileName = new GooString("_err.pdf");
GooString* pTempErrFileNamePath = new GooString(argv[0]);
GooString* pErrFileName = new GooString(pTempErrFileNamePath,pTempErrFileName);
// check for password string(s)
GooString* pOwnerPasswordStr(
ownerPassword[0] != '\001' ? new GooString(ownerPassword)
: (GooString *)NULL );
GooString* pUserPasswordStr(
userPassword[0] != '\001' ? new GooString(userPassword)
: (GooString *)NULL );
if( outputFile[0] != '\001' )
g_binary_out = fopen(outputFile,"wb");
#ifdef WNT
// Win actually modifies output for O_TEXT file mode, so need to
// revert to binary here
_setmode( _fileno( g_binary_out ), _O_BINARY );
#endif
PDFDoc aDoc( pFileName,
pOwnerPasswordStr,
pUserPasswordStr );
PDFDoc aErrDoc( pErrFileName,
pOwnerPasswordStr,
pUserPasswordStr );
// Check various permissions.
if ( !aDoc.isOk()||
!aDoc.okToPrint() ||
!aDoc.okToChange()||
!aDoc.okToCopy()||
!aDoc.okToAddNotes()||
(userPassword[0] != '\001')||
(ownerPassword[0] != '\001')
)
{
pdfi::PDFOutDev* pOutDev( new pdfi::PDFOutDev(&aErrDoc) );
const int nPages = aErrDoc.isOk() ? aErrDoc.getNumPages() : 0;
// tell receiver early - needed for proper progress calculation
pOutDev->setPageNum( nPages );
// virtual resolution of the PDF OutputDev in dpi
static const int PDFI_OUTDEV_RESOLUTION=7200;
// do the conversion
for( int i=1; i<=nPages; ++i )
{
aErrDoc.displayPage( pOutDev,
i,
PDFI_OUTDEV_RESOLUTION,
PDFI_OUTDEV_RESOLUTION,
0, gTrue, gTrue, gTrue );
aErrDoc.processLinks( pOutDev, i );
}
}
else
{
pdfi::PDFOutDev* pOutDev( new pdfi::PDFOutDev(&aDoc) );
// tell receiver early - needed for proper progress calculation
pOutDev->setPageNum( aDoc.getNumPages() );
// virtual resolution of the PDF OutputDev in dpi
static const int PDFI_OUTDEV_RESOLUTION=7200;
// do the conversion
const int nPages = aDoc.getNumPages();
for( int i=1; i<=nPages; ++i )
{
aDoc.displayPage( pOutDev,
i,
PDFI_OUTDEV_RESOLUTION,
PDFI_OUTDEV_RESOLUTION,
0, gTrue, gTrue, gTrue );
aDoc.processLinks( pOutDev, i );
}
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment