From f87063c5269c3828519a8208ecb697aa2e8d55b3 Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Wed, 11 Nov 2009 10:26:06 +0100 Subject: #i99049# use vanilla sources --- jfreereport/java/flute/makefile.mk | 20 +++++++++----------- jfreereport/java/jfreereport/makefile.mk | 8 ++++---- jfreereport/java/libbase/makefile.mk | 17 +++++++++-------- jfreereport/java/libfonts/makefile.mk | 21 +++++++++++---------- jfreereport/java/libformula/makefile.mk | 25 +++++++++++++------------ jfreereport/java/libloader/makefile.mk | 21 +++++++++++---------- jfreereport/java/librepository/makefile.mk | 21 +++++++++++---------- jfreereport/java/libserializer/makefile.mk | 21 +++++++++++---------- jfreereport/java/libxml/makefile.mk | 21 +++++++++++---------- jfreereport/java/sac/makefile.mk | 4 ++-- jfreereport/patches/libformula.patch | 15 --------------- 11 files changed, 92 insertions(+), 102 deletions(-) diff --git a/jfreereport/java/flute/makefile.mk b/jfreereport/java/flute/makefile.mk index 5c949ad4e7f1..a5bef2a6563c 100644 --- a/jfreereport/java/flute/makefile.mk +++ b/jfreereport/java/flute/makefile.mk @@ -33,7 +33,7 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=flute -VERSION=-1.3.0 +VERSION=1.1.2 # --- Settings ----------------------------------------------------- @@ -43,18 +43,16 @@ VERSION=-1.3.0 .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" -TARFILE_NAME=$(TARGET) -TARFILE_ROOTDIR=$(TARGET) -# PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -# CONVERTFILES=build.xml - +TARFILE_NAME=$(TARGET)-$(VERSION) +#TARFILE_ROOTDIR=$(TARGET) +TARFILE_IS_FLAT=true .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -68,9 +66,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk .IF "$(L10N_framework)"=="" -ALLTAR : $(CLASSDIR)$/$(TARGET)$(VERSION).jar -$(CLASSDIR)$/$(TARGET)$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/jfreereport/makefile.mk b/jfreereport/java/jfreereport/makefile.mk index 6e83b0e23932..6904557ee3a8 100644 --- a/jfreereport/java/jfreereport/makefile.mk +++ b/jfreereport/java/jfreereport/makefile.mk @@ -33,7 +33,7 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=flow-engine -VERSION=-0.9.2 +VERSION=0.9.2 # --- Settings ----------------------------------------------------- @@ -67,8 +67,8 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk .IF "$(L10N_framework)"=="" -ALLTAR : $(CLASSDIR)$/$(TARGET)$(VERSION).jar -$(CLASSDIR)$/$(TARGET)$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/libbase/makefile.mk b/jfreereport/java/libbase/makefile.mk index 9c1d8cf18660..637295bbc876 100644 --- a/jfreereport/java/libbase/makefile.mk +++ b/jfreereport/java/libbase/makefile.mk @@ -33,7 +33,7 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=libbase -VERSION=-1.0.0 +VERSION=1.1.2 # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk @@ -42,8 +42,9 @@ VERSION=-1.0.0 .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- -TARFILE_NAME=$(TARGET) -TARFILE_ROOTDIR=$(TARGET) +TARFILE_NAME=$(TARGET)-$(VERSION) +#TARFILE_ROOTDIR=$(TARGET) +TARFILE_IS_FLAT=true # PATCH_FILES=$(PRJ)$/patches$/libbase.patch # CONVERTFILES=build.xml @@ -51,9 +52,9 @@ TARFILE_ROOTDIR=$(TARGET) .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -67,7 +68,7 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(L10N_framework)"=="" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar # XCLASSPATH/CLASSPATH does not work and we only can give lib once. But # the build.xmls fortunately take *.jar out of lib so we can copy our @@ -82,7 +83,7 @@ $(CLASSDIR)$/commons-logging.jar : $(COPY) $(COMMONS_LOGGING_JAR) $(CLASSDIR)$/commons-logging.jar .ENDIF -$(CLASSDIR)$/$(TARGET)$(VERSION).jar : $(CLASSDIR)$/commons-logging.jar $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)$(VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(CLASSDIR)$/commons-logging.jar $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/libfonts/makefile.mk b/jfreereport/java/libfonts/makefile.mk index e7f6b174ad45..1bd28f050c04 100644 --- a/jfreereport/java/libfonts/makefile.mk +++ b/jfreereport/java/libfonts/makefile.mk @@ -33,7 +33,7 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=libfonts -VERSION=-1.0.0 +VERSION=1.1.2 # --- Settings ----------------------------------------------------- @@ -43,17 +43,18 @@ VERSION=-1.0.0 .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" -TARFILE_NAME=$(TARGET) -TARFILE_ROOTDIR=$(TARGET) -PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -CONVERTFILES=build.xml +TARFILE_NAME=$(TARGET)-$(VERSION) +#TARFILE_ROOTDIR=$(TARGET) +TARFILE_IS_FLAT=true +# PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch +# CONVERTFILES=build.xml .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -66,9 +67,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)$(VERSION).jar -$(CLASSDIR)$/$(TARGET)$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/libformula/makefile.mk b/jfreereport/java/libformula/makefile.mk index 35a5b0407740..cb720bc89809 100644 --- a/jfreereport/java/libformula/makefile.mk +++ b/jfreereport/java/libformula/makefile.mk @@ -33,7 +33,7 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=libformula -VERSION=-0.2.0 +VERSION=1.1.2 # --- Settings ----------------------------------------------------- @@ -43,19 +43,20 @@ VERSION=-0.2.0 .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" -TARFILE_NAME=$(TARGET) -TARFILE_ROOTDIR=$(TARGET) -PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -CONVERTFILES=build.xml \ - source$/org$/pentaho$/reporting$/libraries$/formula$/function$/datetime$/DateDifFunction.java \ - source$/org$/pentaho$/reporting$/libraries$/formula$/lvalues$/FormulaFunction.java +TARFILE_NAME=$(TARGET)-$(VERSION) +#TARFILE_ROOTDIR=$(TARGET) +TARFILE_IS_FLAT=true +#PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch +#CONVERTFILES=build.xml \ +# source$/org$/pentaho$/reporting$/libraries$/formula$/function$/datetime$/DateDifFunction.java \ +# source$/org$/pentaho$/reporting$/libraries$/formula$/lvalues$/FormulaFunction.java .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF @@ -69,9 +70,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)$(VERSION).jar -$(CLASSDIR)$/$(TARGET)$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar .ENDIF # $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/source$/org$/jfree$/formula$/function$/information$/IsRef-Function.properties : diff --git a/jfreereport/java/libloader/makefile.mk b/jfreereport/java/libloader/makefile.mk index 6b6e95da5490..6925948201cf 100644 --- a/jfreereport/java/libloader/makefile.mk +++ b/jfreereport/java/libloader/makefile.mk @@ -33,7 +33,7 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=libloader -VERSION=-1.0.0 +VERSION=1.1.2 # --- Settings ----------------------------------------------------- @@ -43,17 +43,18 @@ VERSION=-1.0.0 .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- -TARFILE_NAME=$(TARGET) -TARFILE_ROOTDIR=$(TARGET) -PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -CONVERTFILES=build.xml +TARFILE_NAME=$(TARGET)-$(VERSION) +#TARFILE_ROOTDIR=$(TARGET) +TARFILE_IS_FLAT=true +# PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch +# CONVERTFILES=build.xml .IF "$(L10N_framework)"=="" .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -66,9 +67,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)$(VERSION).jar -$(CLASSDIR)$/$(TARGET)$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/librepository/makefile.mk b/jfreereport/java/librepository/makefile.mk index 7ab0fd6ce623..f7a9a250b26b 100644 --- a/jfreereport/java/librepository/makefile.mk +++ b/jfreereport/java/librepository/makefile.mk @@ -33,7 +33,7 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=librepository -VERSION=-1.0.0 +VERSION=1.1.2 # --- Settings ----------------------------------------------------- @@ -43,17 +43,18 @@ VERSION=-1.0.0 .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- -TARFILE_NAME=$(TARGET) -TARFILE_ROOTDIR=$(TARGET) -PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -CONVERTFILES=build.xml +TARFILE_NAME=$(TARGET)-$(VERSION) +#TARFILE_ROOTDIR=$(TARGET) +TARFILE_IS_FLAT=true +# PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch +# CONVERTFILES=build.xml .IF "$(L10N_framework)"=="" .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -66,9 +67,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)$(VERSION).jar -$(CLASSDIR)$/$(TARGET)$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/libserializer/makefile.mk b/jfreereport/java/libserializer/makefile.mk index 04b4fdb8e760..57c80f75a91e 100644 --- a/jfreereport/java/libserializer/makefile.mk +++ b/jfreereport/java/libserializer/makefile.mk @@ -33,7 +33,7 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=libserializer -VERSION=-1.0.0 +VERSION=1.1.2 # --- Settings ----------------------------------------------------- @@ -43,17 +43,18 @@ VERSION=-1.0.0 .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" -TARFILE_NAME=$(TARGET) -TARFILE_ROOTDIR=$(TARGET) -PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -CONVERTFILES=build.xml +TARFILE_NAME=$(TARGET)-$(VERSION) +#TARFILE_ROOTDIR=$(TARGET) +TARFILE_IS_FLAT=true +# PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch +# CONVERTFILES=build.xml .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -66,9 +67,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)$(VERSION).jar -$(CLASSDIR)$/$(TARGET)$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/libxml/makefile.mk b/jfreereport/java/libxml/makefile.mk index 708cdcbe2f0a..4cd60fffaf86 100644 --- a/jfreereport/java/libxml/makefile.mk +++ b/jfreereport/java/libxml/makefile.mk @@ -33,7 +33,7 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=libxml -VERSION=-1.0.0 +VERSION=1.1.2 # --- Settings ----------------------------------------------------- @@ -43,17 +43,18 @@ VERSION=-1.0.0 .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" -TARFILE_NAME=$(TARGET) -TARFILE_ROOTDIR=$(TARGET) -PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -CONVERTFILES=build.xml +TARFILE_NAME=$(TARGET)-$(VERSION) +#TARFILE_ROOTDIR=$(TARGET) +TARFILE_IS_FLAT=true +# PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch +# CONVERTFILES=build.xml .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -66,9 +67,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)$(VERSION).jar -$(CLASSDIR)$/$(TARGET)$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/sac/makefile.mk b/jfreereport/java/sac/makefile.mk index f0982691b3a1..d3828d4f1cab 100644 --- a/jfreereport/java/sac/makefile.mk +++ b/jfreereport/java/sac/makefile.mk @@ -61,9 +61,9 @@ ADDITIONAL_FILES=build.xml .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) all +BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) all .ELSE -BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -f $(ANT_BUILDFILE) all +BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) all .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" diff --git a/jfreereport/patches/libformula.patch b/jfreereport/patches/libformula.patch index 07968b448675..8beb270e22e8 100644 --- a/jfreereport/patches/libformula.patch +++ b/jfreereport/patches/libformula.patch @@ -1,18 +1,3 @@ ---- misc/libformula/source/org/pentaho/reporting/libraries/formula/function/datetime/DateDifFunction.java 2008-12-12 13:04:46.000000000 +0100 -+++ misc/build/libformula/source/org/pentaho/reporting/libraries/formula/function/datetime/DateDifFunction.java 2008-12-15 08:15:18.293125000 +0100 -@@ -198,12 +198,6 @@ - LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE); - } - -- if (res < 0) -- { -- throw new EvaluationException( -- LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE); -- } -- - //noinspection UnpredictableBigDecimalConstructorCall - return new TypeValuePair(NumberType.GENERIC_NUMBER, new BigDecimal((double) res)); - } --- misc/libformula/source/org/pentaho/reporting/libraries/formula/lvalues/FormulaFunction.java 2008-12-12 13:04:46.000000000 +0100 +++ misc/build/libformula/source/org/pentaho/reporting/libraries/formula/lvalues/FormulaFunction.java 2008-12-15 08:13:14.308750000 +0100 @@ -161,7 +161,8 @@ -- cgit From 01be254231281d3edb429a463497356e94af5997 Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Wed, 11 Nov 2009 10:30:23 +0100 Subject: #i99049# use vanilla sources --- jfreereport/download/flute-1.1.2.zip | Bin 0 -> 207970 bytes jfreereport/download/libbase-1.1.2.zip | Bin 0 -> 427630 bytes jfreereport/download/libfonts-1.1.2.zip | Bin 0 -> 5757381 bytes jfreereport/download/libformula-1.1.2.zip | Bin 0 -> 2001853 bytes jfreereport/download/libloader-1.1.2.zip | Bin 0 -> 2940612 bytes jfreereport/download/librepository-1.1.2.zip | Bin 0 -> 763457 bytes jfreereport/download/libserializer-1.1.2.zip | Bin 0 -> 217737 bytes jfreereport/download/libxml-1.1.2.zip | Bin 0 -> 2934498 bytes 8 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 jfreereport/download/flute-1.1.2.zip create mode 100644 jfreereport/download/libbase-1.1.2.zip create mode 100644 jfreereport/download/libfonts-1.1.2.zip create mode 100644 jfreereport/download/libformula-1.1.2.zip create mode 100644 jfreereport/download/libloader-1.1.2.zip create mode 100644 jfreereport/download/librepository-1.1.2.zip create mode 100644 jfreereport/download/libserializer-1.1.2.zip create mode 100644 jfreereport/download/libxml-1.1.2.zip diff --git a/jfreereport/download/flute-1.1.2.zip b/jfreereport/download/flute-1.1.2.zip new file mode 100644 index 000000000000..bd1059fd728e Binary files /dev/null and b/jfreereport/download/flute-1.1.2.zip differ diff --git a/jfreereport/download/libbase-1.1.2.zip b/jfreereport/download/libbase-1.1.2.zip new file mode 100644 index 000000000000..754c23d0476a Binary files /dev/null and b/jfreereport/download/libbase-1.1.2.zip differ diff --git a/jfreereport/download/libfonts-1.1.2.zip b/jfreereport/download/libfonts-1.1.2.zip new file mode 100644 index 000000000000..2da9ae1404af Binary files /dev/null and b/jfreereport/download/libfonts-1.1.2.zip differ diff --git a/jfreereport/download/libformula-1.1.2.zip b/jfreereport/download/libformula-1.1.2.zip new file mode 100644 index 000000000000..30df78f45f5e Binary files /dev/null and b/jfreereport/download/libformula-1.1.2.zip differ diff --git a/jfreereport/download/libloader-1.1.2.zip b/jfreereport/download/libloader-1.1.2.zip new file mode 100644 index 000000000000..67996e9d0562 Binary files /dev/null and b/jfreereport/download/libloader-1.1.2.zip differ diff --git a/jfreereport/download/librepository-1.1.2.zip b/jfreereport/download/librepository-1.1.2.zip new file mode 100644 index 000000000000..77c810617abe Binary files /dev/null and b/jfreereport/download/librepository-1.1.2.zip differ diff --git a/jfreereport/download/libserializer-1.1.2.zip b/jfreereport/download/libserializer-1.1.2.zip new file mode 100644 index 000000000000..89079a2fb386 Binary files /dev/null and b/jfreereport/download/libserializer-1.1.2.zip differ diff --git a/jfreereport/download/libxml-1.1.2.zip b/jfreereport/download/libxml-1.1.2.zip new file mode 100644 index 000000000000..cfa9222f36a8 Binary files /dev/null and b/jfreereport/download/libxml-1.1.2.zip differ -- cgit From 3aa23a4ad591ec527c65645a22c2f77b3074e2ae Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Wed, 11 Nov 2009 10:31:04 +0100 Subject: #i99049# use vanilla sources --- jfreereport/download/flute.zip | Bin 83503 -> 0 bytes jfreereport/download/libbase.zip | Bin 161294 -> 0 bytes jfreereport/download/libfonts.zip | Bin 1336993 -> 0 bytes jfreereport/download/libformula.zip | Bin 516667 -> 0 bytes jfreereport/download/libloader.zip | Bin 166507 -> 0 bytes jfreereport/download/librepository.zip | Bin 89510 -> 0 bytes jfreereport/download/libserializer.zip | Bin 44748 -> 0 bytes jfreereport/download/libxml.zip | Bin 101837 -> 0 bytes 8 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 jfreereport/download/flute.zip delete mode 100644 jfreereport/download/libbase.zip delete mode 100644 jfreereport/download/libfonts.zip delete mode 100644 jfreereport/download/libformula.zip delete mode 100644 jfreereport/download/libloader.zip delete mode 100644 jfreereport/download/librepository.zip delete mode 100644 jfreereport/download/libserializer.zip delete mode 100644 jfreereport/download/libxml.zip diff --git a/jfreereport/download/flute.zip b/jfreereport/download/flute.zip deleted file mode 100644 index ff1ade906ad4..000000000000 Binary files a/jfreereport/download/flute.zip and /dev/null differ diff --git a/jfreereport/download/libbase.zip b/jfreereport/download/libbase.zip deleted file mode 100644 index 88f555d9ef7c..000000000000 Binary files a/jfreereport/download/libbase.zip and /dev/null differ diff --git a/jfreereport/download/libfonts.zip b/jfreereport/download/libfonts.zip deleted file mode 100644 index 91fbac87b3a6..000000000000 Binary files a/jfreereport/download/libfonts.zip and /dev/null differ diff --git a/jfreereport/download/libformula.zip b/jfreereport/download/libformula.zip deleted file mode 100644 index c819c963767e..000000000000 Binary files a/jfreereport/download/libformula.zip and /dev/null differ diff --git a/jfreereport/download/libloader.zip b/jfreereport/download/libloader.zip deleted file mode 100644 index 505329e0b6ea..000000000000 Binary files a/jfreereport/download/libloader.zip and /dev/null differ diff --git a/jfreereport/download/librepository.zip b/jfreereport/download/librepository.zip deleted file mode 100644 index 9541579941cf..000000000000 Binary files a/jfreereport/download/librepository.zip and /dev/null differ diff --git a/jfreereport/download/libserializer.zip b/jfreereport/download/libserializer.zip deleted file mode 100644 index 94823b28e614..000000000000 Binary files a/jfreereport/download/libserializer.zip and /dev/null differ diff --git a/jfreereport/download/libxml.zip b/jfreereport/download/libxml.zip deleted file mode 100644 index be5cecb2490e..000000000000 Binary files a/jfreereport/download/libxml.zip and /dev/null differ -- cgit From 76e2cf337c3b5af356e64fe7072c39fbc421fc9b Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Wed, 11 Nov 2009 10:32:44 +0100 Subject: #i99049# use vanilla sources --- .../java/com/sun/star/report/pentaho/Manifest.mf | 6 +++--- .../report/pentaho/loader/InputRepositoryLoader.java | 16 ++++++++++++++++ .../java/com/sun/star/report/pentaho/makefile.mk | 2 +- reportbuilder/util/makefile.mk | 18 +++++++++--------- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf b/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf index 70f3ff695cbb..e85f2018da99 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf +++ b/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf @@ -1,7 +1,7 @@ RegistrationClassName: com.sun.star.report.pentaho.SOReportJobFactory Class-Path: reportbuilderwizard.jar - flute-1.3.0.jar libserializer-1.0.0.jar libbase-1.0.0.jar - libfonts-1.0.0.jar libformula-0.2.0.jar liblayout-0.2.9.jar - libloader-1.0.0.jar librepository-1.0.0.jar libxml-1.0.0.jar + flute-1.1.2.jar libserializer-1.1.2.jar libbase-1.1.2.jar + libfonts-1.1.2.jar libformula-1.1.2.jar liblayout-0.2.9.jar + libloader-1.1.2.jar librepository-1.1.2.jar libxml-1.1.2.jar flow-engine-0.9.2.jar sac.jar commons-logging-1.1.1.jar UNO-Type-Path: diff --git a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java index fc6021202e68..c093e5b9d8ef 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/loader/InputRepositoryLoader.java @@ -35,6 +35,7 @@ import java.util.HashMap; import com.sun.star.report.InputRepository; import org.pentaho.reporting.libraries.resourceloader.ResourceData; +import org.pentaho.reporting.libraries.resourceloader.ResourceException; import org.pentaho.reporting.libraries.resourceloader.ResourceKey; import org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException; import org.pentaho.reporting.libraries.resourceloader.ResourceLoader; @@ -169,4 +170,19 @@ public class InputRepositoryLoader implements ResourceLoader { return resourceManager; } + + public boolean isSupportedDeserializer(String string) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String serialize(ResourceKey rk, ResourceKey rk1) throws ResourceException + { + throw new UnsupportedOperationException("Not supported yet."); + } + + public ResourceKey deserialize(ResourceKey rk, String string) throws ResourceKeyCreationException + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk index 36e83afac2d0..4b91d0966ebe 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk @@ -43,7 +43,7 @@ JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar .IF "$(SYSTEM_JFREEREPORT)" == "YES" XCLASSPATH!:=$(XCLASSPATH)$(FLUTE_JAR)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBXML_JAR)$(PATH_SEPERATOR)$(JFREEREPORT_JAR)$(PATH_SEPERATOR)$(LIBLOADER_JAR)$(PATH_SEPERATOR)$(SAC_JAR)$(PATH_SEPERATOR)$(LIBLAYOUT_JAR)$(PATH_SEPERATOR)$(LIBSERIALIZER_JAR)$(PATH_SEPERATOR)$(LIBFONTS_JAR)$(PATH_SEPERATOR)$(LIBFORMULA_JAR)$(PATH_SEPERATOR)$(LIBREPOSITORY_JAR) .ELSE -JARFILES += flute-1.3.0.jar libbase-1.0.0.jar libfonts-1.0.0.jar libformula-0.2.0.jar liblayout-0.2.9.jar libloader-1.0.0.jar librepository-1.0.0.jar libxml-1.0.0.jar flow-engine-0.9.2.jar sac.jar +JARFILES += flute-1.1.2.jar libbase-1.1.2.jar libfonts-1.1.2.jar libformula-1.1.2.jar liblayout-0.2.9.jar libloader-1.1.2.jar librepository-1.1.2.jar libxml-1.1.2.jar flow-engine-0.9.2.jar sac.jar .ENDIF .IF "$(SYSTEM_APACHE_COMMONS)" == "YES" diff --git a/reportbuilder/util/makefile.mk b/reportbuilder/util/makefile.mk index cd65b814abf9..d1cf25c4ad7b 100644 --- a/reportbuilder/util/makefile.mk +++ b/reportbuilder/util/makefile.mk @@ -32,7 +32,7 @@ PRJ=.. PRJNAME=reportbuilder TARGET=rpt -EXTENSION_VERSION_BASE=1.2.0 +EXTENSION_VERSION_BASE=1.2.1 .IF "$(CWS_WORK_STAMP)" == "" EXTENSION_VERSION=$(EXTENSION_VERSION_BASE) @@ -100,15 +100,15 @@ COMPONENT_EXTJARFILES = \ .IF "$(SYSTEM_JFREEREPORT)" != "YES" COMPONENT_EXTJARFILES += \ - $(EXTENSIONDIR)$/flute-1.3.0.jar \ - $(EXTENSIONDIR)$/libserializer-1.0.0.jar \ - $(EXTENSIONDIR)$/libbase-1.0.0.jar \ - $(EXTENSIONDIR)$/libfonts-1.0.0.jar \ - $(EXTENSIONDIR)$/libformula-0.2.0.jar \ + $(EXTENSIONDIR)$/flute-1.1.2.jar \ + $(EXTENSIONDIR)$/libserializer-1.1.2.jar \ + $(EXTENSIONDIR)$/libbase-1.1.2.jar \ + $(EXTENSIONDIR)$/libfonts-1.1.2.jar \ + $(EXTENSIONDIR)$/libformula-1.1.2.jar \ $(EXTENSIONDIR)$/liblayout-0.2.9.jar \ - $(EXTENSIONDIR)$/libloader-1.0.0.jar \ - $(EXTENSIONDIR)$/librepository-1.0.0.jar \ - $(EXTENSIONDIR)$/libxml-1.0.0.jar \ + $(EXTENSIONDIR)$/libloader-1.1.2.jar \ + $(EXTENSIONDIR)$/librepository-1.1.2.jar \ + $(EXTENSIONDIR)$/libxml-1.1.2.jar \ $(EXTENSIONDIR)$/flow-engine-0.9.2.jar \ $(EXTENSIONDIR)$/sac.jar .ENDIF -- cgit From 167c531dae4e9b8d11666f45abfe981d6d238732 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 3 Dec 2009 08:27:54 +0100 Subject: srb1: #i99049# add new lib from pentaho --- jfreereport/download/core.zip | Bin 764464 -> 0 bytes jfreereport/download/flow-engine-0.9.4.zip | Bin 0 -> 743031 bytes jfreereport/download/libbase-1.1.2.zip | Bin 427630 -> 0 bytes jfreereport/download/libbase-1.1.3.zip | Bin 0 -> 425007 bytes jfreereport/download/libcss-1.1.2.zip | Bin 0 -> 5667027 bytes jfreereport/download/libfonts-1.1.2.zip | Bin 5757381 -> 0 bytes jfreereport/download/libfonts-1.1.3.zip | Bin 0 -> 5748561 bytes jfreereport/download/libformat-1.1.3.zip | Bin 0 -> 381764 bytes jfreereport/download/libformula-1.1.2.zip | Bin 2001853 -> 0 bytes jfreereport/download/libformula-1.1.3.zip | Bin 0 -> 2014143 bytes jfreereport/download/liblayout-0.2.10.zip | Bin 0 -> 1396007 bytes jfreereport/download/liblayout.zip | Bin 1449297 -> 0 bytes jfreereport/download/libloader-1.1.2.zip | Bin 2940612 -> 0 bytes jfreereport/download/libloader-1.1.3.zip | Bin 0 -> 2936855 bytes jfreereport/download/librepository-1.1.2.zip | Bin 763457 -> 0 bytes jfreereport/download/librepository-1.1.3.zip | Bin 0 -> 758723 bytes jfreereport/download/libserializer-1.1.2.zip | Bin 217737 -> 0 bytes jfreereport/download/libserializer-1.1.3.zip | Bin 0 -> 210337 bytes jfreereport/download/libxml-1.1.2.zip | Bin 2934498 -> 0 bytes jfreereport/download/libxml-1.1.3.zip | Bin 0 -> 2926887 bytes jfreereport/java/flute/makefile.mk | 14 +++++++------- jfreereport/java/jfreereport/makefile.mk | 13 ++++++------- jfreereport/java/libbase/makefile.mk | 14 +++++++------- jfreereport/java/libfonts/makefile.mk | 14 +++++++------- jfreereport/java/libformula/makefile.mk | 14 +++++++------- jfreereport/java/liblayout/makefile.mk | 13 +++++++------ jfreereport/java/libloader/makefile.mk | 14 +++++++------- jfreereport/java/librepository/makefile.mk | 14 +++++++------- jfreereport/java/libserializer/makefile.mk | 14 +++++++------- jfreereport/java/libxml/makefile.mk | 14 +++++++------- jfreereport/patches/flow-engine.patch | 4 ++-- jfreereport/patches/liblayout.patch | 4 ++-- jfreereport/version.mk | 12 ++++++++++++ 33 files changed, 85 insertions(+), 73 deletions(-) delete mode 100644 jfreereport/download/core.zip create mode 100644 jfreereport/download/flow-engine-0.9.4.zip delete mode 100644 jfreereport/download/libbase-1.1.2.zip create mode 100644 jfreereport/download/libbase-1.1.3.zip create mode 100644 jfreereport/download/libcss-1.1.2.zip delete mode 100644 jfreereport/download/libfonts-1.1.2.zip create mode 100644 jfreereport/download/libfonts-1.1.3.zip create mode 100644 jfreereport/download/libformat-1.1.3.zip delete mode 100644 jfreereport/download/libformula-1.1.2.zip create mode 100644 jfreereport/download/libformula-1.1.3.zip create mode 100644 jfreereport/download/liblayout-0.2.10.zip delete mode 100644 jfreereport/download/liblayout.zip delete mode 100644 jfreereport/download/libloader-1.1.2.zip create mode 100644 jfreereport/download/libloader-1.1.3.zip delete mode 100644 jfreereport/download/librepository-1.1.2.zip create mode 100644 jfreereport/download/librepository-1.1.3.zip delete mode 100644 jfreereport/download/libserializer-1.1.2.zip create mode 100644 jfreereport/download/libserializer-1.1.3.zip delete mode 100644 jfreereport/download/libxml-1.1.2.zip create mode 100644 jfreereport/download/libxml-1.1.3.zip create mode 100644 jfreereport/version.mk diff --git a/jfreereport/download/core.zip b/jfreereport/download/core.zip deleted file mode 100644 index 813d87d49573..000000000000 Binary files a/jfreereport/download/core.zip and /dev/null differ diff --git a/jfreereport/download/flow-engine-0.9.4.zip b/jfreereport/download/flow-engine-0.9.4.zip new file mode 100644 index 000000000000..f6ef1decf09e Binary files /dev/null and b/jfreereport/download/flow-engine-0.9.4.zip differ diff --git a/jfreereport/download/libbase-1.1.2.zip b/jfreereport/download/libbase-1.1.2.zip deleted file mode 100644 index 754c23d0476a..000000000000 Binary files a/jfreereport/download/libbase-1.1.2.zip and /dev/null differ diff --git a/jfreereport/download/libbase-1.1.3.zip b/jfreereport/download/libbase-1.1.3.zip new file mode 100644 index 000000000000..990b09ab2c55 Binary files /dev/null and b/jfreereport/download/libbase-1.1.3.zip differ diff --git a/jfreereport/download/libcss-1.1.2.zip b/jfreereport/download/libcss-1.1.2.zip new file mode 100644 index 000000000000..c6114af6ea8c Binary files /dev/null and b/jfreereport/download/libcss-1.1.2.zip differ diff --git a/jfreereport/download/libfonts-1.1.2.zip b/jfreereport/download/libfonts-1.1.2.zip deleted file mode 100644 index 2da9ae1404af..000000000000 Binary files a/jfreereport/download/libfonts-1.1.2.zip and /dev/null differ diff --git a/jfreereport/download/libfonts-1.1.3.zip b/jfreereport/download/libfonts-1.1.3.zip new file mode 100644 index 000000000000..cfb5b7cde3cd Binary files /dev/null and b/jfreereport/download/libfonts-1.1.3.zip differ diff --git a/jfreereport/download/libformat-1.1.3.zip b/jfreereport/download/libformat-1.1.3.zip new file mode 100644 index 000000000000..a1ebea8712e7 Binary files /dev/null and b/jfreereport/download/libformat-1.1.3.zip differ diff --git a/jfreereport/download/libformula-1.1.2.zip b/jfreereport/download/libformula-1.1.2.zip deleted file mode 100644 index 30df78f45f5e..000000000000 Binary files a/jfreereport/download/libformula-1.1.2.zip and /dev/null differ diff --git a/jfreereport/download/libformula-1.1.3.zip b/jfreereport/download/libformula-1.1.3.zip new file mode 100644 index 000000000000..42ed0f764e6f Binary files /dev/null and b/jfreereport/download/libformula-1.1.3.zip differ diff --git a/jfreereport/download/liblayout-0.2.10.zip b/jfreereport/download/liblayout-0.2.10.zip new file mode 100644 index 000000000000..905a7bff6779 Binary files /dev/null and b/jfreereport/download/liblayout-0.2.10.zip differ diff --git a/jfreereport/download/liblayout.zip b/jfreereport/download/liblayout.zip deleted file mode 100644 index 1311fae496f5..000000000000 Binary files a/jfreereport/download/liblayout.zip and /dev/null differ diff --git a/jfreereport/download/libloader-1.1.2.zip b/jfreereport/download/libloader-1.1.2.zip deleted file mode 100644 index 67996e9d0562..000000000000 Binary files a/jfreereport/download/libloader-1.1.2.zip and /dev/null differ diff --git a/jfreereport/download/libloader-1.1.3.zip b/jfreereport/download/libloader-1.1.3.zip new file mode 100644 index 000000000000..593c8f327575 Binary files /dev/null and b/jfreereport/download/libloader-1.1.3.zip differ diff --git a/jfreereport/download/librepository-1.1.2.zip b/jfreereport/download/librepository-1.1.2.zip deleted file mode 100644 index 77c810617abe..000000000000 Binary files a/jfreereport/download/librepository-1.1.2.zip and /dev/null differ diff --git a/jfreereport/download/librepository-1.1.3.zip b/jfreereport/download/librepository-1.1.3.zip new file mode 100644 index 000000000000..79e9c2e443bf Binary files /dev/null and b/jfreereport/download/librepository-1.1.3.zip differ diff --git a/jfreereport/download/libserializer-1.1.2.zip b/jfreereport/download/libserializer-1.1.2.zip deleted file mode 100644 index 89079a2fb386..000000000000 Binary files a/jfreereport/download/libserializer-1.1.2.zip and /dev/null differ diff --git a/jfreereport/download/libserializer-1.1.3.zip b/jfreereport/download/libserializer-1.1.3.zip new file mode 100644 index 000000000000..4bfd509cbb46 Binary files /dev/null and b/jfreereport/download/libserializer-1.1.3.zip differ diff --git a/jfreereport/download/libxml-1.1.2.zip b/jfreereport/download/libxml-1.1.2.zip deleted file mode 100644 index cfa9222f36a8..000000000000 Binary files a/jfreereport/download/libxml-1.1.2.zip and /dev/null differ diff --git a/jfreereport/download/libxml-1.1.3.zip b/jfreereport/download/libxml-1.1.3.zip new file mode 100644 index 000000000000..0fe02e346e04 Binary files /dev/null and b/jfreereport/download/libxml-1.1.3.zip differ diff --git a/jfreereport/java/flute/makefile.mk b/jfreereport/java/flute/makefile.mk index a5bef2a6563c..d0d8cc865b04 100644 --- a/jfreereport/java/flute/makefile.mk +++ b/jfreereport/java/flute/makefile.mk @@ -33,26 +33,26 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=flute -VERSION=1.1.2 # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : antsettings.mk +.INCLUDE : $(PRJ)$/version.mk .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" -TARFILE_NAME=$(TARGET)-$(VERSION) +TARFILE_NAME=$(TARGET)-$(FLUTE_VERSION) #TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(FLUTE_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(FLUTE_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -66,9 +66,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk .IF "$(L10N_framework)"=="" -ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar -$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(FLUTE_VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(FLUTE_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(FLUTE_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(FLUTE_VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/jfreereport/makefile.mk b/jfreereport/java/jfreereport/makefile.mk index 6904557ee3a8..2c630f34b4ea 100644 --- a/jfreereport/java/jfreereport/makefile.mk +++ b/jfreereport/java/jfreereport/makefile.mk @@ -33,20 +33,19 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=flow-engine -VERSION=0.9.2 # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : antsettings.mk +.INCLUDE : $(PRJ)$/version.mk .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" -TARFILE_NAME=core -TARFILE_ROOTDIR=core +TARFILE_NAME=$(TARGET)-$(FLOW_ENGINE_VERSION) +TARFILE_IS_FLAT=true PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -# ADDITIONAL_FILES=MANIFEST.MF CONVERTFILES=build.xml .IF "$(JAVACISGCJ)"=="yes" @@ -67,8 +66,8 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk .IF "$(L10N_framework)"=="" -ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar -$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(FLOW_ENGINE_VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(FLOW_ENGINE_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)-$(FLOW_ENGINE_VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/libbase/makefile.mk b/jfreereport/java/libbase/makefile.mk index 637295bbc876..ed8a19d323b8 100644 --- a/jfreereport/java/libbase/makefile.mk +++ b/jfreereport/java/libbase/makefile.mk @@ -33,16 +33,16 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=libbase -VERSION=1.1.2 # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : antsettings.mk +.INCLUDE : $(PRJ)$/version.mk .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- -TARFILE_NAME=$(TARGET)-$(VERSION) +TARFILE_NAME=$(TARGET)-$(LIBBASE_VERSION) #TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true @@ -52,9 +52,9 @@ TARFILE_IS_FLAT=true .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBBASE_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBBASE_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -68,7 +68,7 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(L10N_framework)"=="" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBBASE_VERSION).jar # XCLASSPATH/CLASSPATH does not work and we only can give lib once. But # the build.xmls fortunately take *.jar out of lib so we can copy our @@ -83,7 +83,7 @@ $(CLASSDIR)$/commons-logging.jar : $(COPY) $(COMMONS_LOGGING_JAR) $(CLASSDIR)$/commons-logging.jar .ENDIF -$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(CLASSDIR)$/commons-logging.jar $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(LIBBASE_VERSION).jar : $(CLASSDIR)$/commons-logging.jar $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBBASE_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBBASE_VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/libfonts/makefile.mk b/jfreereport/java/libfonts/makefile.mk index 1bd28f050c04..5b8f08b4306e 100644 --- a/jfreereport/java/libfonts/makefile.mk +++ b/jfreereport/java/libfonts/makefile.mk @@ -33,17 +33,17 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=libfonts -VERSION=1.1.2 # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : antsettings.mk +.INCLUDE : $(PRJ)$/version.mk .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" -TARFILE_NAME=$(TARGET)-$(VERSION) +TARFILE_NAME=$(TARGET)-$(LIBFONTS_VERSION) #TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true # PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch @@ -52,9 +52,9 @@ TARFILE_IS_FLAT=true .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBFONTS_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBFONTS_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -67,9 +67,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar -$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBFONTS_VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(LIBFONTS_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBFONTS_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBFONTS_VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/libformula/makefile.mk b/jfreereport/java/libformula/makefile.mk index cb720bc89809..91f4e08d24db 100644 --- a/jfreereport/java/libformula/makefile.mk +++ b/jfreereport/java/libformula/makefile.mk @@ -33,17 +33,17 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=libformula -VERSION=1.1.2 # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : antsettings.mk +.INCLUDE : $(PRJ)$/version.mk .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" -TARFILE_NAME=$(TARGET)-$(VERSION) +TARFILE_NAME=$(TARGET)-$(LIBFORMULA_VERSION) #TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true #PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch @@ -54,9 +54,9 @@ TARFILE_IS_FLAT=true .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBFORMULA_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBFORMULA_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF @@ -70,9 +70,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar -$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBFORMULA_VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(LIBFORMULA_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBFORMULA_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBFORMULA_VERSION).jar .ENDIF # $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/source$/org$/jfree$/formula$/function$/information$/IsRef-Function.properties : diff --git a/jfreereport/java/liblayout/makefile.mk b/jfreereport/java/liblayout/makefile.mk index 30633b040ef7..54c9d14add94 100644 --- a/jfreereport/java/liblayout/makefile.mk +++ b/jfreereport/java/liblayout/makefile.mk @@ -33,18 +33,19 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=liblayout -VERSION=-0.2.9 # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : antsettings.mk +.INCLUDE : $(PRJ)$/version.mk .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" -TARFILE_NAME=$(TARGET) -TARFILE_ROOTDIR=$(TARGET) +TARFILE_NAME=$(TARGET)-$(LIBLAYOUT_VERSION) +TARFILE_IS_FLAT=true +# TARFILE_ROOTDIR=$(TARGET) PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch CONVERTFILES=build.xml @@ -66,9 +67,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)$(VERSION).jar -$(CLASSDIR)$/$(TARGET)$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBLAYOUT_VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(LIBLAYOUT_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/build$/lib$/$(TARGET).jar $(CLASSDIR)$/$(TARGET)-$(LIBLAYOUT_VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/libloader/makefile.mk b/jfreereport/java/libloader/makefile.mk index 6925948201cf..ff9cdddde374 100644 --- a/jfreereport/java/libloader/makefile.mk +++ b/jfreereport/java/libloader/makefile.mk @@ -33,17 +33,17 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=libloader -VERSION=1.1.2 # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : antsettings.mk +.INCLUDE : $(PRJ)$/version.mk .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- -TARFILE_NAME=$(TARGET)-$(VERSION) +TARFILE_NAME=$(TARGET)-$(LIBLOADER_VERSION) #TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true # PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch @@ -52,9 +52,9 @@ TARFILE_IS_FLAT=true .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBLOADER_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBLOADER_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -67,9 +67,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar -$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBLOADER_VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(LIBLOADER_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBLOADER_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBLOADER_VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/librepository/makefile.mk b/jfreereport/java/librepository/makefile.mk index f7a9a250b26b..0b56ec0af9db 100644 --- a/jfreereport/java/librepository/makefile.mk +++ b/jfreereport/java/librepository/makefile.mk @@ -33,17 +33,17 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=librepository -VERSION=1.1.2 # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : antsettings.mk +.INCLUDE : $(PRJ)$/version.mk .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- -TARFILE_NAME=$(TARGET)-$(VERSION) +TARFILE_NAME=$(TARGET)-$(LIBREPOSITORY_VERSION) #TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true # PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch @@ -52,9 +52,9 @@ TARFILE_IS_FLAT=true .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBREPOSITORY_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBREPOSITORY_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -67,9 +67,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar -$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBREPOSITORY_VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(LIBREPOSITORY_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBREPOSITORY_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBREPOSITORY_VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/libserializer/makefile.mk b/jfreereport/java/libserializer/makefile.mk index 57c80f75a91e..4540ef453fdd 100644 --- a/jfreereport/java/libserializer/makefile.mk +++ b/jfreereport/java/libserializer/makefile.mk @@ -33,17 +33,17 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=libserializer -VERSION=1.1.2 # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : antsettings.mk +.INCLUDE : $(PRJ)$/version.mk .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" -TARFILE_NAME=$(TARGET)-$(VERSION) +TARFILE_NAME=$(TARGET)-$(LIBSERIALIZER_VERSION) #TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true # PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch @@ -52,9 +52,9 @@ TARFILE_IS_FLAT=true .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBSERIALIZER_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBSERIALIZER_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -67,9 +67,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar -$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBSERIALIZER_VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(LIBSERIALIZER_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBSERIALIZER_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBSERIALIZER_VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/java/libxml/makefile.mk b/jfreereport/java/libxml/makefile.mk index 4cd60fffaf86..513d969fe9c3 100644 --- a/jfreereport/java/libxml/makefile.mk +++ b/jfreereport/java/libxml/makefile.mk @@ -33,17 +33,17 @@ PRJ=..$/.. PRJNAME=jfreereport TARGET=libxml -VERSION=1.1.2 # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk .INCLUDE : antsettings.mk +.INCLUDE : $(PRJ)$/version.mk .IF "$(SOLAR_JAVA)" != "" # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" -TARFILE_NAME=$(TARGET)-$(VERSION) +TARFILE_NAME=$(TARGET)-$(LIBXML_VERSION) #TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true # PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch @@ -52,9 +52,9 @@ TARFILE_IS_FLAT=true .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBXML_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBXML_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -67,9 +67,9 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(SOLAR_JAVA)" != "" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)-$(VERSION).jar -$(CLASSDIR)$/$(TARGET)-$(VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) - $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(VERSION).jar $(CLASSDIR)$/$(TARGET)-$(VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBXML_VERSION).jar +$(CLASSDIR)$/$(TARGET)-$(LIBXML_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) + $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBXML_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBXML_VERSION).jar .ENDIF .ENDIF diff --git a/jfreereport/patches/flow-engine.patch b/jfreereport/patches/flow-engine.patch index 13da432113fb..aef70cb7fef6 100644 --- a/jfreereport/patches/flow-engine.patch +++ b/jfreereport/patches/flow-engine.patch @@ -1,5 +1,5 @@ ---- misc/core/build.xml (Revision 6728) -+++ misc/build/core/build.xml (Arbeitskopie) +--- misc/flow-engine-0.9.4/build.xml (Revision 6728) ++++ misc/build/flow-engine-0.9.4/build.xml (Arbeitskopie) @@ -24,6 +24,6 @@ diff --git a/jfreereport/patches/liblayout.patch b/jfreereport/patches/liblayout.patch index ef9cb5bb06b3..4b1c23100987 100644 --- a/jfreereport/patches/liblayout.patch +++ b/jfreereport/patches/liblayout.patch @@ -1,5 +1,5 @@ ---- misc/liblayout/build.xml (Revision 6728) -+++ misc/build/liblayout/build.xml (Arbeitskopie) +--- misc/liblayout-0.2.10/build.xml (Revision 6728) ++++ misc/build/liblayout-0.2.10/build.xml (Arbeitskopie) @@ -24,6 +24,6 @@ diff --git a/jfreereport/version.mk b/jfreereport/version.mk new file mode 100644 index 000000000000..999cb290d755 --- /dev/null +++ b/jfreereport/version.mk @@ -0,0 +1,12 @@ +FLUTE_VERSION=1.1.2 +LIBBASE_VERSION=1.1.3 +LIBFONTS_VERSION=1.1.3 +LIBFORMAT_VERSION=1.1.3 +LIBFORMULA_VERSION=1.1.3 +LIBLAYOUT_VERSION=0.2.10 +LIBLOADER_VERSION=1.1.3 +LIBREPOSITORY_VERSION=1.1.3 +LIBSERIALIZER_VERSION=1.1.3 +LIBXML_VERSION=1.1.3 +FLOW_ENGINE_VERSION=0.9.4 + -- cgit From 9a8384ee40fc0ecd2402f4c61f66bb76128bba29 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 3 Dec 2009 08:33:51 +0100 Subject: srb1: #i99049# add new lib from pentaho --- jfreereport/patches/flute.patch | 19 ------------------- jfreereport/patches/libbase.patch | 19 ------------------- jfreereport/patches/libfonts.patch | 10 ---------- jfreereport/patches/libformula.patch | 12 ------------ jfreereport/patches/libloader.patch | 11 ----------- jfreereport/patches/librepository.patch | 10 ---------- jfreereport/patches/libserializer.patch | 10 ---------- jfreereport/patches/libxml.patch | 10 ---------- 8 files changed, 101 deletions(-) delete mode 100644 jfreereport/patches/flute.patch delete mode 100644 jfreereport/patches/libbase.patch delete mode 100644 jfreereport/patches/libfonts.patch delete mode 100644 jfreereport/patches/libformula.patch delete mode 100644 jfreereport/patches/libloader.patch delete mode 100644 jfreereport/patches/librepository.patch delete mode 100644 jfreereport/patches/libserializer.patch delete mode 100644 jfreereport/patches/libxml.patch diff --git a/jfreereport/patches/flute.patch b/jfreereport/patches/flute.patch deleted file mode 100644 index aad7756c3b65..000000000000 --- a/jfreereport/patches/flute.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- misc/flute/build.xml (Revision 6820) -+++ misc/build/flute/build.xml (Arbeitskopie) -@@ -9,6 +9,7 @@ - - - -+ - - - -@@ -21,7 +22,7 @@ - - - -- -+ - - - diff --git a/jfreereport/patches/libbase.patch b/jfreereport/patches/libbase.patch deleted file mode 100644 index f6a7560de145..000000000000 --- a/jfreereport/patches/libbase.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- misc/libbase/build.xml (Revision 6728) -+++ misc/build/libbase/build.xml (Arbeitskopie) -@@ -6,6 +6,7 @@ - - - -+ - - - -@@ -18,7 +19,7 @@ - - - -- -+ - - - diff --git a/jfreereport/patches/libfonts.patch b/jfreereport/patches/libfonts.patch deleted file mode 100644 index 63c5a1a48f93..000000000000 --- a/jfreereport/patches/libfonts.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- misc/libfonts/build.xml (Revision 6728) -+++ misc/build/libfonts/build.xml (Arbeitskopie) -@@ -23,6 +23,6 @@ - - -- -+ - - - diff --git a/jfreereport/patches/libformula.patch b/jfreereport/patches/libformula.patch deleted file mode 100644 index 8beb270e22e8..000000000000 --- a/jfreereport/patches/libformula.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- misc/libformula/source/org/pentaho/reporting/libraries/formula/lvalues/FormulaFunction.java 2008-12-12 13:04:46.000000000 +0100 -+++ misc/build/libformula/source/org/pentaho/reporting/libraries/formula/lvalues/FormulaFunction.java 2008-12-15 08:13:14.308750000 +0100 -@@ -161,7 +161,8 @@ - - for (int i = 0; i < parameters.length; i++) - { -- parameters[i].initialize(context); -+ if ( parameters[i] != null ) -+ parameters[i].initialize(context); - } - } - diff --git a/jfreereport/patches/libloader.patch b/jfreereport/patches/libloader.patch deleted file mode 100644 index 82a2624855a9..000000000000 --- a/jfreereport/patches/libloader.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- misc/libloader/build.xml 2009-02-12 18:01:56.000000000 +0100 -+++ misc/build/libloader/build.xml 2009-02-13 09:57:21.856601684 +0100 -@@ -23,7 +23,7 @@ - - - -- -+ - - - diff --git a/jfreereport/patches/librepository.patch b/jfreereport/patches/librepository.patch deleted file mode 100644 index 8a981595798c..000000000000 --- a/jfreereport/patches/librepository.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- misc/librepository/build.xml (Revision 6728) -+++ misc/build/librepository/build.xml (Arbeitskopie) -@@ -24,6 +24,6 @@ - - -- -+ - - - diff --git a/jfreereport/patches/libserializer.patch b/jfreereport/patches/libserializer.patch deleted file mode 100644 index 830fdb9ca348..000000000000 --- a/jfreereport/patches/libserializer.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- misc/libserializer/build.xml (Revision 6728) -+++ misc/build/libserializer/build.xml (Arbeitskopie) -@@ -24,6 +24,6 @@ - - -- -+ - - - diff --git a/jfreereport/patches/libxml.patch b/jfreereport/patches/libxml.patch deleted file mode 100644 index 50981a462de2..000000000000 --- a/jfreereport/patches/libxml.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- misc/libxml/build.xml (Revision 6728) -+++ misc/build/libxml/build.xml (Arbeitskopie) -@@ -24,6 +24,6 @@ - - -- -+ - - - -- cgit From 5c3f54f9533ae677b10133848daa422a98dcaf3a Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 3 Dec 2009 08:35:42 +0100 Subject: srb1: #i99049# add new lib from pentaho --- jfreereport/download/libcss-1.1.2.zip | Bin 5667027 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 jfreereport/download/libcss-1.1.2.zip diff --git a/jfreereport/download/libcss-1.1.2.zip b/jfreereport/download/libcss-1.1.2.zip deleted file mode 100644 index c6114af6ea8c..000000000000 Binary files a/jfreereport/download/libcss-1.1.2.zip and /dev/null differ -- cgit From 96c967926ea1c35f6a5c187324565812aed3d681 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 3 Dec 2009 08:59:14 +0100 Subject: srb1: #i99049# add new lib from pentaho --- .../java/com/sun/star/report/pentaho/Manifest.mf | 8 ++++---- .../java/com/sun/star/report/pentaho/makefile.mk | 14 +++++++++++++- reportbuilder/util/makefile.mk | 22 ++++++++++++---------- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf b/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf index e85f2018da99..ac543733876b 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf +++ b/reportbuilder/java/com/sun/star/report/pentaho/Manifest.mf @@ -1,7 +1,7 @@ RegistrationClassName: com.sun.star.report.pentaho.SOReportJobFactory Class-Path: reportbuilderwizard.jar - flute-1.1.2.jar libserializer-1.1.2.jar libbase-1.1.2.jar - libfonts-1.1.2.jar libformula-1.1.2.jar liblayout-0.2.9.jar - libloader-1.1.2.jar librepository-1.1.2.jar libxml-1.1.2.jar - flow-engine-0.9.2.jar sac.jar commons-logging-1.1.1.jar + flute-1.1.2.jar libserializer-1.1.3.jar libbase-1.1.3.jar + libfonts-1.1.3.jar libformula-1.1.3.jar liblayout-0.2.10.jar + libloader-1.1.3.jar librepository-1.1.3.jar libxml-1.1.3.jar + flow-engine-0.9.4.jar sac.jar commons-logging-1.1.1.jar UNO-Type-Path: diff --git a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk index 4b91d0966ebe..a26c4fde3ad8 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk +++ b/reportbuilder/java/com/sun/star/report/pentaho/makefile.mk @@ -37,13 +37,25 @@ PACKAGE = com$/sun$/star$/report$/pentaho nodep=true # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk +.INCLUDE : $(SOLARBINDIR)/jfreereport_version.mk #----- compile .java files ----------------------------------------- JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar .IF "$(SYSTEM_JFREEREPORT)" == "YES" XCLASSPATH!:=$(XCLASSPATH)$(FLUTE_JAR)$(PATH_SEPERATOR)$(LIBBASE_JAR)$(PATH_SEPERATOR)$(LIBXML_JAR)$(PATH_SEPERATOR)$(JFREEREPORT_JAR)$(PATH_SEPERATOR)$(LIBLOADER_JAR)$(PATH_SEPERATOR)$(SAC_JAR)$(PATH_SEPERATOR)$(LIBLAYOUT_JAR)$(PATH_SEPERATOR)$(LIBSERIALIZER_JAR)$(PATH_SEPERATOR)$(LIBFONTS_JAR)$(PATH_SEPERATOR)$(LIBFORMULA_JAR)$(PATH_SEPERATOR)$(LIBREPOSITORY_JAR) .ELSE -JARFILES += flute-1.1.2.jar libbase-1.1.2.jar libfonts-1.1.2.jar libformula-1.1.2.jar liblayout-0.2.9.jar libloader-1.1.2.jar librepository-1.1.2.jar libxml-1.1.2.jar flow-engine-0.9.2.jar sac.jar +JARFILES += \ + flute-$(FLUTE_VERSION).jar \ + libserializer-$(LIBSERIALIZER_VERSION).jar \ + libbase-$(LIBBASE_VERSION).jar \ + libfonts-$(LIBFONTS_VERSION).jar \ + libformula-$(LIBFORMULA_VERSION).jar \ + liblayout-$(LIBLAYOUT_VERSION).jar \ + libloader-$(LIBLOADER_VERSION).jar \ + librepository-$(LIBREPOSITORY_VERSION).jar \ + libxml-$(LIBXML_VERSION).jar \ + flow-engine-$(FLOW_ENGINE_VERSION).jar \ + sac.jar .ENDIF .IF "$(SYSTEM_APACHE_COMMONS)" == "YES" diff --git a/reportbuilder/util/makefile.mk b/reportbuilder/util/makefile.mk index d1cf25c4ad7b..78d6b6993ffb 100644 --- a/reportbuilder/util/makefile.mk +++ b/reportbuilder/util/makefile.mk @@ -42,6 +42,8 @@ EXTENSION_VERSION_BASE=1.2.1 # --- Settings ---------------------------------- .INCLUDE : makefile.pmk +.INCLUDE : $(SOLARBINDIR)/jfreereport_version.mk + .IF "$(L10N_framework)"=="" # ------------------------------------------------------------------ # calready set in util$/makefile.pmk @@ -100,16 +102,16 @@ COMPONENT_EXTJARFILES = \ .IF "$(SYSTEM_JFREEREPORT)" != "YES" COMPONENT_EXTJARFILES += \ - $(EXTENSIONDIR)$/flute-1.1.2.jar \ - $(EXTENSIONDIR)$/libserializer-1.1.2.jar \ - $(EXTENSIONDIR)$/libbase-1.1.2.jar \ - $(EXTENSIONDIR)$/libfonts-1.1.2.jar \ - $(EXTENSIONDIR)$/libformula-1.1.2.jar \ - $(EXTENSIONDIR)$/liblayout-0.2.9.jar \ - $(EXTENSIONDIR)$/libloader-1.1.2.jar \ - $(EXTENSIONDIR)$/librepository-1.1.2.jar \ - $(EXTENSIONDIR)$/libxml-1.1.2.jar \ - $(EXTENSIONDIR)$/flow-engine-0.9.2.jar \ + $(EXTENSIONDIR)$/flute-$(FLUTE_VERSION).jar \ + $(EXTENSIONDIR)$/libserializer-$(LIBSERIALIZER_VERSION).jar \ + $(EXTENSIONDIR)$/libbase-$(LIBBASE_VERSION).jar \ + $(EXTENSIONDIR)$/libfonts-$(LIBFONTS_VERSION).jar \ + $(EXTENSIONDIR)$/libformula-$(LIBFORMULA_VERSION).jar \ + $(EXTENSIONDIR)$/liblayout-$(LIBLAYOUT_VERSION).jar \ + $(EXTENSIONDIR)$/libloader-$(LIBLOADER_VERSION).jar \ + $(EXTENSIONDIR)$/librepository-$(LIBREPOSITORY_VERSION).jar \ + $(EXTENSIONDIR)$/libxml-$(LIBXML_VERSION).jar \ + $(EXTENSIONDIR)$/flow-engine-$(FLOW_ENGINE_VERSION).jar \ $(EXTENSIONDIR)$/sac.jar .ENDIF .IF "$(SYSTEM_APACHE_COMMONS)" != "YES" -- cgit From 6083d3a761d4efc3f0ec55e083e782f8b0a9a60a Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Thu, 3 Dec 2009 08:59:37 +0100 Subject: srb1: #i99049# add new lib from pentaho --- jfreereport/prj/d.lst | 1 + 1 file changed, 1 insertion(+) diff --git a/jfreereport/prj/d.lst b/jfreereport/prj/d.lst index a63f3a1312d5..2527cc676782 100644 --- a/jfreereport/prj/d.lst +++ b/jfreereport/prj/d.lst @@ -1 +1,2 @@ ..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.jar +..\version.mk %_DEST%\bin%_EXT%\jfreereport_version.mk -- cgit From 7942ea3149bdcf4f7816a3abf79b5e1344291569 Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Fri, 4 Dec 2009 11:24:57 +0100 Subject: srb1: #i99049# patch common_build.xml --- jfreereport/java/flute/makefile.mk | 13 ++++-- jfreereport/java/libbase/makefile.mk | 15 ++++--- jfreereport/java/libfonts/makefile.mk | 15 ++++--- jfreereport/java/libformula/makefile.mk | 17 ++++---- jfreereport/java/liblayout/makefile.mk | 1 - jfreereport/java/libloader/makefile.mk | 16 +++++--- jfreereport/java/librepository/makefile.mk | 16 +++++--- jfreereport/java/libserializer/makefile.mk | 15 ++++--- jfreereport/java/libxml/makefile.mk | 15 ++++--- jfreereport/java/sac/makefile.mk | 4 +- jfreereport/patches/common_build.patch | 64 ++++++++++++++++++++++++++++++ 11 files changed, 148 insertions(+), 43 deletions(-) create mode 100644 jfreereport/patches/common_build.patch diff --git a/jfreereport/java/flute/makefile.mk b/jfreereport/java/flute/makefile.mk index d0d8cc865b04..42b8fdd3062b 100644 --- a/jfreereport/java/flute/makefile.mk +++ b/jfreereport/java/flute/makefile.mk @@ -44,15 +44,16 @@ TARGET=flute # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" TARFILE_NAME=$(TARGET)-$(FLUTE_VERSION) -#TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true +PATCH_FILES=$(PACKAGE_DIR)$/$(TARGET).patch +CONVERTFILES=common_build.xml .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(FLUTE_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(FLUTE_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(FLUTE_VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(FLUTE_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -67,6 +68,12 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .INCLUDE : tg_ext.mk .IF "$(L10N_framework)"=="" ALLTAR : $(CLASSDIR)$/$(TARGET)-$(FLUTE_VERSION).jar + +$(PACKAGE_DIR)$/$(TARGET).patch : + @-$(MKDIRHIER) $(PACKAGE_DIR)$(fake_root_dir) + ( $(TYPE:s/+//) $(PRJ)$/patches$/common_build.patch | $(SED) 's/libloader-1.1.3/$(TARGET)-$(FLUTE_VERSION)/g' > $(PACKAGE_DIR)$/$(TARGET).patch ) + $(COMMAND_ECHO)$(TOUCH) $(PACKAGE_DIR)$/so_converted_$(TARGET).dummy + $(CLASSDIR)$/$(TARGET)-$(FLUTE_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(FLUTE_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(FLUTE_VERSION).jar .ENDIF diff --git a/jfreereport/java/libbase/makefile.mk b/jfreereport/java/libbase/makefile.mk index ed8a19d323b8..04acff1621b3 100644 --- a/jfreereport/java/libbase/makefile.mk +++ b/jfreereport/java/libbase/makefile.mk @@ -46,15 +46,15 @@ TARFILE_NAME=$(TARGET)-$(LIBBASE_VERSION) #TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true -# PATCH_FILES=$(PRJ)$/patches$/libbase.patch -# CONVERTFILES=build.xml +PATCH_FILES=$(PACKAGE_DIR)$/$(TARGET).patch +CONVERTFILES=common_build.xml .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBBASE_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBBASE_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBBASE_VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBBASE_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -68,8 +68,13 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .IF "$(L10N_framework)"=="" .INCLUDE : tg_ext.mk -ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBBASE_VERSION).jar +ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBBASE_VERSION).jar +$(PACKAGE_DIR)$/$(TARGET).patch : + @-$(MKDIRHIER) $(PACKAGE_DIR)$(fake_root_dir) + ( $(TYPE:s/+//) $(PRJ)$/patches$/common_build.patch | $(SED) 's/libloader-1.1.3/$(TARGET)-$(LIBBASE_VERSION)/g' > $(PACKAGE_DIR)$/$(TARGET).patch ) + $(COMMAND_ECHO)$(TOUCH) $(PACKAGE_DIR)$/so_converted_$(TARGET).dummy + # XCLASSPATH/CLASSPATH does not work and we only can give lib once. But # the build.xmls fortunately take *.jar out of lib so we can copy our # commons-logging.jar here - yes, even in the system-apache commons case. diff --git a/jfreereport/java/libfonts/makefile.mk b/jfreereport/java/libfonts/makefile.mk index 5b8f08b4306e..4de9039f1f8f 100644 --- a/jfreereport/java/libfonts/makefile.mk +++ b/jfreereport/java/libfonts/makefile.mk @@ -44,17 +44,16 @@ TARGET=libfonts # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" TARFILE_NAME=$(TARGET)-$(LIBFONTS_VERSION) -#TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true -# PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -# CONVERTFILES=build.xml +PATCH_FILES=$(PACKAGE_DIR)$/$(TARGET).patch +CONVERTFILES=common_build.xml .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBFONTS_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBFONTS_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBFONTS_VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBFONTS_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -68,6 +67,12 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .INCLUDE : tg_ext.mk ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBFONTS_VERSION).jar + +$(PACKAGE_DIR)$/$(TARGET).patch : + @-$(MKDIRHIER) $(PACKAGE_DIR)$(fake_root_dir) + ( $(TYPE:s/+//) $(PRJ)$/patches$/common_build.patch | $(SED) 's/libloader-1.1.3/$(TARGET)-$(LIBFONTS_VERSION)/g' > $(PACKAGE_DIR)$/$(TARGET).patch ) + $(COMMAND_ECHO)$(TOUCH) $(PACKAGE_DIR)$/so_converted_$(TARGET).dummy + $(CLASSDIR)$/$(TARGET)-$(LIBFONTS_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBFONTS_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBFONTS_VERSION).jar diff --git a/jfreereport/java/libformula/makefile.mk b/jfreereport/java/libformula/makefile.mk index 91f4e08d24db..5256b06956ab 100644 --- a/jfreereport/java/libformula/makefile.mk +++ b/jfreereport/java/libformula/makefile.mk @@ -44,19 +44,16 @@ TARGET=libformula # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" TARFILE_NAME=$(TARGET)-$(LIBFORMULA_VERSION) -#TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true -#PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -#CONVERTFILES=build.xml \ -# source$/org$/pentaho$/reporting$/libraries$/formula$/function$/datetime$/DateDifFunction.java \ -# source$/org$/pentaho$/reporting$/libraries$/formula$/lvalues$/FormulaFunction.java +PATCH_FILES=$(PACKAGE_DIR)$/$(TARGET).patch +CONVERTFILES=common_build.xml .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBFORMULA_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBFORMULA_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBFORMULA_VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBFORMULA_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF @@ -71,6 +68,12 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .INCLUDE : tg_ext.mk ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBFORMULA_VERSION).jar + +$(PACKAGE_DIR)$/$(TARGET).patch : + @-$(MKDIRHIER) $(PACKAGE_DIR)$(fake_root_dir) + ( $(TYPE:s/+//) $(PRJ)$/patches$/common_build.patch | $(SED) 's/libloader-1.1.3/$(TARGET)-$(LIBFORMULA_VERSION)/g' > $(PACKAGE_DIR)$/$(TARGET).patch ) + $(COMMAND_ECHO)$(TOUCH) $(PACKAGE_DIR)$/so_converted_$(TARGET).dummy + $(CLASSDIR)$/$(TARGET)-$(LIBFORMULA_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBFORMULA_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBFORMULA_VERSION).jar diff --git a/jfreereport/java/liblayout/makefile.mk b/jfreereport/java/liblayout/makefile.mk index 54c9d14add94..7a47e736ec17 100644 --- a/jfreereport/java/liblayout/makefile.mk +++ b/jfreereport/java/liblayout/makefile.mk @@ -45,7 +45,6 @@ TARGET=liblayout .IF "$(L10N_framework)"=="" TARFILE_NAME=$(TARGET)-$(LIBLAYOUT_VERSION) TARFILE_IS_FLAT=true -# TARFILE_ROOTDIR=$(TARGET) PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch CONVERTFILES=build.xml diff --git a/jfreereport/java/libloader/makefile.mk b/jfreereport/java/libloader/makefile.mk index ff9cdddde374..22757ffc969a 100644 --- a/jfreereport/java/libloader/makefile.mk +++ b/jfreereport/java/libloader/makefile.mk @@ -44,17 +44,17 @@ TARGET=libloader # --- Files -------------------------------------------------------- TARFILE_NAME=$(TARGET)-$(LIBLOADER_VERSION) -#TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true -# PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -# CONVERTFILES=build.xml +PATCH_FILES=$(PACKAGE_DIR)$/$(TARGET).patch +CONVERTFILES=common_build.xml + .IF "$(L10N_framework)"=="" .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBLOADER_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBLOADER_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBLOADER_VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBLOADER_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -68,6 +68,12 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .INCLUDE : tg_ext.mk ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBLOADER_VERSION).jar + +$(PACKAGE_DIR)$/$(TARGET).patch : + @-$(MKDIRHIER) $(PACKAGE_DIR)$(fake_root_dir) + ( $(TYPE:s/+//) $(PRJ)$/patches$/common_build.patch | $(SED) 's/libloader-1.1.3/$(TARGET)-$(LIBLOADER_VERSION)/g' > $(PACKAGE_DIR)$/$(TARGET).patch ) + $(COMMAND_ECHO)$(TOUCH) $(PACKAGE_DIR)$/so_converted_$(TARGET).dummy + $(CLASSDIR)$/$(TARGET)-$(LIBLOADER_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBLOADER_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBLOADER_VERSION).jar diff --git a/jfreereport/java/librepository/makefile.mk b/jfreereport/java/librepository/makefile.mk index 0b56ec0af9db..5b620164340a 100644 --- a/jfreereport/java/librepository/makefile.mk +++ b/jfreereport/java/librepository/makefile.mk @@ -44,17 +44,17 @@ TARGET=librepository # --- Files -------------------------------------------------------- TARFILE_NAME=$(TARGET)-$(LIBREPOSITORY_VERSION) -#TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true -# PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -# CONVERTFILES=build.xml +PATCH_FILES=$(PACKAGE_DIR)$/$(TARGET).patch +CONVERTFILES=common_build.xml + .IF "$(L10N_framework)"=="" .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBREPOSITORY_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBREPOSITORY_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBREPOSITORY_VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBREPOSITORY_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -68,6 +68,12 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .INCLUDE : tg_ext.mk ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBREPOSITORY_VERSION).jar + +$(PACKAGE_DIR)$/$(TARGET).patch : + @-$(MKDIRHIER) $(PACKAGE_DIR)$(fake_root_dir) + ( $(TYPE:s/+//) $(PRJ)$/patches$/common_build.patch | $(SED) 's/libloader-1.1.3/$(TARGET)-$(LIBREPOSITORY_VERSION)/g' > $(PACKAGE_DIR)$/$(TARGET).patch ) + $(COMMAND_ECHO)$(TOUCH) $(PACKAGE_DIR)$/so_converted_$(TARGET).dummy + $(CLASSDIR)$/$(TARGET)-$(LIBREPOSITORY_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBREPOSITORY_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBREPOSITORY_VERSION).jar diff --git a/jfreereport/java/libserializer/makefile.mk b/jfreereport/java/libserializer/makefile.mk index 4540ef453fdd..b734bc220bef 100644 --- a/jfreereport/java/libserializer/makefile.mk +++ b/jfreereport/java/libserializer/makefile.mk @@ -44,17 +44,16 @@ TARGET=libserializer # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" TARFILE_NAME=$(TARGET)-$(LIBSERIALIZER_VERSION) -#TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true -# PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -# CONVERTFILES=build.xml +PATCH_FILES=$(PACKAGE_DIR)$/$(TARGET).patch +CONVERTFILES=common_build.xml .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBSERIALIZER_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBSERIALIZER_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBSERIALIZER_VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBSERIALIZER_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -68,6 +67,12 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .INCLUDE : tg_ext.mk ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBSERIALIZER_VERSION).jar + +$(PACKAGE_DIR)$/$(TARGET).patch : + @-$(MKDIRHIER) $(PACKAGE_DIR)$(fake_root_dir) + ( $(TYPE:s/+//) $(PRJ)$/patches$/common_build.patch | $(SED) 's/libloader-1.1.3/$(TARGET)-$(LIBSERIALIZER_VERSION)/g' > $(PACKAGE_DIR)$/$(TARGET).patch ) + $(COMMAND_ECHO)$(TOUCH) $(PACKAGE_DIR)$/so_converted_$(TARGET).dummy + $(CLASSDIR)$/$(TARGET)-$(LIBSERIALIZER_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBSERIALIZER_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBSERIALIZER_VERSION).jar diff --git a/jfreereport/java/libxml/makefile.mk b/jfreereport/java/libxml/makefile.mk index 513d969fe9c3..65f20ddbb58b 100644 --- a/jfreereport/java/libxml/makefile.mk +++ b/jfreereport/java/libxml/makefile.mk @@ -44,17 +44,16 @@ TARGET=libxml # --- Files -------------------------------------------------------- .IF "$(L10N_framework)"=="" TARFILE_NAME=$(TARGET)-$(LIBXML_VERSION) -#TARFILE_ROOTDIR=$(TARGET) TARFILE_IS_FLAT=true -# PATCH_FILES=$(PRJ)$/patches$/$(TARGET).patch -# CONVERTFILES=build.xml +PATCH_FILES=$(PACKAGE_DIR)$/$(TARGET).patch +CONVERTFILES=common_build.xml .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBXML_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBXML_VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) jar .ELSE -BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(LIBXML_VERSION)" -f $(ANT_BUILDFILE) jar +BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dbuild.id="10682" -Dproject.revision="$(LIBXML_VERSION)" -f $(ANT_BUILDFILE) jar .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" @@ -68,6 +67,12 @@ BUILD_ACTION=$(ANT) -Dlib="../../../class" -Dbuild.label="build-$(RSCREVISION)" .INCLUDE : tg_ext.mk ALLTAR : $(CLASSDIR)$/$(TARGET)-$(LIBXML_VERSION).jar + +$(PACKAGE_DIR)$/$(TARGET).patch : + @-$(MKDIRHIER) $(PACKAGE_DIR)$(fake_root_dir) + ( $(TYPE:s/+//) $(PRJ)$/patches$/common_build.patch | $(SED) 's/libloader-1.1.3/$(TARGET)-$(LIBXML_VERSION)/g' > $(PACKAGE_DIR)$/$(TARGET).patch ) + $(COMMAND_ECHO)$(TOUCH) $(PACKAGE_DIR)$/so_converted_$(TARGET).dummy + $(CLASSDIR)$/$(TARGET)-$(LIBXML_VERSION).jar : $(PACKAGE_DIR)$/$(INSTALL_FLAG_FILE) $(COPY) $(PACKAGE_DIR)$/$(TARFILE_ROOTDIR)$/dist$/$(TARGET)-$(LIBXML_VERSION).jar $(CLASSDIR)$/$(TARGET)-$(LIBXML_VERSION).jar diff --git a/jfreereport/java/sac/makefile.mk b/jfreereport/java/sac/makefile.mk index d3828d4f1cab..43aa15fe2db5 100644 --- a/jfreereport/java/sac/makefile.mk +++ b/jfreereport/java/sac/makefile.mk @@ -61,9 +61,9 @@ ADDITIONAL_FILES=build.xml .IF "$(JAVACISGCJ)"=="yes" JAVA_HOME= .EXPORT : JAVA_HOME -BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) all +BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dproject.revision="$(VERSION)" -Dbuild.compiler=gcj -f $(ANT_BUILDFILE) all .ELSE -BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) all +BUILD_ACTION=$(ANT) -Dbuild.label="build-$(RSCREVISION)" -Dantcontrib.available="true" -Dproject.revision="$(VERSION)" -f $(ANT_BUILDFILE) all .ENDIF .ENDIF # $(SOLAR_JAVA)!= "" diff --git a/jfreereport/patches/common_build.patch b/jfreereport/patches/common_build.patch new file mode 100644 index 000000000000..69b5d734b4d7 --- /dev/null +++ b/jfreereport/patches/common_build.patch @@ -0,0 +1,64 @@ +--- misc/libloader-1.1.3/common_build.xml 2009-11-16 10:25:34.000000000 +0100 ++++ misc/build/libloader-1.1.3/common_build.xml 2009-12-04 10:22:24.277647200 +0100 +@@ -497,7 +497,7 @@ + Sets a property build.id to the either "development" or the svn revision + if in release mode + ====================================================================--> +- ++ + + + +@@ -1082,27 +1082,32 @@ + duplicate copying of resources from src tree (handled by compile.src_copy + if jar.include.source is set. + ====================================================================--> +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ + +- +- +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + + ++ ++ ++ ++ ++ + Date: Tue, 6 Jul 2010 09:21:34 +0200 Subject: srb1: add missing files to ooo.lst --- ooo.lst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ooo.lst b/ooo.lst index d2f92d6ef534..604755fa643d 100644 --- a/ooo.lst +++ b/ooo.lst @@ -71,3 +71,11 @@ fcc6df1160753d0b8c835d17fdeeb0a7-boost_1_39_0.tar.gz fdb27bfe2dbe2e7b57ae194d9bf36bab-SampleICC-1.3.2.tar.gz fe5b3e2b7c4577f30dc001054365653e-dejavu-fonts-ttf-2.30.zip 831126a1ee5af269923cfab6050769fe-mysql-connector-cpp.zip +3404ab6b1792ae5f16bbd603bd1e1d03-libformula-1.1.7.zip +8ce2fcd72becf06c41f7201d15373ed9-librepository-1.1.6.zip +97b2d4dba862397f446b217e2b623e71-libloader-1.1.6.zip +ace6ab49184e329db254e454a010f56d-libxml-1.1.7.zip +d8bd5eed178db6e2b18eeed243f85aa8-flute-1.1.6.zip +db60e4fde8dd6d6807523deb71ee34dc-liblayout-0.2.10.zip +eeb2c7ddf0d302fba4bfc6e97eac9624-libbase-1.1.6.zip +f94d9870737518e3b597f9265f4e9803-libserializer-1.1.6.zip -- cgit From 5d7dd0a1b0e730a12a1702bd2c51a7fded6dddff Mon Sep 17 00:00:00 2001 From: "Ocke Janssen [oj]" Date: Tue, 6 Jul 2010 09:25:38 +0200 Subject: srb1: add missing files to ooo.lst --- ooo.lst | 1 + 1 file changed, 1 insertion(+) diff --git a/ooo.lst b/ooo.lst index 604755fa643d..3c2f6a141786 100644 --- a/ooo.lst +++ b/ooo.lst @@ -72,6 +72,7 @@ fdb27bfe2dbe2e7b57ae194d9bf36bab-SampleICC-1.3.2.tar.gz fe5b3e2b7c4577f30dc001054365653e-dejavu-fonts-ttf-2.30.zip 831126a1ee5af269923cfab6050769fe-mysql-connector-cpp.zip 3404ab6b1792ae5f16bbd603bd1e1d03-libformula-1.1.7.zip +3bdf40c0d199af31923e900d082ca2dd-libfonts-1.1.6.zip 8ce2fcd72becf06c41f7201d15373ed9-librepository-1.1.6.zip 97b2d4dba862397f446b217e2b623e71-libloader-1.1.6.zip ace6ab49184e329db254e454a010f56d-libxml-1.1.7.zip -- cgit From a555527edb34036835b167f0b3b7f6d515f098c4 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 2 Sep 2010 18:58:54 +0200 Subject: pl08: #i114277# enhance SfxPasswordDialog --- vcl/inc/vcl/arrange.hxx | 28 ++++++++++++++++++++++------ vcl/source/window/arrange.cxx | 41 ++++++++++++++++++++++++++++------------- 2 files changed, 50 insertions(+), 19 deletions(-) diff --git a/vcl/inc/vcl/arrange.hxx b/vcl/inc/vcl/arrange.hxx index eed33e379e5b..d33bac7ccd7f 100644 --- a/vcl/inc/vcl/arrange.hxx +++ b/vcl/inc/vcl/arrange.hxx @@ -76,11 +76,13 @@ namespace vcl Element( Window* i_pWin, boost::shared_ptr const & i_pChild = boost::shared_ptr(), - sal_Int32 i_nExpandPriority = 0 + sal_Int32 i_nExpandPriority = 0, + const Size& i_rMinSize = Size() ) : m_pElement( i_pWin ) , m_pChild( i_pChild ) , m_nExpandPriority( i_nExpandPriority ) + , m_aMinSize( i_rMinSize ) , m_bHidden( false ) , m_nLeftBorder( 0 ) , m_nTopBorder( 0 ) @@ -183,6 +185,19 @@ namespace vcl } } + void getBorders( size_t i_nIndex, long* i_pLeft = NULL, long* i_pTop = NULL, long* i_pRight = NULL, long* i_pBottom = NULL ) const + { + const Element* pEle = getConstElement( i_nIndex ); + if( pEle ) + { + if( i_pLeft ) *i_pLeft = pEle->m_nLeftBorder; + if( i_pTop ) *i_pTop = pEle->m_nTopBorder; + if( i_pRight ) *i_pRight = pEle->m_nRightBorder; + if( i_pBottom ) *i_pBottom = pEle->m_nBottomBorder; + } + } + + void show( bool i_bShow = true, bool i_bImmediateUpdate = true ); void setManagedArea( const Rectangle& i_rArea ) @@ -234,7 +249,7 @@ namespace vcl // add a managed window at the given index // an index smaller than zero means add the window at the end - size_t addWindow( Window*, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 ); + size_t addWindow( Window*, sal_Int32 i_nExpandPrio = 0, const Size& i_rMinSize = Size(), size_t i_nIndex = ~0 ); void remove( Window* ); size_t addChild( boost::shared_ptr const &, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 ); @@ -304,7 +319,7 @@ namespace vcl // returns the index of the added label size_t addRow( Window* i_pLabel, boost::shared_ptr const& i_rElement, long i_nIndent = 0 ); - size_t addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent = 0 ); + size_t addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent = 0, const Size& i_rElementMinSize = Size() ); }; class VCL_DLLPUBLIC Indenter : public WindowArranger @@ -386,9 +401,10 @@ namespace vcl MatrixElement( Window* i_pWin, sal_uInt32 i_nX, sal_uInt32 i_nY, boost::shared_ptr const & i_pChild = boost::shared_ptr(), - sal_Int32 i_nExpandPriority = 0 + sal_Int32 i_nExpandPriority = 0, + const Size& i_rMinSize = Size() ) - : WindowArranger::Element( i_pWin, i_pChild, i_nExpandPriority ) + : WindowArranger::Element( i_pWin, i_pChild, i_nExpandPriority, i_rMinSize ) , m_nX( i_nX ) , m_nY( i_nY ) { @@ -422,7 +438,7 @@ namespace vcl virtual size_t countElements() const { return m_aElements.size(); } // add a managed window at the given matrix position - size_t addWindow( Window*, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 ); + size_t addWindow( Window*, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0, const Size& i_rMinSize = Size() ); void remove( Window* ); size_t addChild( boost::shared_ptr const &, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 ); diff --git a/vcl/source/window/arrange.cxx b/vcl/source/window/arrange.cxx index ea827a224f4a..bba5eeb013a3 100644 --- a/vcl/source/window/arrange.cxx +++ b/vcl/source/window/arrange.cxx @@ -178,16 +178,26 @@ Size WindowArranger::Element::getOptimalSize( WindowSizeType i_eType ) const Size aResult; if( ! m_bHidden ) { + bool bVisible = false; if( m_pElement && m_pElement->IsVisible() ) + { aResult = m_pElement->GetOptimalSize( i_eType ); - else if( m_pChild ) + bVisible = true; + } + else if( m_pChild && m_pChild->isVisible() ) + { aResult = m_pChild->getOptimalSize( i_eType ); - if( aResult.Width() < m_aMinSize.Width() ) - aResult.Width() = m_aMinSize.Width(); - if( aResult.Height() < m_aMinSize.Height() ) - aResult.Height() = m_aMinSize.Height(); - aResult.Width() += getBorderValue( m_nLeftBorder ) + getBorderValue( m_nRightBorder ); - aResult.Height() += getBorderValue( m_nTopBorder ) + getBorderValue( m_nBottomBorder ); + bVisible = true; + } + if( bVisible ) + { + if( aResult.Width() < m_aMinSize.Width() ) + aResult.Width() = m_aMinSize.Width(); + if( aResult.Height() < m_aMinSize.Height() ) + aResult.Height() = m_aMinSize.Height(); + aResult.Width() += getBorderValue( m_nLeftBorder ) + getBorderValue( m_nRightBorder ); + aResult.Height() += getBorderValue( m_nTopBorder ) + getBorderValue( m_nBottomBorder ); + } } return aResult; @@ -477,20 +487,20 @@ void RowOrColumn::resize() } } -size_t RowOrColumn::addWindow( Window* i_pWindow, sal_Int32 i_nExpandPrio, size_t i_nIndex ) +size_t RowOrColumn::addWindow( Window* i_pWindow, sal_Int32 i_nExpandPrio, const Size& i_rMinSize, size_t i_nIndex ) { size_t nIndex = i_nIndex; if( i_nIndex >= m_aElements.size() ) { nIndex = m_aElements.size(); - m_aElements.push_back( WindowArranger::Element( i_pWindow, boost::shared_ptr(), i_nExpandPrio ) ); + m_aElements.push_back( WindowArranger::Element( i_pWindow, boost::shared_ptr(), i_nExpandPrio, i_rMinSize ) ); } else { std::vector< WindowArranger::Element >::iterator it = m_aElements.begin(); while( i_nIndex-- ) ++it; - m_aElements.insert( it, WindowArranger::Element( i_pWindow, boost::shared_ptr(), i_nExpandPrio ) ); + m_aElements.insert( it, WindowArranger::Element( i_pWindow, boost::shared_ptr(), i_nExpandPrio, i_rMinSize ) ); } return nIndex; } @@ -664,6 +674,9 @@ long LabelColumn::getLabelWidth() const if( pLW ) { Size aLabSize( pLW->GetOptimalSize( WINDOWSIZE_MINIMUM ) ); + long nLB = 0; + pLabel->getBorders(0, &nLB); + aLabSize.Width() += getBorderValue( nLB ); if( aLabSize.Width() > nWidth ) nWidth = aLabSize.Width(); } @@ -754,12 +767,13 @@ size_t LabelColumn::addRow( Window* i_pLabel, boost::shared_ptr return nIndex; } -size_t LabelColumn::addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent ) +size_t LabelColumn::addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent, const Size& i_rElementMinSize ) { boost::shared_ptr< LabeledElement > xLabel( new LabeledElement( this, 1 ) ); xLabel->setLabel( i_pLabel ); xLabel->setBorders( 0, i_nIndent, 0, 0, 0 ); xLabel->setElement( i_pElement ); + xLabel->setMinimumSize( 1, i_rElementMinSize ); size_t nIndex = addChild( xLabel ); resize(); return nIndex; @@ -918,7 +932,7 @@ void MatrixArranger::resize() } } -size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio ) +size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio, const Size& i_rMinSize ) { sal_uInt64 nMapValue = getMap( i_nX, i_nY ); std::map< sal_uInt64, size_t >::const_iterator it = m_aMatrixMap.find( nMapValue ); @@ -926,7 +940,7 @@ size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32 if( it == m_aMatrixMap.end() ) { m_aMatrixMap[ nMapValue ] = nIndex = m_aElements.size(); - m_aElements.push_back( MatrixElement( i_pWindow, i_nX, i_nY, boost::shared_ptr(), i_nExpandPrio ) ); + m_aElements.push_back( MatrixElement( i_pWindow, i_nX, i_nY, boost::shared_ptr(), i_nExpandPrio, i_rMinSize ) ); } else { @@ -934,6 +948,7 @@ size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32 rEle.m_pElement = i_pWindow; rEle.m_pChild.reset(); rEle.m_nExpandPriority = i_nExpandPrio; + rEle.m_aMinSize = i_rMinSize; rEle.m_nX = i_nX; rEle.m_nY = i_nY; nIndex = it->second; -- cgit From 1ceeac4ca836372279a0eea26e32959dce327ebf Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 2 Sep 2010 18:58:54 +0200 Subject: pl08: #i114277# enhance SfxPasswordDialog --- sfx2/inc/sfx2/passwd.hxx | 22 ++++-- sfx2/source/dialog/passwd.cxx | 179 ++++++++++++++++++++++++++---------------- sfx2/source/dialog/passwd.hrc | 5 +- sfx2/source/dialog/passwd.src | 30 ++++++- 4 files changed, 157 insertions(+), 79 deletions(-) diff --git a/sfx2/inc/sfx2/passwd.hxx b/sfx2/inc/sfx2/passwd.hxx index 4f4a04834257..19053aa96f97 100644 --- a/sfx2/inc/sfx2/passwd.hxx +++ b/sfx2/inc/sfx2/passwd.hxx @@ -39,29 +39,35 @@ // defines --------------------------------------------------------------- -#define SHOWEXTRAS_NONE ((USHORT)0x0000) -#define SHOWEXTRAS_USER ((USHORT)0x0001) -#define SHOWEXTRAS_CONFIRM ((USHORT)0x0002) -#define SHOWEXTRAS_ALL ((USHORT)(SHOWEXTRAS_USER | SHOWEXTRAS_CONFIRM)) +#define SHOWEXTRAS_NONE ((USHORT)0x0000) +#define SHOWEXTRAS_USER ((USHORT)0x0001) +#define SHOWEXTRAS_CONFIRM ((USHORT)0x0002) +#define SHOWEXTRAS_PASSWORD2 ((USHORT)0x0004) +#define SHOWEXTRAS_CONFIRM2 ((USHORT)0x0008) +#define SHOWEXTRAS_ALL ((USHORT)(SHOWEXTRAS_USER | SHOWEXTRAS_CONFIRM)) // class SfxPasswordDialog ----------------------------------------------- class SFX2_DLLPUBLIC SfxPasswordDialog : public ModalDialog { private: + FixedLine maPasswordBox; FixedText maUserFT; Edit maUserED; FixedText maPasswordFT; Edit maPasswordED; FixedText maConfirmFT; Edit maConfirmED; - FixedLine maPasswordBox; + FixedLine maPassword2Box; + FixedText maPassword2FT; + Edit maPassword2ED; + FixedText maConfirm2FT; + Edit maConfirm2ED; OKButton maOKBtn; CancelButton maCancelBtn; HelpButton maHelpBtn; - String maConfirmStr; USHORT mnMinLen; USHORT mnExtras; @@ -76,6 +82,10 @@ public: String GetPassword() const { return maPasswordED.GetText(); } String GetConfirm() const { return maConfirmED.GetText(); } + String GetPassword2() const { return maPassword2ED.GetText(); } + String GetConfirm2() const { return maConfirm2ED.GetText(); } + void SetGroup2Text( const String& i_rText ) { maPassword2Box.SetText( i_rText ); } + void SetMinLen( USHORT Len ); void SetMaxLen( USHORT Len ); void SetEditHelpId( ULONG nId ) { maPasswordED.SetHelpId( nId ); } diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx index e7cc73ca04bf..52c6acedd4ea 100644 --- a/sfx2/source/dialog/passwd.cxx +++ b/sfx2/source/dialog/passwd.cxx @@ -41,14 +41,15 @@ #include "passwd.hrc" #include "vcl/sound.hxx" +#include "vcl/arrange.hxx" // ----------------------------------------------------------------------- -IMPL_LINK_INLINE_START( SfxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG ) +IMPL_LINK_INLINE_START( SfxPasswordDialog, EditModifyHdl, Edit *, pEdit ) { - if( mbAsciiOnly ) + if( mbAsciiOnly && (pEdit == &maPasswordED || pEdit == &maPassword2ED) ) { - rtl::OUString aTest( maPasswordED.GetText() ); + rtl::OUString aTest( pEdit->GetText() ); const sal_Unicode* pTest = aTest.getStr(); sal_Int32 nLen = aTest.getLength(); rtl::OUStringBuffer aFilter( nLen ); @@ -64,12 +65,15 @@ IMPL_LINK_INLINE_START( SfxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG ) if( bReset ) { Sound::Beep( SOUND_ERROR ); - maPasswordED.SetSelection( Selection( 0, nLen ) ); - maPasswordED.ReplaceSelected( aFilter.makeStringAndClear() ); + pEdit->SetSelection( Selection( 0, nLen ) ); + pEdit->ReplaceSelected( aFilter.makeStringAndClear() ); } } - maOKBtn.Enable( maPasswordED.GetText().Len() >= mnMinLen ); + bool bEnable = maPasswordED.GetText().Len() >= mnMinLen; + if( maPassword2ED.IsVisible() ) + bEnable = (bEnable && (maPassword2ED.GetText().Len() >= mnMinLen)); + maOKBtn.Enable( bEnable ); return 0; } IMPL_LINK_INLINE_END( SfxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG ) @@ -78,8 +82,11 @@ IMPL_LINK_INLINE_END( SfxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG ) IMPL_LINK( SfxPasswordDialog, OKHdl, OKButton *, EMPTYARG ) { - if ( ( ( mnExtras & SHOWEXTRAS_CONFIRM ) == SHOWEXTRAS_CONFIRM ) && - ( GetConfirm() != GetPassword() ) ) + bool bConfirmFailed = ( ( mnExtras & SHOWEXTRAS_CONFIRM ) == SHOWEXTRAS_CONFIRM ) && + ( GetConfirm() != GetPassword() ); + if( ( mnExtras & SHOWEXTRAS_CONFIRM2 ) == SHOWEXTRAS_CONFIRM2 && ( GetConfirm2() != GetPassword2() ) ) + bConfirmFailed = true; + if ( bConfirmFailed ) { ErrorBox aBox( this, SfxResId( MSG_ERROR_WRONG_CONFIRM ) ); aBox.Execute(); @@ -97,27 +104,83 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText ModalDialog( pParent, SfxResId ( DLG_PASSWD ) ), + maPasswordBox ( this, SfxResId( GB_PASSWD_PASSWORD ) ), maUserFT ( this, SfxResId( FT_PASSWD_USER ) ), maUserED ( this, SfxResId( ED_PASSWD_USER ) ), maPasswordFT ( this, SfxResId( FT_PASSWD_PASSWORD ) ), maPasswordED ( this, SfxResId( ED_PASSWD_PASSWORD ) ), maConfirmFT ( this, SfxResId( FT_PASSWD_CONFIRM ) ), maConfirmED ( this, SfxResId( ED_PASSWD_CONFIRM ) ), - maPasswordBox ( this, SfxResId( GB_PASSWD_PASSWORD ) ), + maPassword2Box ( this, 0 ), + maPassword2FT ( this, SfxResId( FT_PASSWD_PASSWORD2 ) ), + maPassword2ED ( this, SfxResId( ED_PASSWD_PASSWORD2 ) ), + maConfirm2FT ( this, SfxResId( FT_PASSWD_CONFIRM2 ) ), + maConfirm2ED ( this, SfxResId( ED_PASSWD_CONFIRM2 ) ), maOKBtn ( this, SfxResId( BTN_PASSWD_OK ) ), maCancelBtn ( this, SfxResId( BTN_PASSWD_CANCEL ) ), maHelpBtn ( this, SfxResId( BTN_PASSWD_HELP ) ), - maConfirmStr ( SfxResId( STR_PASSWD_CONFIRM ) ), - mnMinLen ( 5 ), + mnMinLen ( 1 ), mnExtras ( 0 ), mbAsciiOnly ( false ) { FreeResource(); + // setup layout + boost::shared_ptr xLayout = + boost::dynamic_pointer_cast( getLayout() ); + xLayout->setOuterBorder( 0 ); + + // get edit size, should be used as minimum + Size aEditSize( maUserED.GetSizePixel() ); + + // add labelcolumn for the labeled edit fields + boost::shared_ptr xEdits( new vcl::LabelColumn( xLayout.get() ) ); + size_t nChildIndex = xLayout->addChild( xEdits ); + xLayout->setBorders( nChildIndex, -2, -2, -2, 0 ); + + // add group box + xEdits->addWindow( &maPasswordBox ); + + // add user line + xEdits->addRow( &maUserFT, &maUserED, -2, aEditSize ); + + // add password line + xEdits->addRow( &maPasswordFT, &maPasswordED, -2, aEditSize ); + + // add confirm line + xEdits->addRow( &maConfirmFT, &maConfirmED, -2, aEditSize ); + + // add second group box + xEdits->addWindow( &maPassword2Box ); + + // add second password line + xEdits->addRow( &maPassword2FT, &maPassword2ED, -2, aEditSize ); + + // add second confirm line + xEdits->addRow( &maConfirm2FT, &maConfirm2ED, -2, aEditSize ); + + // add a FixedLine + FixedLine* pLine = new FixedLine( this, 0 ); + pLine->Show(); + addWindow( pLine, true ); + xLayout->addWindow( pLine ); + + // add button column + Size aBtnSize( maCancelBtn.GetSizePixel() ); + boost::shared_ptr xButtons( new vcl::RowOrColumn( xLayout.get(), false ) ); + nChildIndex = xLayout->addChild( xButtons ); + xLayout->setBorders( nChildIndex, -2, 0, -2, -2 ); + + size_t nBtnIndex = xButtons->addWindow( &maHelpBtn, 0, aBtnSize ); + xButtons->addChild( new vcl::Spacer( xButtons.get() ) ); + nBtnIndex = xButtons->addWindow( &maOKBtn, 0, aBtnSize ); + nBtnIndex = xButtons->addWindow( &maCancelBtn, 0, aBtnSize ); + Link aLink = LINK( this, SfxPasswordDialog, EditModifyHdl ); maPasswordED.SetModifyHdl( aLink ); + maPassword2ED.SetModifyHdl( aLink ); aLink = LINK( this, SfxPasswordDialog, OKHdl ); maOKBtn.SetClickHdl( aLink ); @@ -146,66 +209,46 @@ void SfxPasswordDialog::SetMaxLen( USHORT nLen ) short SfxPasswordDialog::Execute() { - if ( mnExtras < SHOWEXTRAS_ALL ) + maUserFT.Hide(); + maUserED.Hide(); + maConfirmFT.Hide(); + maConfirmED.Hide(); + maPasswordFT.Hide(); + maPassword2Box.Hide(); + maPassword2FT.Hide(); + maPassword2ED.Hide(); + maPassword2FT.Hide(); + maConfirm2FT.Hide(); + maConfirm2ED.Hide(); + + if( mnExtras != SHOWEXTRAS_NONE ) + maPasswordFT.Show(); + if( (mnExtras & SHOWEXTRAS_USER ) ) { - Size a3Size = LogicToPixel( Size( 3, 3 ), MAP_APPFONT ); - Size a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); - long nMinHeight = maHelpBtn.GetPosPixel().Y() + - maHelpBtn.GetSizePixel().Height() + a6Size.Height(); - USHORT nRowHided = 1; - - if ( SHOWEXTRAS_NONE == mnExtras ) - { - maUserFT.Hide(); - maUserED.Hide(); - maConfirmFT.Hide(); - maConfirmED.Hide(); - maPasswordFT.Hide(); - - Point aPos = maUserFT.GetPosPixel(); - long nEnd = maUserED.GetPosPixel().X() + maUserED.GetSizePixel().Width(); - maPasswordED.SetPosPixel( aPos ); - Size aSize = maPasswordED.GetSizePixel(); - aSize.Width() = nEnd - aPos.X(); - maPasswordED.SetSizePixel( aSize ); - - nRowHided = 2; - } - else if ( SHOWEXTRAS_USER == mnExtras ) - { - maConfirmFT.Hide(); - maConfirmED.Hide(); - } - else if ( SHOWEXTRAS_CONFIRM == mnExtras ) - { - maUserFT.Hide(); - maUserED.Hide(); - - Point aPwdPos1 = maPasswordFT.GetPosPixel(); - Point aPwdPos2 = maPasswordED.GetPosPixel(); - - Point aPos = maUserFT.GetPosPixel(); - maPasswordFT.SetPosPixel( aPos ); - aPos = maUserED.GetPosPixel(); - maPasswordED.SetPosPixel( aPos ); - - maConfirmFT.SetPosPixel( aPwdPos1 ); - maConfirmED.SetPosPixel( aPwdPos2 ); - } - - Size aBoxSize = maPasswordBox.GetSizePixel(); - aBoxSize.Height() -= ( nRowHided * maUserED.GetSizePixel().Height() ); - aBoxSize.Height() -= ( nRowHided * a3Size.Height() ); - maPasswordBox.SetSizePixel( aBoxSize ); - - long nDlgHeight = maPasswordBox.GetPosPixel().Y() + aBoxSize.Height() + a6Size.Height(); - if ( nDlgHeight < nMinHeight ) - nDlgHeight = nMinHeight; - Size aDlgSize = GetOutputSizePixel(); - aDlgSize.Height() = nDlgHeight; - SetOutputSizePixel( aDlgSize ); + maUserFT.Show(); + maUserED.Show(); + } + if( (mnExtras & SHOWEXTRAS_CONFIRM ) ) + { + maConfirmFT.Show(); + maConfirmED.Show(); + } + if( (mnExtras & SHOWEXTRAS_PASSWORD2) ) + { + maPassword2Box.Show(); + maPassword2FT.Show(); + maPassword2ED.Show(); + } + if( (mnExtras & SHOWEXTRAS_CONFIRM2 ) ) + { + maConfirm2FT.Show(); + maConfirm2ED.Show(); } + boost::shared_ptr xLayout = + boost::dynamic_pointer_cast( getLayout() ); + SetSizePixel( xLayout->getOptimalSize( WINDOWSIZE_PREFERRED ) ); + return ModalDialog::Execute(); } diff --git a/sfx2/source/dialog/passwd.hrc b/sfx2/source/dialog/passwd.hrc index 5be0446fd752..5c9b07c7a130 100644 --- a/sfx2/source/dialog/passwd.hrc +++ b/sfx2/source/dialog/passwd.hrc @@ -41,7 +41,10 @@ #define BTN_PASSWD_CANCEL 21 #define BTN_PASSWD_HELP 22 -#define STR_PASSWD_CONFIRM 30 +#define FT_PASSWD_PASSWORD2 25 +#define ED_PASSWD_PASSWORD2 26 +#define FT_PASSWD_CONFIRM2 27 +#define ED_PASSWD_CONFIRM2 28 #endif diff --git a/sfx2/source/dialog/passwd.src b/sfx2/source/dialog/passwd.src index fc58ecfda219..37d23ca48b01 100644 --- a/sfx2/source/dialog/passwd.src +++ b/sfx2/source/dialog/passwd.src @@ -83,6 +83,32 @@ ModalDialog DLG_PASSWD Size = MAP_APPFONT( 132, 8 ); Text [ en-US ] = "Password" ; }; + FixedText FT_PASSWD_PASSWORD2 + { + Pos = MAP_APPFONT( 12, 30 ); + Size = MAP_APPFONT( 42, 10 ); + Text [ en-US ] = "P~assword"; + }; + Edit ED_PASSWD_PASSWORD2 + { + Border = TRUE; + PassWord = TRUE; + Pos = MAP_APPFONT( 57, 29 ); + Size = MAP_APPFONT( 75, 12 ); + }; + FixedText FT_PASSWD_CONFIRM2 + { + Pos = MAP_APPFONT( 12, 45 ); + Size = MAP_APPFONT( 42, 10 ); + Text [ en-US ] = "Confir~m"; + }; + Edit ED_PASSWD_CONFIRM2 + { + Border = TRUE; + PassWord = TRUE; + Pos = MAP_APPFONT( 57, 44 ); + Size = MAP_APPFONT( 75, 12 ); + }; OKButton BTN_PASSWD_OK { Disable = TRUE; @@ -100,10 +126,6 @@ ModalDialog DLG_PASSWD Pos = MAP_APPFONT( 144, 43 ); Size = MAP_APPFONT( 50, 14 ); }; - String STR_PASSWD_CONFIRM - { - Text [ en-US ] = "Confirm password" ; - }; }; // ********************************************************************** EOF -- cgit From a3af7f1b7438fab4fac0345d11246568ffdeae2f Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 3 Sep 2010 11:43:39 +0200 Subject: pl08: #i114278# simplify security page --- filter/source/pdf/impdialog.cxx | 40 ++++++++++++++-------------------------- filter/source/pdf/impdialog.hrc | 5 +++-- filter/source/pdf/impdialog.hxx | 8 ++++---- filter/source/pdf/impdialog.src | 32 ++++++++++++++++---------------- 4 files changed, 37 insertions(+), 48 deletions(-) diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index bb125bd37a47..d24606d2b2b6 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -1017,12 +1017,12 @@ void ImpPDFTabViewerPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent ImpPDFTabSecurityPage::ImpPDFTabSecurityPage( Window* i_pParent, const SfxItemSet& i_rCoreSet ) : SfxTabPage( i_pParent, PDFFilterResId( RID_PDF_TAB_SECURITY ), i_rCoreSet ), - maPbUserPwd( this, PDFFilterResId( BTN_USER_PWD ) ), + maFlGroup( this, PDFFilterResId( FL_PWD_GROUP ) ), + maPbSetPwd( this, PDFFilterResId( BTN_SET_PWD ) ), maFtUserPwd( this, PDFFilterResId( FT_USER_PWD ) ), maUserPwdSet( PDFFilterResId( STR_USER_PWD_SET ) ), maUserPwdUnset( PDFFilterResId( STR_USER_PWD_UNSET ) ), - - maPbOwnerPwd( this, PDFFilterResId( BTN_OWNER_PWD ) ), + maStrSetPwd( PDFFilterResId( STR_SET_PWD ) ), maFtOwnerPwd( this, PDFFilterResId( FT_OWNER_PWD ) ), maOwnerPwdSet( PDFFilterResId( STR_OWNER_PWD_SET ) ), maOwnerPwdUnset( PDFFilterResId( STR_OWNER_PWD_UNSET ) ), @@ -1081,6 +1081,8 @@ ImpPDFTabSecurityPage::ImpPDFTabSecurityPage( Window* i_pParent, (*pCurrent++)->SetPosPixel( aNewPos ); } } + + maPbSetPwd.SetClickHdl( LINK( this, ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl ) ); } // ----------------------------------------------------------------------------- @@ -1135,10 +1137,6 @@ void ImpPDFTabSecurityPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) // ----------------------------------------------------------------------------- void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent ) { - maPbUserPwd.SetClickHdl( LINK( this, ImpPDFTabSecurityPage, ClickmaPbUserPwdHdl ) ); - - maPbOwnerPwd.SetClickHdl( LINK( this, ImpPDFTabSecurityPage, ClickmaPbOwnerPwdHdl ) ); - switch( paParent->mnPrint ) { default: @@ -1184,30 +1182,20 @@ void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* paParen !( ( ImpPDFTabGeneralPage* )paParent->GetTabPage( RID_PDF_TAB_GENER ) )->IsPdfaSelected() ); } -//method common to both the password entry procedures -void ImpPDFTabSecurityPage::ImplPwdPushButton( const String & i_rDlgTitle, String & io_rDestPassword ) +IMPL_LINK( ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl, void*, EMPTYARG ) { -// string needed: dialog title, message box text, depending on the button clicked - SfxPasswordDialog aPwdDialog( this ); + SfxPasswordDialog aPwdDialog( this, &msUserPwdTitle ); aPwdDialog.SetMinLen( 0 ); - aPwdDialog.ShowExtras( SHOWEXTRAS_CONFIRM ); - aPwdDialog.SetText( i_rDlgTitle ); + aPwdDialog.ShowExtras( SHOWEXTRAS_CONFIRM | SHOWEXTRAS_PASSWORD2 | SHOWEXTRAS_CONFIRM2 ); + aPwdDialog.SetText( maStrSetPwd ); + aPwdDialog.SetGroup2Text( msOwnerPwdTitle ); aPwdDialog.AllowAsciiOnly(); if( aPwdDialog.Execute() == RET_OK ) //OK issued get password and set it - io_rDestPassword = aPwdDialog.GetPassword(); + { + msUserPassword = aPwdDialog.GetPassword(); + msOwnerPassword = aPwdDialog.GetPassword2(); + } enablePermissionControls(); -} - -IMPL_LINK( ImpPDFTabSecurityPage, ClickmaPbUserPwdHdl, void*, EMPTYARG ) -{ - ImplPwdPushButton(msUserPwdTitle, msUserPassword ); - return 0; -} - -IMPL_LINK( ImpPDFTabSecurityPage, ClickmaPbOwnerPwdHdl, void*, EMPTYARG ) -{ - ImplPwdPushButton( msOwnerPwdTitle, msOwnerPassword ); - return 0; } diff --git a/filter/source/pdf/impdialog.hrc b/filter/source/pdf/impdialog.hrc index cc438255650f..dccdc2cad11b 100644 --- a/filter/source/pdf/impdialog.hrc +++ b/filter/source/pdf/impdialog.hrc @@ -144,14 +144,15 @@ #define NUM_BOOKMARKLEVELS 114 //controls for security preferences tab page -#define BTN_USER_PWD 120 +#define FL_PWD_GROUP 119 +#define BTN_SET_PWD 120 #define FT_USER_PWD 121 #define STR_USER_PWD_SET 122 #define STR_USER_PWD_ENC 123 #define STR_USER_PWD_UNSET 124 #define STR_USER_PWD_UNENC 125 +#define STR_SET_PWD 126 -#define BTN_OWNER_PWD 127 #define FT_OWNER_PWD 128 #define STR_OWNER_PWD_SET 129 #define STR_OWNER_PWD_REST 130 diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index 38da273c2fbd..e450009ca822 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -314,12 +314,13 @@ public: //class security tab page class ImpPDFTabSecurityPage : public SfxTabPage { - PushButton maPbUserPwd; + FixedLine maFlGroup; + PushButton maPbSetPwd; FixedText maFtUserPwd; String maUserPwdSet; String maUserPwdUnset; + String maStrSetPwd; - PushButton maPbOwnerPwd; FixedText maFtOwnerPwd; String maOwnerPwdSet; String maOwnerPwdUnset; @@ -347,8 +348,7 @@ class ImpPDFTabSecurityPage : public SfxTabPage long nWidth; - DECL_LINK( ClickmaPbUserPwdHdl, void* ); - DECL_LINK( ClickmaPbOwnerPwdHdl, void* ); + DECL_LINK( ClickmaPbSetPwdHdl, void* ); void enablePermissionControls(); diff --git a/filter/source/pdf/impdialog.src b/filter/source/pdf/impdialog.src index 76e64e87c173..5d87cf382215 100644 --- a/filter/source/pdf/impdialog.src +++ b/filter/source/pdf/impdialog.src @@ -39,13 +39,13 @@ String STR_PDF_EXPORT //password dialog title String STR_PDF_EXPORT_UDPWD { - Text[ en-US ] = "Set Open Password"; + Text[ en-US ] = "Set open password"; }; //password dialog title String STR_PDF_EXPORT_ODPWD { - Text[ en-US ] = "Set Permission Password"; + Text[ en-US ] = "Set permission password"; }; ////////////////////////////////////////////////////////////// @@ -515,19 +515,28 @@ TabPage RID_PDF_TAB_SECURITY TAB_PDF_SIZE; Hide = TRUE; -////////////////////////////////////// - PushButton BTN_USER_PWD + FixedLine FL_PWD_GROUP + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 125, 10 ); + Text[ en-US ] = "File encryption and permission"; + }; + PushButton BTN_SET_PWD { TabStop = TRUE ; Disable = TRUE ; - Pos = MAP_APPFONT ( 12, 5 ) ; + Pos = MAP_APPFONT ( 12, 20 ) ; Size = MAP_APPFONT ( 120 , 13 ) ; - Text[ en-US ] = "Set ~open password..."; + Text[ en-US ] = "Set ~passwords..."; + }; + String STR_SET_PWD + { + Text[ en-US ] = "Set passwords"; }; FixedText FT_USER_PWD { - Pos = MAP_APPFONT(12 , 25 ); + Pos = MAP_APPFONT(12 , 40 ); Size = MAP_APPFONT( 160, 20 ); }; @@ -551,15 +560,6 @@ TabPage RID_PDF_TAB_SECURITY Text [ en-US ] = "PDF document will not be encrypted"; }; - PushButton BTN_OWNER_PWD - { - TabStop = TRUE ; - Disable = TRUE ; - Pos = MAP_APPFONT ( 12, 45 ) ; - Size = MAP_APPFONT ( 120 , 13 ) ; - Text[ en-US ] = "Set ~permission password..."; - }; - FixedText FT_OWNER_PWD { Pos = MAP_APPFONT( 12 , 65 ); -- cgit From c95c83950c9de73ca9a01f7b468b72b77c19c051 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 23 Sep 2010 16:17:38 +0200 Subject: sb132: #i114155# use "en" as additional fallback locale after "en-US" (transplanted from 630d6876c61cd1e0d42b8aa18bfc2ab22079a20f) --- configmgr/source/childaccess.cxx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index ef2b213d4ef1..c20fa49fb18c 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -283,8 +283,9 @@ css::uno::Any ChildAccess::asValue() { // Find best match using an adaption of RFC 4647 lookup matching // rules, removing "-" or "_" delimited segments from the end; // defaults are the empty string locale, the "en-US" locale, the - // first child (if any), or a nil value (even though it may be - // illegal for the given property), in that order: + // "en" locale, the first child (if any), or a nil value (even + // though it may be illegal for the given property), in that + // order: rtl::Reference< ChildAccess > child; for (;;) { child = getChild(locale); @@ -301,10 +302,14 @@ css::uno::Any ChildAccess::asValue() { child = getChild( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en-US"))); if (!child.is()) { - std::vector< rtl::Reference< ChildAccess > > all( - getAllChildren()); - if (!all.empty()) { - child = all.front(); + child = getChild( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en"))); + if (!child.is()) { + std::vector< rtl::Reference< ChildAccess > > all( + getAllChildren()); + if (!all.empty()) { + child = all.front(); + } } } } -- cgit From 4d25643942f30ad94b853a65338098d842767ed8 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 24 Sep 2010 14:28:04 +0200 Subject: step1: put encrpytion parameters into PDFContext --- vcl/inc/vcl/pdfwriter.hxx | 82 ++-- vcl/source/gdi/pdfwriter.cxx | 20 +- vcl/source/gdi/pdfwriter_impl.cxx | 817 +++++++++++++++++++++++--------------- vcl/source/gdi/pdfwriter_impl.hxx | 170 +++----- 4 files changed, 607 insertions(+), 482 deletions(-) diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index 419814e5ce97..cbb9c7c2fe93 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -61,16 +61,6 @@ class Wallpaper; namespace vcl { -struct PDFDocInfo -{ - String Title; // document title - String Author; // document author - String Subject; // subject - String Keywords; // keywords - String Creator; // application that created the original document - String Producer; // OpenOffice -}; - struct PDFNote { String Title; // optional title for the popup containing the note @@ -468,7 +458,7 @@ public: FitVisible, ActionZoom }; -// These emuns are treated as integer while reading/writing to configuration +// These enums are treated as integer while reading/writing to configuration enum PDFPageLayout { DefaultLayout, @@ -489,20 +479,35 @@ public: /* The following structure describes the permissions used in PDF security */ - struct PDFSecPermissions + struct PDFEncryptionProperties { -//for both 40 and 128 bit security, see 3.5.2 PDF v 1.4 table 3.15, v 1.5 and v 1.6 table 3.20. - bool CanPrintTheDocument; + + bool Security128bit; // true to select 128 bit encryption, false for 40 bit + //for both 40 and 128 bit security, see 3.5.2 PDF v 1.4 table 3.15, v 1.5 and v 1.6 table 3.20. + bool CanPrintTheDocument; bool CanModifyTheContent; bool CanCopyOrExtract; bool CanAddOrModify; -//for revision 3 (bit 128 security) only + //for revision 3 (bit 128 security) only bool CanFillInteractive; bool CanExtractForAccessibility; bool CanAssemble; bool CanPrintFull; -//permission default set for 128 bit, accessibility only - PDFSecPermissions() : + + // encryption will only happen if EncryptionKey is not empty + // EncryptionKey is actually a construct out of OValue, UValue and DocumentIdentifier + // if these do not match, behavior is undefined, most likely an invalid PDF will be produced + // OValue, UValue, EncryptionKey and DocumentIdentifier can be computed from + // PDFDocInfo, Owner password and User password usend the InitEncryption method which + // implements the algorithms described in the PDF reference chapter 3.5: Encryption + std::vector OValue; + std::vector UValue; + std::vector EncryptionKey; + std::vector DocumentIdentifier; + + //permission default set for 128 bit, accessibility only + PDFEncryptionProperties() : + Security128bit ( true ), CanPrintTheDocument ( false ), CanModifyTheContent ( false ), CanCopyOrExtract ( false ), @@ -512,6 +517,20 @@ The following structure describes the permissions used in PDF security CanAssemble ( false ), CanPrintFull ( false ) {} + + + bool Encrypt() const + { return ! OValue.empty() && ! UValue.empty() && ! DocumentIdentifier.empty(); } + }; + + struct PDFDocInfo + { + String Title; // document title + String Author; // document author + String Subject; // subject + String Keywords; // keywords + String Creator; // application that created the original document + String Producer; // OpenOffice }; struct PDFWriterContext @@ -570,12 +589,8 @@ The following structure describes the permissions used in PDF security sal_Int32 InitialPage; sal_Int32 OpenBookmarkLevels; // -1 means all levels - struct PDFSecPermissions AccessPermissions; - - bool Encrypt; // main encryption flag, must be true to encript - bool Security128bit; // true to select 128 bit encryption, false for 40 bit - rtl::OUString OwnerPassword; // owner password for PDF, in clear text - rtl::OUString UserPassword; // user password for PDF, in clear text + PDFWriter::PDFEncryptionProperties Encryption; + PDFWriter::PDFDocInfo DocumentInfo; com::sun::star::lang::Locale DocumentLocale; // defines the document default language @@ -604,9 +619,7 @@ The following structure describes the permissions used in PDF security FirstPageLeft( false ), InitialPage( 1 ), OpenBookmarkLevels( -1 ), - AccessPermissions( ), - Encrypt( false ), - Security128bit( true ) + Encryption() {} }; @@ -636,17 +649,6 @@ The following structure describes the permissions used in PDF security */ sal_Int32 NewPage( sal_Int32 nPageWidth = 0, sal_Int32 nPageHeight = 0, Orientation eOrientation = Inherit ); - /* - * set document info; due to the use of document information in building the PDF document ID, must be called before - * emitting anything. - */ - void SetDocInfo( const PDFDocInfo& rInfo ); - - /* - * get currently set document info - */ - const PDFDocInfo& GetDocInfo() const; - /* sets the document locale originally passed with the context to a new value * only affects the output if used before calling Emit/code>. */ @@ -664,6 +666,12 @@ The following structure describes the permissions used in PDF security PDFVersion GetVersion() const; + static bool InitEncryption( PDFWriter::PDFEncryptionProperties& io_rProperties, + const rtl::OUString& i_rOwnerPassword, + const rtl::OUString& i_rUserPassword, + const PDFWriter::PDFDocInfo& i_rDocInfo + ); + /* functions for graphics state */ /* flag values: see vcl/outdev.hxx */ void Push( USHORT nFlags = 0xffff ); diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 5dcce25a0315..3b5e70d938a8 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -69,16 +69,6 @@ PDFWriter::PDFVersion PDFWriter::GetVersion() const return ((PDFWriterImpl*)pImplementation)->getVersion(); } -void PDFWriter::SetDocInfo( const PDFDocInfo& rInfo ) -{ - ((PDFWriterImpl*)pImplementation)->setDocInfo( rInfo ); -} - -const PDFDocInfo& PDFWriter::GetDocInfo() const -{ - return ((PDFWriterImpl*)pImplementation)->getDocInfo(); -} - void PDFWriter::SetDocumentLocale( const com::sun::star::lang::Locale& rLoc ) { ((PDFWriterImpl*)pImplementation)->setDocumentLocale( rLoc ); @@ -569,3 +559,13 @@ std::set< PDFWriter::ErrorCode > PDFWriter::GetErrors() { return ((PDFWriterImpl*)pImplementation)->getErrors(); } + +bool PDFWriter::InitEncryption( PDFWriter::PDFEncryptionProperties& io_rProperties, + const rtl::OUString& i_rOwnerPassword, + const rtl::OUString& i_rUserPassword, + const PDFWriter::PDFDocInfo& i_rDocInfo + ) +{ + return PDFWriterImpl::initEncryption( io_rProperties, i_rOwnerPassword, i_rUserPassword, i_rDocInfo ); +} + diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 09cf1734eb6f..ff415ccfa98c 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -113,12 +113,10 @@ void doTestCode() aContext.Version = PDFWriter::PDF_1_4; aContext.Tagged = true; aContext.InitialPage = 2; + aContext.DocumentInfo.Title = OUString( RTL_CONSTASCII_USTRINGPARAM( "PDF export test document" ) ); + aContext.DocumentInfo.Producer = OUString( RTL_CONSTASCII_USTRINGPARAM( "VCL" ) ); PDFWriter aWriter( aContext ); - PDFDocInfo aDocInfo; - aDocInfo.Title = OUString( RTL_CONSTASCII_USTRINGPARAM( "PDF export test document" ) ); - aDocInfo.Producer = OUString( RTL_CONSTASCII_USTRINGPARAM( "VCL" ) ); - aWriter.SetDocInfo( aDocInfo ); aWriter.NewPage( 595, 842 ); aWriter.BeginStructureElement( PDFWriter::Document ); // set duration of 3 sec for first page @@ -496,6 +494,12 @@ static inline double pixelToPoint( sal_Int32 px ) { return double(px)/fDivisor; static inline double pixelToPoint( double px ) { return px/fDivisor; } static inline sal_Int32 pointToPixel( double pt ) { return sal_Int32(pt*fDivisor); } +const sal_uInt8 PDFWriterImpl::s_nPadString[32] = +{ + 0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, + 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A +}; + static void appendHex( sal_Int8 nInt, OStringBuffer& rBuffer ) { static const sal_Char pHexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', @@ -1714,9 +1718,6 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext ) m_aCipher( (rtlCipher)NULL ), m_aDigest( NULL ), m_bEncryptThisStream( false ), - m_aDocID( 32 ), - m_aCreationDateString( 64 ), - m_aCreationMetaDateString( 64 ), m_pEncryptionBuffer( NULL ), m_nEncryptionBufferSize( 0 ), m_bIsPDF_A1( false ) @@ -1758,14 +1759,32 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext ) m_bOpen = true; -/* prepare the cypher engine, can be done in CTOR, free in DTOR */ + /* prepare the cypher engine, can be done in CTOR, free in DTOR */ m_aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream ); m_aDigest = rtl_digest_createMD5(); -/* the size of the Codec default maximum */ + /* the size of the Codec default maximum */ checkEncryptionBufferSize( 0x4000 ); + if( m_aContext.Encryption.Encrypt() ) + { + // sanity check + if( m_aContext.Encryption.OValue.size() != ENCRYPTED_PWD_SIZE || + m_aContext.Encryption.UValue.size() != ENCRYPTED_PWD_SIZE || + m_aContext.Encryption.EncryptionKey.size() != MAXIMUM_RC4_KEY_LENGTH + ) + { + // the field lengths are invalid ? This was not setup by initEncryption. + // do not encrypt after all + m_aContext.Encryption.OValue.clear(); + m_aContext.Encryption.UValue.clear(); + OSL_ENSURE( 0, "encryption data failed sanity check, encryption disabled" ); + } + else // setup key lengths + m_nAccessPermissions = computeAccessPermissions( m_aContext.Encryption, m_nKeyLength, m_nRC4KeyLength ); + } + // write header OStringBuffer aBuffer( 20 ); aBuffer.append( "%PDF-" ); @@ -1811,139 +1830,138 @@ PDFWriterImpl::~PDFWriterImpl() rtl_freeMemory( m_pEncryptionBuffer ); } -void PDFWriterImpl::setDocInfo( const PDFDocInfo& rInfo ) +void PDFWriterImpl::setupDocInfo() { - m_aDocInfo.Title = rInfo.Title; - m_aDocInfo.Author = rInfo.Author; - m_aDocInfo.Subject = rInfo.Subject; - m_aDocInfo.Keywords = rInfo.Keywords; - m_aDocInfo.Creator = rInfo.Creator; - m_aDocInfo.Producer = rInfo.Producer; + std::vector< sal_uInt8 > aId; + computeDocumentIdentifier( aId, m_aContext.DocumentInfo, m_aCreationDateString, m_aCreationMetaDateString ); + if( m_aContext.Encryption.DocumentIdentifier.empty() ) + m_aContext.Encryption.DocumentIdentifier = aId; +} + +void PDFWriterImpl::computeDocumentIdentifier( std::vector< sal_uInt8 >& o_rIdentifier, + const vcl::PDFWriter::PDFDocInfo& i_rDocInfo, + rtl::OString& o_rCString1, + rtl::OString& o_rCString2 + ) +{ + o_rIdentifier.clear(); -//build the document id + //build the document id rtl::OString aInfoValuesOut; OStringBuffer aID( 1024 ); - if( m_aDocInfo.Title.Len() ) - appendUnicodeTextString( m_aDocInfo.Title, aID ); - if( m_aDocInfo.Author.Len() ) - appendUnicodeTextString( m_aDocInfo.Author, aID ); - if( m_aDocInfo.Subject.Len() ) - appendUnicodeTextString( m_aDocInfo.Subject, aID ); - if( m_aDocInfo.Keywords.Len() ) - appendUnicodeTextString( m_aDocInfo.Keywords, aID ); - if( m_aDocInfo.Creator.Len() ) - appendUnicodeTextString( m_aDocInfo.Creator, aID ); - if( m_aDocInfo.Producer.Len() ) - appendUnicodeTextString( m_aDocInfo.Producer, aID ); + if( i_rDocInfo.Title.Len() ) + appendUnicodeTextString( i_rDocInfo.Title, aID ); + if( i_rDocInfo.Author.Len() ) + appendUnicodeTextString( i_rDocInfo.Author, aID ); + if( i_rDocInfo.Subject.Len() ) + appendUnicodeTextString( i_rDocInfo.Subject, aID ); + if( i_rDocInfo.Keywords.Len() ) + appendUnicodeTextString( i_rDocInfo.Keywords, aID ); + if( i_rDocInfo.Creator.Len() ) + appendUnicodeTextString( i_rDocInfo.Creator, aID ); + if( i_rDocInfo.Producer.Len() ) + appendUnicodeTextString( i_rDocInfo.Producer, aID ); TimeValue aTVal, aGMT; oslDateTime aDT; osl_getSystemTime( &aGMT ); osl_getLocalTimeFromSystemTime( &aGMT, &aTVal ); osl_getDateTimeFromTimeValue( &aTVal, &aDT ); - m_aCreationDateString.append( "D:" ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/1000)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/100)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/10)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Year)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Month/10)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Month)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Day/10)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Day)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Hours/10)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Hours)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Minutes/10)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Minutes)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Seconds/10)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((aDT.Seconds)%10)) ); -//--> i59651, we fill the Metadata date string as well, if PDF/A is requested - if( m_bIsPDF_A1 ) - { -// according to ISO 19005-1:2005 6.7.3 the date is corrected for -// local time zone offset UTC only, whereas Acrobat 8 seems -// to use the localtime notation only -// according to a raccomandation in XMP Specification (Jan 2004, page 75) -// the Acrobat way seems the right approach - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/1000)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/100)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/10)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year)%10)) ); - m_aCreationMetaDateString.append( "-" ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Month/10)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Month)%10)) ); - m_aCreationMetaDateString.append( "-" ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Day/10)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Day)%10)) ); - m_aCreationMetaDateString.append( "T" ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Hours/10)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Hours)%10)) ); - m_aCreationMetaDateString.append( ":" ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Minutes/10)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Minutes)%10)) ); - m_aCreationMetaDateString.append( ":" ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Seconds/10)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Seconds)%10)) ); - } + rtl::OStringBuffer aCreationDateString(64), aCreationMetaDateString(64); + aCreationDateString.append( "D:" ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/1000)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/100)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Year/10)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Year)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Month/10)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Month)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Day/10)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Day)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Hours/10)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Hours)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Minutes/10)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Minutes)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Seconds/10)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((aDT.Seconds)%10)) ); + + //--> i59651, we fill the Metadata date string as well, if PDF/A is requested + // according to ISO 19005-1:2005 6.7.3 the date is corrected for + // local time zone offset UTC only, whereas Acrobat 8 seems + // to use the localtime notation only + // according to a raccomandation in XMP Specification (Jan 2004, page 75) + // the Acrobat way seems the right approach + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/1000)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/100)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year/10)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Year)%10)) ); + aCreationMetaDateString.append( "-" ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Month/10)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Month)%10)) ); + aCreationMetaDateString.append( "-" ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Day/10)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Day)%10)) ); + aCreationMetaDateString.append( "T" ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Hours/10)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Hours)%10)) ); + aCreationMetaDateString.append( ":" ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Minutes/10)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Minutes)%10)) ); + aCreationMetaDateString.append( ":" ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Seconds/10)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((aDT.Seconds)%10)) ); + sal_uInt32 nDelta = 0; if( aGMT.Seconds > aTVal.Seconds ) { - m_aCreationDateString.append( "-" ); + aCreationDateString.append( "-" ); nDelta = aGMT.Seconds-aTVal.Seconds; - if( m_bIsPDF_A1 ) - m_aCreationMetaDateString.append( "-" ); + aCreationMetaDateString.append( "-" ); } else if( aGMT.Seconds < aTVal.Seconds ) { - m_aCreationDateString.append( "+" ); + aCreationDateString.append( "+" ); nDelta = aTVal.Seconds-aGMT.Seconds; - if( m_bIsPDF_A1 ) - m_aCreationMetaDateString.append( "+" ); + aCreationMetaDateString.append( "+" ); } else { - m_aCreationDateString.append( "Z" ); - if( m_bIsPDF_A1 ) - m_aCreationMetaDateString.append( "Z" ); + aCreationDateString.append( "Z" ); + aCreationMetaDateString.append( "Z" ); } if( nDelta ) { - m_aCreationDateString.append( (sal_Char)('0' + ((nDelta/36000)%10)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((nDelta/3600)%10)) ); - m_aCreationDateString.append( "'" ); - m_aCreationDateString.append( (sal_Char)('0' + ((nDelta/600)%6)) ); - m_aCreationDateString.append( (sal_Char)('0' + ((nDelta/60)%10)) ); - if( m_bIsPDF_A1 ) - { - m_aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/36000)%10)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/3600)%10)) ); - m_aCreationMetaDateString.append( ":" ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/600)%6)) ); - m_aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/60)%10)) ); - } + aCreationDateString.append( (sal_Char)('0' + ((nDelta/36000)%10)) ); + aCreationDateString.append( (sal_Char)('0' + ((nDelta/3600)%10)) ); + aCreationDateString.append( "'" ); + aCreationDateString.append( (sal_Char)('0' + ((nDelta/600)%6)) ); + aCreationDateString.append( (sal_Char)('0' + ((nDelta/60)%10)) ); + + aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/36000)%10)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/3600)%10)) ); + aCreationMetaDateString.append( ":" ); + aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/600)%6)) ); + aCreationMetaDateString.append( (sal_Char)('0' + ((nDelta/60)%10)) ); } - m_aCreationDateString.append( "'" ); - aID.append( m_aCreationDateString.getStr(), m_aCreationDateString.getLength() ); + aCreationDateString.append( "'" ); + aID.append( aCreationDateString.getStr(), aCreationDateString.getLength() ); aInfoValuesOut = aID.makeStringAndClear(); + o_rCString1 = aCreationDateString.makeStringAndClear(); + o_rCString2 = aCreationMetaDateString.makeStringAndClear(); - DBG_ASSERT( m_aDigest != NULL, "PDFWrite_Impl::setDocInfo: cannot obtain a digest object !" ); - - m_aDocID.setLength( 0 ); - if( m_aDigest ) + rtlDigest aDigest = rtl_digest_createMD5(); + OSL_ENSURE( aDigest != NULL, "PDFWriterImpl::computeDocumentIdentifier: cannot obtain a digest object !" ); + if( aDigest ) { - osl_getSystemTime( &aGMT ); - rtlDigestError nError = rtl_digest_updateMD5( m_aDigest, &aGMT, sizeof( aGMT ) ); + rtlDigestError nError = rtl_digest_updateMD5( aDigest, &aGMT, sizeof( aGMT ) ); if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( m_aDigest, m_aContext.URL.getStr(), m_aContext.URL.getLength()*sizeof(sal_Unicode) ); - if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( m_aDigest, aInfoValuesOut.getStr(), aInfoValuesOut.getLength() ); + nError = rtl_digest_updateMD5( aDigest, aInfoValuesOut.getStr(), aInfoValuesOut.getLength() ); if( nError == rtl_Digest_E_None ) { -//the binary form of the doc id is needed for encryption stuff - rtl_digest_getMD5( m_aDigest, m_nDocID, 16 ); - for( unsigned int i = 0; i < 16; i++ ) - appendHex( m_nDocID[i], m_aDocID ); + o_rIdentifier = std::vector< sal_uInt8 >( 16, 0 ); + //the binary form of the doc id is needed for encryption stuff + rtl_digest_getMD5( aDigest, &o_rIdentifier[0], 16 ); } } } @@ -1956,7 +1974,7 @@ append the string as unicode hex, encrypted if needed inline void PDFWriterImpl::appendUnicodeTextStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer ) { rOutBuffer.append( "<" ); - if( m_aContext.Encrypt ) + if( m_aContext.Encryption.Encrypt() ) { const sal_Unicode* pStr = rInString.getStr(); sal_Int32 nLen = rInString.getLength(); @@ -1993,7 +2011,7 @@ inline void PDFWriterImpl::appendLiteralStringEncrypt( rtl::OStringBuffer& rInSt rOutBuffer.append( "(" ); sal_Int32 nChars = rInString.getLength(); //check for encryption, if ok, encrypt the string, then convert with appndLiteralString - if( m_aContext.Encrypt && checkEncryptionBufferSize( nChars ) ) + if( m_aContext.Encryption.Encrypt() && checkEncryptionBufferSize( nChars ) ) { //encrypt the string in a buffer, then append it enableStringEncryption( nInObjectNumber ); @@ -2380,9 +2398,6 @@ SalLayout* PDFWriterImpl::GetTextLayout( ImplLayoutArgs& rArgs, ImplFontSelectDa sal_Int32 PDFWriterImpl::newPage( sal_Int32 nPageWidth, sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation ) { - if( m_aContext.Encrypt && m_aPages.empty() ) - initEncryption(); - endPage(); m_nCurrentPage = m_aPages.size(); m_aPages.push_back( PDFPage(this, nPageWidth, nPageHeight, eOrientation ) ); @@ -5877,7 +5892,7 @@ bool PDFWriterImpl::emitCatalog() } // viewer preferences, if we had some, then emit if( m_aContext.HideViewerToolbar || - ( m_aContext.Version > PDFWriter::PDF_1_3 && m_aDocInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) || + ( m_aContext.Version > PDFWriter::PDF_1_3 && m_aContext.DocumentInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) || m_aContext.HideViewerMenubar || m_aContext.HideViewerWindowControls || m_aContext.FitWindow || m_aContext.CenterWindow || (m_aContext.FirstPageLeft && m_aContext.PageLayout == PDFWriter::ContinuousFacing ) || @@ -5894,7 +5909,7 @@ bool PDFWriterImpl::emitCatalog() aLine.append( "/FitWindow true\n" ); if( m_aContext.CenterWindow ) aLine.append( "/CenterWindow true\n" ); - if( m_aContext.Version > PDFWriter::PDF_1_3 && m_aDocInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) + if( m_aContext.Version > PDFWriter::PDF_1_3 && m_aContext.DocumentInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) aLine.append( "/DisplayDocTitle true\n" ); if( m_aContext.FirstPageLeft && m_aContext.PageLayout == PDFWriter::ContinuousFacing ) aLine.append( "/Direction/R2L\n" ); @@ -5998,40 +6013,40 @@ sal_Int32 PDFWriterImpl::emitInfoDict( ) aLine.append( nObject ); aLine.append( " 0 obj\n" "<<" ); - if( m_aDocInfo.Title.Len() ) + if( m_aContext.DocumentInfo.Title.Len() ) { aLine.append( "/Title" ); - appendUnicodeTextStringEncrypt( m_aDocInfo.Title, nObject, aLine ); + appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Title, nObject, aLine ); aLine.append( "\n" ); } - if( m_aDocInfo.Author.Len() ) + if( m_aContext.DocumentInfo.Author.Len() ) { aLine.append( "/Author" ); - appendUnicodeTextStringEncrypt( m_aDocInfo.Author, nObject, aLine ); + appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Author, nObject, aLine ); aLine.append( "\n" ); } - if( m_aDocInfo.Subject.Len() ) + if( m_aContext.DocumentInfo.Subject.Len() ) { aLine.append( "/Subject" ); - appendUnicodeTextStringEncrypt( m_aDocInfo.Subject, nObject, aLine ); + appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Subject, nObject, aLine ); aLine.append( "\n" ); } - if( m_aDocInfo.Keywords.Len() ) + if( m_aContext.DocumentInfo.Keywords.Len() ) { aLine.append( "/Keywords" ); - appendUnicodeTextStringEncrypt( m_aDocInfo.Keywords, nObject, aLine ); + appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Keywords, nObject, aLine ); aLine.append( "\n" ); } - if( m_aDocInfo.Creator.Len() ) + if( m_aContext.DocumentInfo.Creator.Len() ) { aLine.append( "/Creator" ); - appendUnicodeTextStringEncrypt( m_aDocInfo.Creator, nObject, aLine ); + appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Creator, nObject, aLine ); aLine.append( "\n" ); } - if( m_aDocInfo.Producer.Len() ) + if( m_aContext.DocumentInfo.Producer.Len() ) { aLine.append( "/Producer" ); - appendUnicodeTextStringEncrypt( m_aDocInfo.Producer, nObject, aLine ); + appendUnicodeTextStringEncrypt( m_aContext.DocumentInfo.Producer, nObject, aLine ); aLine.append( "\n" ); } @@ -6277,45 +6292,45 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata() aMetadataStream.append( " A\n" ); aMetadataStream.append( " \n" ); //... Dublin Core properties go here - if( m_aDocInfo.Title.Len() || - m_aDocInfo.Author.Len() || - m_aDocInfo.Subject.Len() ) + if( m_aContext.DocumentInfo.Title.Len() || + m_aContext.DocumentInfo.Author.Len() || + m_aContext.DocumentInfo.Subject.Len() ) { aMetadataStream.append( " \n" ); - if( m_aDocInfo.Title.Len() ) + if( m_aContext.DocumentInfo.Title.Len() ) { // this is according to PDF/A-1, technical corrigendum 1 (2007-04-01) aMetadataStream.append( " \n" ); aMetadataStream.append( " \n" ); aMetadataStream.append( " " ); rtl::OUString aTitle; - escapeStringXML( m_aDocInfo.Title, aTitle ); + escapeStringXML( m_aContext.DocumentInfo.Title, aTitle ); aMetadataStream.append( OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ) ); aMetadataStream.append( "\n" ); aMetadataStream.append( " \n" ); aMetadataStream.append( " \n" ); } - if( m_aDocInfo.Author.Len() ) + if( m_aContext.DocumentInfo.Author.Len() ) { aMetadataStream.append( " \n" ); aMetadataStream.append( " \n" ); aMetadataStream.append( " " ); rtl::OUString aAuthor; - escapeStringXML( m_aDocInfo.Author, aAuthor ); + escapeStringXML( m_aContext.DocumentInfo.Author, aAuthor ); aMetadataStream.append( OUStringToOString( aAuthor , RTL_TEXTENCODING_UTF8 ) ); aMetadataStream.append( "\n" ); aMetadataStream.append( " \n" ); aMetadataStream.append( " \n" ); } - if( m_aDocInfo.Subject.Len() ) + if( m_aContext.DocumentInfo.Subject.Len() ) { // this is according to PDF/A-1, technical corrigendum 1 (2007-04-01) aMetadataStream.append( " \n" ); aMetadataStream.append( " \n" ); aMetadataStream.append( " " ); rtl::OUString aSubject; - escapeStringXML( m_aDocInfo.Subject, aSubject ); + escapeStringXML( m_aContext.DocumentInfo.Subject, aSubject ); aMetadataStream.append( OUStringToOString( aSubject , RTL_TEXTENCODING_UTF8 ) ); aMetadataStream.append( "\n" ); aMetadataStream.append( " \n" ); @@ -6325,24 +6340,24 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata() } //... PDF properties go here - if( m_aDocInfo.Producer.Len() || - m_aDocInfo.Keywords.Len() ) + if( m_aContext.DocumentInfo.Producer.Len() || + m_aContext.DocumentInfo.Keywords.Len() ) { aMetadataStream.append( " \n" ); - if( m_aDocInfo.Producer.Len() ) + if( m_aContext.DocumentInfo.Producer.Len() ) { aMetadataStream.append( " " ); rtl::OUString aProducer; - escapeStringXML( m_aDocInfo.Producer, aProducer ); + escapeStringXML( m_aContext.DocumentInfo.Producer, aProducer ); aMetadataStream.append( OUStringToOString( aProducer , RTL_TEXTENCODING_UTF8 ) ); aMetadataStream.append( "\n" ); } - if( m_aDocInfo.Keywords.Len() ) + if( m_aContext.DocumentInfo.Keywords.Len() ) { aMetadataStream.append( " " ); rtl::OUString aKeywords; - escapeStringXML( m_aDocInfo.Keywords, aKeywords ); + escapeStringXML( m_aContext.DocumentInfo.Keywords, aKeywords ); aMetadataStream.append( OUStringToOString( aKeywords , RTL_TEXTENCODING_UTF8 ) ); aMetadataStream.append( "\n" ); } @@ -6351,11 +6366,11 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata() aMetadataStream.append( " \n" ); - if( m_aDocInfo.Creator.Len() ) + if( m_aContext.DocumentInfo.Creator.Len() ) { aMetadataStream.append( " " ); rtl::OUString aCreator; - escapeStringXML( m_aDocInfo.Creator, aCreator ); + escapeStringXML( m_aContext.DocumentInfo.Creator, aCreator ); aMetadataStream.append( OUStringToOString( aCreator , RTL_TEXTENCODING_UTF8 ) ); aMetadataStream.append( "\n" ); } @@ -6411,7 +6426,7 @@ bool PDFWriterImpl::emitTrailer() sal_Int32 nSecObject = 0; - if( m_aContext.Encrypt == true ) + if( m_aContext.Encryption.Encrypt() ) { //emit the security information //must be emitted as indirect dictionary object, since @@ -6425,16 +6440,16 @@ bool PDFWriterImpl::emitTrailer() aLineS.append( " 0 obj\n" "<>\nendobj\n\n" ); @@ -6500,13 +6515,21 @@ bool PDFWriterImpl::emitTrailer() aLine.append( nDocInfoObject ); aLine.append( " 0 R\n" ); } - if( m_aDocID.getLength() ) + if( ! m_aContext.Encryption.DocumentIdentifier.empty() ) { aLine.append( "/ID [ <" ); - aLine.append( m_aDocID.getStr(), m_aDocID.getLength() ); + for( std::vector< sal_uInt8 >::const_iterator it = m_aContext.Encryption.DocumentIdentifier.begin(); + it != m_aContext.Encryption.DocumentIdentifier.end(); ++it ) + { + appendHex( sal_Int8(*it), aLine ); + } aLine.append( ">\n" "<" ); - aLine.append( m_aDocID.getStr(), m_aDocID.getLength() ); + for( std::vector< sal_uInt8 >::const_iterator it = m_aContext.Encryption.DocumentIdentifier.begin(); + it != m_aContext.Encryption.DocumentIdentifier.end(); ++it ) + { + appendHex( sal_Int8(*it), aLine ); + } aLine.append( "> ]\n" ); } if( aDocChecksum.getLength() ) @@ -9653,7 +9676,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) aLine.append( "[ /Indexed/DeviceRGB " ); aLine.append( (sal_Int32)(pAccess->GetPaletteEntryCount()-1) ); aLine.append( "\n<" ); - if( m_aContext.Encrypt ) + if( m_aContext.Encryption.Encrypt() ) { enableStringEncryption( rObject.m_nObject ); //check encryption buffer size @@ -12039,30 +12062,169 @@ void PDFWriterImpl::addStream( const String& rMimeType, PDFOutputStream* pStream } } + +sal_Bool PDFWriterImpl::checkEncryptionBufferSize( register sal_Int32 newSize ) +{ + if( m_nEncryptionBufferSize < newSize ) + { + /* reallocate the buffer, the used function allocate as rtl_allocateMemory + if the pointer parameter is NULL */ + m_pEncryptionBuffer = (sal_uInt8*)rtl_reallocateMemory( m_pEncryptionBuffer, newSize ); + if( m_pEncryptionBuffer ) + m_nEncryptionBufferSize = newSize; + else + m_nEncryptionBufferSize = 0; + } + return ( m_nEncryptionBufferSize != 0 ); +} + +void PDFWriterImpl::checkAndEnableStreamEncryption( register sal_Int32 nObject ) +{ + if( m_aContext.Encryption.Encrypt() ) + { + m_bEncryptThisStream = true; + sal_Int32 i = m_nKeyLength; + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)nObject; + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 8 ); + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 16 ); + //the other location of m_nEncryptionKey are already set to 0, our fixed generation number + // do the MD5 hash + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + // the i+2 to take into account the generation number, always zero + rtl_digest_MD5( &m_aContext.Encryption.EncryptionKey[0], i+2, nMD5Sum, sizeof(nMD5Sum) ); + // initialize the RC4 with the key + // key legth: see algoritm 3.1, step 4: (N+5) max 16 + rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 ); + } +} + +void PDFWriterImpl::enableStringEncryption( register sal_Int32 nObject ) +{ + if( m_aContext.Encryption.Encrypt() ) + { + sal_Int32 i = m_nKeyLength; + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)nObject; + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 8 ); + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 16 ); + //the other location of m_nEncryptionKey are already set to 0, our fixed generation number + // do the MD5 hash + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + // the i+2 to take into account the generation number, always zero + rtl_digest_MD5( &m_aContext.Encryption.EncryptionKey[0], i+2, nMD5Sum, sizeof(nMD5Sum) ); + // initialize the RC4 with the key + // key legth: see algoritm 3.1, step 4: (N+5) max 16 + rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 ); + } +} + +/* init the encryption engine +1. init the document id, used both for building the document id and for building the encryption key(s) +2. build the encryption key following algorithms described in the PDF specification + */ +bool PDFWriterImpl::initEncryption( vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + const rtl::OUString& i_rOwnerPassword, + const rtl::OUString& i_rUserPassword, + const vcl::PDFWriter::PDFDocInfo& i_rDocInfo + ) +{ + bool bSuccess = false; + rtl::OString aC1, aC2; + computeDocumentIdentifier( io_rProperties.DocumentIdentifier, i_rDocInfo, aC1, aC2 ); + if( i_rOwnerPassword.getLength() || i_rUserPassword.getLength() ) + { + sal_Int32 nKeyLength = 0, nRC4KeyLength = 0; + sal_Int32 nAccessPermissions = computeAccessPermissions( io_rProperties, nKeyLength, nRC4KeyLength ); + // get padded passwords + sal_uInt8 aPadUPW[ENCRYPTED_PWD_SIZE], aPadOPW[ENCRYPTED_PWD_SIZE]; + padPassword( i_rOwnerPassword.getLength() ? i_rOwnerPassword : i_rUserPassword, aPadOPW ); + padPassword( i_rUserPassword, aPadUPW ); + bSuccess = computeODictionaryValue( aPadOPW, aPadUPW, io_rProperties, nKeyLength, nRC4KeyLength ) + && computeUDictionaryValue( aPadOPW, aPadUPW, io_rProperties, nKeyLength, nRC4KeyLength, nAccessPermissions ) + ; + + // trash temporary padded cleartext PWDs + rtl_zeroMemory( aPadOPW, sizeof(aPadOPW) ); + rtl_zeroMemory( aPadUPW, sizeof(aPadUPW) ); + + //clear out exceding key values, prepares for generation number default to 0 as well + // see checkAndEnableStreamEncryption in pdfwriter_impl.hxx + if( bSuccess ) + { + sal_Int32 i, y; + for( i = nKeyLength, y = 0; y < 5 ; y++ ) + io_rProperties.EncryptionKey[i++] = 0; + } + } + else + bSuccess = true; + + if( ! bSuccess ) // something failed, disable encrpytion + { + io_rProperties.OValue.clear(); + io_rProperties.UValue.clear(); + io_rProperties.EncryptionKey.clear(); + } + + return bSuccess; +} + +sal_Int32 PDFWriterImpl::computeAccessPermissions( const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties, + sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength ) +{ + /* + 2) compute the access permissions, in numerical form + + the default value depends on the revision 2 (40 bit) or 3 (128 bit security): + - for 40 bit security the unused bit must be set to 1, since they are not used + - for 128 bit security the same bit must be preset to 0 and set later if needed + according to the table 3.15, pdf v 1.4 */ + sal_Int32 nAccessPermissions = ( i_rProperties.Security128bit ) ? 0xfffff0c0 : 0xffffffc0 ; + + /* check permissions for 40 bit security case */ + nAccessPermissions |= ( i_rProperties.CanPrintTheDocument ) ? 1 << 2 : 0; + nAccessPermissions |= ( i_rProperties.CanModifyTheContent ) ? 1 << 3 : 0; + nAccessPermissions |= ( i_rProperties.CanCopyOrExtract ) ? 1 << 4 : 0; + nAccessPermissions |= ( i_rProperties.CanAddOrModify ) ? 1 << 5 : 0; + o_rKeyLength = SECUR_40BIT_KEY; + o_rRC4KeyLength = SECUR_40BIT_KEY+5; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 5 + + if( i_rProperties.Security128bit ) + { + o_rKeyLength = SECUR_128BIT_KEY; + o_rRC4KeyLength = 16; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 16, thus maximum + // permitted value is 16 + nAccessPermissions |= ( i_rProperties.CanFillInteractive ) ? 1 << 8 : 0; + nAccessPermissions |= ( i_rProperties.CanExtractForAccessibility ) ? 1 << 9 : 0; + nAccessPermissions |= ( i_rProperties.CanAssemble ) ? 1 << 10 : 0; + nAccessPermissions |= ( i_rProperties.CanPrintFull ) ? 1 << 11 : 0; + } + return nAccessPermissions; +} + /************************************************************* begin i12626 methods Implements Algorithm 3.2, step 1 only */ -void PDFWriterImpl::padPassword( rtl::OUString aPassword, sal_uInt8 *paPasswordTarget ) +void PDFWriterImpl::padPassword( const rtl::OUString& i_rPassword, sal_uInt8* o_pPaddedPW ) { -// get ansi-1252 version of the password string CHECKIT ! i12626 - rtl::OString aString = rtl::OUStringToOString( aPassword, RTL_TEXTENCODING_MS_1252 ); + // get ansi-1252 version of the password string CHECKIT ! i12626 + rtl::OString aString( rtl::OUStringToOString( i_rPassword, RTL_TEXTENCODING_MS_1252 ) ); -//copy the string to the target - sal_Int32 nToCopy = ( aString.getLength() < 32 ) ? aString.getLength() : 32; + //copy the string to the target + sal_Int32 nToCopy = ( aString.getLength() < ENCRYPTED_PWD_SIZE ) ? aString.getLength() : ENCRYPTED_PWD_SIZE; sal_Int32 nCurrentChar; for( nCurrentChar = 0; nCurrentChar < nToCopy; nCurrentChar++ ) - paPasswordTarget[nCurrentChar] = (sal_uInt8)( aString.getStr()[nCurrentChar] ); + o_pPaddedPW[nCurrentChar] = (sal_uInt8)( aString.getStr()[nCurrentChar] ); -//pad it - if( nCurrentChar < 32 ) - {//fill with standard byte string - sal_Int32 i,y; - for( i = nCurrentChar, y = 0 ; i < 32; i++, y++ ) - paPasswordTarget[i] = m_nPadString[y]; - } + //pad it with standard byte string + sal_Int32 i,y; + for( i = nCurrentChar, y = 0 ; i < ENCRYPTED_PWD_SIZE; i++, y++ ) + o_pPaddedPW[i] = s_nPadString[y]; + + // trash memory of temporary clear text password + rtl_zeroMemory( (sal_Char*)aString.getStr(), aString.getLength() ); } /********************************** @@ -12075,91 +12237,126 @@ it will be 16 byte long for 128 bit security; for 40 bit security only the first TODO: in pdf ver 1.5 and 1.6 the step 6 is different, should be implemented. See spec. */ -void PDFWriterImpl::computeEncryptionKey(sal_uInt8 *paThePaddedPassword, sal_uInt8 *paEncryptionKey ) +bool PDFWriterImpl::computeEncryptionKey( const sal_uInt8* i_pOPW, const sal_uInt8* i_pUPW, vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, sal_Int32 i_nAccessPermissions ) { -//step 2 - if( m_aDigest ) + bool bSuccess = true; + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + + rtlDigest aDigest = rtl_digest_createMD5(); + if( aDigest ) { - rtlDigestError nError = rtl_digest_updateMD5( m_aDigest, paThePaddedPassword, ENCRYPTED_PWD_SIZE ); -//step 3 - if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( m_aDigest, m_nEncryptedOwnerPassword , sizeof( m_nEncryptedOwnerPassword ) ); -//Step 4 + //step 2 + rtlDigestError nError = rtl_digest_updateMD5( aDigest, i_pUPW, ENCRYPTED_PWD_SIZE ); + //step 3 + if( nError == rtl_Digest_E_None && ! io_rProperties.OValue.empty() ) + nError = rtl_digest_updateMD5( aDigest, &io_rProperties.OValue[0] , sal_Int32(io_rProperties.OValue.size()) ); + else + bSuccess = false; + //Step 4 sal_uInt8 nPerm[4]; - nPerm[0] = (sal_uInt8)m_nAccessPermissions; - nPerm[1] = (sal_uInt8)( m_nAccessPermissions >> 8 ); - nPerm[2] = (sal_uInt8)( m_nAccessPermissions >> 16 ); - nPerm[3] = (sal_uInt8)( m_nAccessPermissions >> 24 ); + nPerm[0] = (sal_uInt8)i_nAccessPermissions; + nPerm[1] = (sal_uInt8)( i_nAccessPermissions >> 8 ); + nPerm[2] = (sal_uInt8)( i_nAccessPermissions >> 16 ); + nPerm[3] = (sal_uInt8)( i_nAccessPermissions >> 24 ); if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( m_aDigest, nPerm , sizeof( nPerm ) ); + nError = rtl_digest_updateMD5( aDigest, nPerm , sizeof( nPerm ) ); -//step 5, get the document ID, binary form + //step 5, get the document ID, binary form if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( m_aDigest, m_nDocID , sizeof( m_nDocID ) ); -//get the digest - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + nError = rtl_digest_updateMD5( aDigest, &io_rProperties.DocumentIdentifier[0], sal_Int32(io_rProperties.DocumentIdentifier.size()) ); + //get the digest if( nError == rtl_Digest_E_None ) { - rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof( nMD5Sum ) ); + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); -//step 6, only if 128 bit - if( m_aContext.Security128bit ) + //step 6, only if 128 bit + if( io_rProperties.Security128bit ) { for( sal_Int32 i = 0; i < 50; i++ ) { - nError = rtl_digest_updateMD5( m_aDigest, &nMD5Sum, sizeof( nMD5Sum ) ); + nError = rtl_digest_updateMD5( aDigest, &nMD5Sum, sizeof( nMD5Sum ) ); if( nError != rtl_Digest_E_None ) + { + bSuccess = false; break; - rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof( nMD5Sum ) ); + } + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); } } } -//Step 7 + rtl_digest_destroyMD5( aDigest ); + } + else + bSuccess = false; + + //Step 7 + if( bSuccess ) + { + io_rProperties.EncryptionKey.resize( MAXIMUM_RC4_KEY_LENGTH ); for( sal_Int32 i = 0; i < MD5_DIGEST_SIZE; i++ ) - paEncryptionKey[i] = nMD5Sum[i]; + io_rProperties.EncryptionKey[i] = nMD5Sum[i]; } + else + io_rProperties.EncryptionKey.clear(); + + return bSuccess; } /********************************** Algorithm 3.3 Compute the encryption dictionary /O value, save into the class data member the step numbers down here correspond to the ones in PDF v.1.4 specfication */ -void PDFWriterImpl::computeODictionaryValue() +bool PDFWriterImpl::computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, + const sal_uInt8* i_pPaddedUserPassword, + vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + sal_Int32 i_nKeyLength, + sal_Int32 i_nRC4KeyLength + ) { -//step 1 already done, data is in m_nPaddedOwnerPassword -//step 2 - if( m_aDigest ) + bool bSuccess = true; + + io_rProperties.OValue.resize( ENCRYPTED_PWD_SIZE ); + + rtlDigest aDigest = rtl_digest_createMD5(); + rtlCipher aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream ); + if( aDigest && aCipher) { - rtlDigestError nError = rtl_digest_updateMD5( m_aDigest, &m_nPaddedOwnerPassword, sizeof( m_nPaddedOwnerPassword ) ); + //step 1 already done, data is in i_pPaddedOwnerPassword + //step 2 + + rtlDigestError nError = rtl_digest_updateMD5( aDigest, i_pPaddedOwnerPassword, ENCRYPTED_PWD_SIZE ); if( nError == rtl_Digest_E_None ) { sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof(nMD5Sum) ); + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof(nMD5Sum) ); //step 3, only if 128 bit - if( m_aContext.Security128bit ) + if( io_rProperties.Security128bit ) { sal_Int32 i; for( i = 0; i < 50; i++ ) { - nError = rtl_digest_updateMD5( m_aDigest, nMD5Sum, sizeof( nMD5Sum ) ); + nError = rtl_digest_updateMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); if( nError != rtl_Digest_E_None ) + { + bSuccess = false; break; - rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof( nMD5Sum ) ); + } + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); } } -//Step 4, the key is in nMD5Sum -//step 5 already done, data is in m_nPaddedUserPassword -//step 6 - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, - nMD5Sum, m_nKeyLength , NULL, 0 ); -// encrypt the user password using the key set above - rtl_cipher_encodeARCFOUR( m_aCipher, m_nPaddedUserPassword, sizeof( m_nPaddedUserPassword ), // the data to be encrypted - m_nEncryptedOwnerPassword, sizeof( m_nEncryptedOwnerPassword ) ); //encrypted data, stored in class data member -//Step 7, only if 128 bit - if( m_aContext.Security128bit ) + //Step 4, the key is in nMD5Sum + //step 5 already done, data is in i_pPaddedUserPassword + //step 6 + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + nMD5Sum, i_nKeyLength , NULL, 0 ); + // encrypt the user password using the key set above + rtl_cipher_encodeARCFOUR( aCipher, i_pPaddedUserPassword, ENCRYPTED_PWD_SIZE, // the data to be encrypted + &io_rProperties.OValue[0], sal_Int32(io_rProperties.OValue.size()) ); //encrypted data + //Step 7, only if 128 bit + if( io_rProperties.Security128bit ) { sal_uInt32 i, y; sal_uInt8 nLocalKey[ SECUR_128BIT_KEY ]; // 16 = 128 bit key @@ -12169,138 +12366,116 @@ void PDFWriterImpl::computeODictionaryValue() for( y = 0; y < sizeof( nLocalKey ); y++ ) nLocalKey[y] = (sal_uInt8)( nMD5Sum[y] ^ i ); - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, nLocalKey, SECUR_128BIT_KEY, NULL, 0 ); //destination data area, on init can be NULL - rtl_cipher_encodeARCFOUR( m_aCipher, m_nEncryptedOwnerPassword, sizeof( m_nEncryptedOwnerPassword ), // the data to be encrypted - m_nEncryptedOwnerPassword, sizeof( m_nEncryptedOwnerPassword ) ); // encrypted data, can be the same as the input, encrypt "in place" -//step 8, store in class data member + rtl_cipher_encodeARCFOUR( aCipher, &io_rProperties.OValue[0], sal_Int32(io_rProperties.OValue.size()), // the data to be encrypted + &io_rProperties.OValue[0], sal_Int32(io_rProperties.OValue.size()) ); // encrypted data, can be the same as the input, encrypt "in place" + //step 8, store in class data member } } } + else + bSuccess = false; } + else + bSuccess = false; + + if( aDigest ) + rtl_digest_destroyMD5( aDigest ); + if( aCipher ) + rtl_cipher_destroyARCFOUR( aCipher ); + + if( ! bSuccess ) + io_rProperties.OValue.clear(); + return bSuccess; } /********************************** Algorithms 3.4 and 3.5 Compute the encryption dictionary /U value, save into the class data member, revision 2 (40 bit) or 3 (128 bit) */ -void PDFWriterImpl::computeUDictionaryValue() +bool PDFWriterImpl::computeUDictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, + const sal_uInt8* i_pPaddedUserPassword, + vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + sal_Int32 i_nKeyLength, + sal_Int32 i_nRC4KeyLength, + sal_Int32 i_nAccessPermissions + ) { -//step 1, common to both 3.4 and 3.5 - computeEncryptionKey( m_nPaddedUserPassword , m_nEncryptionKey ); + bool bSuccess = true; - if( m_aContext.Security128bit == false ) - { -//3.4 -//step 2 and 3 - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, - m_nEncryptionKey, 5 , // key and key length - NULL, 0 ); //destination data area -// encrypt the user password using the key set above, save for later use - rtl_cipher_encodeARCFOUR( m_aCipher, m_nPadString, sizeof( m_nPadString ), // the data to be encrypted - m_nEncryptedUserPassword, sizeof( m_nEncryptedUserPassword ) ); //encrypted data, stored in class data member - } - else + io_rProperties.UValue.resize( ENCRYPTED_PWD_SIZE ); + + rtlDigest aDigest = rtl_digest_createMD5(); + rtlCipher aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream ); + if( aDigest && aCipher ) { -//or 3.5, for 128 bit security -//step6, initilize the last 16 bytes of the encrypted user password to 0 - for(sal_uInt32 i = MD5_DIGEST_SIZE; i < sizeof( m_nEncryptedUserPassword ); i++) - m_nEncryptedUserPassword[i] = 0; -//step 2 - if( m_aDigest ) + //step 1, common to both 3.4 and 3.5 + if( computeEncryptionKey( i_pPaddedOwnerPassword, i_pPaddedUserPassword, io_rProperties, i_nAccessPermissions ) ) { - rtlDigestError nError = rtl_digest_updateMD5( m_aDigest, m_nPadString, sizeof( m_nPadString ) ); -//step 3 - if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( m_aDigest, m_nDocID , sizeof(m_nDocID) ); - - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - rtl_digest_getMD5( m_aDigest, nMD5Sum, sizeof(nMD5Sum) ); -//Step 4 - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, - m_nEncryptionKey, SECUR_128BIT_KEY, NULL, 0 ); //destination data area - rtl_cipher_encodeARCFOUR( m_aCipher, nMD5Sum, sizeof( nMD5Sum ), // the data to be encrypted - m_nEncryptedUserPassword, sizeof( nMD5Sum ) ); //encrypted data, stored in class data member -//step 5 - sal_uInt32 i, y; - sal_uInt8 nLocalKey[SECUR_128BIT_KEY]; - - for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1 + if( io_rProperties.Security128bit == false ) + { + //3.4 + //step 2 and 3 + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + &io_rProperties.EncryptionKey[0], 5 , // key and key length + NULL, 0 ); //destination data area + // encrypt the user password using the key set above, save for later use + rtl_cipher_encodeARCFOUR( aCipher, s_nPadString, sizeof( s_nPadString ), // the data to be encrypted + &io_rProperties.UValue[0], sal_Int32(io_rProperties.UValue.size()) ); //encrypted data, stored in class data member + } + else { - for( y = 0; y < sizeof( nLocalKey ) ; y++ ) - nLocalKey[y] = (sal_uInt8)( m_nEncryptionKey[y] ^ i ); - - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, - nLocalKey, SECUR_128BIT_KEY, // key and key length - NULL, 0 ); //destination data area, on init can be NULL - rtl_cipher_encodeARCFOUR( m_aCipher, m_nEncryptedUserPassword, SECUR_128BIT_KEY, // the data to be encrypted - m_nEncryptedUserPassword, SECUR_128BIT_KEY ); // encrypted data, can be the same as the input, encrypt "in place" + //or 3.5, for 128 bit security + //step6, initilize the last 16 bytes of the encrypted user password to 0 + for(sal_uInt32 i = MD5_DIGEST_SIZE; i < sal_uInt32(io_rProperties.UValue.size()); i++) + io_rProperties.UValue[i] = 0; + //step 2 + rtlDigestError nError = rtl_digest_updateMD5( aDigest, s_nPadString, sizeof( s_nPadString ) ); + //step 3 + if( nError == rtl_Digest_E_None ) + nError = rtl_digest_updateMD5( aDigest, &io_rProperties.DocumentIdentifier[0], sal_Int32(io_rProperties.DocumentIdentifier.size()) ); + else + bSuccess = false; + + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof(nMD5Sum) ); + //Step 4 + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + &io_rProperties.EncryptionKey[0], SECUR_128BIT_KEY, NULL, 0 ); //destination data area + rtl_cipher_encodeARCFOUR( aCipher, nMD5Sum, sizeof( nMD5Sum ), // the data to be encrypted + &io_rProperties.UValue[0], sizeof( nMD5Sum ) ); //encrypted data, stored in class data member + //step 5 + sal_uInt32 i, y; + sal_uInt8 nLocalKey[SECUR_128BIT_KEY]; + + for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1 + { + for( y = 0; y < sizeof( nLocalKey ) ; y++ ) + nLocalKey[y] = (sal_uInt8)( io_rProperties.EncryptionKey[y] ^ i ); + + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + nLocalKey, SECUR_128BIT_KEY, // key and key length + NULL, 0 ); //destination data area, on init can be NULL + rtl_cipher_encodeARCFOUR( aCipher, &io_rProperties.UValue[0], SECUR_128BIT_KEY, // the data to be encrypted + &io_rProperties.UValue[0], SECUR_128BIT_KEY ); // encrypted data, can be the same as the input, encrypt "in place" + } } } + else + bSuccess = false; } -} - -/* init the encryption engine -1. init the document id, used both for building the document id and for building the encryption key(s) -2. build the encryption key following algorithms described in the PDF specification - */ -void PDFWriterImpl::initEncryption() -{ - m_aOwnerPassword = m_aContext.OwnerPassword; - m_aUserPassword = m_aContext.UserPassword; -/* password stuff computing, before sending out anything */ - DBG_ASSERT( m_aCipher != NULL, "PDFWriterImpl::initEncryption: a cipher (ARCFOUR) object is not available !" ); - DBG_ASSERT( m_aDigest != NULL, "PDFWriterImpl::initEncryption: a digest (MD5) object is not available !" ); + else + bSuccess = false; - if( m_aCipher && m_aDigest ) - { -//if there is no owner password, force it to the user password - if( m_aOwnerPassword.getLength() == 0 ) - m_aOwnerPassword = m_aUserPassword; + if( aDigest ) + rtl_digest_destroyMD5( aDigest ); + if( aCipher ) + rtl_cipher_destroyARCFOUR( aCipher ); - initPadString(); -/* -1) pad passwords -*/ - padPassword( m_aOwnerPassword, m_nPaddedOwnerPassword ); - padPassword( m_aUserPassword, m_nPaddedUserPassword ); -/* -2) compute the access permissions, in numerical form - -the default value depends on the revision 2 (40 bit) or 3 (128 bit security): -- for 40 bit security the unused bit must be set to 1, since they are not used -- for 128 bit security the same bit must be preset to 0 and set later if needed -according to the table 3.15, pdf v 1.4 */ - m_nAccessPermissions = ( m_aContext.Security128bit ) ? 0xfffff0c0 : 0xffffffc0 ; - -/* check permissions for 40 bit security case */ - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanPrintTheDocument ) ? 1 << 2 : 0; - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanModifyTheContent ) ? 1 << 3 : 0; - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanCopyOrExtract ) ? 1 << 4 : 0; - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanAddOrModify ) ? 1 << 5 : 0; - m_nKeyLength = SECUR_40BIT_KEY; - m_nRC4KeyLength = SECUR_40BIT_KEY+5; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 5 - - if( m_aContext.Security128bit ) - { - m_nKeyLength = SECUR_128BIT_KEY; - m_nRC4KeyLength = 16; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 16, thus maximum - // permitted value is 16 - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanFillInteractive ) ? 1 << 8 : 0; - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanExtractForAccessibility ) ? 1 << 9 : 0; - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanAssemble ) ? 1 << 10 : 0; - m_nAccessPermissions |= ( m_aContext.AccessPermissions.CanPrintFull ) ? 1 << 11 : 0; - } - computeODictionaryValue(); - computeUDictionaryValue(); - -//clear out exceding key values, prepares for generation number default to 0 as well -// see checkAndEnableStreamEncryption in pdfwriter_impl.hxx - sal_Int32 i, y; - for( i = m_nKeyLength, y = 0; y < 5 ; y++ ) - m_nEncryptionKey[i++] = 0; - } - else //either no cipher or no digest or both, something is wrong with memory or something else - m_aContext.Encrypt = false; //then turn the encryption off + if( ! bSuccess ) + io_rProperties.UValue.clear(); + return bSuccess; } + /* end i12626 methods */ diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 2eacdc215dd8..dd75ca4f1a47 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -595,7 +595,6 @@ private: MapMode m_aMapMode; // PDFWriterImpl scaled units std::vector< PDFPage > m_aPages; - PDFDocInfo m_aDocInfo; /* maps object numbers to file offsets (needed for xref) */ std::vector< sal_uInt64 > m_aObjects; /* contains Bitmaps until they are written to the @@ -796,116 +795,37 @@ i12626 /* used to cipher the stream data and for password management */ rtlCipher m_aCipher; rtlDigest m_aDigest; -/* pad string used for password in Standard security handler */ - sal_uInt8 m_nPadString[ENCRYPTED_PWD_SIZE]; -/* the owner password, in clear text */ - rtl::OUString m_aOwnerPassword; -/* the padded owner password */ - sal_uInt8 m_nPaddedOwnerPassword[ENCRYPTED_PWD_SIZE]; -/* the encryption dictionary owner password, according to algorithm 3.3 */ - sal_uInt8 m_nEncryptedOwnerPassword[ENCRYPTED_PWD_SIZE]; -/* the user password, in clear text */ - rtl::OUString m_aUserPassword; -/* the padded user password */ - sal_uInt8 m_nPaddedUserPassword[ENCRYPTED_PWD_SIZE]; -/* the encryption dictionary user password, according to algorithm 3.4 or 3.5 depending on the - security handler revision */ - sal_uInt8 m_nEncryptedUserPassword[ENCRYPTED_PWD_SIZE]; - -/* the encryption key, formed with the user password according to algorithm 3.2, maximum length is 16 bytes + 3 + 2 - for 128 bit security */ - sal_uInt8 m_nEncryptionKey[MAXIMUM_RC4_KEY_LENGTH]; + /* pad string used for password in Standard security handler */ + static const sal_uInt8 s_nPadString[ENCRYPTED_PWD_SIZE]; + + /* the encryption key, formed with the user password according to algorithm 3.2, maximum length is 16 bytes + 3 + 2 + for 128 bit security */ sal_Int32 m_nKeyLength; // key length, 16 or 5 sal_Int32 m_nRC4KeyLength; // key length, 16 or 10, to be input to the algorith 3.1 -/* set to true if the following stream must be encrypted, used inside writeBuffer() */ + /* set to true if the following stream must be encrypted, used inside writeBuffer() */ sal_Bool m_bEncryptThisStream; -/* the numerical value of the access permissions, according to PDF spec, must be signed */ + /* the numerical value of the access permissions, according to PDF spec, must be signed */ sal_Int32 m_nAccessPermissions; -/* the document ID, the raw MD5 hash */ - sal_uInt8 m_nDocID[MD5_DIGEST_SIZE]; -/* string buffer to hold document ID, this is the output string */ - rtl::OStringBuffer m_aDocID; -/* string to hold the PDF creation date */ - rtl::OStringBuffer m_aCreationDateString; -/* string to hold the PDF creation date, for PDF/A metadata */ - rtl::OStringBuffer m_aCreationMetaDateString; -/* the buffer where the data are encrypted, dynamically allocated */ + /* string to hold the PDF creation date */ + rtl::OString m_aCreationDateString; + /* string to hold the PDF creation date, for PDF/A metadata */ + rtl::OString m_aCreationMetaDateString; + /* the buffer where the data are encrypted, dynamically allocated */ sal_uInt8 *m_pEncryptionBuffer; -/* size of the buffer */ + /* size of the buffer */ sal_Int32 m_nEncryptionBufferSize; -/* check and reallocate the buffer for encryption */ - sal_Bool checkEncryptionBufferSize( register sal_Int32 newSize ) - { - if( m_nEncryptionBufferSize < newSize ) - { -/* reallocate the buffer, the used function allocate as rtl_allocateMemory - if the pointer parameter is NULL */ - m_pEncryptionBuffer = (sal_uInt8*)rtl_reallocateMemory( m_pEncryptionBuffer, newSize ); - if( m_pEncryptionBuffer ) - m_nEncryptionBufferSize = newSize; - else - m_nEncryptionBufferSize = 0; - } - return ( m_nEncryptionBufferSize != 0 ); - } -/* init the internal pad string */ - void initPadString() - { - static const sal_uInt8 nPadString[32] = - { - 0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, - 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A - }; - - for(sal_uInt32 i = 0; i < sizeof( nPadString ); i++ ) - m_nPadString[i] = nPadString[i]; - - }; -/* initialize the encryption engine */ - void initEncryption(); - -/* this function implements part of the PDF spec algorithm 3.1 in encryption, the rest (the actual encryption) is in PDFWriterImpl::writeBuffer */ - void checkAndEnableStreamEncryption( register sal_Int32 nObject ) - { - if( m_aContext.Encrypt ) - { - m_bEncryptThisStream = true; - register sal_Int32 i = m_nKeyLength; - m_nEncryptionKey[i++] = (sal_uInt8)nObject; - m_nEncryptionKey[i++] = (sal_uInt8)( nObject >> 8 ); - m_nEncryptionKey[i++] = (sal_uInt8)( nObject >> 16 ); -//the other location of m_nEncryptionKey are already set to 0, our fixed generation number -// do the MD5 hash - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - // the i+2 to take into account the generation number, always zero - rtl_digest_MD5( &m_nEncryptionKey, i+2, nMD5Sum, sizeof(nMD5Sum) ); -// initialize the RC4 with the key -// key legth: see algoritm 3.1, step 4: (N+5) max 16 - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 ); - } - }; + /* check and reallocate the buffer for encryption */ + sal_Bool checkEncryptionBufferSize( register sal_Int32 newSize ); + /* this function implements part of the PDF spec algorithm 3.1 in encryption, the rest (the actual encryption) is in PDFWriterImpl::writeBuffer */ + void checkAndEnableStreamEncryption( register sal_Int32 nObject ); void disableStreamEncryption() { m_bEncryptThisStream = false; }; -/* */ - void enableStringEncryption( register sal_Int32 nObject ) - { - register sal_Int32 i = m_nKeyLength; - m_nEncryptionKey[i++] = (sal_uInt8)nObject; - m_nEncryptionKey[i++] = (sal_uInt8)( nObject >> 8 ); - m_nEncryptionKey[i++] = (sal_uInt8)( nObject >> 16 ); -//the other location of m_nEncryptionKey are already set to 0, our fixed generation number -// do the MD5 hash - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - // the i+2 to take into account the generation number, always zero - rtl_digest_MD5( &m_nEncryptionKey, i+2, nMD5Sum, sizeof(nMD5Sum) ); -// initialize the RC4 with the key -// key legth: see algoritm 3.1, step 4: (N+5) max 16 - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 ); - }; + /* */ + void enableStringEncryption( register sal_Int32 nObject ); // test if the encryption is active, if yes than encrypt the unicode string and add to the OStringBuffer parameter void appendUnicodeTextStringEncrypt( const rtl::OUString& rInString, const sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer ); @@ -1096,23 +1016,47 @@ i12626 /* true if PDF/A-1a or PDF/A-1b is output */ sal_Bool m_bIsPDF_A1; -/* -i12626 -methods for PDF security - - pad a password according algorithm 3.2, step 1 */ - void padPassword( const rtl::OUString aPassword, sal_uInt8 *paPasswordTarget ); -/* algorithm 3.2: compute an encryption key */ - void computeEncryptionKey( sal_uInt8 *paThePaddedPassword, sal_uInt8 *paEncryptionKey ); -/* algorithm 3.3: computing the encryption dictionary'ss owner password value ( /O ) */ - void computeODictionaryValue(); -/* algorithm 3.4 or 3.5: computing the encryption dictionary's user password value ( /U ) revision 2 or 3 of the standard security handler */ - void computeUDictionaryValue(); - + /* + i12626 + methods for PDF security + + pad a password according algorithm 3.2, step 1 */ + static void padPassword( const rtl::OUString& i_rPassword, sal_uInt8* o_pPaddedPW ); + /* algorithm 3.2: compute an encryption key */ + static bool computeEncryptionKey( const sal_uInt8* i_pOPW, const sal_uInt8* i_pUPW, + vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + sal_Int32 i_nAccessPermissions + ); + /* algorithm 3.3: computing the encryption dictionary'ss owner password value ( /O ) */ + static bool computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, const sal_uInt8* i_pPaddedUserPassword, + vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + sal_Int32 i_nKeyLength, sal_Int32 i_nRC4KeyLength + ); + /* algorithm 3.4 or 3.5: computing the encryption dictionary's user password value ( /U ) revision 2 or 3 of the standard security handler */ + static bool computeUDictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, const sal_uInt8* i_pPaddedUserPassword, + vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + sal_Int32 i_nKeyLength, sal_Int32 i_nRC4KeyLength, + sal_Int32 i_nAccessPermissions + ); + + static void computeDocumentIdentifier( std::vector< sal_uInt8 >& o_rIdentifier, + const vcl::PDFWriter::PDFDocInfo& i_rDocInfo, + rtl::OString& o_rCString1, + rtl::OString& o_rCString2 + ); + static sal_Int32 computeAccessPermissions( const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties, + sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength ); + void setupDocInfo(); public: PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext ); ~PDFWriterImpl(); + static bool initEncryption( vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + const rtl::OUString& i_rOwnerPassword, + const rtl::OUString& i_rUserPassword, + const vcl::PDFWriter::PDFDocInfo& i_rDocInfo + ); + /* for OutputDevice so the reference device can have a list * that contains only suitable fonts (subsettable or builtin) * produces a new font list @@ -1144,8 +1088,6 @@ public: } PDFWriter::PDFVersion getVersion() const { return m_aContext.Version; } - void setDocInfo( const PDFDocInfo& rInfo ); - const PDFDocInfo& getDocInfo() const { return m_aDocInfo; } void setDocumentLocale( const com::sun::star::lang::Locale& rLoc ) { m_aContext.DocumentLocale = rLoc; } -- cgit From 4c227c8eb3b025438557cb817f8e406d205b75ae Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 24 Sep 2010 14:28:04 +0200 Subject: step1: put encrpytion parameters into PDFContext --- filter/source/pdf/pdfexport.cxx | 107 +++++++++++++++++++--------------------- filter/source/pdf/pdfexport.hxx | 2 - 2 files changed, 50 insertions(+), 59 deletions(-) diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 8115f36d76f8..77be4cc81415 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -126,9 +126,7 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, Reference< task:: mbFirstPageLeft ( sal_False ), mbEncrypt ( sal_False ), - msOpenPassword (), mbRestrictPermissions ( sal_False ), - msPermissionPassword (), mnPrintAllowed ( 2 ), mnChangesAllowed ( 4 ), mbCanCopyOrExtract ( sal_True ), @@ -386,6 +384,9 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue VCLXDevice* pXDevice = new VCLXDevice; OUString aPageRange; Any aSelection; + PDFWriter::PDFWriterContext aContext; + rtl::OUString aOpenPassword, aPermissionPassword; + // getting the string for the creator String aCreator; @@ -404,7 +405,34 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue aCreator.AppendAscii( "Math" ); } - PDFWriter::PDFWriterContext aContext; + Reference< document::XDocumentPropertiesSupplier > xDocumentPropsSupplier( mxSrcDoc, UNO_QUERY ); + if ( xDocumentPropsSupplier.is() ) + { + Reference< document::XDocumentProperties > xDocumentProps( xDocumentPropsSupplier->getDocumentProperties() ); + if ( xDocumentProps.is() ) + { + aContext.DocumentInfo.Title = xDocumentProps->getTitle(); + aContext.DocumentInfo.Author = xDocumentProps->getAuthor(); + aContext.DocumentInfo.Subject = xDocumentProps->getSubject(); + aContext.DocumentInfo.Keywords = ::comphelper::string::convertCommaSeparated(xDocumentProps->getKeywords()); + } + } + // getting the string for the producer + String aProducer; + ::utl::ConfigManager* pMgr = ::utl::ConfigManager::GetConfigManager(); + if ( pMgr ) + { + Any aProductName = pMgr->GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); + ::rtl::OUString sProductName; + aProductName >>= sProductName; + aProducer = sProductName; + aProductName = pMgr->GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION ); + aProductName >>= sProductName; + aProducer.AppendAscii(" "); + aProducer += String( sProductName ); + } + aContext.DocumentInfo.Producer = aProducer; + aContext.DocumentInfo.Creator = aCreator; for( sal_Int32 nData = 0, nDataCount = rFilterData.getLength(); nData < nDataCount; ++nData ) { @@ -478,11 +506,11 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptFile" ) ) ) rFilterData[ nData ].Value >>= mbEncrypt; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentOpenPassword" ) ) ) - rFilterData[ nData ].Value >>= msOpenPassword; + rFilterData[ nData ].Value >>= aOpenPassword; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RestrictPermissions" ) ) ) rFilterData[ nData ].Value >>= mbRestrictPermissions; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PermissionPassword" ) ) ) - rFilterData[ nData ].Value >>= msPermissionPassword; + rFilterData[ nData ].Value >>= aPermissionPassword; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Printing" ) ) ) rFilterData[ nData ].Value >>= mnPrintAllowed; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Changes" ) ) ) @@ -600,23 +628,17 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue if( aContext.Version != PDFWriter::PDF_A_1 ) { //set values needed in encryption - aContext.Encrypt = mbEncrypt; //set encryption level, fixed, but here it can set by the UI if needed. // true is 128 bit, false 40 //note that in 40 bit mode the UI needs reworking, since the current UI is meaningfull only for //128bit security mode - aContext.Security128bit = sal_True; - -//set the open password - if( aContext.Encrypt && msOpenPassword.getLength() > 0 ) - aContext.UserPassword = msOpenPassword; + aContext.Encryption.Security128bit = sal_True; //set check for permission change password // if not enabled and no permission password, force permissions to default as if PDF where without encryption - if( mbRestrictPermissions && msPermissionPassword.getLength() > 0 ) + if( mbRestrictPermissions && aPermissionPassword.getLength() > 0 ) { - aContext.OwnerPassword = msPermissionPassword; - aContext.Encrypt = sal_True; + mbEncrypt = sal_True; //permission set as desired, done after } else @@ -634,9 +656,9 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue break; default: case 2: - aContext.AccessPermissions.CanPrintFull = sal_True; + aContext.Encryption.CanPrintFull = sal_True; case 1: - aContext.AccessPermissions.CanPrintTheDocument = sal_True; + aContext.Encryption.CanPrintTheDocument = sal_True; break; } @@ -645,25 +667,27 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue case 0: //already in struct PDFSecPermissions CTOR break; case 1: - aContext.AccessPermissions.CanAssemble = sal_True; + aContext.Encryption.CanAssemble = sal_True; break; case 2: - aContext.AccessPermissions.CanFillInteractive = sal_True; + aContext.Encryption.CanFillInteractive = sal_True; break; case 3: - aContext.AccessPermissions.CanAddOrModify = sal_True; + aContext.Encryption.CanAddOrModify = sal_True; break; default: case 4: - aContext.AccessPermissions.CanModifyTheContent = - aContext.AccessPermissions.CanCopyOrExtract = - aContext.AccessPermissions.CanAddOrModify = - aContext.AccessPermissions.CanFillInteractive = sal_True; + aContext.Encryption.CanModifyTheContent = + aContext.Encryption.CanCopyOrExtract = + aContext.Encryption.CanAddOrModify = + aContext.Encryption.CanFillInteractive = sal_True; break; } - aContext.AccessPermissions.CanCopyOrExtract = mbCanCopyOrExtract; - aContext.AccessPermissions.CanExtractForAccessibility = mbCanExtractForAccessibility; + aContext.Encryption.CanCopyOrExtract = mbCanCopyOrExtract; + aContext.Encryption.CanExtractForAccessibility = mbCanExtractForAccessibility; + if( mbEncrypt ) + PDFWriter::InitEncryption( aContext.Encryption, aPermissionPassword, aOpenPassword, aContext.DocumentInfo ); } /* * FIXME: the entries are only implicitly defined by the resource file. Should there @@ -740,41 +764,10 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue // get mimetype OUString aSrcMimetype = getMimetypeForDocument( mxMSF, mxSrcDoc ); pPDFWriter->AddStream( aSrcMimetype, - new PDFExportStreamDoc( mxSrcDoc, msPermissionPassword ), + new PDFExportStreamDoc( mxSrcDoc, aPermissionPassword ), false ); } - PDFDocInfo aDocInfo; - Reference< document::XDocumentPropertiesSupplier > xDocumentPropsSupplier( mxSrcDoc, UNO_QUERY ); - if ( xDocumentPropsSupplier.is() ) - { - Reference< document::XDocumentProperties > xDocumentProps( xDocumentPropsSupplier->getDocumentProperties() ); - if ( xDocumentProps.is() ) - { - aDocInfo.Title = xDocumentProps->getTitle(); - aDocInfo.Author = xDocumentProps->getAuthor(); - aDocInfo.Subject = xDocumentProps->getSubject(); - aDocInfo.Keywords = ::comphelper::string::convertCommaSeparated(xDocumentProps->getKeywords()); - } - } - // getting the string for the producer - String aProducer; - ::utl::ConfigManager* pMgr = ::utl::ConfigManager::GetConfigManager(); - if ( pMgr ) - { - Any aProductName = pMgr->GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); - ::rtl::OUString sProductName; - aProductName >>= sProductName; - aProducer = sProductName; - aProductName = pMgr->GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION ); - aProductName >>= sProductName; - aProducer.AppendAscii(" "); - aProducer += String( sProductName ); - } - aDocInfo.Producer = aProducer; - aDocInfo.Creator = aCreator; - - pPDFWriter->SetDocInfo( aDocInfo ); if ( pOut ) { diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx index 18c760b85675..6a1ed9962774 100644 --- a/filter/source/pdf/pdfexport.hxx +++ b/filter/source/pdf/pdfexport.hxx @@ -98,9 +98,7 @@ private: sal_Bool mbFirstPageLeft; sal_Bool mbEncrypt; - rtl::OUString msOpenPassword; sal_Bool mbRestrictPermissions; - rtl::OUString msPermissionPassword; sal_Int32 mnPrintAllowed; sal_Int32 mnChangesAllowed; sal_Bool mbCanCopyOrExtract; -- cgit From 208de777d5af30720ba212a233283ba4c1ac57cb Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 27 Sep 2010 19:58:20 +0200 Subject: limit password life time --- vcl/inc/vcl/pdfwriter.hxx | 17 +- vcl/source/gdi/makefile.mk | 1 + vcl/source/gdi/pdfwriter.cxx | 16 +- vcl/source/gdi/pdfwriter_impl.cxx | 425 +------------------------------------- vcl/source/gdi/pdfwriter_impl.hxx | 19 +- 5 files changed, 36 insertions(+), 442 deletions(-) diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index cbb9c7c2fe93..204ddaa9e33c 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -38,7 +38,8 @@ #include #include -#include +#include "com/sun/star/io/XOutputStream.hpp" +#include "com/sun/star/beans/XMaterialHolder.hpp" #include #include @@ -498,7 +499,7 @@ The following structure describes the permissions used in PDF security // EncryptionKey is actually a construct out of OValue, UValue and DocumentIdentifier // if these do not match, behavior is undefined, most likely an invalid PDF will be produced // OValue, UValue, EncryptionKey and DocumentIdentifier can be computed from - // PDFDocInfo, Owner password and User password usend the InitEncryption method which + // PDFDocInfo, Owner password and User password used the InitEncryption method which // implements the algorithms described in the PDF reference chapter 3.5: Encryption std::vector OValue; std::vector UValue; @@ -623,7 +624,7 @@ The following structure describes the permissions used in PDF security {} }; - PDFWriter( const PDFWriterContext& rContext ); + PDFWriter( const PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& ); ~PDFWriter(); /** Returns an OutputDevice for formatting @@ -666,11 +667,11 @@ The following structure describes the permissions used in PDF security PDFVersion GetVersion() const; - static bool InitEncryption( PDFWriter::PDFEncryptionProperties& io_rProperties, - const rtl::OUString& i_rOwnerPassword, - const rtl::OUString& i_rUserPassword, - const PDFWriter::PDFDocInfo& i_rDocInfo - ); + static com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > + InitEncryption( const rtl::OUString& i_rOwnerPassword, + const rtl::OUString& i_rUserPassword, + bool b128Bit + ); /* functions for graphics state */ /* flag values: see vcl/outdev.hxx */ diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index 77df20976c73..ac2e586a41cb 100755 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -63,6 +63,7 @@ EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ $(SLO)$/impgraph.obj \ $(SLO)$/metric.obj \ $(SLO)$/pdfwriter_impl.obj \ + $(SLO)$/pdfwriter_impl2.obj \ $(SLO)$/pdffontcache.obj\ $(SLO)$/bmpconv.obj \ $(SLO)$/pdfextoutdevdata.obj \ diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 3b5e70d938a8..98627b448aed 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -38,9 +38,9 @@ PDFWriter::AnyWidget::~AnyWidget() { } -PDFWriter::PDFWriter( const PDFWriter::PDFWriterContext& rContext ) +PDFWriter::PDFWriter( const PDFWriter::PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& xEnc ) : - pImplementation( new PDFWriterImpl( rContext ) ) + pImplementation( new PDFWriterImpl( rContext, xEnc ) ) { } @@ -560,12 +560,12 @@ std::set< PDFWriter::ErrorCode > PDFWriter::GetErrors() return ((PDFWriterImpl*)pImplementation)->getErrors(); } -bool PDFWriter::InitEncryption( PDFWriter::PDFEncryptionProperties& io_rProperties, - const rtl::OUString& i_rOwnerPassword, - const rtl::OUString& i_rUserPassword, - const PDFWriter::PDFDocInfo& i_rDocInfo - ) +com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > +PDFWriter::InitEncryption( const rtl::OUString& i_rOwnerPassword, + const rtl::OUString& i_rUserPassword, + bool b128Bit + ) { - return PDFWriterImpl::initEncryption( io_rProperties, i_rOwnerPassword, i_rUserPassword, i_rDocInfo ); + return PDFWriterImpl::initEncryption( i_rOwnerPassword, i_rUserPassword, b128Bit ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index ff415ccfa98c..1e39f0e46260 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1697,7 +1697,8 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal * class PDFWriterImpl */ -PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext ) + PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, + const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& xEnc ) : m_pReferenceDevice( NULL ), m_aMapMode( MAP_POINT, Point(), Fraction( 1L, pointToPixel(1) ), Fraction( 1L, pointToPixel(1) ) ), @@ -1759,14 +1760,19 @@ PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext ) m_bOpen = true; - /* prepare the cypher engine, can be done in CTOR, free in DTOR */ + // setup DocInfo + setupDocInfo(); + /* prepare the cypher engine, can be done in CTOR, free in DTOR */ m_aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream ); m_aDigest = rtl_digest_createMD5(); /* the size of the Codec default maximum */ checkEncryptionBufferSize( 0x4000 ); + if( xEnc.is() ) + prepareEncryption( xEnc ); + if( m_aContext.Encryption.Encrypt() ) { // sanity check @@ -12063,419 +12069,4 @@ void PDFWriterImpl::addStream( const String& rMimeType, PDFOutputStream* pStream } -sal_Bool PDFWriterImpl::checkEncryptionBufferSize( register sal_Int32 newSize ) -{ - if( m_nEncryptionBufferSize < newSize ) - { - /* reallocate the buffer, the used function allocate as rtl_allocateMemory - if the pointer parameter is NULL */ - m_pEncryptionBuffer = (sal_uInt8*)rtl_reallocateMemory( m_pEncryptionBuffer, newSize ); - if( m_pEncryptionBuffer ) - m_nEncryptionBufferSize = newSize; - else - m_nEncryptionBufferSize = 0; - } - return ( m_nEncryptionBufferSize != 0 ); -} - -void PDFWriterImpl::checkAndEnableStreamEncryption( register sal_Int32 nObject ) -{ - if( m_aContext.Encryption.Encrypt() ) - { - m_bEncryptThisStream = true; - sal_Int32 i = m_nKeyLength; - m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)nObject; - m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 8 ); - m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 16 ); - //the other location of m_nEncryptionKey are already set to 0, our fixed generation number - // do the MD5 hash - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - // the i+2 to take into account the generation number, always zero - rtl_digest_MD5( &m_aContext.Encryption.EncryptionKey[0], i+2, nMD5Sum, sizeof(nMD5Sum) ); - // initialize the RC4 with the key - // key legth: see algoritm 3.1, step 4: (N+5) max 16 - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 ); - } -} - -void PDFWriterImpl::enableStringEncryption( register sal_Int32 nObject ) -{ - if( m_aContext.Encryption.Encrypt() ) - { - sal_Int32 i = m_nKeyLength; - m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)nObject; - m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 8 ); - m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 16 ); - //the other location of m_nEncryptionKey are already set to 0, our fixed generation number - // do the MD5 hash - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - // the i+2 to take into account the generation number, always zero - rtl_digest_MD5( &m_aContext.Encryption.EncryptionKey[0], i+2, nMD5Sum, sizeof(nMD5Sum) ); - // initialize the RC4 with the key - // key legth: see algoritm 3.1, step 4: (N+5) max 16 - rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 ); - } -} - -/* init the encryption engine -1. init the document id, used both for building the document id and for building the encryption key(s) -2. build the encryption key following algorithms described in the PDF specification - */ -bool PDFWriterImpl::initEncryption( vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, - const rtl::OUString& i_rOwnerPassword, - const rtl::OUString& i_rUserPassword, - const vcl::PDFWriter::PDFDocInfo& i_rDocInfo - ) -{ - bool bSuccess = false; - rtl::OString aC1, aC2; - computeDocumentIdentifier( io_rProperties.DocumentIdentifier, i_rDocInfo, aC1, aC2 ); - if( i_rOwnerPassword.getLength() || i_rUserPassword.getLength() ) - { - sal_Int32 nKeyLength = 0, nRC4KeyLength = 0; - sal_Int32 nAccessPermissions = computeAccessPermissions( io_rProperties, nKeyLength, nRC4KeyLength ); - // get padded passwords - sal_uInt8 aPadUPW[ENCRYPTED_PWD_SIZE], aPadOPW[ENCRYPTED_PWD_SIZE]; - padPassword( i_rOwnerPassword.getLength() ? i_rOwnerPassword : i_rUserPassword, aPadOPW ); - padPassword( i_rUserPassword, aPadUPW ); - bSuccess = computeODictionaryValue( aPadOPW, aPadUPW, io_rProperties, nKeyLength, nRC4KeyLength ) - && computeUDictionaryValue( aPadOPW, aPadUPW, io_rProperties, nKeyLength, nRC4KeyLength, nAccessPermissions ) - ; - - // trash temporary padded cleartext PWDs - rtl_zeroMemory( aPadOPW, sizeof(aPadOPW) ); - rtl_zeroMemory( aPadUPW, sizeof(aPadUPW) ); - - //clear out exceding key values, prepares for generation number default to 0 as well - // see checkAndEnableStreamEncryption in pdfwriter_impl.hxx - if( bSuccess ) - { - sal_Int32 i, y; - for( i = nKeyLength, y = 0; y < 5 ; y++ ) - io_rProperties.EncryptionKey[i++] = 0; - } - } - else - bSuccess = true; - - if( ! bSuccess ) // something failed, disable encrpytion - { - io_rProperties.OValue.clear(); - io_rProperties.UValue.clear(); - io_rProperties.EncryptionKey.clear(); - } - - return bSuccess; -} - -sal_Int32 PDFWriterImpl::computeAccessPermissions( const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties, - sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength ) -{ - /* - 2) compute the access permissions, in numerical form - - the default value depends on the revision 2 (40 bit) or 3 (128 bit security): - - for 40 bit security the unused bit must be set to 1, since they are not used - - for 128 bit security the same bit must be preset to 0 and set later if needed - according to the table 3.15, pdf v 1.4 */ - sal_Int32 nAccessPermissions = ( i_rProperties.Security128bit ) ? 0xfffff0c0 : 0xffffffc0 ; - - /* check permissions for 40 bit security case */ - nAccessPermissions |= ( i_rProperties.CanPrintTheDocument ) ? 1 << 2 : 0; - nAccessPermissions |= ( i_rProperties.CanModifyTheContent ) ? 1 << 3 : 0; - nAccessPermissions |= ( i_rProperties.CanCopyOrExtract ) ? 1 << 4 : 0; - nAccessPermissions |= ( i_rProperties.CanAddOrModify ) ? 1 << 5 : 0; - o_rKeyLength = SECUR_40BIT_KEY; - o_rRC4KeyLength = SECUR_40BIT_KEY+5; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 5 - - if( i_rProperties.Security128bit ) - { - o_rKeyLength = SECUR_128BIT_KEY; - o_rRC4KeyLength = 16; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 16, thus maximum - // permitted value is 16 - nAccessPermissions |= ( i_rProperties.CanFillInteractive ) ? 1 << 8 : 0; - nAccessPermissions |= ( i_rProperties.CanExtractForAccessibility ) ? 1 << 9 : 0; - nAccessPermissions |= ( i_rProperties.CanAssemble ) ? 1 << 10 : 0; - nAccessPermissions |= ( i_rProperties.CanPrintFull ) ? 1 << 11 : 0; - } - return nAccessPermissions; -} - -/************************************************************* -begin i12626 methods - -Implements Algorithm 3.2, step 1 only -*/ -void PDFWriterImpl::padPassword( const rtl::OUString& i_rPassword, sal_uInt8* o_pPaddedPW ) -{ - // get ansi-1252 version of the password string CHECKIT ! i12626 - rtl::OString aString( rtl::OUStringToOString( i_rPassword, RTL_TEXTENCODING_MS_1252 ) ); - - //copy the string to the target - sal_Int32 nToCopy = ( aString.getLength() < ENCRYPTED_PWD_SIZE ) ? aString.getLength() : ENCRYPTED_PWD_SIZE; - sal_Int32 nCurrentChar; - - for( nCurrentChar = 0; nCurrentChar < nToCopy; nCurrentChar++ ) - o_pPaddedPW[nCurrentChar] = (sal_uInt8)( aString.getStr()[nCurrentChar] ); - - //pad it with standard byte string - sal_Int32 i,y; - for( i = nCurrentChar, y = 0 ; i < ENCRYPTED_PWD_SIZE; i++, y++ ) - o_pPaddedPW[i] = s_nPadString[y]; - - // trash memory of temporary clear text password - rtl_zeroMemory( (sal_Char*)aString.getStr(), aString.getLength() ); -} - -/********************************** -Algorithm 3.2 Compute the encryption key used - -step 1 should already be done before calling, the paThePaddedPassword parameter should contain -the padded password and must be 32 byte long, the encryption key is returned into the paEncryptionKey parameter, -it will be 16 byte long for 128 bit security; for 40 bit security only the first 5 bytes are used - -TODO: in pdf ver 1.5 and 1.6 the step 6 is different, should be implemented. See spec. - -*/ -bool PDFWriterImpl::computeEncryptionKey( const sal_uInt8* i_pOPW, const sal_uInt8* i_pUPW, vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, sal_Int32 i_nAccessPermissions ) -{ - bool bSuccess = true; - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - - rtlDigest aDigest = rtl_digest_createMD5(); - if( aDigest ) - { - //step 2 - rtlDigestError nError = rtl_digest_updateMD5( aDigest, i_pUPW, ENCRYPTED_PWD_SIZE ); - //step 3 - if( nError == rtl_Digest_E_None && ! io_rProperties.OValue.empty() ) - nError = rtl_digest_updateMD5( aDigest, &io_rProperties.OValue[0] , sal_Int32(io_rProperties.OValue.size()) ); - else - bSuccess = false; - //Step 4 - sal_uInt8 nPerm[4]; - - nPerm[0] = (sal_uInt8)i_nAccessPermissions; - nPerm[1] = (sal_uInt8)( i_nAccessPermissions >> 8 ); - nPerm[2] = (sal_uInt8)( i_nAccessPermissions >> 16 ); - nPerm[3] = (sal_uInt8)( i_nAccessPermissions >> 24 ); - - if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( aDigest, nPerm , sizeof( nPerm ) ); - - //step 5, get the document ID, binary form - if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( aDigest, &io_rProperties.DocumentIdentifier[0], sal_Int32(io_rProperties.DocumentIdentifier.size()) ); - //get the digest - if( nError == rtl_Digest_E_None ) - { - rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); - - //step 6, only if 128 bit - if( io_rProperties.Security128bit ) - { - for( sal_Int32 i = 0; i < 50; i++ ) - { - nError = rtl_digest_updateMD5( aDigest, &nMD5Sum, sizeof( nMD5Sum ) ); - if( nError != rtl_Digest_E_None ) - { - bSuccess = false; - break; - } - rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); - } - } - } - rtl_digest_destroyMD5( aDigest ); - } - else - bSuccess = false; - - //Step 7 - if( bSuccess ) - { - io_rProperties.EncryptionKey.resize( MAXIMUM_RC4_KEY_LENGTH ); - for( sal_Int32 i = 0; i < MD5_DIGEST_SIZE; i++ ) - io_rProperties.EncryptionKey[i] = nMD5Sum[i]; - } - else - io_rProperties.EncryptionKey.clear(); - - return bSuccess; -} - -/********************************** -Algorithm 3.3 Compute the encryption dictionary /O value, save into the class data member -the step numbers down here correspond to the ones in PDF v.1.4 specfication -*/ -bool PDFWriterImpl::computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, - const sal_uInt8* i_pPaddedUserPassword, - vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, - sal_Int32 i_nKeyLength, - sal_Int32 i_nRC4KeyLength - ) -{ - bool bSuccess = true; - - io_rProperties.OValue.resize( ENCRYPTED_PWD_SIZE ); - - rtlDigest aDigest = rtl_digest_createMD5(); - rtlCipher aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream ); - if( aDigest && aCipher) - { - //step 1 already done, data is in i_pPaddedOwnerPassword - //step 2 - - rtlDigestError nError = rtl_digest_updateMD5( aDigest, i_pPaddedOwnerPassword, ENCRYPTED_PWD_SIZE ); - if( nError == rtl_Digest_E_None ) - { - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - - rtl_digest_getMD5( aDigest, nMD5Sum, sizeof(nMD5Sum) ); -//step 3, only if 128 bit - if( io_rProperties.Security128bit ) - { - sal_Int32 i; - for( i = 0; i < 50; i++ ) - { - nError = rtl_digest_updateMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); - if( nError != rtl_Digest_E_None ) - { - bSuccess = false; - break; - } - rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); - } - } - //Step 4, the key is in nMD5Sum - //step 5 already done, data is in i_pPaddedUserPassword - //step 6 - rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, - nMD5Sum, i_nKeyLength , NULL, 0 ); - // encrypt the user password using the key set above - rtl_cipher_encodeARCFOUR( aCipher, i_pPaddedUserPassword, ENCRYPTED_PWD_SIZE, // the data to be encrypted - &io_rProperties.OValue[0], sal_Int32(io_rProperties.OValue.size()) ); //encrypted data - //Step 7, only if 128 bit - if( io_rProperties.Security128bit ) - { - sal_uInt32 i, y; - sal_uInt8 nLocalKey[ SECUR_128BIT_KEY ]; // 16 = 128 bit key - - for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1 - { - for( y = 0; y < sizeof( nLocalKey ); y++ ) - nLocalKey[y] = (sal_uInt8)( nMD5Sum[y] ^ i ); - - rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, - nLocalKey, SECUR_128BIT_KEY, NULL, 0 ); //destination data area, on init can be NULL - rtl_cipher_encodeARCFOUR( aCipher, &io_rProperties.OValue[0], sal_Int32(io_rProperties.OValue.size()), // the data to be encrypted - &io_rProperties.OValue[0], sal_Int32(io_rProperties.OValue.size()) ); // encrypted data, can be the same as the input, encrypt "in place" - //step 8, store in class data member - } - } - } - else - bSuccess = false; - } - else - bSuccess = false; - - if( aDigest ) - rtl_digest_destroyMD5( aDigest ); - if( aCipher ) - rtl_cipher_destroyARCFOUR( aCipher ); - - if( ! bSuccess ) - io_rProperties.OValue.clear(); - return bSuccess; -} - -/********************************** -Algorithms 3.4 and 3.5 Compute the encryption dictionary /U value, save into the class data member, revision 2 (40 bit) or 3 (128 bit) -*/ -bool PDFWriterImpl::computeUDictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, - const sal_uInt8* i_pPaddedUserPassword, - vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, - sal_Int32 i_nKeyLength, - sal_Int32 i_nRC4KeyLength, - sal_Int32 i_nAccessPermissions - ) -{ - bool bSuccess = true; - - io_rProperties.UValue.resize( ENCRYPTED_PWD_SIZE ); - - rtlDigest aDigest = rtl_digest_createMD5(); - rtlCipher aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream ); - if( aDigest && aCipher ) - { - //step 1, common to both 3.4 and 3.5 - if( computeEncryptionKey( i_pPaddedOwnerPassword, i_pPaddedUserPassword, io_rProperties, i_nAccessPermissions ) ) - { - if( io_rProperties.Security128bit == false ) - { - //3.4 - //step 2 and 3 - rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, - &io_rProperties.EncryptionKey[0], 5 , // key and key length - NULL, 0 ); //destination data area - // encrypt the user password using the key set above, save for later use - rtl_cipher_encodeARCFOUR( aCipher, s_nPadString, sizeof( s_nPadString ), // the data to be encrypted - &io_rProperties.UValue[0], sal_Int32(io_rProperties.UValue.size()) ); //encrypted data, stored in class data member - } - else - { - //or 3.5, for 128 bit security - //step6, initilize the last 16 bytes of the encrypted user password to 0 - for(sal_uInt32 i = MD5_DIGEST_SIZE; i < sal_uInt32(io_rProperties.UValue.size()); i++) - io_rProperties.UValue[i] = 0; - //step 2 - rtlDigestError nError = rtl_digest_updateMD5( aDigest, s_nPadString, sizeof( s_nPadString ) ); - //step 3 - if( nError == rtl_Digest_E_None ) - nError = rtl_digest_updateMD5( aDigest, &io_rProperties.DocumentIdentifier[0], sal_Int32(io_rProperties.DocumentIdentifier.size()) ); - else - bSuccess = false; - - sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; - rtl_digest_getMD5( aDigest, nMD5Sum, sizeof(nMD5Sum) ); - //Step 4 - rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, - &io_rProperties.EncryptionKey[0], SECUR_128BIT_KEY, NULL, 0 ); //destination data area - rtl_cipher_encodeARCFOUR( aCipher, nMD5Sum, sizeof( nMD5Sum ), // the data to be encrypted - &io_rProperties.UValue[0], sizeof( nMD5Sum ) ); //encrypted data, stored in class data member - //step 5 - sal_uInt32 i, y; - sal_uInt8 nLocalKey[SECUR_128BIT_KEY]; - - for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1 - { - for( y = 0; y < sizeof( nLocalKey ) ; y++ ) - nLocalKey[y] = (sal_uInt8)( io_rProperties.EncryptionKey[y] ^ i ); - - rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, - nLocalKey, SECUR_128BIT_KEY, // key and key length - NULL, 0 ); //destination data area, on init can be NULL - rtl_cipher_encodeARCFOUR( aCipher, &io_rProperties.UValue[0], SECUR_128BIT_KEY, // the data to be encrypted - &io_rProperties.UValue[0], SECUR_128BIT_KEY ); // encrypted data, can be the same as the input, encrypt "in place" - } - } - } - else - bSuccess = false; - } - else - bSuccess = false; - - if( aDigest ) - rtl_digest_destroyMD5( aDigest ); - if( aCipher ) - rtl_cipher_destroyARCFOUR( aCipher ); - - if( ! bSuccess ) - io_rProperties.UValue.clear(); - return bSuccess; -} - -/* end i12626 methods */ diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index dd75ca4f1a47..9006a104b576 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -58,6 +58,7 @@ class ImplFontSelectData; class ImplFontMetricData; class FontSubsetInfo; class ZCodec; +class EncHashTransporter; // the maximum password length #define ENCRYPTED_PWD_SIZE 32 @@ -1023,17 +1024,17 @@ i12626 pad a password according algorithm 3.2, step 1 */ static void padPassword( const rtl::OUString& i_rPassword, sal_uInt8* o_pPaddedPW ); /* algorithm 3.2: compute an encryption key */ - static bool computeEncryptionKey( const sal_uInt8* i_pOPW, const sal_uInt8* i_pUPW, + static bool computeEncryptionKey( EncHashTransporter*, vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, sal_Int32 i_nAccessPermissions ); /* algorithm 3.3: computing the encryption dictionary'ss owner password value ( /O ) */ static bool computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, const sal_uInt8* i_pPaddedUserPassword, - vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + std::vector< sal_uInt8 >& io_rOValue, sal_Int32 i_nKeyLength, sal_Int32 i_nRC4KeyLength ); /* algorithm 3.4 or 3.5: computing the encryption dictionary's user password value ( /U ) revision 2 or 3 of the standard security handler */ - static bool computeUDictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, const sal_uInt8* i_pPaddedUserPassword, + static bool computeUDictionaryValue( EncHashTransporter* i_pTransporter, vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, sal_Int32 i_nKeyLength, sal_Int32 i_nRC4KeyLength, sal_Int32 i_nAccessPermissions @@ -1047,15 +1048,15 @@ i12626 static sal_Int32 computeAccessPermissions( const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties, sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength ); void setupDocInfo(); + bool prepareEncryption( const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& ); public: - PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext ); + PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext, const com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >& ); ~PDFWriterImpl(); - static bool initEncryption( vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, - const rtl::OUString& i_rOwnerPassword, - const rtl::OUString& i_rUserPassword, - const vcl::PDFWriter::PDFDocInfo& i_rDocInfo - ); + static com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > + initEncryption( const rtl::OUString& i_rOwnerPassword, + const rtl::OUString& i_rUserPassword, + bool b128Bit ); /* for OutputDevice so the reference device can have a list * that contains only suitable fonts (subsettable or builtin) -- cgit From c73eb35e21eaf9a4c062da475af36b806741285b Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 27 Sep 2010 19:58:20 +0200 Subject: limit password life time --- filter/source/pdf/impdialog.cxx | 43 ++++++++++++++++++++++++++++------------- filter/source/pdf/impdialog.hxx | 11 +++++++---- filter/source/pdf/pdfexport.cxx | 22 +++++++++++++-------- 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index d24606d2b2b6..d542d47ec449 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -382,8 +382,8 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() nElementAdded--; // add the open password - aRet[ aRet.getLength() - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentOpenPassword" ) ); - aRet[ aRet.getLength() - nElementAdded ].Value <<= OUString( msUserPassword ); + aRet[ aRet.getLength() - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PreparedPasswords" ) ); + aRet[ aRet.getLength() - nElementAdded ].Value <<= mxPreparedPasswords; nElementAdded--; //the restrict permission flag (needed to have the scripting consistent with the dialog) @@ -1043,6 +1043,8 @@ ImpPDFTabSecurityPage::ImpPDFTabSecurityPage( Window* i_pParent, maCbEnableAccessibility( this, PDFFilterResId( CB_ENAB_ACCESS ) ), msUserPwdTitle( PDFFilterResId( STR_PDF_EXPORT_UDPWD ) ), + mbHaveOwnerPassword( false ), + mbHaveUserPassword( false ), msOwnerPwdTitle( PDFFilterResId( STR_PDF_EXPORT_ODPWD ) ) { @@ -1102,13 +1104,11 @@ void ImpPDFTabSecurityPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) { // please note that in PDF/A-1a mode even if this are copied back, // the security settings are forced disabled in PDFExport::Export - paParent->mbEncrypt = (msUserPassword.Len() > 0); - if( paParent->mbEncrypt ) - paParent->msUserPassword = msUserPassword; + paParent->mbEncrypt = mbHaveUserPassword; + paParent->mxPreparedPasswords = mxPreparedPasswords; - paParent->mbRestrictPermissions = (msOwnerPassword.Len() > 0); - if( msOwnerPassword.Len() > 0 ) - paParent->msOwnerPassword = msOwnerPassword; + paParent->mbRestrictPermissions = mbHaveOwnerPassword; + paParent->msOwnerPassword = msOwnerPassword; //verify print status paParent->mnPrint = 0; @@ -1192,8 +1192,26 @@ IMPL_LINK( ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl, void*, EMPTYARG ) aPwdDialog.AllowAsciiOnly(); if( aPwdDialog.Execute() == RET_OK ) //OK issued get password and set it { - msUserPassword = aPwdDialog.GetPassword(); - msOwnerPassword = aPwdDialog.GetPassword2(); + rtl::OUString aUserPW( aPwdDialog.GetPassword() ); + rtl::OUString aOwnerPW( aPwdDialog.GetPassword2() ); + + mbHaveUserPassword = (aUserPW.getLength() != 0); + mbHaveOwnerPassword = (aOwnerPW.getLength() != 0); + + mxPreparedPasswords = vcl::PDFWriter::InitEncryption( aOwnerPW, aUserPW, true ); + + // FIXME: used as parameter for hybrid PDF + if( mbHaveOwnerPassword ) + { + // force deep copy, not ref count + msOwnerPassword = rtl::OUString( aOwnerPW.getStr(), aOwnerPW.getLength() ); + } + else + msOwnerPassword = rtl::OUString(); + + // trash clear text passwords string memory + rtl_zeroMemory( (void*)aUserPW.getStr(), aUserPW.getLength() ); + rtl_zeroMemory( (void*)aOwnerPW.getStr(), aOwnerPW.getLength() ); } enablePermissionControls(); return 0; @@ -1201,10 +1219,9 @@ IMPL_LINK( ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl, void*, EMPTYARG ) void ImpPDFTabSecurityPage::enablePermissionControls() { - maFtUserPwd.SetText( (msUserPassword.Len() > 0 && IsEnabled()) ? maUserPwdSet : maUserPwdUnset ); - - sal_Bool bLocalEnable = (msOwnerPassword.Len() > 0) && IsEnabled(); + maFtUserPwd.SetText( (mbHaveUserPassword && IsEnabled()) ? maUserPwdSet : maUserPwdUnset ); + sal_Bool bLocalEnable = mbHaveOwnerPassword && IsEnabled(); maFtOwnerPwd.SetText( bLocalEnable ? maOwnerPwdSet : maOwnerPwdUnset ); maFlPrintPermissions.Enable( bLocalEnable ); diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index e450009ca822..743a41fcc032 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -126,14 +126,14 @@ protected: sal_Bool mbFirstPageLeft; sal_Bool mbEncrypt; - String msUserPassword; sal_Bool mbRestrictPermissions; - String msOwnerPassword; + rtl::OUString msOwnerPassword; sal_Int32 mnPrint; sal_Int32 mnChangesAllowed; sal_Bool mbCanCopyOrExtract; sal_Bool mbCanExtractForAccessibility; + com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > mxPreparedPasswords; sal_Bool mbIsRangeChecked; String msPageRange; @@ -340,12 +340,15 @@ class ImpPDFTabSecurityPage : public SfxTabPage CheckBox maCbEnableCopy; CheckBox maCbEnableAccessibility; - String msUserPassword; String msUserPwdTitle; - String msOwnerPassword; + bool mbHaveOwnerPassword; + bool mbHaveUserPassword; + rtl::OUString msOwnerPassword; String msOwnerPwdTitle; + com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > mxPreparedPasswords; + long nWidth; DECL_LINK( ClickmaPbSetPwdHdl, void* ); diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 77be4cc81415..4124c726fbfd 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -386,6 +386,7 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue Any aSelection; PDFWriter::PDFWriterContext aContext; rtl::OUString aOpenPassword, aPermissionPassword; + Reference< beans::XMaterialHolder > xEnc; // getting the string for the creator @@ -511,6 +512,8 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue rFilterData[ nData ].Value >>= mbRestrictPermissions; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PermissionPassword" ) ) ) rFilterData[ nData ].Value >>= aPermissionPassword; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PreparedPasswords" ) ) ) + rFilterData[ nData ].Value >>= xEnc; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Printing" ) ) ) rFilterData[ nData ].Value >>= mnPrintAllowed; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Changes" ) ) ) @@ -545,14 +548,17 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue break; case 1: aContext.Version = PDFWriter::PDF_A_1; -//force the tagged PDF as well + //force the tagged PDF as well mbUseTaggedPDF = sal_True; -//force embedding of standard fonts + //force embedding of standard fonts mbEmbedStandardFonts = sal_True; -//force disabling of form conversion + //force disabling of form conversion mbExportFormFields = sal_False; -// PDF/A does not allow transparencies + // PDF/A does not allow transparencies mbRemoveTransparencies = sal_True; + // no encryption + mbEncrypt = sal_False; + xEnc.clear(); break; } @@ -636,7 +642,7 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue //set check for permission change password // if not enabled and no permission password, force permissions to default as if PDF where without encryption - if( mbRestrictPermissions && aPermissionPassword.getLength() > 0 ) + if( mbRestrictPermissions && (xEnc.is() || aPermissionPassword.getLength() > 0) ) { mbEncrypt = sal_True; //permission set as desired, done after @@ -686,8 +692,8 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue aContext.Encryption.CanCopyOrExtract = mbCanCopyOrExtract; aContext.Encryption.CanExtractForAccessibility = mbCanExtractForAccessibility; - if( mbEncrypt ) - PDFWriter::InitEncryption( aContext.Encryption, aPermissionPassword, aOpenPassword, aContext.DocumentInfo ); + if( mbEncrypt && ! xEnc.is() ) + xEnc = PDFWriter::InitEncryption( aPermissionPassword, aOpenPassword, aContext.Encryption.Security128bit ); } /* * FIXME: the entries are only implicitly defined by the resource file. Should there @@ -751,7 +757,7 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue //<--- } // all context data set, time to create the printing device - PDFWriter* pPDFWriter = new PDFWriter( aContext ); + PDFWriter* pPDFWriter = new PDFWriter( aContext, xEnc ); OutputDevice* pOut = pPDFWriter->GetReferenceDevice(); vcl::PDFExtOutDevData* pPDFExtOutDevData = NULL; -- cgit From 40d960cbdba0dbd445d624f62a523b7e78d5f5c9 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 28 Sep 2010 16:18:13 +0200 Subject: divide pdfwriter_impl.cxx --- vcl/source/gdi/pdfwriter_impl2.cxx | 544 +++++++++++++++++++++++++++++++++++++ 1 file changed, 544 insertions(+) create mode 100644 vcl/source/gdi/pdfwriter_impl2.cxx diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx new file mode 100644 index 000000000000..c7996e3935b8 --- /dev/null +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -0,0 +1,544 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include "pdfwriter_impl.hxx" + +#include "cppuhelper/implbase1.hxx" + +#include + +using namespace vcl; +using namespace rtl; +using namespace com::sun::star; + +/* a crutch to transport an rtlDigest safely though UNO API + this is needed for the PDF export dialog, which otherwise would have to pass + clear text passwords down till they can be used in PDFWriter. Unfortunately + the MD5 sum of the password (which is needed to create the PDF encryption key) + is not sufficient, since an rtl MD5 digest cannot be created in an arbitrary state + which would be needed in PDFWriterImpl::computeEncryptionKey. +*/ +class EncHashTransporter : public cppu::WeakImplHelper1 < com::sun::star::beans::XMaterialHolder > +{ + rtlDigest maUDigest; + sal_IntPtr maID; + std::vector< sal_uInt8 > maOValue; + + static std::map< sal_IntPtr, EncHashTransporter* > sTransporters; +public: + EncHashTransporter() + : maUDigest( rtl_digest_createMD5() ) + { + maID = reinterpret_cast< sal_IntPtr >(this); + while( sTransporters.find( maID ) != sTransporters.end() ) // paranoia mode + maID++; + sTransporters[ maID ] = this; + } + + virtual ~EncHashTransporter() + { + sTransporters.erase( maID ); + if( maUDigest ) + rtl_digest_destroyMD5( maUDigest ); + OSL_TRACE( "EncHashTransporter freed\n" ); + } + + rtlDigest getUDigest() const { return maUDigest; }; + std::vector< sal_uInt8 >& getOValue() { return maOValue; } + void invalidate() + { + if( maUDigest ) + { + rtl_digest_destroyMD5( maUDigest ); + maUDigest = NULL; + } + } + + // XMaterialHolder + virtual uno::Any SAL_CALL getMaterial() throw() + { + return uno::makeAny( sal_Int64(maID) ); + } + + static EncHashTransporter* getEncHashTransporter( const uno::Reference< beans::XMaterialHolder >& ); + +}; + +std::map< sal_IntPtr, EncHashTransporter* > EncHashTransporter::sTransporters; + +EncHashTransporter* EncHashTransporter::getEncHashTransporter( const uno::Reference< beans::XMaterialHolder >& xRef ) +{ + EncHashTransporter* pResult = NULL; + if( xRef.is() ) + { + uno::Any aMat( xRef->getMaterial() ); + sal_Int64 nMat = 0; + if( aMat >>= nMat ) + { + std::map< sal_IntPtr, EncHashTransporter* >::iterator it = sTransporters.find( static_cast(nMat) ); + if( it != sTransporters.end() ) + pResult = it->second; + } + } + return pResult; +} + +sal_Bool PDFWriterImpl::checkEncryptionBufferSize( register sal_Int32 newSize ) +{ + if( m_nEncryptionBufferSize < newSize ) + { + /* reallocate the buffer, the used function allocate as rtl_allocateMemory + if the pointer parameter is NULL */ + m_pEncryptionBuffer = (sal_uInt8*)rtl_reallocateMemory( m_pEncryptionBuffer, newSize ); + if( m_pEncryptionBuffer ) + m_nEncryptionBufferSize = newSize; + else + m_nEncryptionBufferSize = 0; + } + return ( m_nEncryptionBufferSize != 0 ); +} + +void PDFWriterImpl::checkAndEnableStreamEncryption( register sal_Int32 nObject ) +{ + if( m_aContext.Encryption.Encrypt() ) + { + m_bEncryptThisStream = true; + sal_Int32 i = m_nKeyLength; + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)nObject; + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 8 ); + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 16 ); + //the other location of m_nEncryptionKey are already set to 0, our fixed generation number + // do the MD5 hash + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + // the i+2 to take into account the generation number, always zero + rtl_digest_MD5( &m_aContext.Encryption.EncryptionKey[0], i+2, nMD5Sum, sizeof(nMD5Sum) ); + // initialize the RC4 with the key + // key legth: see algoritm 3.1, step 4: (N+5) max 16 + rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 ); + } +} + +void PDFWriterImpl::enableStringEncryption( register sal_Int32 nObject ) +{ + if( m_aContext.Encryption.Encrypt() ) + { + sal_Int32 i = m_nKeyLength; + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)nObject; + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 8 ); + m_aContext.Encryption.EncryptionKey[i++] = (sal_uInt8)( nObject >> 16 ); + //the other location of m_nEncryptionKey are already set to 0, our fixed generation number + // do the MD5 hash + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + // the i+2 to take into account the generation number, always zero + rtl_digest_MD5( &m_aContext.Encryption.EncryptionKey[0], i+2, nMD5Sum, sizeof(nMD5Sum) ); + // initialize the RC4 with the key + // key legth: see algoritm 3.1, step 4: (N+5) max 16 + rtl_cipher_initARCFOUR( m_aCipher, rtl_Cipher_DirectionEncode, nMD5Sum, m_nRC4KeyLength, NULL, 0 ); + } +} + +/* init the encryption engine +1. init the document id, used both for building the document id and for building the encryption key(s) +2. build the encryption key following algorithms described in the PDF specification + */ +uno::Reference< beans::XMaterialHolder > PDFWriterImpl::initEncryption( const rtl::OUString& i_rOwnerPassword, + const rtl::OUString& i_rUserPassword, + bool b128Bit + ) +{ + uno::Reference< beans::XMaterialHolder > xResult; + if( i_rOwnerPassword.getLength() || i_rUserPassword.getLength() ) + { + EncHashTransporter* pTransporter = new EncHashTransporter; + xResult = pTransporter; + + // get padded passwords + sal_uInt8 aPadUPW[ENCRYPTED_PWD_SIZE], aPadOPW[ENCRYPTED_PWD_SIZE]; + padPassword( i_rOwnerPassword.getLength() ? i_rOwnerPassword : i_rUserPassword, aPadOPW ); + padPassword( i_rUserPassword, aPadUPW ); + sal_Int32 nKeyLength = SECUR_40BIT_KEY, nRC4KeyLength = SECUR_40BIT_KEY+5; + if( b128Bit ) + { + nKeyLength = SECUR_128BIT_KEY; + nRC4KeyLength = 16; + } + + if( computeODictionaryValue( aPadOPW, aPadUPW, pTransporter->getOValue(), nKeyLength, nRC4KeyLength ) ) + { + rtlDigest aDig = pTransporter->getUDigest(); + if( rtl_digest_updateMD5( aDig, aPadUPW, ENCRYPTED_PWD_SIZE ) != rtl_Digest_E_None ) + xResult.clear(); + } + else + xResult.clear(); + + // trash temporary padded cleartext PWDs + rtl_zeroMemory( aPadOPW, sizeof(aPadOPW) ); + rtl_zeroMemory( aPadUPW, sizeof(aPadUPW) ); + + } + return xResult; +} + +bool PDFWriterImpl::prepareEncryption( const uno::Reference< beans::XMaterialHolder >& xEnc ) +{ + bool bSuccess = false; + EncHashTransporter* pTransporter = EncHashTransporter::getEncHashTransporter( xEnc ); + if( pTransporter ) + { + sal_Int32 nKeyLength = 0, nRC4KeyLength = 0; + sal_Int32 nAccessPermissions = computeAccessPermissions( m_aContext.Encryption, nKeyLength, nRC4KeyLength ); + m_aContext.Encryption.OValue = pTransporter->getOValue(); + bSuccess = computeUDictionaryValue( pTransporter, m_aContext.Encryption, nKeyLength, nRC4KeyLength, nAccessPermissions ); + } + if( ! bSuccess ) + { + m_aContext.Encryption.OValue.clear(); + m_aContext.Encryption.UValue.clear(); + m_aContext.Encryption.EncryptionKey.clear(); + } + return bSuccess; +} + +sal_Int32 PDFWriterImpl::computeAccessPermissions( const vcl::PDFWriter::PDFEncryptionProperties& i_rProperties, + sal_Int32& o_rKeyLength, sal_Int32& o_rRC4KeyLength ) +{ + /* + 2) compute the access permissions, in numerical form + + the default value depends on the revision 2 (40 bit) or 3 (128 bit security): + - for 40 bit security the unused bit must be set to 1, since they are not used + - for 128 bit security the same bit must be preset to 0 and set later if needed + according to the table 3.15, pdf v 1.4 */ + sal_Int32 nAccessPermissions = ( i_rProperties.Security128bit ) ? 0xfffff0c0 : 0xffffffc0 ; + + /* check permissions for 40 bit security case */ + nAccessPermissions |= ( i_rProperties.CanPrintTheDocument ) ? 1 << 2 : 0; + nAccessPermissions |= ( i_rProperties.CanModifyTheContent ) ? 1 << 3 : 0; + nAccessPermissions |= ( i_rProperties.CanCopyOrExtract ) ? 1 << 4 : 0; + nAccessPermissions |= ( i_rProperties.CanAddOrModify ) ? 1 << 5 : 0; + o_rKeyLength = SECUR_40BIT_KEY; + o_rRC4KeyLength = SECUR_40BIT_KEY+5; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 5 + + if( i_rProperties.Security128bit ) + { + o_rKeyLength = SECUR_128BIT_KEY; + o_rRC4KeyLength = 16; // for this value see PDF spec v 1.4, algorithm 3.1 step 4, where n is 16, thus maximum + // permitted value is 16 + nAccessPermissions |= ( i_rProperties.CanFillInteractive ) ? 1 << 8 : 0; + nAccessPermissions |= ( i_rProperties.CanExtractForAccessibility ) ? 1 << 9 : 0; + nAccessPermissions |= ( i_rProperties.CanAssemble ) ? 1 << 10 : 0; + nAccessPermissions |= ( i_rProperties.CanPrintFull ) ? 1 << 11 : 0; + } + return nAccessPermissions; +} + +/************************************************************* +begin i12626 methods + +Implements Algorithm 3.2, step 1 only +*/ +void PDFWriterImpl::padPassword( const rtl::OUString& i_rPassword, sal_uInt8* o_pPaddedPW ) +{ + // get ansi-1252 version of the password string CHECKIT ! i12626 + rtl::OString aString( rtl::OUStringToOString( i_rPassword, RTL_TEXTENCODING_MS_1252 ) ); + + //copy the string to the target + sal_Int32 nToCopy = ( aString.getLength() < ENCRYPTED_PWD_SIZE ) ? aString.getLength() : ENCRYPTED_PWD_SIZE; + sal_Int32 nCurrentChar; + + for( nCurrentChar = 0; nCurrentChar < nToCopy; nCurrentChar++ ) + o_pPaddedPW[nCurrentChar] = (sal_uInt8)( aString.getStr()[nCurrentChar] ); + + //pad it with standard byte string + sal_Int32 i,y; + for( i = nCurrentChar, y = 0 ; i < ENCRYPTED_PWD_SIZE; i++, y++ ) + o_pPaddedPW[i] = s_nPadString[y]; + + // trash memory of temporary clear text password + rtl_zeroMemory( (sal_Char*)aString.getStr(), aString.getLength() ); +} + +/********************************** +Algorithm 3.2 Compute the encryption key used + +step 1 should already be done before calling, the paThePaddedPassword parameter should contain +the padded password and must be 32 byte long, the encryption key is returned into the paEncryptionKey parameter, +it will be 16 byte long for 128 bit security; for 40 bit security only the first 5 bytes are used + +TODO: in pdf ver 1.5 and 1.6 the step 6 is different, should be implemented. See spec. + +*/ +bool PDFWriterImpl::computeEncryptionKey( EncHashTransporter* i_pTransporter, vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, sal_Int32 i_nAccessPermissions ) +{ + bool bSuccess = true; + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + + // transporter contains an MD5 digest with the padded user password already + rtlDigest aDigest = i_pTransporter->getUDigest(); + rtlDigestError nError = rtl_Digest_E_None; + if( aDigest ) + { + //step 3 + if( ! io_rProperties.OValue.empty() ) + nError = rtl_digest_updateMD5( aDigest, &io_rProperties.OValue[0] , sal_Int32(io_rProperties.OValue.size()) ); + else + bSuccess = false; + //Step 4 + sal_uInt8 nPerm[4]; + + nPerm[0] = (sal_uInt8)i_nAccessPermissions; + nPerm[1] = (sal_uInt8)( i_nAccessPermissions >> 8 ); + nPerm[2] = (sal_uInt8)( i_nAccessPermissions >> 16 ); + nPerm[3] = (sal_uInt8)( i_nAccessPermissions >> 24 ); + + if( nError == rtl_Digest_E_None ) + nError = rtl_digest_updateMD5( aDigest, nPerm , sizeof( nPerm ) ); + + //step 5, get the document ID, binary form + if( nError == rtl_Digest_E_None ) + nError = rtl_digest_updateMD5( aDigest, &io_rProperties.DocumentIdentifier[0], sal_Int32(io_rProperties.DocumentIdentifier.size()) ); + //get the digest + if( nError == rtl_Digest_E_None ) + { + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); + + //step 6, only if 128 bit + if( io_rProperties.Security128bit ) + { + for( sal_Int32 i = 0; i < 50; i++ ) + { + nError = rtl_digest_updateMD5( aDigest, &nMD5Sum, sizeof( nMD5Sum ) ); + if( nError != rtl_Digest_E_None ) + { + bSuccess = false; + break; + } + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); + } + } + } + } + else + bSuccess = false; + + i_pTransporter->invalidate(); + + //Step 7 + if( bSuccess ) + { + io_rProperties.EncryptionKey.resize( MAXIMUM_RC4_KEY_LENGTH ); + for( sal_Int32 i = 0; i < MD5_DIGEST_SIZE; i++ ) + io_rProperties.EncryptionKey[i] = nMD5Sum[i]; + } + else + io_rProperties.EncryptionKey.clear(); + + return bSuccess; +} + +/********************************** +Algorithm 3.3 Compute the encryption dictionary /O value, save into the class data member +the step numbers down here correspond to the ones in PDF v.1.4 specfication +*/ +bool PDFWriterImpl::computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, + const sal_uInt8* i_pPaddedUserPassword, + std::vector< sal_uInt8 >& io_rOValue, + sal_Int32 i_nKeyLength, + sal_Int32 i_nRC4KeyLength + ) +{ + bool bSuccess = true; + + io_rOValue.resize( ENCRYPTED_PWD_SIZE ); + + rtlDigest aDigest = rtl_digest_createMD5(); + rtlCipher aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream ); + if( aDigest && aCipher) + { + //step 1 already done, data is in i_pPaddedOwnerPassword + //step 2 + + rtlDigestError nError = rtl_digest_updateMD5( aDigest, i_pPaddedOwnerPassword, ENCRYPTED_PWD_SIZE ); + if( nError == rtl_Digest_E_None ) + { + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof(nMD5Sum) ); +//step 3, only if 128 bit + if( i_nKeyLength == SECUR_128BIT_KEY ) + { + sal_Int32 i; + for( i = 0; i < 50; i++ ) + { + nError = rtl_digest_updateMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); + if( nError != rtl_Digest_E_None ) + { + bSuccess = false; + break; + } + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof( nMD5Sum ) ); + } + } + //Step 4, the key is in nMD5Sum + //step 5 already done, data is in i_pPaddedUserPassword + //step 6 + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + nMD5Sum, i_nKeyLength , NULL, 0 ); + // encrypt the user password using the key set above + rtl_cipher_encodeARCFOUR( aCipher, i_pPaddedUserPassword, ENCRYPTED_PWD_SIZE, // the data to be encrypted + &io_rOValue[0], sal_Int32(io_rOValue.size()) ); //encrypted data + //Step 7, only if 128 bit + if( i_nKeyLength == SECUR_128BIT_KEY ) + { + sal_uInt32 i, y; + sal_uInt8 nLocalKey[ SECUR_128BIT_KEY ]; // 16 = 128 bit key + + for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1 + { + for( y = 0; y < sizeof( nLocalKey ); y++ ) + nLocalKey[y] = (sal_uInt8)( nMD5Sum[y] ^ i ); + + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + nLocalKey, SECUR_128BIT_KEY, NULL, 0 ); //destination data area, on init can be NULL + rtl_cipher_encodeARCFOUR( aCipher, &io_rOValue[0], sal_Int32(io_rOValue.size()), // the data to be encrypted + &io_rOValue[0], sal_Int32(io_rOValue.size()) ); // encrypted data, can be the same as the input, encrypt "in place" + //step 8, store in class data member + } + } + } + else + bSuccess = false; + } + else + bSuccess = false; + + if( aDigest ) + rtl_digest_destroyMD5( aDigest ); + if( aCipher ) + rtl_cipher_destroyARCFOUR( aCipher ); + + if( ! bSuccess ) + io_rOValue.clear(); + return bSuccess; +} + +/********************************** +Algorithms 3.4 and 3.5 Compute the encryption dictionary /U value, save into the class data member, revision 2 (40 bit) or 3 (128 bit) +*/ +bool PDFWriterImpl::computeUDictionaryValue( EncHashTransporter* i_pTransporter, + vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, + sal_Int32 i_nKeyLength, + sal_Int32 i_nRC4KeyLength, + sal_Int32 i_nAccessPermissions + ) +{ + bool bSuccess = true; + + io_rProperties.UValue.resize( ENCRYPTED_PWD_SIZE ); + + rtlDigest aDigest = rtl_digest_createMD5(); + rtlCipher aCipher = rtl_cipher_createARCFOUR( rtl_Cipher_ModeStream ); + if( aDigest && aCipher ) + { + //step 1, common to both 3.4 and 3.5 + if( computeEncryptionKey( i_pTransporter, io_rProperties, i_nAccessPermissions ) ) + { + // prepare encryption key for object + for( sal_Int32 i = i_nKeyLength, y = 0; y < 5 ; y++ ) + io_rProperties.EncryptionKey[i++] = 0; + + if( io_rProperties.Security128bit == false ) + { + //3.4 + //step 2 and 3 + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + &io_rProperties.EncryptionKey[0], 5 , // key and key length + NULL, 0 ); //destination data area + // encrypt the user password using the key set above, save for later use + rtl_cipher_encodeARCFOUR( aCipher, s_nPadString, sizeof( s_nPadString ), // the data to be encrypted + &io_rProperties.UValue[0], sal_Int32(io_rProperties.UValue.size()) ); //encrypted data, stored in class data member + } + else + { + //or 3.5, for 128 bit security + //step6, initilize the last 16 bytes of the encrypted user password to 0 + for(sal_uInt32 i = MD5_DIGEST_SIZE; i < sal_uInt32(io_rProperties.UValue.size()); i++) + io_rProperties.UValue[i] = 0; + //step 2 + rtlDigestError nError = rtl_digest_updateMD5( aDigest, s_nPadString, sizeof( s_nPadString ) ); + //step 3 + if( nError == rtl_Digest_E_None ) + nError = rtl_digest_updateMD5( aDigest, &io_rProperties.DocumentIdentifier[0], sal_Int32(io_rProperties.DocumentIdentifier.size()) ); + else + bSuccess = false; + + sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ]; + rtl_digest_getMD5( aDigest, nMD5Sum, sizeof(nMD5Sum) ); + //Step 4 + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + &io_rProperties.EncryptionKey[0], SECUR_128BIT_KEY, NULL, 0 ); //destination data area + rtl_cipher_encodeARCFOUR( aCipher, nMD5Sum, sizeof( nMD5Sum ), // the data to be encrypted + &io_rProperties.UValue[0], sizeof( nMD5Sum ) ); //encrypted data, stored in class data member + //step 5 + sal_uInt32 i, y; + sal_uInt8 nLocalKey[SECUR_128BIT_KEY]; + + for( i = 1; i <= 19; i++ ) // do it 19 times, start with 1 + { + for( y = 0; y < sizeof( nLocalKey ) ; y++ ) + nLocalKey[y] = (sal_uInt8)( io_rProperties.EncryptionKey[y] ^ i ); + + rtl_cipher_initARCFOUR( aCipher, rtl_Cipher_DirectionEncode, + nLocalKey, SECUR_128BIT_KEY, // key and key length + NULL, 0 ); //destination data area, on init can be NULL + rtl_cipher_encodeARCFOUR( aCipher, &io_rProperties.UValue[0], SECUR_128BIT_KEY, // the data to be encrypted + &io_rProperties.UValue[0], SECUR_128BIT_KEY ); // encrypted data, can be the same as the input, encrypt "in place" + } + } + } + else + bSuccess = false; + } + else + bSuccess = false; + + if( aDigest ) + rtl_digest_destroyMD5( aDigest ); + if( aCipher ) + rtl_cipher_destroyARCFOUR( aCipher ); + + if( ! bSuccess ) + io_rProperties.UValue.clear(); + return bSuccess; +} + +/* end i12626 methods */ + -- cgit From ffa480fecf420f2a667538950defa87b2e562185 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 28 Sep 2010 18:39:54 +0200 Subject: remove warning --- vcl/source/gdi/pdfwriter_impl.hxx | 4 ++-- vcl/source/gdi/pdfwriter_impl2.cxx | 13 ++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 9006a104b576..212a45c77033 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -1031,12 +1031,12 @@ i12626 /* algorithm 3.3: computing the encryption dictionary'ss owner password value ( /O ) */ static bool computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, const sal_uInt8* i_pPaddedUserPassword, std::vector< sal_uInt8 >& io_rOValue, - sal_Int32 i_nKeyLength, sal_Int32 i_nRC4KeyLength + sal_Int32 i_nKeyLength ); /* algorithm 3.4 or 3.5: computing the encryption dictionary's user password value ( /U ) revision 2 or 3 of the standard security handler */ static bool computeUDictionaryValue( EncHashTransporter* i_pTransporter, vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, - sal_Int32 i_nKeyLength, sal_Int32 i_nRC4KeyLength, + sal_Int32 i_nKeyLength, sal_Int32 i_nAccessPermissions ); diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index c7996e3935b8..c0e9d905db3b 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -183,14 +183,11 @@ uno::Reference< beans::XMaterialHolder > PDFWriterImpl::initEncryption( const rt sal_uInt8 aPadUPW[ENCRYPTED_PWD_SIZE], aPadOPW[ENCRYPTED_PWD_SIZE]; padPassword( i_rOwnerPassword.getLength() ? i_rOwnerPassword : i_rUserPassword, aPadOPW ); padPassword( i_rUserPassword, aPadUPW ); - sal_Int32 nKeyLength = SECUR_40BIT_KEY, nRC4KeyLength = SECUR_40BIT_KEY+5; + sal_Int32 nKeyLength = SECUR_40BIT_KEY; if( b128Bit ) - { nKeyLength = SECUR_128BIT_KEY; - nRC4KeyLength = 16; - } - if( computeODictionaryValue( aPadOPW, aPadUPW, pTransporter->getOValue(), nKeyLength, nRC4KeyLength ) ) + if( computeODictionaryValue( aPadOPW, aPadUPW, pTransporter->getOValue(), nKeyLength ) ) { rtlDigest aDig = pTransporter->getUDigest(); if( rtl_digest_updateMD5( aDig, aPadUPW, ENCRYPTED_PWD_SIZE ) != rtl_Digest_E_None ) @@ -216,7 +213,7 @@ bool PDFWriterImpl::prepareEncryption( const uno::Reference< beans::XMaterialHol sal_Int32 nKeyLength = 0, nRC4KeyLength = 0; sal_Int32 nAccessPermissions = computeAccessPermissions( m_aContext.Encryption, nKeyLength, nRC4KeyLength ); m_aContext.Encryption.OValue = pTransporter->getOValue(); - bSuccess = computeUDictionaryValue( pTransporter, m_aContext.Encryption, nKeyLength, nRC4KeyLength, nAccessPermissions ); + bSuccess = computeUDictionaryValue( pTransporter, m_aContext.Encryption, nKeyLength, nAccessPermissions ); } if( ! bSuccess ) { @@ -371,8 +368,7 @@ the step numbers down here correspond to the ones in PDF v.1.4 specfication bool PDFWriterImpl::computeODictionaryValue( const sal_uInt8* i_pPaddedOwnerPassword, const sal_uInt8* i_pPaddedUserPassword, std::vector< sal_uInt8 >& io_rOValue, - sal_Int32 i_nKeyLength, - sal_Int32 i_nRC4KeyLength + sal_Int32 i_nKeyLength ) { bool bSuccess = true; @@ -456,7 +452,6 @@ Algorithms 3.4 and 3.5 Compute the encryption dictionary /U value, save into th bool PDFWriterImpl::computeUDictionaryValue( EncHashTransporter* i_pTransporter, vcl::PDFWriter::PDFEncryptionProperties& io_rProperties, sal_Int32 i_nKeyLength, - sal_Int32 i_nRC4KeyLength, sal_Int32 i_nAccessPermissions ) { -- cgit From ed7ea296b2f7338477806e25666a1f85e8e8ace2 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 28 Sep 2010 19:34:49 +0200 Subject: fix a warning --- vcl/source/window/wpropset.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/source/window/wpropset.cxx b/vcl/source/window/wpropset.cxx index 98c8a5b1dcfb..4aaa3f987b77 100644 --- a/vcl/source/window/wpropset.cxx +++ b/vcl/source/window/wpropset.cxx @@ -73,6 +73,7 @@ public: { } + using cppu::WeakComponentImplHelperBase::disposing; virtual void SAL_CALL disposing( const lang::EventObject& ) throw() { } -- cgit From 1aaca7da01b830bd5bb4e6e4001c1cacdd77d243 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 29 Sep 2010 11:02:42 +0200 Subject: add exception file --- sfx2/source/dialog/makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 sfx2/source/dialog/makefile.mk diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk old mode 100755 new mode 100644 index 4c56cd683e34..572053557e00 --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -46,6 +46,7 @@ EXCEPTIONSFILES=\ $(SLO)$/templdlg.obj \ $(SLO)$/dinfdlg.obj \ $(SLO)$/dockwin.obj \ + $(SLO)$/passwd.obj \ $(SLO)$/taskpane.obj SLOFILES =\ @@ -58,7 +59,6 @@ SLOFILES =\ $(SLO)$/mgetempl.obj \ $(SLO)$/navigat.obj \ $(SLO)$/newstyle.obj \ - $(SLO)$/passwd.obj \ $(SLO)$/printopt.obj \ $(SLO)$/sfxdlg.obj \ $(SLO)$/splitwin.obj \ -- cgit From 9c90c77200562328c226f35cb14ee6ae9a135b71 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Wed, 29 Sep 2010 14:35:52 +0200 Subject: fix a warning --- vcl/inc/vcl/window.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 vcl/inc/vcl/window.hxx diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx old mode 100644 new mode 100755 index d3f2ec901cf4..be783f5457c4 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -97,7 +97,7 @@ namespace com { namespace sun { namespace star { namespace beans { - class PropertyValue; + struct PropertyValue; }}}} namespace com { -- cgit From a83c7faceec94f6062481c9977e92621f3b71060 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 1 Oct 2010 17:36:06 +0200 Subject: pl08: #i111050# use interaction handler for export warnings, this may be suppressed by a custom interaction handler --- officecfg/registry/data/org/openoffice/Interaction.xcu | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/officecfg/registry/data/org/openoffice/Interaction.xcu b/officecfg/registry/data/org/openoffice/Interaction.xcu index afd78005fb71..cc207de626d2 100644 --- a/officecfg/registry/data/org/openoffice/Interaction.xcu +++ b/officecfg/registry/data/org/openoffice/Interaction.xcu @@ -52,5 +52,17 @@ com.sun.star.comp.dbaccess.DatabaseInteractionHandler + + + + + named-and-derived + + + + + com.sun.star.filter.pdfexport.PDFExportInteractionHandler + + -- cgit From 2e0f29fa0ec42a404b40fa3fc25f669dc8923fb2 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 1 Oct 2010 17:36:06 +0200 Subject: pl08: #i111050# use interaction handler for export warnings, this may be suppressed by a custom interaction handler --- filter/source/pdf/makefile.mk | 1 + filter/source/pdf/pdfexport.cxx | 136 ++++++++++++++++++++++++++----------- filter/source/pdf/pdfexport.hxx | 6 +- filter/source/pdf/pdffilter.cxx | 5 +- filter/source/pdf/pdffilter.hxx | 1 + filter/source/pdf/pdfinteract.cxx | 137 ++++++++++++++++++++++++++++++++++++++ filter/source/pdf/pdfinteract.hxx | 91 +++++++++++++++++++++++++ filter/source/pdf/pdfuno.cxx | 15 +++++ 8 files changed, 351 insertions(+), 41 deletions(-) create mode 100644 filter/source/pdf/pdfinteract.cxx create mode 100644 filter/source/pdf/pdfinteract.hxx diff --git a/filter/source/pdf/makefile.mk b/filter/source/pdf/makefile.mk index edf3147a822c..11ad638b0527 100644 --- a/filter/source/pdf/makefile.mk +++ b/filter/source/pdf/makefile.mk @@ -47,6 +47,7 @@ SLOFILES= $(SLO)$/pdfuno.obj \ $(SLO)$/pdfdialog.obj \ $(SLO)$/impdialog.obj \ $(SLO)$/pdffilter.obj \ + $(SLO)$/pdfinteract.obj \ $(SLO)$/pdfexport.obj # --- Library ----------------------------------- diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 4124c726fbfd..1d01ffdb5212 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -32,46 +32,53 @@ #include "impdialog.hxx" #include "pdf.hrc" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "tools/urlobj.hxx" +#include "tools/fract.hxx" +#include "tools/poly.hxx" +#include "vcl/mapmod.hxx" +#include "vcl/virdev.hxx" +#include "vcl/metaact.hxx" +#include "vcl/gdimtf.hxx" +#include "vcl/jobset.hxx" +#include "vcl/salbtype.hxx" +#include "vcl/bmpacc.hxx" #include "vcl/svapp.hxx" -#include -#include -#include -#include -#include -#include -#include +#include "toolkit/awt/vclxdevice.hxx" +#include "unotools/localfilehelper.hxx" +#include "unotools/processfactory.hxx" +#include "svtools/FilterConfigItem.hxx" +#include "svtools/filter.hxx" +#include "svl/solar.hrc" +#include "comphelper/string.hxx" #include "basegfx/polygon/b2dpolygon.hxx" #include "basegfx/polygon/b2dpolypolygon.hxx" #include "basegfx/polygon/b2dpolygontools.hxx" -#include // only for testing of relative saving options in PDF - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "unotools/saveopt.hxx" // only for testing of relative saving options in PDF + +#include "vcl/graphictools.hxx" +#include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/awt/Rectangle.hpp" +#include "com/sun/star/awt/XDevice.hpp" +#include "com/sun/star/util/MeasureUnit.hpp" +#include "com/sun/star/frame/XModel.hpp" +#include "com/sun/star/frame/XModuleManager.hpp" +#include "com/sun/star/frame/XStorable.hpp" +#include "com/sun/star/frame/XController.hpp" +#include "com/sun/star/document/XDocumentProperties.hpp" +#include "com/sun/star/document/XDocumentPropertiesSupplier.hpp" +#include "com/sun/star/container/XNameAccess.hpp" +#include "com/sun/star/view/XViewSettingsSupplier.hpp" +#include "com/sun/star/task/XInteractionRequest.hpp" +#include "com/sun/star/task/PDFExportException.hpp" + +#include "unotools/configmgr.hxx" +#include "cppuhelper/exc_hlp.hxx" +#include "cppuhelper/compbase1.hxx" +#include "cppuhelper/basemutex.hxx" + +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/drawing/XShapes.hpp" using namespace ::rtl; using namespace ::vcl; @@ -85,10 +92,14 @@ using namespace ::com::sun::star::view; // - PDFExport - // ------------- -PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, Reference< task::XStatusIndicator >& rxStatusIndicator, const Reference< lang::XMultiServiceFactory >& xFactory ) : +PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, + const Reference< task::XStatusIndicator >& rxStatusIndicator, + const Reference< task::XInteractionHandler >& rxIH, + const Reference< lang::XMultiServiceFactory >& xFactory ) : mxSrcDoc ( rxSrcDoc ), mxMSF ( xFactory ), mxStatusIndicator ( rxStatusIndicator ), + mxIH ( rxIH ), mbUseTaggedPDF ( sal_False ), mnPDFTypeSelection ( 0 ), mbExportNotes ( sal_True ), @@ -917,12 +928,59 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue return bRet; } +namespace +{ + +typedef cppu::WeakComponentImplHelper1< task::XInteractionRequest > PDFErrorRequestBase; + +class PDFErrorRequest : private cppu::BaseMutex, + public PDFErrorRequestBase +{ + task::PDFExportException maExc; +public: + PDFErrorRequest( const task::PDFExportException& i_rExc ); + + // XInteractionRequest + virtual uno::Any SAL_CALL getRequest() throw (uno::RuntimeException); + virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() throw (uno::RuntimeException); +}; + +PDFErrorRequest::PDFErrorRequest( const task::PDFExportException& i_rExc ) : + PDFErrorRequestBase( m_aMutex ), + maExc( i_rExc ) +{ +} + +uno::Any SAL_CALL PDFErrorRequest::getRequest() throw (uno::RuntimeException) +{ + osl::MutexGuard const guard( m_aMutex ); + + uno::Any aRet; + aRet <<= maExc; + return aRet; +} + +uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL PDFErrorRequest::getContinuations() throw (uno::RuntimeException) +{ + return uno::Sequence< uno::Reference< task::XInteractionContinuation > >(); +} + +} // namespace + void PDFExport::showErrors( const std::set< PDFWriter::ErrorCode >& rErrors ) { - if( ! rErrors.empty() ) + if( ! rErrors.empty() && mxIH.is() ) { - ImplErrorDialog aDlg( rErrors ); - aDlg.Execute(); + task::PDFExportException aExc; + aExc.ErrorCodes.realloc( sal_Int32(rErrors.size()) ); + sal_Int32 i = 0; + for( std::set< PDFWriter::ErrorCode >::const_iterator it = rErrors.begin(); + it != rErrors.end(); ++it, i++ ) + { + aExc.ErrorCodes.getArray()[i] = (sal_Int32)*it; + } + Reference< task::XInteractionRequest > xReq( new PDFErrorRequest( aExc ) ); + mxIH->handle( xReq ); } } diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx index 6a1ed9962774..78b495dd1b45 100644 --- a/filter/source/pdf/pdfexport.hxx +++ b/filter/source/pdf/pdfexport.hxx @@ -56,6 +56,7 @@ private: Reference< XComponent > mxSrcDoc; Reference< lang::XMultiServiceFactory > mxMSF; Reference< task::XStatusIndicator > mxStatusIndicator; + Reference< task::XInteractionHandler > mxIH; sal_Bool mbUseTaggedPDF; sal_Int32 mnPDFTypeSelection; @@ -125,7 +126,10 @@ private: void ImplWriteWatermark( ::vcl::PDFWriter& rWriter, const Size& rPageSize ); public: - PDFExport( const Reference< XComponent >& rxSrcDoc, Reference< task::XStatusIndicator >& xStatusIndicator, const Reference< lang::XMultiServiceFactory >& xFact ); + PDFExport( const Reference< XComponent >& rxSrcDoc, + const Reference< task::XStatusIndicator >& xStatusIndicator, + const Reference< task::XInteractionHandler >& xIH, + const Reference< lang::XMultiServiceFactory >& xFact ); ~PDFExport(); sal_Bool ExportSelection( vcl::PDFWriter& rPDFWriter, Reference< com::sun::star::view::XRenderable >& rRenderable, Any& rSelection, diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx index 0c08be6d8a66..0abb2eb1d3da 100644 --- a/filter/source/pdf/pdffilter.cxx +++ b/filter/source/pdf/pdffilter.cxx @@ -60,6 +60,7 @@ sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) const PropertyValue* pValue = rDescriptor.getConstArray(); sal_Bool bRet = sal_False; Reference< task::XStatusIndicator > xStatusIndicator; + Reference< task::XInteractionHandler > xIH; for ( sal_Int32 i = 0 ; ( i < nLength ) && !xOStm.is(); ++i) { @@ -69,6 +70,8 @@ sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) pValue[ i ].Value >>= aFilterData; else if ( pValue[ i ].Name.equalsAscii( "StatusIndicator" ) ) pValue[ i ].Value >>= xStatusIndicator; + else if( pValue[i].Name.equalsAscii( "InteractionHandler" ) ) + pValue[i].Value >>= xIH; } /* we don't get FilterData if we are exporting directly @@ -117,7 +120,7 @@ sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) } if( mxSrcDoc.is() && xOStm.is() ) { - PDFExport aExport( mxSrcDoc, xStatusIndicator, mxMSF ); + PDFExport aExport( mxSrcDoc, xStatusIndicator, xIH, mxMSF ); ::utl::TempFile aTempFile; aTempFile.EnableKillingFile(); diff --git a/filter/source/pdf/pdffilter.hxx b/filter/source/pdf/pdffilter.hxx index b4720c1627c7..ea223496522e 100644 --- a/filter/source/pdf/pdffilter.hxx +++ b/filter/source/pdf/pdffilter.hxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include diff --git a/filter/source/pdf/pdfinteract.cxx b/filter/source/pdf/pdfinteract.cxx new file mode 100644 index 000000000000..23ea98d6bf51 --- /dev/null +++ b/filter/source/pdf/pdfinteract.cxx @@ -0,0 +1,137 @@ + /************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_filter.hxx" + +#include "pdfinteract.hxx" +#include "impdialog.hxx" + +#include "com/sun/star/task/XInteractionRequest.hpp" +#include "com/sun/star/task/PDFExportException.hpp" + +// ------------- +// - PDFInteractionHandler - +// ------------- + +PDFInteractionHandler::PDFInteractionHandler( const Reference< XMultiServiceFactory > &rxMSF ) : + mxMSF( rxMSF ) +{ +} + +// ----------------------------------------------------------------------------- + +PDFInteractionHandler::~PDFInteractionHandler() +{ +} + + +void SAL_CALL PDFInteractionHandler::handle( const Reference< task::XInteractionRequest >& i_xRequest ) + throw (RuntimeException) +{ + handleInteractionRequest( i_xRequest ); +} + +sal_Bool SAL_CALL PDFInteractionHandler::handleInteractionRequest( const Reference< task::XInteractionRequest >& i_xRequest ) + throw (RuntimeException) +{ + sal_Bool bHandled = sal_False; + + Any aRequest( i_xRequest->getRequest() ); + task::PDFExportException aExc; + if( aRequest >>= aExc ) + { + std::set< vcl::PDFWriter::ErrorCode > aCodes; + sal_Int32 nCodes = aExc.ErrorCodes.getLength(); + for( sal_Int32 i = 0; i < nCodes; i++ ) + aCodes.insert( (vcl::PDFWriter::ErrorCode)aExc.ErrorCodes.getConstArray()[i] ); + ImplErrorDialog aDlg( aCodes ); + aDlg.Execute(); + bHandled = sal_True; + } + return bHandled; +} + +// ----------------------------------------------------------------------------- + +OUString PDFInteractionHandler_getImplementationName () + throw (RuntimeException) +{ + return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.PDF.PDFExportInteractionHandler" ) ); +} + +// ----------------------------------------------------------------------------- + +#define SERVICE_NAME "com.sun.star.filter.pdfexport.PDFExportInteractionHandler" + +sal_Bool SAL_CALL PDFInteractionHandler_supportsService( const OUString& ServiceName ) + throw (RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) ); +} + +// ----------------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL PDFInteractionHandler_getSupportedServiceNames( ) throw (RuntimeException) +{ + Sequence < OUString > aRet(1); + OUString* pArray = aRet.getArray(); + pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) ); + return aRet; +} + +#undef SERVICE_NAME + +// ----------------------------------------------------------------------------- + +Reference< XInterface > SAL_CALL PDFInteractionHandler_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) +{ + return (cppu::OWeakObject*) new PDFInteractionHandler( rSMgr ); +} + +// ----------------------------------------------------------------------------- + +OUString SAL_CALL PDFInteractionHandler::getImplementationName() + throw (RuntimeException) +{ + return PDFInteractionHandler_getImplementationName(); +} + +// ----------------------------------------------------------------------------- + +sal_Bool SAL_CALL PDFInteractionHandler::supportsService( const OUString& rServiceName ) + throw (RuntimeException) +{ + return PDFInteractionHandler_supportsService( rServiceName ); +} + +// ----------------------------------------------------------------------------- + +::com::sun::star::uno::Sequence< OUString > SAL_CALL PDFInteractionHandler::getSupportedServiceNames( ) throw (RuntimeException) +{ + return PDFInteractionHandler_getSupportedServiceNames(); +} diff --git a/filter/source/pdf/pdfinteract.hxx b/filter/source/pdf/pdfinteract.hxx new file mode 100644 index 000000000000..4cffc70c962a --- /dev/null +++ b/filter/source/pdf/pdfinteract.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef PDFINTERACT_HXX +#define PDFINTERACT_HXX + +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "cppuhelper/implbase2.hxx" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/task/XInteractionHandler2.hpp" + +using namespace ::rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; + +// ------------- +// - PDFFilter - +// ------------- + +class PDFInteractionHandler : public cppu::WeakImplHelper2 < task::XInteractionHandler2, + XServiceInfo > +{ +private: + + Reference< XMultiServiceFactory > mxMSF; + +protected: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw(RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException); + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException); + + // XIniteractionHandler + virtual void SAL_CALL handle( const Reference< task::XInteractionRequest >& ) throw(RuntimeException); + + // XIniteractionHandler2 + virtual sal_Bool SAL_CALL handleInteractionRequest( const Reference< task::XInteractionRequest >& ) throw(RuntimeException); +public: + + PDFInteractionHandler( const Reference< XMultiServiceFactory >& rxMSF ); + virtual ~PDFInteractionHandler(); +}; + +// ----------------------------------------------------------------------------- + +OUString PDFInteractionHandler_getImplementationName () + throw ( RuntimeException ); + +// ----------------------------------------------------------------------------- + +sal_Bool SAL_CALL PDFInteractionHandler_supportsService( const OUString& ServiceName ) + throw ( RuntimeException ); + +// ----------------------------------------------------------------------------- + +Sequence< OUString > SAL_CALL PDFInteractionHandler_getSupportedServiceNames( ) + throw ( RuntimeException ); + +// ----------------------------------------------------------------------------- + +Reference< XInterface > +SAL_CALL PDFInteractionHandler_createInstance( const Reference< XMultiServiceFactory > & rSMgr) + throw ( Exception ); + +#endif // PDFINTERACT_HXX + diff --git a/filter/source/pdf/pdfuno.cxx b/filter/source/pdf/pdfuno.cxx index 10c0f7df293d..321cef89e41e 100644 --- a/filter/source/pdf/pdfuno.cxx +++ b/filter/source/pdf/pdfuno.cxx @@ -36,6 +36,7 @@ #include #include +#include using namespace ::rtl; using namespace ::cppu; @@ -76,6 +77,13 @@ extern "C" for ( nPos = rSNL2.getLength(); nPos--; ) xNewKey->createKey( pArray2[nPos] ); + xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( PDFInteractionHandler_getImplementationName() ); + xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); + const Sequence< OUString > & rSNL3 = PDFInteractionHandler_getSupportedServiceNames(); + const OUString * pArray3 = rSNL3.getConstArray(); + for ( nPos = rSNL3.getLength(); nPos--; ) + xNewKey->createKey( pArray3[nPos] ); + return sal_True; } catch (InvalidRegistryException &) @@ -110,6 +118,13 @@ extern "C" OUString::createFromAscii( pImplName ), PDFDialog_createInstance, PDFDialog_getSupportedServiceNames() ); + } + else if( aImplName.equals( PDFInteractionHandler_getImplementationName() ) ) + { + xFactory = createSingleFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ), + OUString::createFromAscii( pImplName ), + PDFInteractionHandler_createInstance, PDFInteractionHandler_getSupportedServiceNames() ); + } if( xFactory.is() ) -- cgit From a8303182c5b111c86e5958c652e1b165a59f42dc Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 1 Oct 2010 17:36:06 +0200 Subject: pl08: #i111050# use interaction handler for export warnings, this may be suppressed by a custom interaction handler --- offapi/com/sun/star/task/PDFExportException.idl | 52 +++++++++++++++++++++++++ offapi/com/sun/star/task/makefile.mk | 1 + 2 files changed, 53 insertions(+) create mode 100644 offapi/com/sun/star/task/PDFExportException.idl mode change 100755 => 100644 offapi/com/sun/star/task/makefile.mk diff --git a/offapi/com/sun/star/task/PDFExportException.idl b/offapi/com/sun/star/task/PDFExportException.idl new file mode 100644 index 000000000000..8547aea76418 --- /dev/null +++ b/offapi/com/sun/star/task/PDFExportException.idl @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_task_PDFExportException_idl__ +#define __com_sun_star_task_PDFExportException_idl__ + +#ifndef __com_sun_star_uno_Exception_idl__ +#include +#endif + + module com { module sun { module star { module task { + + +/** is an exception that provides information on an error during PDF export. + */ +published exception PDFExportException: com::sun::star::uno::Exception +{ + /** contains a number of errors that occured during PDFExport + */ + sequence< long > ErrorCodes; +}; + +//============================================================================= + +}; }; }; }; + +/*=========================================================================== +===========================================================================*/ +#endif diff --git a/offapi/com/sun/star/task/makefile.mk b/offapi/com/sun/star/task/makefile.mk old mode 100755 new mode 100644 index 16b0be56e36c..cd9db6b5a738 --- a/offapi/com/sun/star/task/makefile.mk +++ b/offapi/com/sun/star/task/makefile.mk @@ -59,6 +59,7 @@ IDLFILES=\ PasswordContainerInteractionHandler.idl\ PasswordRequest.idl\ PasswordRequestMode.idl\ + PDFExportException.idl\ OfficeRestartManager.idl\ UnsupportedOverwriteRequest.idl\ UrlRecord.idl\ -- cgit From f8678b2f6fe6af1ecea49d9bda7814be08731695 Mon Sep 17 00:00:00 2001 From: Christian Lippka ORACLE Date: Mon, 11 Oct 2010 17:31:02 +0200 Subject: #i104850# enable 'create summary page' during initial text editing --- sd/source/filter/ppt/propread.cxx | 2 +- sd/source/ui/func/fuexpand.cxx | 3 +++ .../ui/slidesorter/controller/SlsSlotManager.cxx | 25 +++++++++++++++++-- sd/source/ui/view/drviews7.cxx | 28 ++++++++++++++++------ sd/source/ui/view/outlnvsh.cxx | 21 ++++++++++++++-- 5 files changed, 67 insertions(+), 12 deletions(-) mode change 100644 => 100755 sd/source/ui/func/fuexpand.cxx diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx index ff1250bdf090..317e242b4026 100755 --- a/sd/source/filter/ppt/propread.cxx +++ b/sd/source/filter/ppt/propread.cxx @@ -99,7 +99,7 @@ static xub_StrLen lcl_getMaxSafeStrLen(sal_uInt32 nSize) if (nSize > STRING_MAXLEN) nSize = STRING_MAXLEN; - return nSize; + return static_cast(nSize); } BOOL PropItem::Read( String& rString, sal_uInt32 nStringType, sal_Bool bAlign ) diff --git a/sd/source/ui/func/fuexpand.cxx b/sd/source/ui/func/fuexpand.cxx old mode 100644 new mode 100755 index 281e4c692228..e45b8ce36673 --- a/sd/source/ui/func/fuexpand.cxx +++ b/sd/source/ui/func/fuexpand.cxx @@ -84,6 +84,9 @@ FunctionReference FuExpandPage::Create( ViewShell* pViewSh, ::sd::Window* pWin, void FuExpandPage::DoExecute( SfxRequest& ) { + if ( mpView && mpView->IsTextEdit() ) + mpView->SdrEndTextEdit(); + // Selektierte Seite finden (nur Standard-Seiten) SdPage* pActualPage = NULL; USHORT i = 0; diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index ded7c2ebfdde..0ab4b9e3bdc3 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -29,6 +29,8 @@ #include +#include + #include "controller/SlsSlotManager.hxx" #include "SlideSorter.hxx" #include "SlideSorterViewShell.hxx" @@ -558,8 +560,27 @@ void SlotManager::GetMenuState (SfxItemSet& rSet) { SdPage* pPage = aSelectedPages.GetNextElement()->GetPage(); SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE); - if (pObj!=NULL && !pObj->IsEmptyPresObj()) - bDisable = false; + if (pObj!=NULL ) + { + if( !pObj->IsEmptyPresObj() ) + { + bDisable = false; + } + else + { + // check if the object is in edit, than its temporarely not empty + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj ); + if( pTextObj ) + { + OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject(); + if( pParaObj ) + { + delete pParaObj; + bDisable = false; + } + } + } + } } } diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index f758a65953d5..5b58b2623df0 100755 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -34,12 +34,9 @@ #include #include #include -#ifndef _FLDITEM_HXX #include -#endif -#ifndef _SVXIDS_HXX +#include #include -#endif #include #include #include @@ -310,7 +307,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) if(bDisable) { - rSet.DisableItem(SID_EXPAND_PAGE); + rSet.DisableItem(SID_ASSIGN_LAYOUT); } } @@ -325,9 +322,26 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE); - if(pObj && !pObj->IsEmptyPresObj()) + if (pObj!=NULL ) { - bDisable = false; + if( !pObj->IsEmptyPresObj() ) + { + bDisable = false; + } + else + { + // check if the object is in edit, than its temporarely not empty + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj ); + if( pTextObj ) + { + OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject(); + if( pParaObj ) + { + delete pParaObj; + bDisable = false; + } + } + } } } } diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 955a9d167b49..fb4fdff2a06f 100755 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -1030,9 +1030,26 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) { SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE); - if (pObj && !pObj->IsEmptyPresObj()) + if (pObj!=NULL ) { - bDisable = FALSE; + if( !pObj->IsEmptyPresObj() ) + { + bDisable = false; + } + else + { + // check if the object is in edit, than its temporarely not empty + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj ); + if( pTextObj ) + { + OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject(); + if( pParaObj ) + { + delete pParaObj; + bDisable = false; + } + } + } } } -- cgit From 1ff403576d66813cfec535da9f1558f2f3e2d336 Mon Sep 17 00:00:00 2001 From: Christian Lippka ORACLE Date: Mon, 11 Oct 2010 18:15:21 +0200 Subject: impress202: #i84795# write/load unicode strings for url and author fields --- editeng/source/items/flditem.cxx | 109 +++++++++++---------------------------- 1 file changed, 31 insertions(+), 78 deletions(-) diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx index 5cb45144abab..132a6d0ee38c 100644 --- a/editeng/source/items/flditem.cxx +++ b/editeng/source/items/flditem.cxx @@ -377,83 +377,46 @@ int SvxURLField::operator==( const SvxFieldData& rOther ) const // ----------------------------------------------------------------------- -void SvxURLField::Load( SvPersistStream & rStm ) +static void write_unicode( SvPersistStream & rStm, const String& rString ) { - USHORT nFormat; - sal_uInt32 nFrameMarker, nCharSetMarker; - long nUlongSize = (long)sizeof(sal_uInt32); - String aTmpURL; - - rStm >> nFormat; - - // UNICODE: rStm >> aTmpURL; - rStm.ReadByteString(aTmpURL); - - // UNICODE: rStm >> aRepresentation; - // read to a temp string first, read text encoding and - // convert later to stay compatible to fileformat - ByteString aTempString; - rtl_TextEncoding aTempEncoding = RTL_TEXTENCODING_MS_1252; // #101493# Init for old documents - rStm.ReadByteString(aTempString); + USHORT nL = rString.Len(); + rStm << nL; + rStm.Write( rString.GetBuffer(), nL*sizeof(sal_Unicode) ); +} - rStm >> nFrameMarker; - if ( nFrameMarker == FRAME_MARKER ) +static void read_unicode( SvPersistStream & rStm, String& rString ) +{ + USHORT nL = 0; + rStm >> nL; + if ( nL ) { - // UNICODE: rStm >> aTargetFrame; - rStm.ReadByteString(aTargetFrame); - - rStm >> nCharSetMarker; - if ( nCharSetMarker == CHARSET_MARKER ) - { - USHORT nCharSet; - rStm >> nCharSet; - - // remember encoding - aTempEncoding = (rtl_TextEncoding)nCharSet; - } - else - rStm.SeekRel( -nUlongSize ); + rString.AllocBuffer( nL ); + rStm.Read( rString.GetBufferAccess(), nL*sizeof(sal_Unicode) ); + rString.ReleaseBufferAccess( nL ); } - else - rStm.SeekRel( -nUlongSize ); +} - // now build representation string due to known encoding - aRepresentation = String(aTempString, aTempEncoding); +void SvxURLField::Load( SvPersistStream & rStm ) +{ + USHORT nFormat = 0; + rStm >> nFormat; eFormat= (SvxURLFormat)nFormat; - // Relatives Speichern => Beim laden absolut machen. - DBG_ERROR("No BaseURL!"); - // TODO/MBA: no BaseURL - aURL = INetURLObject::GetAbsURL( String(), aTmpURL ); + read_unicode( rStm, aURL ); + read_unicode( rStm, aRepresentation ); + read_unicode( rStm, aTargetFrame ); } // ----------------------------------------------------------------------- void SvxURLField::Save( SvPersistStream & rStm ) { - // Relatives Speichern der URL - DBG_ERROR("No BaseURL!"); - // TODO/MBA: no BaseURL - String aTmpURL = INetURLObject::GetRelURL( String(), aURL ); - rStm << (USHORT)eFormat; - // UNICODE: rStm << aTmpURL; - rStm.WriteByteString(aTmpURL); - - // UNICODE: rStm << aRepresentation; - rStm.WriteByteString(aRepresentation); - - rStm << FRAME_MARKER; - - // UNICODE: rStm << aTargetFrame; - rStm.WriteByteString(aTargetFrame); - - rStm << CHARSET_MARKER; - - // #90477# rStm << (USHORT)GetStoreCharSet(gsl_getSystemTextEncoding(), rStm.GetVersion()); - rStm << (USHORT)GetSOStoreTextEncoding(gsl_getSystemTextEncoding(), (sal_uInt16)rStm.GetVersion()); + write_unicode( rStm, aURL ); + write_unicode( rStm, aRepresentation ); + write_unicode( rStm, aTargetFrame ); } MetaAction* SvxURLField::createBeginComment() const @@ -921,16 +884,11 @@ int SvxAuthorField::operator==( const SvxFieldData& rOther ) const void SvxAuthorField::Load( SvPersistStream & rStm ) { - USHORT nType, nFormat; - - // UNICODE: rStm >> aName; - rStm.ReadByteString(aName); + USHORT nType = 0, nFormat = 0; - // UNICODE: rStm >> aFirstName; - rStm.ReadByteString(aFirstName); - - // UNICODE: rStm >> aShortName; - rStm.ReadByteString(aShortName); + read_unicode( rStm, aName ); + read_unicode( rStm, aFirstName ); + read_unicode( rStm, aShortName ); rStm >> nType; rStm >> nFormat; @@ -943,14 +901,9 @@ void SvxAuthorField::Load( SvPersistStream & rStm ) void SvxAuthorField::Save( SvPersistStream & rStm ) { - // UNICODE: rStm << aName; - rStm.WriteByteString(aName); - - // UNICODE: rStm << aFirstName; - rStm.WriteByteString(aFirstName); - - // UNICODE: rStm << aShortName; - rStm.WriteByteString(aShortName); + write_unicode( rStm, aName ); + write_unicode( rStm, aFirstName ); + write_unicode( rStm, aShortName ); rStm << (USHORT) eType; rStm << (USHORT) eFormat; -- cgit From 3a95d76279984551d2843e89db58a0b2ad1808a7 Mon Sep 17 00:00:00 2001 From: sj Date: Tue, 12 Oct 2010 16:11:23 +0200 Subject: impress202: #i113673# added support of smybol fonts --- oox/source/drawingml/textcharacterproperties.cxx | 2 +- oox/source/drawingml/textrun.cxx | 50 +++++++++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 3ac5018c1dad..9750375f97dd 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -96,7 +96,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil rPropMap[ PROP_CharFontFamilyComplex ] <<= nFontFamily; } - // symbol font not supported + // symbolfont, will now be ... textrun.cxx ... ausgewertet !!!i#113673 if( maCharColor.isUsed() ) rPropMap[ PROP_CharColor ] <<= maCharColor.getColor( rFilter.getGraphicHelper() ); diff --git a/oox/source/drawingml/textrun.cxx b/oox/source/drawingml/textrun.cxx index aa74d767a7ad..1f2b3da4560e 100644 --- a/oox/source/drawingml/textrun.cxx +++ b/oox/source/drawingml/textrun.cxx @@ -78,7 +78,55 @@ void TextRun::insertAt( } else { - xText->insertString( xStart, getText(), sal_False ); + OUString aLatinFontName, aSymbolFontName; + sal_Int16 nLatinFontPitch = 0, nSymbolFontPitch = 0; + sal_Int16 nLatinFontFamily = 0, nSymbolFontFamily = 0; + + if ( !aTextCharacterProps.maSymbolFont.getFontData( aSymbolFontName, nSymbolFontPitch, nSymbolFontFamily, rFilterBase ) ) + xText->insertString( xStart, getText(), sal_False ); + else if ( getText().getLength() ) + { // !!#i113673<<< + aTextCharacterProps.maLatinFont.getFontData( aLatinFontName, nLatinFontPitch, nLatinFontFamily, rFilterBase ); + + sal_Int32 nIndex = 0; + while ( sal_True ) + { + sal_Int32 nCount = 0; + sal_Bool bSymbol = ( getText()[ nIndex ] & 0xff00 ) == 0xf000; + if ( bSymbol ) + { + do + { + nCount++; + } + while( ( ( nCount + nIndex ) < getText().getLength() ) && ( ( getText()[ nCount + nIndex ] & 0xff00 ) == 0xf000 ) ); + aPropSet.setAnyProperty( PROP_CharFontName, Any( aSymbolFontName ) ); + aPropSet.setAnyProperty( PROP_CharFontPitch, Any( nSymbolFontPitch ) ); + aPropSet.setAnyProperty( PROP_CharFontFamily, Any( nSymbolFontFamily ) ); + } + else + { + do + { + nCount++; + } + while( ( ( nCount + nIndex ) < getText().getLength() ) && ( ( getText()[ nCount + nIndex ] & 0xff00 ) != 0xf000 ) ); + aPropSet.setAnyProperty( PROP_CharFontName, Any( aLatinFontName ) ); + aPropSet.setAnyProperty( PROP_CharFontPitch, Any( nLatinFontPitch ) ); + aPropSet.setAnyProperty( PROP_CharFontFamily, Any( nLatinFontFamily ) ); + } + rtl::OUString aSubString( getText().copy( nIndex, nCount ) ); + xText->insertString( xStart, aSubString, sal_False ); + nIndex += nCount; + + if ( nIndex >= getText().getLength() ) + break; + + Reference< XTextRange > xStart( xAt, UNO_QUERY ); + aPropSet = PropertySet( xStart ); + aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase ); + } + } } } else -- cgit From 140317980aa8b885cb5cb7a2b24bb155d5cb514a Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Wed, 13 Oct 2010 11:23:08 +0200 Subject: #i114938# fix extremum parameter calculation --- basegfx/source/curve/b2dcubicbezier.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index adf819a214a1..adec8a2ac6ca 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -978,10 +978,10 @@ namespace basegfx // calculate the x-extrema parameters by zeroing first x-derivative // of the cubic bezier's parametric formula, which results in a // quadratic equation: dBezier/dt = t*t*fAX - 2*t*fBX + fCX - const B2DPoint aRelativeEndPoint(maEndPoint-maStartPoint); - const double fAX = 3 * (maControlPointA.getX() - maControlPointB.getX()) + aRelativeEndPoint.getX(); - const double fBX = 2 * maControlPointA.getX() - maControlPointB.getX() - maStartPoint.getX(); - double fCX(maControlPointA.getX() - maStartPoint.getX()); + const B2DPoint aControlDiff( maControlPointA - maControlPointB ); + double fCX = maControlPointA.getX() - maStartPoint.getX(); + const double fBX = fCX + aControlDiff.getX(); + const double fAX = 3 * aControlDiff.getX() + (maEndPoint.getX() - maStartPoint.getX()); if(fTools::equalZero(fCX)) { @@ -997,9 +997,9 @@ namespace basegfx { const double fS = sqrt(fD); // calculate both roots (avoiding a numerically unstable subtraction) - const double fQ = -(fBX + ((fBX >= 0) ? +fS : -fS)); + const double fQ = fBX + ((fBX >= 0) ? +fS : -fS); impCheckExtremumResult(fQ / fAX, rResults); - if( fD > 0.0 ) // ignore root multiplicity + if( !fTools::equalZero(fS) ) // ignore root multiplicity impCheckExtremumResult(fCX / fQ, rResults); } } @@ -1010,9 +1010,9 @@ namespace basegfx } // calculate the y-extrema parameters by zeroing first y-derivative - const double fAY = 3 * (maControlPointA.getY() - maControlPointB.getY()) + aRelativeEndPoint.getY(); - const double fBY = 2 * maControlPointA.getY() - maControlPointB.getY() - maStartPoint.getY(); - double fCY(maControlPointA.getY() - maStartPoint.getY()); + double fCY = maControlPointA.getY() - maStartPoint.getY(); + const double fBY = fCY + aControlDiff.getY(); + const double fAY = 3 * aControlDiff.getY() + (maEndPoint.getY() - maStartPoint.getY()); if(fTools::equalZero(fCY)) { @@ -1024,13 +1024,13 @@ namespace basegfx { // derivative is polynomial of order 2 => use binomial formula const double fD = fBY*fBY - fAY*fCY; - if( fD >= 0 ) + if( fD >= 0.0 ) { const double fS = sqrt(fD); // calculate both roots (avoiding a numerically unstable subtraction) - const double fQ = -(fBY + ((fBY >= 0) ? +fS : -fS)); + const double fQ = fBY + ((fBY >= 0) ? +fS : -fS); impCheckExtremumResult(fQ / fAY, rResults); - if( fD > 0.0 ) // ignore root multiplicity, TODO: use equalZero() instead? + if( !fTools::equalZero(fS) ) // ignore root multiplicity impCheckExtremumResult(fCY / fQ, rResults); } } -- cgit From 96e3776c1ad226e5f7e8765ae6d9e4b3205429fa Mon Sep 17 00:00:00 2001 From: sj Date: Fri, 15 Oct 2010 08:12:17 +0200 Subject: impress212: #i114750# fixed odf import problem, (using correct word wrap default for shapes) --- svx/source/svdraw/svdmodel.cxx | 2 ++ xmloff/source/draw/XMLGraphicsDefaultStyle.cxx | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 8ab385fa329c..9abb1969459d 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -207,6 +207,8 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe else nDefTextHgt = SdrEngineDefaults::GetFontHeight(); + pItemPool->SetPoolDefaultItem( SdrTextWordWrapItem( sal_False ) ); + SetTextDefaults(); pLayerAdmin=new SdrLayerAdmin; pLayerAdmin->SetModel(this); diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx index 4b8bcf429057..e30b44345d59 100644 --- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx +++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx @@ -104,6 +104,16 @@ void XMLGraphicsDefaultStyle::SetDefaults() Reference< XPropertySet > xDefaults( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults") ) ), UNO_QUERY ); if( !xDefaults.is() ) return; + // SJ: #i114750# + sal_Bool bWordWrapDefault = sal_True; // initializing with correct odf fo:wrap-option default + sal_Int32 nUPD( 0 ); + sal_Int32 nBuild( 0 ); + const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild ); + if ( bBuildIdFound && ( + ( nUPD == 641 ) || ( nUPD == 645 ) || ( nUPD == 680 ) || ( nUPD == 310 ) || ( nUPD == 320 ) || ( nUPD == 330 ) + || ( ( nUPD == 300 ) && ( nBuild <= 9535 ) ) ) ) + bWordWrapDefault = sal_False; + xDefaults->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextWordWrap" ) ), Any( bWordWrapDefault ) ); FillPropertySet( xDefaults ); } -- cgit From e1a618e234c64e5bd64c52408ddbf2ddd0585317 Mon Sep 17 00:00:00 2001 From: sj Date: Fri, 15 Oct 2010 08:12:17 +0200 Subject: impress212: #i114750# fixed odf import problem, (using correct word wrap default for shapes) --- sd/source/filter/ppt/propread.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx index ff1250bdf090..b77c2563fc03 100755 --- a/sd/source/filter/ppt/propread.cxx +++ b/sd/source/filter/ppt/propread.cxx @@ -99,7 +99,7 @@ static xub_StrLen lcl_getMaxSafeStrLen(sal_uInt32 nSize) if (nSize > STRING_MAXLEN) nSize = STRING_MAXLEN; - return nSize; + return static_cast< xub_StrLen >( nSize ); } BOOL PropItem::Read( String& rString, sal_uInt32 nStringType, sal_Bool bAlign ) -- cgit From 6e4c487a07e94c58c8402e67437f2cb802f78dea Mon Sep 17 00:00:00 2001 From: sj Date: Fri, 15 Oct 2010 15:44:59 +0200 Subject: impress212: #i114750# fixed odf import problem, (using correct word wrap default for shapes) --- xmloff/source/draw/XMLGraphicsDefaultStyle.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx index e30b44345d59..a5de333ee9f6 100644 --- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx +++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx @@ -110,8 +110,12 @@ void XMLGraphicsDefaultStyle::SetDefaults() sal_Int32 nBuild( 0 ); const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild ); if ( bBuildIdFound && ( - ( nUPD == 641 ) || ( nUPD == 645 ) || ( nUPD == 680 ) || ( nUPD == 310 ) || ( nUPD == 320 ) || ( nUPD == 330 ) - || ( ( nUPD == 300 ) && ( nBuild <= 9535 ) ) ) ) + ((nUPD >= 600) && (nUPD < 700)) + || + ((nUPD == 300) && (nBuild <= 9535)) + || + ((nUPD > 300) && (nUPD <= 330)) + ) bWordWrapDefault = sal_False; xDefaults->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextWordWrap" ) ), Any( bWordWrapDefault ) ); -- cgit From bbb0e497279b5fd751aea97882bfaf555e733415 Mon Sep 17 00:00:00 2001 From: sj Date: Fri, 15 Oct 2010 15:46:18 +0200 Subject: impress202: #i35600# fixed heart + puzzle shape.. --- extras/source/gallery/gallery_system/sg24.sdg | Bin 49161 -> 47940 bytes extras/source/gallery/gallery_system/sg24.sdv | Bin 359424 -> 358400 bytes extras/source/gallery/gallery_system/sg24.thm | Bin 1236 -> 1236 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/extras/source/gallery/gallery_system/sg24.sdg b/extras/source/gallery/gallery_system/sg24.sdg index 019c5801180c..166f1404f133 100644 Binary files a/extras/source/gallery/gallery_system/sg24.sdg and b/extras/source/gallery/gallery_system/sg24.sdg differ diff --git a/extras/source/gallery/gallery_system/sg24.sdv b/extras/source/gallery/gallery_system/sg24.sdv index adbf1a399f3f..fb029a7520da 100644 Binary files a/extras/source/gallery/gallery_system/sg24.sdv and b/extras/source/gallery/gallery_system/sg24.sdv differ diff --git a/extras/source/gallery/gallery_system/sg24.thm b/extras/source/gallery/gallery_system/sg24.thm index e44262abc470..8fa77d1f5716 100644 Binary files a/extras/source/gallery/gallery_system/sg24.thm and b/extras/source/gallery/gallery_system/sg24.thm differ -- cgit From d5530cf90e36dd194b7787e78addf4ce70250cf2 Mon Sep 17 00:00:00 2001 From: sj Date: Mon, 18 Oct 2010 17:26:29 +0200 Subject: impress202: #i35600# fixed some shape outlines (flower shape) --- extras/source/gallery/gallery_system/sg24.sdg | Bin 47940 -> 45786 bytes extras/source/gallery/gallery_system/sg24.sdv | Bin 358400 -> 360960 bytes extras/source/gallery/gallery_system/sg24.thm | Bin 1236 -> 1236 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/extras/source/gallery/gallery_system/sg24.sdg b/extras/source/gallery/gallery_system/sg24.sdg index 166f1404f133..7441d764cb37 100644 Binary files a/extras/source/gallery/gallery_system/sg24.sdg and b/extras/source/gallery/gallery_system/sg24.sdg differ diff --git a/extras/source/gallery/gallery_system/sg24.sdv b/extras/source/gallery/gallery_system/sg24.sdv index fb029a7520da..2e780644618c 100644 Binary files a/extras/source/gallery/gallery_system/sg24.sdv and b/extras/source/gallery/gallery_system/sg24.sdv differ diff --git a/extras/source/gallery/gallery_system/sg24.thm b/extras/source/gallery/gallery_system/sg24.thm index 8fa77d1f5716..b821a9de8bb2 100644 Binary files a/extras/source/gallery/gallery_system/sg24.thm and b/extras/source/gallery/gallery_system/sg24.thm differ -- cgit From 056f830614e0642c8abc0cd036fdd7d0c4ca9770 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Thu, 21 Oct 2010 18:21:46 +0200 Subject: fix a merge conflict --- vcl/source/gdi/pdfwriter.cxx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 2d9412cc93b4..23ce1dfa6169 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -560,23 +560,17 @@ std::set< PDFWriter::ErrorCode > PDFWriter::GetErrors() return ((PDFWriterImpl*)pImplementation)->getErrors(); } -<<<<<<< local com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > PDFWriter::InitEncryption( const rtl::OUString& i_rOwnerPassword, const rtl::OUString& i_rUserPassword, bool b128Bit ) -======= -void PDFWriter::PlayMetafile( const GDIMetaFile& i_rMTF, const vcl::PDFWriter::PlayMetafileContext& i_rPlayContext, PDFExtOutDevData* i_pData ) ->>>>>>> other { -<<<<<<< local return PDFWriterImpl::initEncryption( i_rOwnerPassword, i_rUserPassword, b128Bit ); -======= +} + +void PDFWriter::PlayMetafile( const GDIMetaFile& i_rMTF, const vcl::PDFWriter::PlayMetafileContext& i_rPlayContext, PDFExtOutDevData* i_pData ) +{ ((PDFWriterImpl*)pImplementation)->playMetafile( i_rMTF, i_pData, i_rPlayContext, NULL); ->>>>>>> other } -<<<<<<< local -======= ->>>>>>> other -- cgit From 3de4569874698d5d0eee19787bbee14b68709d7a Mon Sep 17 00:00:00 2001 From: sj Date: Fri, 29 Oct 2010 11:55:40 +0200 Subject: fixed warning (shadowed variable) --- oox/source/drawingml/textrun.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oox/source/drawingml/textrun.cxx b/oox/source/drawingml/textrun.cxx index 1f2b3da4560e..cb8304b76d04 100644 --- a/oox/source/drawingml/textrun.cxx +++ b/oox/source/drawingml/textrun.cxx @@ -122,7 +122,7 @@ void TextRun::insertAt( if ( nIndex >= getText().getLength() ) break; - Reference< XTextRange > xStart( xAt, UNO_QUERY ); + xStart = Reference< XTextRange >( xAt, UNO_QUERY ); aPropSet = PropertySet( xStart ); aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase ); } -- cgit From 9640687d784626529912225efae4a8df49f94748 Mon Sep 17 00:00:00 2001 From: sj Date: Fri, 29 Oct 2010 13:23:16 +0200 Subject: fixed build problem --- xmloff/source/draw/XMLGraphicsDefaultStyle.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx index a5de333ee9f6..92aa1ce17140 100644 --- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx +++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx @@ -115,7 +115,7 @@ void XMLGraphicsDefaultStyle::SetDefaults() ((nUPD == 300) && (nBuild <= 9535)) || ((nUPD > 300) && (nUPD <= 330)) - ) + ) ) bWordWrapDefault = sal_False; xDefaults->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextWordWrap" ) ), Any( bWordWrapDefault ) ); -- cgit From d0e31654bf2d5cbbacce9ed45210dd8881fd3d6a Mon Sep 17 00:00:00 2001 From: os Date: Mon, 1 Nov 2010 12:20:46 +0100 Subject: #i115314# FN_INSERT_FRAME: keep WrtShell locally to prevent crash after sub shell dispose --- sw/source/ui/shells/textsh.cxx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index 52b60c66d178..a819a8b21da0 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -627,16 +627,18 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) DBG_ASSERT(pDlg, "Dialogdiet fail!"); if(pDlg->Execute() && pDlg->GetOutputItemSet()) { - GetShell().LockPaint(); - GetShell().StartAllAction(); - GetShell().StartUndo(UNDO_INSERT); + //local variable necessary at least after call of .AutoCaption() because this could be deleted at this point + SwWrtShell& rShell = GetShell(); + rShell.LockPaint(); + rShell.StartAllAction(); + rShell.StartUndo(UNDO_INSERT); const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); aMgr.SetAttrSet(*pOutSet); // beim ClickToEditFeld erst die Selektion loeschen - if( GetShell().IsInClickToEdit() ) - GetShell().DelRight(); + if( rShell.IsInClickToEdit() ) + rShell.DelRight(); aMgr.InsertFlyFrm(); @@ -647,8 +649,8 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) //FN_INSERT_FRAME USHORT nAnchor = (USHORT)aMgr.GetAnchor(); rReq.AppendItem(SfxUInt16Item(nSlot, nAnchor)); - rReq.AppendItem(SfxPointItem(FN_PARAM_1, GetShell().GetObjAbsPos())); - rReq.AppendItem(SvxSizeItem(FN_PARAM_2, GetShell().GetObjSize())); + rReq.AppendItem(SfxPointItem(FN_PARAM_1, rShell.GetObjAbsPos())); + rReq.AppendItem(SvxSizeItem(FN_PARAM_2, rShell.GetObjSize())); rReq.Done(); } @@ -659,10 +661,10 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_FRAME)); - GetShell().EndUndo(UNDO_INSERT, &aRewriter); + rShell.EndUndo(UNDO_INSERT, &aRewriter); } - GetShell().EndAllAction(); - GetShell().UnlockPaint(); + rShell.EndAllAction(); + rShell.UnlockPaint(); } DELETEZ(pDlg); -- cgit From 9f7cb00c135c713c2dfaf931b02487f0057320dd Mon Sep 17 00:00:00 2001 From: os Date: Mon, 1 Nov 2010 14:16:03 +0100 Subject: #i110287# omit caption separator if caption text is empty --- sw/source/core/doc/doclay.cxx | 5 ++++- sw/source/ui/frmdlg/cption.cxx | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index ceb7d6e3463c..cc29cc8406d0 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -1474,7 +1474,10 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co aTxt += ' '; } xub_StrLen nIdx = aTxt.Len(); - aTxt += rSeparator; + if( rTxt.Len() > 0 ) + { + aTxt += rSeparator; + } xub_StrLen nSepIdx = aTxt.Len(); aTxt += rTxt; diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index 5e620ce6955c..e92cd4e0ae81 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -382,6 +382,7 @@ IMPL_LINK(SwCaptionDialog, CaptionHdl, PushButton*, EMPTYARG) void SwCaptionDialog::DrawSample() { String aStr; + String sCaption = aTextEdit.GetText(); // Nummer String sFldTypeName = aCategoryBox.GetText(); @@ -436,9 +437,12 @@ void SwCaptionDialog::DrawSample() } } - aStr += aSepEdit.GetText(); + if( sCaption.Len() > 0 ) + { + aStr += aSepEdit.GetText(); + } } - aStr += aTextEdit.GetText(); + aStr += sCaption; // do preview! aPrevWin.SetPreviewText( aStr ); } -- cgit From 603a6d30d5288aa9f044ac1fd9694f4aa2c5aecd Mon Sep 17 00:00:00 2001 From: sj Date: Mon, 1 Nov 2010 17:39:15 +0100 Subject: impress202: #i114961# fixed performance problem with linked graphics --- .../sdr/contact/objectcontactofobjlistpainter.hxx | 9 + svx/inc/svx/svdograf.hxx | 3 +- .../sdr/contact/objectcontactofobjlistpainter.cxx | 19 ++ .../sdr/contact/viewobjectcontactofgraphic.cxx | 36 ++-- svx/source/svdraw/svdograf.cxx | 192 ++++++++++++++++++--- 5 files changed, 219 insertions(+), 40 deletions(-) diff --git a/svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx b/svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx index 3f7211aa9dc0..870192c9b151 100644 --- a/svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx +++ b/svx/inc/svx/sdr/contact/objectcontactofobjlistpainter.hxx @@ -95,6 +95,15 @@ namespace sdr // Process the whole displaying virtual void ProcessDisplay(DisplayInfo& rDisplayInfo); + // VirtualDevice? Default is false + virtual bool isOutputToVirtualDevice() const; + + // recording MetaFile? Default is false + virtual bool isOutputToRecordingMetaFile() const; + + // pdf export? Default is false + virtual bool isOutputToPDFFile() const; + // access to OutputDevice. May return 0L like the default implementations do. Needs to be overloaded as needed. virtual OutputDevice* TryToGetOutputDevice() const; }; diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx index 23d9204ca891..1eba8822402a 100644 --- a/svx/inc/svx/svdograf.hxx +++ b/svx/inc/svx/svdograf.hxx @@ -120,7 +120,8 @@ protected: void ImpLinkAnmeldung(); void ImpLinkAbmeldung(); - sal_Bool ImpUpdateGraphicLink() const; + sal_Bool ImpUpdateGraphicLink( sal_Bool bAsynchron = sal_True ) const; + void ImpSetLinkedGraphic( const Graphic& rGraphic ); DECL_LINK( ImpSwapHdl, GraphicObject* ); public: diff --git a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx index da8518d7f1a1..c6965fcd40fb 100644 --- a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx +++ b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx @@ -151,6 +151,25 @@ namespace sdr } } + // VirtualDevice? + bool ObjectContactOfObjListPainter::isOutputToVirtualDevice() const + { + return (OUTDEV_VIRDEV == mrTargetOutputDevice.GetOutDevType()); + } + + // recording MetaFile? + bool ObjectContactOfObjListPainter::isOutputToRecordingMetaFile() const + { + GDIMetaFile* pMetaFile = mrTargetOutputDevice.GetConnectMetaFile(); + return (pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); + } + + // pdf export? + bool ObjectContactOfObjListPainter::isOutputToPDFFile() const + { + return (0 != mrTargetOutputDevice.GetPDFWriter()); + } + OutputDevice* ObjectContactOfObjListPainter::TryToGetOutputDevice() const { return &mrTargetOutputDevice; diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx index cd2d9670bf7c..110186d41bf4 100644 --- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx @@ -177,7 +177,7 @@ namespace sdr if(rGrafObj.IsLinkedGraphic()) { // update graphic link - rGrafObj.ImpUpdateGraphicLink(); + rGrafObj.ImpUpdateGraphicLink( sal_False ); } else { @@ -196,7 +196,7 @@ namespace sdr rGrafObj.mbInsidePaint = sal_True; rGrafObj.ForceSwapIn(); rGrafObj.mbInsidePaint = sal_False; - } + } bRetval = true; } @@ -252,19 +252,27 @@ namespace sdr // prepare primitive generation with evtl. loading the graphic when it's swapped out SdrGrafObj& rGrafObj = const_cast< ViewObjectContactOfGraphic* >(this)->getSdrGrafObj(); bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics()); - static bool bSuppressAsynchLoading(false); bool bSwapInDone(false); + bool bSwapInExclusive(false); - if(bDoAsynchronGraphicLoading - && rGrafObj.IsSwappedOut() - && rGrafObj.GetPage() - && rGrafObj.GetPage()->IsMasterPage()) + if( bDoAsynchronGraphicLoading && rGrafObj.IsSwappedOut() ) { - // #i102380# force Swap-In for GraphicObjects on MasterPage to have a nicer visualisation - bDoAsynchronGraphicLoading = false; + // sometimes it is needed that each graphic is completely available and swapped in + // for these cases a ForceSwapIn is called later at the graphic object + if ( rGrafObj.GetPage() && rGrafObj.GetPage()->IsMasterPage() ) + { + // #i102380# force Swap-In for GraphicObjects on MasterPage to have a nicer visualisation + bDoAsynchronGraphicLoading = false; + } + else if ( GetObjectContact().isOutputToPrinter() + || GetObjectContact().isOutputToRecordingMetaFile() + || GetObjectContact().isOutputToPDFFile() ) + { + bDoAsynchronGraphicLoading = false; + bSwapInExclusive = true; + } } - - if(bDoAsynchronGraphicLoading && !bSuppressAsynchLoading) + if( bDoAsynchronGraphicLoading ) { bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithAsynchroniousLoading(); } @@ -293,10 +301,8 @@ namespace sdr } } - // if swap in was forced only for printing, swap out again - const bool bSwapInExclusiveForPrinting(bSwapInDone && GetObjectContact().isOutputToPrinter()); - - if(bSwapInExclusiveForPrinting) + // if swap in was forced only for printing metafile and pdf, swap out again + if( bSwapInDone && bSwapInExclusive ) { rGrafObj.ForceSwapOut(); } diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index d1f65c30050d..27c96f6c819d 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -45,6 +45,7 @@ #include #include +#include #include #include "svdglob.hxx" #include "svdstr.hrc" @@ -69,6 +70,8 @@ #include #include #include +#include +#include using namespace ::com::sun::star::uno; using namespace ::com::sun::star::io; @@ -80,13 +83,48 @@ using namespace ::com::sun::star::io; #define GRAFSTREAMPOS_INVALID 0xffffffff #define SWAPGRAPHIC_TIMEOUT 5000 + // ------------------ // - SdrGraphicLink - // ------------------ + +const Graphic ImpLoadLinkedGraphic( const String& rFileName, const String& rFilterName ) +{ + Graphic aGraphic; + + SfxMedium xMed( rFileName, STREAM_STD_READ, TRUE ); + xMed.DownLoad(); + + SvStream* pInStrm = xMed.GetInStream(); + if ( pInStrm ) + { + pInStrm->Seek( STREAM_SEEK_TO_BEGIN ); + GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); + + const USHORT nFilter = rFilterName.Len() && pGF->GetImportFormatCount() + ? pGF->GetImportFormatNumber( rFilterName ) + : GRFILTER_FORMAT_DONTKNOW; + + String aEmptyStr; + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aFilterData( 1 ); + + // Room for improvment: + // As this is a linked graphic the GfxLink is not needed if saving/loading our own format. + // But this link is required by some filters to access the native graphic (pdf export/ms export), + // there we should create a new service to provide this data if needed + aFilterData[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CreateNativeLink" ) ); + aFilterData[ 0 ].Value = Any( sal_True ); + pGF->ImportGraphic( aGraphic, aEmptyStr, *pInStrm, nFilter, NULL, 0, &aFilterData ); + } + return aGraphic; +} + +class SdrGraphicUpdater; class SdrGraphicLink : public sfx2::SvBaseLink { SdrGrafObj* pGrafObj; + SdrGraphicUpdater* pGraphicUpdater; public: SdrGraphicLink(SdrGrafObj* pObj); @@ -95,16 +133,87 @@ public: virtual void Closed(); virtual void DataChanged( const String& rMimeType, const ::com::sun::star::uno::Any & rValue ); + void DataChanged( const Graphic& rGraphic ); BOOL Connect() { return 0 != GetRealObject(); } - void UpdateSynchron(); + void UpdateAsynchron(); + void RemoveGraphicUpdater(); }; +class SdrGraphicUpdater : public ::osl::Thread +{ +public: + SdrGraphicUpdater( const String& rFileName, const String& rFilterName, SdrGraphicLink& ); + virtual ~SdrGraphicUpdater( void ); + + void SAL_CALL Terminate( void ); + + sal_Bool GraphicLinkChanged( const String& rFileName ){ return mrFileName != rFileName; }; + +protected: + + /** is called from the inherited create method and acts as the + main function of this thread. + */ + virtual void SAL_CALL run(void); + + /** Called after the thread is terminated via the terminate + method. Used to kill the thread by calling delete on this. + */ + virtual void SAL_CALL onTerminated(void); + +private: + + ::osl::Mutex maMutex; + const String& mrFileName; + const String& mrFilterName; + SdrGraphicLink& mrGraphicLink; + + volatile bool mbIsTerminated; +}; + +SdrGraphicUpdater::SdrGraphicUpdater( const String& rFileName, const String& rFilterName, SdrGraphicLink& rGraphicLink ) +: mrFileName( rFileName ) +, mrFilterName( rFilterName ) +, mrGraphicLink( rGraphicLink ) +, mbIsTerminated( sal_False ) +{ + create(); +} + +SdrGraphicUpdater::~SdrGraphicUpdater( void ) +{ +} + +void SdrGraphicUpdater::Terminate() +{ + ::osl::MutexGuard aGuard( maMutex ); + mbIsTerminated = sal_True; +} + +void SAL_CALL SdrGraphicUpdater::onTerminated(void) +{ + delete this; +} + +void SAL_CALL SdrGraphicUpdater::run(void) +{ + Graphic aGraphic( ImpLoadLinkedGraphic( mrFileName, mrFilterName ) ); + ::osl::MutexGuard aGuard(maMutex); + vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + if ( !mbIsTerminated ) + { + mrGraphicLink.DataChanged( aGraphic ); + mrGraphicLink.RemoveGraphicUpdater(); + } +} + // ----------------------------------------------------------------------------- -SdrGraphicLink::SdrGraphicLink(SdrGrafObj* pObj): - ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, SOT_FORMATSTR_ID_SVXB ), - pGrafObj(pObj) +SdrGraphicLink::SdrGraphicLink(SdrGrafObj* pObj) +: ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, SOT_FORMATSTR_ID_SVXB ) +, pGrafObj( pObj ) +, pGraphicUpdater( NULL ) { SetSynchron( FALSE ); } @@ -113,6 +222,22 @@ SdrGraphicLink::SdrGraphicLink(SdrGrafObj* pObj): SdrGraphicLink::~SdrGraphicLink() { + if ( pGraphicUpdater ) + pGraphicUpdater->Terminate(); +} + +// ----------------------------------------------------------------------------- + +void SdrGraphicLink::DataChanged( const Graphic& rGraphic ) +{ + pGrafObj->ImpSetLinkedGraphic( rGraphic ); +} + +// ----------------------------------------------------------------------------- + +void SdrGraphicLink::RemoveGraphicUpdater() +{ + pGraphicUpdater = NULL; } // ----------------------------------------------------------------------------- @@ -135,9 +260,8 @@ void SdrGraphicLink::DataChanged( const String& rMimeType, } else if( SotExchange::GetFormatIdFromMimeType( rMimeType ) != sfx2::LinkManager::RegisterStatusInfoId() ) { - // only repaint, no objectchange - pGrafObj->ActionChanged(); - // pGrafObj->BroadcastObjectChange(); + // broadcasting, to update slidesorter + pGrafObj->BroadcastObjectChange(); } } } @@ -155,14 +279,20 @@ void SdrGraphicLink::Closed() // ----------------------------------------------------------------------------- -void SdrGraphicLink::UpdateSynchron() +void SdrGraphicLink::UpdateAsynchron() { if( GetObj() ) { - String aMimeType( SotExchange::GetFormatMimeType( GetContentType() )); - ::com::sun::star::uno::Any aValue; - GetObj()->GetData( aValue, aMimeType, TRUE ); - DataChanged( aMimeType, aValue ); + if ( pGraphicUpdater ) + { + if ( pGraphicUpdater->GraphicLinkChanged( pGrafObj->GetFileName() ) ) + { + pGraphicUpdater->Terminate(); + pGraphicUpdater = new SdrGraphicUpdater( pGrafObj->GetFileName(), pGrafObj->GetFilterName(), *this ); + } + } + else + pGraphicUpdater = new SdrGraphicUpdater( pGrafObj->GetFileName(), pGrafObj->GetFilterName(), *this ); } } @@ -447,8 +577,10 @@ void SdrGrafObj::ForceSwapIn() const const_cast< SdrGrafObj* >( this )->mbIsPreview = sal_False; } - - pGraphic->FireSwapInRequest(); + if ( pGraphicLink && pGraphic->IsSwappedOut() ) + ImpUpdateGraphicLink( sal_False ); + else + pGraphic->FireSwapInRequest(); if( pGraphic->IsSwappedOut() || ( pGraphic->GetType() == GRAPHIC_NONE ) || @@ -558,24 +690,36 @@ UINT16 SdrGrafObj::GetObjIdentifier() const // ----------------------------------------------------------------------------- -sal_Bool SdrGrafObj::ImpUpdateGraphicLink() const +/* The graphic of the GraphicLink will be loaded. If it is called with + bAsynchron = true then the graphic will be set later via DataChanged +*/ +sal_Bool SdrGrafObj::ImpUpdateGraphicLink( sal_Bool bAsynchron ) const { - sal_Bool bRet = sal_False; - + sal_Bool bRet = sal_False; if( pGraphicLink ) { - const sal_Bool bIsChanged = pModel->IsChanged(); - pGraphicLink->UpdateSynchron(); - pModel->SetChanged( bIsChanged ); - + if ( bAsynchron ) + pGraphicLink->UpdateAsynchron(); + else + pGraphicLink->DataChanged( ImpLoadLinkedGraphic( aFileName, aFilterName ) ); bRet = sal_True; } - return bRet; } // ----------------------------------------------------------------------------- +void SdrGrafObj::ImpSetLinkedGraphic( const Graphic& rGraphic ) +{ + const sal_Bool bIsChanged = GetModel()->IsChanged(); + NbcSetGraphic( rGraphic ); + ActionChanged(); + BroadcastObjectChange(); + GetModel()->SetChanged( bIsChanged ); +} + +// ----------------------------------------------------------------------------- + void SdrGrafObj::TakeObjNameSingul(XubString& rName) const { switch( pGraphic->GetType() ) @@ -1095,7 +1239,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) if( ( pGraphic->HasUserData() || pGraphicLink ) && ( nSwapMode & SDR_SWAPGRAPHICSMODE_PURGE ) ) { - pRet = NULL; + pRet = GRFMGR_AUTOSWAPSTREAM_LINK; } else if( nSwapMode & SDR_SWAPGRAPHICSMODE_TEMP ) { @@ -1180,7 +1324,7 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) } } } - else if( !ImpUpdateGraphicLink() ) + else if( !ImpUpdateGraphicLink( sal_False ) ) { pRet = GRFMGR_AUTOSWAPSTREAM_TEMP; } -- cgit From 2ce6a123f867943205e26c2976159fd4a23da9f7 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 2 Nov 2010 15:47:47 +0100 Subject: fix a merge problem --- vcl/unx/source/gdi/salprnpsp.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx index 417704eb3b69..ece724d717cb 100644 --- a/vcl/unx/source/gdi/salprnpsp.cxx +++ b/vcl/unx/source/gdi/salprnpsp.cxx @@ -1187,14 +1187,12 @@ BOOL PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJobNam aContext.Version = vcl::PDFWriter::PDF_1_4; aContext.Tagged = false; aContext.EmbedStandardFonts = true; - aContext.Encrypt = false; aContext.DocumentLocale = Application::GetSettings().GetLocale(); // prepare doc info - vcl::PDFDocInfo aDocInfo; - aDocInfo.Title = i_rJobName; - aDocInfo.Creator = i_rAppName; - aDocInfo.Producer = i_rAppName; + aContext.DocumentInfo.Title = i_rJobName; + aContext.DocumentInfo.Creator = i_rAppName; + aContext.DocumentInfo.Producer = i_rAppName; // define how we handle metafiles in PDFWriter vcl::PDFWriter::PlayMetafileContext aMtfContext; @@ -1271,11 +1269,10 @@ BOOL PspSalPrinter::StartJob( const String* i_pFileName, const String& i_rJobNam #if defined __SUNPRO_CC #pragma disable_warn #endif - pWriter.reset( new vcl::PDFWriter( aContext ) ); + pWriter.reset( new vcl::PDFWriter( aContext, uno::Reference< beans::XMaterialHolder >() ) ); #if defined __SUNPRO_CC #pragma enable_warn #endif - pWriter->SetDocInfo( aDocInfo ); } pWriter->NewPage( TenMuToPt( aNewParm.maPageSize.Width() ), -- cgit From f6281ec4112479b5bdd750be351f4437ecf8a65a Mon Sep 17 00:00:00 2001 From: os Date: Wed, 3 Nov 2010 14:18:15 +0100 Subject: #i110273# caption order changed for locale hu --- officecfg/registry/data/org/openoffice/Office/Writer.xcu | 3 +++ 1 file changed, 3 insertions(+) diff --git a/officecfg/registry/data/org/openoffice/Office/Writer.xcu b/officecfg/registry/data/org/openoffice/Office/Writer.xcu index b318614ef789..06eff1b079e7 100644 --- a/officecfg/registry/data/org/openoffice/Office/Writer.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Writer.xcu @@ -53,6 +53,9 @@ + + true + -- cgit From 72959a6d4909fbebbcc40b7b745d233277d546e2 Mon Sep 17 00:00:00 2001 From: os Date: Thu, 4 Nov 2010 11:21:05 +0100 Subject: #i105063# moving cursor to linebreak (dtardon) --- sw/source/core/text/frmcrsr.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 8f9d3fc77337..aeddb97d3f83 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -780,7 +780,7 @@ sal_Bool SwTxtFrm::RightMargin(SwPaM *pPam, sal_Bool bAPI) const if( aLine.GetCurr()->GetLen() && CH_BREAK == aInf.GetTxt().GetChar( nRightMargin - 1 ) ) --nRightMargin; - if( !bAPI && (aLine.GetNext() || pFrm->GetFollow()) ) + else if( !bAPI && (aLine.GetNext() || pFrm->GetFollow()) ) { while( nRightMargin > aLine.GetStart() && ' ' == aInf.GetTxt().GetChar( nRightMargin - 1 ) ) -- cgit From 8eb582f4d077d49d76274b8df82a3f9b20cd8251 Mon Sep 17 00:00:00 2001 From: os Date: Thu, 4 Nov 2010 13:05:15 +0100 Subject: #i101078# gcc 4.3.2 warnings --- sw/inc/fmtcol.hxx | 2 +- sw/source/core/doc/docfld.cxx | 12 ++++++------ sw/source/core/doc/docftn.cxx | 4 ++-- sw/source/core/doc/tblrwcl.cxx | 8 ++++---- sw/source/core/edit/edsect.cxx | 4 ++-- sw/source/core/frmedt/feshview.cxx | 6 ++++-- sw/source/core/frmedt/tblsel.cxx | 4 ++-- sw/source/core/layout/calcmove.cxx | 4 ++-- sw/source/core/layout/frmtool.cxx | 2 +- sw/source/core/layout/layact.cxx | 2 +- sw/source/core/layout/pagechg.cxx | 4 ++-- sw/source/core/layout/paintfrm.cxx | 8 ++++---- sw/source/core/layout/trvlfrm.cxx | 22 ++++++++++++---------- sw/source/core/layout/wsfrm.cxx | 2 +- sw/source/core/table/swtable.cxx | 2 +- sw/source/core/unocore/unostyle.cxx | 12 ++++++------ sw/source/core/unocore/unotbl.cxx | 12 ++++++------ sw/source/filter/ascii/ascatr.cxx | 4 ++-- sw/source/filter/html/htmlctxt.cxx | 2 +- sw/source/filter/ww8/ww8par.cxx | 2 +- sw/source/ui/frmdlg/frmpage.cxx | 2 +- sw/source/ui/index/cnttab.cxx | 12 ++++++------ sw/source/ui/misc/glosdoc.cxx | 2 +- sw/source/ui/misc/outline.cxx | 4 ++-- sw/source/ui/shells/frmsh.cxx | 6 +++--- sw/source/ui/shells/tabsh.cxx | 16 ++++++++-------- sw/source/ui/shells/textsh.cxx | 2 +- sw/source/ui/shells/textsh1.cxx | 4 ++-- sw/source/ui/shells/txtattr.cxx | 4 ++-- sw/source/ui/uiview/view.cxx | 4 ++-- sw/source/ui/uiview/viewtab.cxx | 22 +++++++++++----------- sw/source/ui/utlui/content.cxx | 10 +++++----- 32 files changed, 105 insertions(+), 101 deletions(-) diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx index aba9b8533c0a..bcc9d6b45e4d 100644 --- a/sw/inc/fmtcol.hxx +++ b/sw/inc/fmtcol.hxx @@ -113,7 +113,7 @@ public: void SetAttrOutlineLevel( int ); int GetAttrOutlineLevel() const; int GetAssignedOutlineStyleLevel() const; - inline bool IsAssignedToListLevelOfOutlineStyle() const + inline const bool IsAssignedToListLevelOfOutlineStyle() const { return mbAssignedToOutlineStyle; } diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index f4e80e9de52a..994f33d358ba 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -2464,9 +2464,9 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) { SwDBData aDBData(((SwDBNumSetField*)pFld)->GetDBData(&rDoc)); - if( bIsDBMgr && - rDoc.GetNewDBMgr()->OpenDataSource( aDBData.sDataSource, aDBData.sCommand )&& - GETFLD_ALL == eGetMode || + if( (bIsDBMgr && + rDoc.GetNewDBMgr()->OpenDataSource( aDBData.sDataSource, aDBData.sCommand )&& + GETFLD_ALL == eGetMode) || ( GETFLD_CALC & eGetMode && ((SwDBNumSetField*)pFld)->IsCondValid())) pFormel = &pFld->GetPar1(); @@ -2476,9 +2476,9 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) { SwDBData aDBData(((SwDBNextSetField*)pFld)->GetDBData(&rDoc)); - if( bIsDBMgr && - rDoc.GetNewDBMgr()->OpenDataSource( aDBData.sDataSource, aDBData.sCommand )&& - GETFLD_ALL == eGetMode || + if( (bIsDBMgr && + rDoc.GetNewDBMgr()->OpenDataSource( aDBData.sDataSource, aDBData.sCommand )&& + GETFLD_ALL == eGetMode) || ( GETFLD_CALC & eGetMode && ((SwDBNextSetField*)pFld)->IsCondValid() )) pFormel = &pFld->GetPar1(); diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index 61bab9fdd525..43b0dbca6853 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -333,8 +333,8 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo) } BOOL bNumChg = rInfo.nFtnOffset != GetEndNoteInfo().nFtnOffset; - BOOL bExtra = !bNumChg && - rInfo.aFmt.GetNumberingType() != GetEndNoteInfo().aFmt.GetNumberingType()|| + BOOL bExtra = (!bNumChg && rInfo.aFmt.GetNumberingType() != GetEndNoteInfo().aFmt.GetNumberingType() ) + || rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix() || rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix(); BOOL bFtnDesc = rInfo.GetPageDesc( *this ) != diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 6119184d3209..1b0cf4fdfa32 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -2924,10 +2924,10 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( rParam.bLeft ? ((nDist + nWidth / 2 ) <= rParam.nSide && (TBLFIX_CHGABS != rParam.nMode || - n < rBoxes.Count() && + (n < rBoxes.Count() && (nDist + nWidth + rBoxes[ n+1 ]-> GetFrmFmt()->GetFrmSize().GetWidth() / 2) - > rParam.nSide )) + > rParam.nSide) )) : (nDist + nWidth / 2 ) > rParam.nSide ) { @@ -2989,10 +2989,10 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( nLowerDiff || (rParam.bLeft ? ((nDist + nWidth / 2 ) <= rParam.nSide && (TBLFIX_CHGABS != rParam.nMode || - n < rBoxes.Count() && + (n < rBoxes.Count() && (nDist + nWidth + rBoxes[ n+1 ]-> GetFrmFmt()->GetFrmSize().GetWidth() / 2) - > rParam.nSide )) + > rParam.nSide) )) : (nDist + nWidth / 2 ) > rParam.nSide )) { if( !nLowerDiff ) diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx index ba3c2e9c7966..a936002df9a2 100644 --- a/sw/source/core/edit/edsect.cxx +++ b/sw/source/core/edit/edsect.cxx @@ -143,8 +143,8 @@ BOOL SwEditShell::IsAnySectionInDoc( BOOL bChkReadOnly, BOOL bChkHidden, BOOL bC const SwSectionFmt* pFmt = rFmts[ n ]; if( pFmt->IsInNodesArr() && (bChkTOX || - (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION - && TOX_HEADER_SECTION != eTmpType )) + ( (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION + && TOX_HEADER_SECTION != eTmpType ) ) ) { const SwSection& rSect = *rFmts[ n ]->GetSection(); if( (!bChkReadOnly && !bChkHidden ) || diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index f334ddcaee2f..cb9b9d81cf46 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1475,10 +1475,12 @@ const SdrObject* SwFEShell::GetBestObject( BOOL bNext, USHORT /*GOTOOBJ_...*/ eT break; } - if( (bNext? (aPos.Y() < aCurPos.Y()) : // nur unter mir + if( ( + (bNext? (aPos.Y() < aCurPos.Y()) : // nur unter mir (aPos.Y() > aCurPos.Y())) && // " reverse (bNext? (aBestPos.Y() > aCurPos.Y()) : // naeher drunter - (aBestPos.Y() < aCurPos.Y())) || // " reverse + (aBestPos.Y() < aCurPos.Y())) + ) || // " reverse (aBestPos.Y() == aCurPos.Y() && (bNext? (aBestPos.X() > aCurPos.X()) : // weiter links (aBestPos.X() < aCurPos.X())))) // " reverse diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 8cabf285e12b..e1e2386d7ab9 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1747,8 +1747,8 @@ void lcl_FindStartEndCol( const SwLayoutFrm *&rpStart, (!pTmp->IsCellFrm() || ( ( ! bRTL && (pTmp->Frm().*fnRect->fnGetLeft)() < nSX && (pTmp->Frm().*fnRect->fnGetRight)()< nSX2 ) || - bRTL && (pTmp->Frm().*fnRect->fnGetLeft)() > nSX && - (pTmp->Frm().*fnRect->fnGetRight)()> nSX2 ) ) ) + ( bRTL && (pTmp->Frm().*fnRect->fnGetLeft)() > nSX && + (pTmp->Frm().*fnRect->fnGetRight)()> nSX2 ) ) ) ) pTmp = pTmp->GetNextLayoutLeaf(); if ( pTmp ) diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 28287c957ad1..90d210955023 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1004,8 +1004,8 @@ BOOL SwCntntFrm::MakePrtArea( const SwBorderAttrs &rAttrs ) SwAnchoredObject* pObj = (*GetDrawObjs())[i]; const SwFrmFmt& rFmt = pObj->GetFrmFmt(); const BOOL bFly = pObj->ISA(SwFlyFrm); - if ( bFly && - WEIT_WECH == pObj->GetObjRect().Width()|| + if ( ( bFly && + WEIT_WECH == pObj->GetObjRect().Width() ) || rFmt.GetFrmSize().GetWidthPercent() ) continue; diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 395009122063..ca226a8c5fbe 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1738,7 +1738,7 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx, // die in den Fussnoten liegen, nicht etwa die (spaltigen) Bereiche, // in denen die Fussnoten(Container) liegen. // #109767# Table frame is in section, insert section in cell frame. - if( pSct && ( pFtnFrm && !pSct->IsInFtn() ) || pUpper->IsCellFrm() ) + if( (pSct && ( pFtnFrm && !pSct->IsInFtn() )) || pUpper->IsCellFrm() ) pSct = NULL; if( pSct ) { // damit der SectionFrm nicht zerstoert wird durch pTmp->MoveFwd() diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index aec3fde909f1..b9931a6b80fb 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1077,7 +1077,7 @@ static bool lcl_IsInvaLay( const SwFrm *pFrm, long nBottom ) { if ( !pFrm->IsValid() || - (pFrm->IsCompletePaint() && pFrm->Frm().Top() < nBottom) + (pFrm->IsCompletePaint() && ( pFrm->Frm().Top() < nBottom ) ) ) { return true; diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 01f09f2c41c3..fd24e112109f 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1827,8 +1827,8 @@ void SwRootFrm::ImplCalcBrowseWidth() SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i]; const SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt(); const BOOL bFly = pAnchoredObj->ISA(SwFlyFrm); - if ( bFly && - WEIT_WECH == pAnchoredObj->GetObjRect().Width()|| + if ( ( bFly && + WEIT_WECH == pAnchoredObj->GetObjRect().Width() ) || rFmt.GetFrmSize().GetWidthPercent() ) continue; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 09fc6b00e03d..5793971d6938 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -533,7 +533,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut ) if ( rL2.GetTab() != rL1.GetTab() || rL2.IsPainted() || rL2.IsLocked() || - bVert == rL2.Height() > rL2.Width() ) + (bVert == (rL2.Height() > rL2.Width())) ) continue; long nL2a, nL2b, nL2c, nL2d; @@ -707,7 +707,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) if ( rLine.IsLocked () ) continue; - if ( !bVerticalSubs == rLine.Height() > rLine.Width() ) //gleiche Ausrichtung? + if ( (!bVerticalSubs == (rLine.Height() > rLine.Width())) ) //gleiche Ausrichtung? continue; if ( aSubsRect.IsOver( rLine ) ) @@ -912,7 +912,7 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut, SwLineRect &rLk = operator[](k); if ( rLi.SSize() == rLk.SSize() ) { - if ( bVerticalSubs == rLk.Height() > rLk.Width() ) + if ( (bVerticalSubs == (rLk.Height() > rLk.Width())) ) { if ( bVerticalSubs ) { @@ -6263,7 +6263,7 @@ void SwLayoutFrm::PaintSubsidiaryLines( const SwPageFrm *pPage, void SwPageFrm::RefreshExtraData( const SwRect &rRect ) const { const SwLineNumberInfo &rInfo = GetFmt()->GetDoc()->GetLineNumberInfo(); - BOOL bLineInFly = rInfo.IsPaintLineNumbers() && rInfo.IsCountInFlys() + BOOL bLineInFly = (rInfo.IsPaintLineNumbers() && rInfo.IsCountInFlys()) || (sal_Int16)SW_MOD()->GetRedlineMarkPos() != text::HoriOrientation::NONE; SwRect aRect( rRect ); diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 018e48440b59..df045392e33f 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -581,8 +581,8 @@ const SwCntntFrm * MA_FASTCALL lcl_MissProtectedFrames( const SwCntntFrm *pCnt, if ( !pCell || ( ( bInReadOnly || !pCell->GetFmt()->GetProtect().IsCntntProtected() ) && ( !bMissHeadline || !lcl_IsInRepeatedHeadline( pCell ) ) && - ( !bMissFollowFlowLine || !pCell->IsInFollowFlowRow() ) ) && - !pCell->IsCoveredCell() ) + ( !bMissFollowFlowLine || !pCell->IsInFollowFlowRow() ) && + !pCell->IsCoveredCell() ) ) bProtect = FALSE; else pCnt = (*fnNxtPrv)( pCnt ); @@ -701,14 +701,14 @@ BOOL MA_FASTCALL lcl_UpDown( SwPaM *pPam, const SwCntntFrm *pStart, const long nPrtLeft = bRTL ? (pTable->*fnRect->fnGetPrtRight)() : (pTable->*fnRect->fnGetPrtLeft)(); - if ( bRTL != nX < nPrtLeft ) + if ( (bRTL != (nX < nPrtLeft)) ) nX = nPrtLeft; else { const long nPrtRight = bRTL ? (pTable->*fnRect->fnGetPrtLeft)() : (pTable->*fnRect->fnGetPrtRight)(); - if ( bRTL != nX > nPrtRight ) + if ( (bRTL != (nX > nPrtRight)) ) nX = nPrtRight; } } @@ -2308,12 +2308,14 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode ) (aTmp.*fnRectX->fnSetTop)( nTmp ); if( (aEndRect.*fnRectX->fnGetTop)() != (pEnd2Pos->aPortion.*fnRectX->fnGetTop)() ) - if( bPorR2L ) - (aTmp.*fnRectX->fnSetLeft)( - (pEnd2Pos->aPortion.*fnRectX->fnGetLeft)() ); - else - (aTmp.*fnRectX->fnSetRight)( - (pEnd2Pos->aPortion.*fnRectX->fnGetRight)() ); + { + if( bPorR2L ) + (aTmp.*fnRectX->fnSetLeft)( + (pEnd2Pos->aPortion.*fnRectX->fnGetLeft)() ); + else + (aTmp.*fnRectX->fnSetRight)( + (pEnd2Pos->aPortion.*fnRectX->fnGetRight)() ); + } aTmp.Intersection( aEndFrm ); Sub( aRegion, aTmp ); } diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index ade3efd4e70d..31d27d0152a0 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -3125,7 +3125,7 @@ void SwLayoutFrm::ChgLowersProp( const Size& rOldSize ) // Finally adjust the columns if width is set to auto // Possible optimisation: execute this code earlier in this function and // return??? - if ( ( bVert && bHeightChgd || ! bVert && bWidthChgd ) && + if ( ( (bVert && bHeightChgd) || (! bVert && bWidthChgd) ) && Lower()->IsColumnFrm() ) { // get column attribute diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 281aac016e43..48b3b5f335fb 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -2410,7 +2410,7 @@ void SwTableBoxFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) BOOL bNewIsTxtFmt = pNumFmtr->IsTextFormat( nNewFmt ) || NUMBERFORMAT_TEXT == nNewFmt; - if( !bNewIsTxtFmt && nOldFmt != nNewFmt || pNewFml ) + if( (!bNewIsTxtFmt && nOldFmt != nNewFmt) || pNewFml ) { BOOL bChgTxt = TRUE; double fVal = 0; diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 4309622c9545..6bfce552765e 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1894,8 +1894,8 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, if( pCharStyleNames[i] != SwXNumberingRules::GetInvalidStyle() && ((pCharStyleNames[i].Len() && !pFmt->GetCharFmt()) || - pCharStyleNames[i].Len() && - pFmt->GetCharFmt()->GetName() != pCharStyleNames[i] )) + (pCharStyleNames[i].Len() && + pFmt->GetCharFmt()->GetName() != pCharStyleNames[i]) )) { SwCharFmt* pCharFmt = 0; @@ -1927,8 +1927,8 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, //jetzt nochmal fuer Fonts if(pBulletFontNames[i] != SwXNumberingRules::GetInvalidStyle() && ((pBulletFontNames[i].Len() && !pFmt->GetBulletFont()) || - pBulletFontNames[i].Len() && - pFmt->GetBulletFont()->GetName() != pBulletFontNames[i] )) + (pBulletFontNames[i].Len() && + pFmt->GetBulletFont()->GetName() != pBulletFontNames[i]) )) { const SvxFontListItem* pFontListItem = (const SvxFontListItem* )pDoc->GetDocShell() @@ -3609,8 +3609,8 @@ MakeObject: { const SwPageDesc& rDesc = aBase.GetOldPageDesc(); const SwFrmFmt* pFrmFmt = 0; - sal_Bool bShare = bHeader && rDesc.IsHeaderShared()|| - !bHeader && rDesc.IsFooterShared(); + sal_Bool bShare = (bHeader && rDesc.IsHeaderShared())|| + (!bHeader && rDesc.IsFooterShared()); // TextLeft returns the left content if there is one, // Text and TextRight return the master content. // TextRight does the same as Text and is for diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index fdc382ad99d9..a3f52d9c9901 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -700,7 +700,7 @@ void lcl_SetTblSeparators(const uno::Any& rVal, SwTable* pTable, SwTableBox* pBo { aCols[i] = pArray[i].Position; if(pArray[i].IsVisible == aCols.IsHidden(i) || - !bRow && aCols.IsHidden(i) || + (!bRow && aCols.IsHidden(i)) || long(aCols[i] - long(nLastValue)) < 0 || UNO_TABLE_COLUMN_SUM < aCols[i] ) { @@ -3439,10 +3439,10 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const SwFrmFmt* pBoxFmt = pBox->GetFrmFmt(); const SvxBoxItem& rBox = pBoxFmt->GetBox(); if( - aTableBorderDistances.IsLeftDistanceValid && nLeftDistance != rBox.GetDistance( BOX_LINE_LEFT ) || - aTableBorderDistances.IsRightDistanceValid && nRightDistance != rBox.GetDistance( BOX_LINE_RIGHT ) || - aTableBorderDistances.IsTopDistanceValid && nTopDistance != rBox.GetDistance( BOX_LINE_TOP ) || - aTableBorderDistances.IsBottomDistanceValid && nBottomDistance != rBox.GetDistance( BOX_LINE_BOTTOM )) + (aTableBorderDistances.IsLeftDistanceValid && nLeftDistance != rBox.GetDistance( BOX_LINE_LEFT )) || + (aTableBorderDistances.IsRightDistanceValid && nRightDistance != rBox.GetDistance( BOX_LINE_RIGHT )) || + (aTableBorderDistances.IsTopDistanceValid && nTopDistance != rBox.GetDistance( BOX_LINE_TOP )) || + (aTableBorderDistances.IsBottomDistanceValid && nBottomDistance != rBox.GetDistance( BOX_LINE_BOTTOM ))) { SvxBoxItem aSetBox( rBox ); SwFrmFmt* pSetBoxFmt = pBox->ClaimFrmFmt(); @@ -3755,7 +3755,7 @@ void SwXTextTable::setName(const OUString& rName) throw( uno::RuntimeException ) vos::OGuard aGuard(Application::GetSolarMutex()); SwFrmFmt* pFmt = GetFrmFmt(); String sNewTblName(rName); - if(!pFmt && !bIsDescriptor || + if((!pFmt && !bIsDescriptor) || !sNewTblName.Len() || STRING_NOTFOUND != sNewTblName.Search('.') || STRING_NOTFOUND != sNewTblName.Search(' ') ) diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index c1ba4908a339..d4471f9bb790 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -205,8 +205,8 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) } while( nStrPos < nEnde ); if( !bLastNd || - ( !rWrt.bWriteClipboardDoc && !rWrt.bASCII_NoLastLineEnd ) - && !nStrPos && nEnde == nNodeEnde ) + ( ( !rWrt.bWriteClipboardDoc && !rWrt.bASCII_NoLastLineEnd ) + && !nStrPos && nEnde == nNodeEnde ) ) rWrt.Strm().WriteUnicodeOrByteText( ((SwASCWriter&)rWrt).GetLineEnd()); return rWrt; diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx index 485ac5dd2a2b..b3a62fe4d189 100644 --- a/sw/source/filter/html/htmlctxt.cxx +++ b/sw/source/filter/html/htmlctxt.cxx @@ -192,7 +192,7 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos ) nOldEndCnt = pPam->GetPoint()->nContent.GetIndex(); } - if( RES_PARATR_BEGIN <= nWhich && bMoveBack || + if( (RES_PARATR_BEGIN <= nWhich && bMoveBack) || pAttr->GetSttParaIdx() < pOldEndPara->GetIndex() || (pAttr->GetSttPara() == *pOldEndPara && pAttr->GetSttCnt() != nOldEndCnt) ) diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 24f36b047a4e..21852ea86f25 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3575,7 +3575,7 @@ void wwSectionManager::InsertSegments() bool bThisAndNextAreCompatible = (aNext != aEnd) ? ((aIter->GetPageWidth() == aNext->GetPageWidth()) && (aIter->GetPageHeight() == aNext->GetPageHeight()) && (aIter->IsLandScape() == aNext->IsLandScape())) : true; - if ((aNext != aEnd && aNext->IsContinous() && bThisAndNextAreCompatible) || bProtected) + if (((aNext != aEnd && aNext->IsContinous() && bThisAndNextAreCompatible) || bProtected)) { bIgnoreCols = true; if ((aIter->NoCols() > 1) || bProtected) diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 5bff86b1a4c7..49bd1b2a0c7e 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -1080,7 +1080,7 @@ BOOL SwFrmPage::FillItemSet(SfxItemSet &rSet) aWidthED .GetValue() == aWidthED .GetMin() && aHeightED.GetValue() == aHeightED.GetMin()); - if ((bNew && !bFormat) || (bValueModified || bCheckChanged) && bLegalValue) + if ((bNew && !bFormat) || ((bValueModified || bCheckChanged) && bLegalValue)) { sal_Int64 nNewWidth = aWidthED.DenormalizePercent(aWidthED.GetRealValue(FUNIT_TWIP)); sal_Int64 nNewHeight = aHeightED.DenormalizePercent(aHeightED.GetRealValue(FUNIT_TWIP)); diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index a8a01a4f8222..038ec65df87b 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -1826,8 +1826,8 @@ void SwTOXEdit::KeyInput( const KeyEvent& rKEvt ) { const Selection& rSel = GetSelection(); sal_uInt16 nTextLen = GetText().Len(); - if(rSel.A() == rSel.B() && - !rSel.A() || rSel.A() == nTextLen ) + if( (rSel.A() == rSel.B() && + !rSel.A() ) || rSel.A() == nTextLen ) { sal_Bool bCall = sal_False; KeyCode aCode = rKEvt.GetKeyCode(); @@ -3804,8 +3804,8 @@ IMPL_LINK(SwTokenWindow, EditResize, Edit*, pEdit) IMPL_LINK(SwTokenWindow, NextItemHdl, SwTOXEdit*, pEdit) { sal_uInt16 nPos = (sal_uInt16)aControlList.GetPos(pEdit); - if(nPos && !pEdit->IsNextControl() || - nPos < aControlList.Count() - 1 && pEdit->IsNextControl()) + if( (nPos && !pEdit->IsNextControl()) || + (nPos < aControlList.Count() - 1 && pEdit->IsNextControl())) { aControlList.Seek(nPos); Control* pNextPrev = pEdit->IsNextControl() ? aControlList.Next() : aControlList.Prev(); @@ -3840,8 +3840,8 @@ IMPL_LINK(SwTokenWindow, TbxFocusHdl, SwTOXEdit*, pEdit) IMPL_LINK(SwTokenWindow, NextItemBtnHdl, SwTOXButton*, pBtn ) { sal_uInt16 nPos = (sal_uInt16)aControlList.GetPos(pBtn); - if(nPos && !pBtn->IsNextControl() || - nPos < aControlList.Count() - 1 && pBtn->IsNextControl()) + if( (nPos && !pBtn->IsNextControl()) || + (nPos < aControlList.Count() - 1 && pBtn->IsNextControl())) { aControlList.Seek(nPos); sal_Bool bNext = pBtn->IsNextControl(); diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx index 9ce1038eb898..6ed886fb3974 100644 --- a/sw/source/ui/misc/glosdoc.cxx +++ b/sw/source/ui/misc/glosdoc.cxx @@ -523,7 +523,7 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull) aDirArr.DeleteAndDestroy(0, aDirArr.Count()); if(!nTokenCount || - m_sErrPath.Len() && (bPathChanged || m_sOldErrPath != m_sErrPath) ) + (m_sErrPath.Len() && (bPathChanged || m_sOldErrPath != m_sErrPath)) ) { m_sOldErrPath = m_sErrPath; // Falscher Pfad, d.h. AutoText-Verzeichnis existiert nicht diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index e733aa0389c2..5380a00afbaf 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -617,8 +617,8 @@ void SwOutlineSettingsTabPage::Update() bSameSuffix &= aNumFmtArr[i]->GetSuffix() == aNumFmtArr[0]->GetSuffix(); bSameComplete &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[0]->GetIncludeUpperLevels(); const SwCharFmt* pFmt = aNumFmtArr[i]->GetCharFmt(); - bSameCharFmt &= !pFirstFmt && !pFmt - || pFirstFmt && pFmt && pFmt->GetName() == pFirstFmt->GetName(); + bSameCharFmt &= (!pFirstFmt && !pFmt) + || (pFirstFmt && pFmt && pFmt->GetName() == pFirstFmt->GetName()); } } CheckForStartValue_Impl(aNumFmtArr[0]->GetNumberingType()); diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx index 5d972af52f72..75ee36b32f1e 100644 --- a/sw/source/ui/shells/frmsh.cxx +++ b/sw/source/ui/shells/frmsh.cxx @@ -711,7 +711,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) case FN_FRAME_ALIGN_HORZ_LEFT: if ( (eFrmType & FRMTYPE_FLY_INCNT) || bProtect || - (nWhich == FN_FRAME_ALIGN_HORZ_CENTER || nWhich == SID_OBJECT_ALIGN_CENTER)&& bHtmlMode ) + ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER || nWhich == SID_OBJECT_ALIGN_CENTER)&& bHtmlMode) ) rSet.DisableItem( nWhich ); break; case FN_FRAME_ALIGN_VERT_ROW_TOP: @@ -721,7 +721,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) case FN_FRAME_ALIGN_VERT_CHAR_CENTER: case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM: if ( !(eFrmType & FRMTYPE_FLY_INCNT) || bProtect - || bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich ) + || (bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich) ) rSet.DisableItem( nWhich ); break; @@ -732,7 +732,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) case FN_FRAME_ALIGN_VERT_TOP: case FN_FRAME_ALIGN_VERT_CENTER: case FN_FRAME_ALIGN_VERT_BOTTOM: - if ( bProtect || bHtmlMode && eFrmType & FRMTYPE_FLY_ATCNT) + if ( bProtect || (bHtmlMode && eFrmType & FRMTYPE_FLY_ATCNT) ) rSet.DisableItem( nWhich ); else { diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx index f87bc0d41208..bb4f1c7fb609 100644 --- a/sw/source/ui/shells/tabsh.cxx +++ b/sw/source/ui/shells/tabsh.cxx @@ -220,7 +220,7 @@ static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh ) // Tabellenvariante, wenn mehrere Tabellenzellen selektiert rSh.GetCrsr(); //Damit GetCrsrCnt() auch das Richtige liefert - aBoxInfo.SetTable (rSh.IsTableMode() && rSh.GetCrsrCnt() > 1 || + aBoxInfo.SetTable ((rSh.IsTableMode() && rSh.GetCrsrCnt() > 1) || !bTableSel); // Abstandsfeld immer anzeigen aBoxInfo.SetDist ((BOOL) TRUE); @@ -663,7 +663,7 @@ void SwTableShell::Execute(SfxRequest &rReq) else aCoreSet.InvalidateItem( RES_BACKGROUND ); - if ( !pDlg && rReq.GetArgs() || pDlg->Execute() == RET_OK ) + if ( (!pDlg && rReq.GetArgs()) || pDlg->Execute() == RET_OK ) { const SfxItemSet* pOutSet = pDlg ? pDlg->GetOutputItemSet() : rReq.GetArgs(); if ( pDlg ) @@ -1330,9 +1330,9 @@ void SwTableShell::GetState(SfxItemSet &rSet) case FN_TABLE_VERT_BOTTOM: { USHORT nAlign = rSh.GetBoxAlign(); - BOOL bSet = nSlot == FN_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE|| - nSlot == FN_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER || - nSlot == FN_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM; + BOOL bSet = (nSlot == FN_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) || + (nSlot == FN_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) || + (nSlot == FN_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM); rSet.Put(SfxBoolItem(nSlot, bSet)); } break; @@ -1342,9 +1342,9 @@ void SwTableShell::GetState(SfxItemSet &rSet) case FN_TABLE_MODE_VARIABLE : { TblChgMode nMode = rSh.GetTblChgMode(); - BOOL bSet = nSlot == FN_TABLE_MODE_FIX && nMode == TBLFIX_CHGABS || - nSlot == FN_TABLE_MODE_FIX_PROP && nMode == TBLFIX_CHGPROP || - nSlot == FN_TABLE_MODE_VARIABLE && nMode == TBLVAR_CHGABS; + BOOL bSet = (nSlot == FN_TABLE_MODE_FIX && nMode == TBLFIX_CHGABS) || + (nSlot == FN_TABLE_MODE_FIX_PROP && nMode == TBLFIX_CHGPROP) || + (nSlot == FN_TABLE_MODE_VARIABLE && nMode == TBLVAR_CHGABS); rSet.Put(SfxBoolItem(nSlot, bSet)); } break; diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index a819a8b21da0..0d217532e32a 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -902,7 +902,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) } break; case FN_INSERT_HRULER : - if(rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() || bCrsrInHidden ) + if((rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel()) || bCrsrInHidden ) rSet.DisableItem(nWhich); break; case FN_FORMAT_COLUMN : diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index 2dff1eddc4b4..e084c539da19 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -1743,8 +1743,8 @@ void SwTextShell::ChangeHeaderOrFooter( if( !rStyleName.Len() || rStyleName == sTmp ) { if( bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() && - (bHeader && aDesc.GetMaster().GetHeader().IsActive() || - !bHeader && aDesc.GetMaster().GetFooter().IsActive())) + ((bHeader && aDesc.GetMaster().GetHeader().IsActive()) || + (!bHeader && aDesc.GetMaster().GetFooter().IsActive()))) { bShowWarning = FALSE; //Actions have to be closed while the dialog is showing diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx index 9e89620bed28..9d90ac5d5b26 100644 --- a/sw/source/ui/shells/txtattr.cxx +++ b/sw/source/ui/shells/txtattr.cxx @@ -119,8 +119,8 @@ void SwTextShell::ExecCharAttr(SfxRequest &rReq) eEscape = nWhich == FN_SET_SUPER_SCRIPT ? SVX_ESCAPEMENT_SUPERSCRIPT: SVX_ESCAPEMENT_SUBSCRIPT; - if( nWhich == FN_SET_SUB_SCRIPT && nTmpEsc < 0 || - nWhich == FN_SET_SUPER_SCRIPT && nTmpEsc > 0 ) + if( (nWhich == FN_SET_SUB_SCRIPT && nTmpEsc < 0) || + (nWhich == FN_SET_SUPER_SCRIPT && nTmpEsc > 0) ) eEscape = SVX_ESCAPEMENT_OFF; SfxBindings& rBind = GetView().GetViewFrame()->GetBindings(); diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index 15c94782883f..256bdb20b732 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -1180,8 +1180,8 @@ bool lcl_IsOwnDocument( SwView& rView ) String Created = xDocProps->getAuthor(); String Changed = xDocProps->getModifiedBy(); String FullName = SW_MOD()->GetUserOptions().GetFullName(); - return FullName.Len() && - (Changed.Len() && Changed == FullName ) || + return (FullName.Len() && + (Changed.Len() && Changed == FullName )) || (!Changed.Len() && Created.Len() && Created == FullName ); } diff --git a/sw/source/ui/uiview/viewtab.cxx b/sw/source/ui/uiview/viewtab.cxx index 44e314a7475b..ca65184c74e6 100644 --- a/sw/source/ui/uiview/viewtab.cxx +++ b/sw/source/ui/uiview/viewtab.cxx @@ -529,7 +529,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) aUL.SetLower( (USHORT)aLongULSpace.GetLower() ); aDesc.GetMaster().SetFmtAttr( aUL ); - if( bHead && pHeaderFmt || !bHead && pFooterFmt ) + if( (bHead && pHeaderFmt) || (!bHead && pFooterFmt) ) { SwFmtFrmSize aSz( bHead ? pHeaderFmt->GetFrmSize() : pFooterFmt->GetFrmSize() ); @@ -694,7 +694,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) SvxColumnItem aColItem((const SvxColumnItem&)rReq. GetArgs()->Get(nSlot)); - if( bSetTabColFromDoc || !bSect && rSh.GetTableFmt() ) + if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) ) { ASSERT(aColItem.Count(), "ColDesc ist leer!!"); @@ -826,7 +826,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) SvxColumnItem aColItem((const SvxColumnItem&)rReq. GetArgs()->Get(nSlot)); - if( bSetTabColFromDoc || !bSect && rSh.GetTableFmt() ) + if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) ) { ASSERT(aColItem.Count(), "ColDesc ist leer!!"); @@ -1078,8 +1078,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) (nSelType & nsSelectionType::SEL_FRM) || (nSelType & nsSelectionType::SEL_OLE) || SFX_ITEM_AVAILABLE > aCoreSet.GetItemState(RES_LR_SPACE)|| - !bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich)|| - bVerticalWriting && (RES_PARATR_TABSTOP == nWhich) + (!bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich))|| + (bVerticalWriting && (RES_PARATR_TABSTOP == nWhich)) ) rSet.DisableItem( nWhich ); else @@ -1106,8 +1106,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) nSelType & nsSelectionType::SEL_FRM || nSelType & nsSelectionType::SEL_OLE || nFrmType == FRMTYPE_DRAWOBJ || - !bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich)|| - bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich) + (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich))|| + (bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich)) ) { rSet.DisableItem(nWhich); @@ -1282,9 +1282,9 @@ void SwView::StateTabWin(SfxItemSet& rSet) BOOL bTableVertical = bHasTable && rSh.IsTableVertical(); - if((SID_RULER_BORDERS_VERTICAL == nWhich) && + if( ( (SID_RULER_BORDERS_VERTICAL == nWhich) && ((bHasTable && !bTableVertical)|| - (!bVerticalWriting && !bFrmSelection && !bHasTable ) || (bFrmSelection && !bFrameHasVerticalColumns)) || + (!bVerticalWriting && !bFrmSelection && !bHasTable ) || (bFrmSelection && !bFrameHasVerticalColumns)) ) || ((SID_RULER_BORDERS == nWhich) && ((bHasTable && bTableVertical)|| (bVerticalWriting && !bFrmSelection&& !bHasTable) || bFrameHasVerticalColumns))) @@ -1501,8 +1501,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) BOOL bFrameRTL; BOOL bFrameHasVerticalColumns = rSh.IsFrmVertical(FALSE, bFrameRTL) && bFrmSelection; - if((SID_RULER_ROWS == nWhich) && - ((!bVerticalWriting && !bFrmSelection) || (bFrmSelection && !bFrameHasVerticalColumns)) || + if( ( (SID_RULER_ROWS == nWhich) && + ((!bVerticalWriting && !bFrmSelection) || (bFrmSelection && !bFrameHasVerticalColumns)) ) || ((SID_RULER_ROWS_VERTICAL == nWhich) && ((bVerticalWriting && !bFrmSelection) || bFrameHasVerticalColumns))) rSet.DisableItem(nWhich); diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index 0b0bca564f48..b8e1c52a7f96 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -2070,7 +2070,7 @@ void SwContentTree::ExecCommand(sal_uInt16 nCmd, sal_Bool bModifier) SvLBoxEntry* pFirstEntry = FirstSelected(); if (pFirstEntry && lcl_IsContent(pFirstEntry)) { - if(bIsRoot && nRootType == CONTENT_TYPE_OUTLINE || + if((bIsRoot && nRootType == CONTENT_TYPE_OUTLINE) || ((SwContent*)pFirstEntry->GetUserData())->GetParent()->GetType() == CONTENT_TYPE_OUTLINE) { @@ -2088,8 +2088,8 @@ void SwContentTree::ExecCommand(sal_uInt16 nCmd, sal_Bool bModifier) if( nMove ) { short nDir = nCmd == FN_ITEM_UP ? -1 : 1; - if( !bModifier && (nDir == -1 && nActPos > 0 || - nDir == 1 && nActPos < GetEntryCount() - 2 ) ) + if( !bModifier && ((nDir == -1 && nActPos > 0) || + (nDir == 1 && nActPos < GetEntryCount() - 2 )) ) { pShell->MoveOutlinePara( nDir ); //Cursor wieder an die aktuelle Position setzen @@ -2761,8 +2761,8 @@ sal_Bool SwContentTree::Select( SvLBoxEntry* pEntry, sal_Bool bSelect ) sal_Bool bEnable = sal_False; SvLBoxEntry* pParentEntry = GetParent(pEntry); if(!bIsLastReadOnly && (!IsVisible() || - (bIsRoot && nRootType == CONTENT_TYPE_OUTLINE && pParentEntry || - lcl_IsContent(pEntry) && ((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE))) + ((bIsRoot && nRootType == CONTENT_TYPE_OUTLINE && pParentEntry) || + (lcl_IsContent(pEntry) && ((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)))) bEnable = sal_True; SwNavigationPI* pNavi = GetParentWindow(); pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , bEnable); -- cgit From 826161a9ee79df8e57dac2257c242dabbee7c7cc Mon Sep 17 00:00:00 2001 From: os Date: Thu, 4 Nov 2010 13:28:24 +0100 Subject: #i104053# patch: use of page styles in dialogs fixed --- sw/source/ui/chrdlg/break.cxx | 2 +- sw/source/ui/misc/docfnote.cxx | 2 +- sw/source/ui/table/tabledlg.cxx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx index cc1f208950dc..63d878006f7e 100644 --- a/sw/source/ui/chrdlg/break.cxx +++ b/sw/source/ui/chrdlg/break.cxx @@ -200,7 +200,7 @@ SwBreakDlg::SwBreakDlg( Window *pParent, SwWrtShell &rS ) : } String aFmtName; - for(i = RES_POOLPAGE_BEGIN; i <= RES_POOLPAGE_REGISTER; ++i) + for(i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i) if(LISTBOX_ENTRY_NOTFOUND == aPageCollBox.GetEntryPos( aFmtName = SwStyleNameMapper::GetUIName( i, aFmtName ))) ::InsertStringSorted(aFmtName, aPageCollBox, 1 ); diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx index 06a2e1ae69f4..67fc32bcf1c9 100644 --- a/sw/source/ui/misc/docfnote.cxx +++ b/sw/source/ui/misc/docfnote.cxx @@ -265,7 +265,7 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet& ) } // Seite - for( i = RES_POOLPAGE_BEGIN; i <= RES_POOLPAGE_LANDSCAPE; ++i ) + for( i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i ) aPageTemplBox.InsertEntry(SwStyleNameMapper::GetUIName( i, aEmptyStr )); USHORT nCount = pSh->GetPageDescCnt(); diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index d8e1eed0f3fc..5b26b99d012f 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1643,7 +1643,7 @@ void SwTextFlowPage::Reset( const SfxItemSet& rSet ) } String aFmtName; - for(i = RES_POOLPAGE_BEGIN; i <= RES_POOLPAGE_REGISTER; ++i) + for(i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i) if( LISTBOX_ENTRY_NOTFOUND == aPageCollLB.GetEntryPos( aFmtName = SwStyleNameMapper::GetUIName( i, aFmtName ) )) aPageCollLB.InsertEntry( aFmtName ); -- cgit From fde11872616870dc4edbf497c485481e8b6156a2 Mon Sep 17 00:00:00 2001 From: os Date: Thu, 4 Nov 2010 14:00:48 +0100 Subject: non-warning change removed --- sw/inc/fmtcol.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx index bcc9d6b45e4d..aba9b8533c0a 100644 --- a/sw/inc/fmtcol.hxx +++ b/sw/inc/fmtcol.hxx @@ -113,7 +113,7 @@ public: void SetAttrOutlineLevel( int ); int GetAttrOutlineLevel() const; int GetAssignedOutlineStyleLevel() const; - inline const bool IsAssignedToListLevelOfOutlineStyle() const + inline bool IsAssignedToListLevelOfOutlineStyle() const { return mbAssignedToOutlineStyle; } -- cgit From 452e5f66caaee7284e4e5a9fcb1e322ea2f2db9b Mon Sep 17 00:00:00 2001 From: os Date: Thu, 4 Nov 2010 15:45:06 +0100 Subject: #i52088# patch: sorting of index entries with and without primary key --- sw/source/core/doc/doctxm.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 58b3e084cf7a..decf471164f9 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -2380,8 +2380,7 @@ Range SwTOXBaseSection::GetKeyRange(const String& rStr, const String& rStrReadin if( rIntl.IsEqual( sMyString, sMyStringReading, pBase->GetLocale(), sToCompare, sToCompareReading, rNew.GetLocale() ) && - pBase->GetLevel() == nLevel && - pBase->GetType() == TOX_SORT_CUSTOM ) + pBase->GetLevel() == nLevel ) break; } if(i == nMax) -- cgit From 34a04ae552339d2b7799806da36a8c2858b9baf7 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 4 Nov 2010 17:56:39 +0100 Subject: pl08: #163778# use EncryptionData from MediaDescriptor --- sfx2/inc/sfx2/docfile.hxx | 2 +- sfx2/inc/sfx2/sfxsids.hrc | 4 ++- sfx2/inc/sfx2/sfxuno.hxx | 3 +- sfx2/sdi/sfx.sdi | 2 +- sfx2/source/appl/appopen.cxx | 49 +++++++++++++++++++------ sfx2/source/appl/appuno.cxx | 14 ++++++++ sfx2/source/dialog/filedlghelper.cxx | 31 ++++++++++++++-- sfx2/source/dialog/mailmodelapi.cxx | 2 -- sfx2/source/dialog/makefile.mk | 1 + sfx2/source/dialog/versdlg.cxx | 8 ++--- sfx2/source/doc/docfile.cxx | 14 +++++--- sfx2/source/doc/guisaveas.cxx | 10 +++--- sfx2/source/doc/objserv.cxx | 4 +-- sfx2/source/doc/objstor.cxx | 46 +++++++++++++++--------- sfx2/source/doc/sfxbasemodel.cxx | 70 +++++++++++++++++++----------------- 15 files changed, 175 insertions(+), 85 deletions(-) mode change 100755 => 100644 sfx2/sdi/sfx.sdi diff --git a/sfx2/inc/sfx2/docfile.hxx b/sfx2/inc/sfx2/docfile.hxx index 0cb57e7a414d..35656202650f 100644 --- a/sfx2/inc/sfx2/docfile.hxx +++ b/sfx2/inc/sfx2/docfile.hxx @@ -112,7 +112,7 @@ class SFX2_DLLPUBLIC SfxMedium : public SvRefBase SAL_DLLPRIVATE void CloseStreams_Impl(); DECL_DLLPRIVATE_STATIC_LINK( SfxMedium, UCBHdl_Impl, sal_uInt32 * ); - SAL_DLLPRIVATE void SetPasswordToStorage_Impl(); + SAL_DLLPRIVATE void SetEncryptionDataToStorage_Impl(); #endif public: diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 26e1991c24b8..42b27c17e767 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -309,7 +309,9 @@ #define SID_DEFAULTFILENAME (SID_SFX_START + 1717) #define SID_MODIFYPASSWORDINFO (SID_SFX_START + 1718) #define SID_RECOMMENDREADONLY (SID_SFX_START + 1719) -#define SID_SFX_free_START (SID_SFX_START + 1720) +#define SID_ENCRYPTIONDATA (SID_SFX_START + 1720) +#define SID_PASSWORDINTERACTION (SID_SFX_START + 1721) +#define SID_SFX_free_START (SID_SFX_START + 1722) #define SID_SFX_free_END (SID_SFX_START + 3999) #define SID_OPEN_NEW_VIEW (SID_SFX_START + 520) diff --git a/sfx2/inc/sfx2/sfxuno.hxx b/sfx2/inc/sfx2/sfxuno.hxx index f9702063713a..691716b70571 100644 --- a/sfx2/inc/sfx2/sfxuno.hxx +++ b/sfx2/inc/sfx2/sfxuno.hxx @@ -37,6 +37,7 @@ #include #include #include +#include //________________________________________________________________________________________________________________________ @@ -104,7 +105,7 @@ SFX2_DLLPUBLIC void TransformItems( sal_uInt16 UNOSEQUENCE< UNOPROPERTYVALUE >& seqArgs , const SfxSlot* pSlot = 0 ); -sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, ::rtl::OUString& rPasswd ); +bool GetEncryptionData_Impl( const SfxItemSet* pSet, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ); #define FrameSearchFlags sal_Int32 diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi old mode 100755 new mode 100644 index 8ca8645a05ff..2f960e31ba29 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -5317,7 +5317,7 @@ SfxBoolItem SaveAll SID_SAVEDOCS //-------------------------------------------------------------------------- SfxBoolItem SaveAs SID_SAVEASDOC -(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem Password SID_PASSWORD,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxStringItem VersionAuthor SID_DOCINFO_AUTHOR,SfxBoolItem Overwrite SID_OVERWRITE,SfxBoolItem Unpacked SID_UNPACK,SfxBoolItem SaveTo SID_SAVETO) +(SfxStringItem URL SID_FILE_NAME,SfxStringItem FilterName SID_FILTER_NAME,SfxStringItem Password SID_PASSWORD,SfxBoolItem PasswordInteraction SID_PASSWORDINTERACTION,SfxStringItem FilterOptions SID_FILE_FILTEROPTIONS,SfxStringItem VersionComment SID_DOCINFO_COMMENTS,SfxStringItem VersionAuthor SID_DOCINFO_AUTHOR,SfxBoolItem Overwrite SID_OVERWRITE,SfxBoolItem Unpacked SID_UNPACK,SfxBoolItem SaveTo SID_SAVETO) [ /* flags: */ AutoUpdate = FALSE, diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 89bb5f23f1de..807834ca41a5 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -239,8 +239,7 @@ void SetTemplate_Impl( const String &rFileName, pDoc->ResetFromTemplate( rLongName, rFileName ); } -//-------------------------------------------------------------------- - +//==================================================================== class SfxDocPasswordVerifier : public ::comphelper::IDocPasswordVerifier { public: @@ -248,21 +247,33 @@ public: mxStorage( rxStorage ) {} virtual ::comphelper::DocPasswordVerifierResult - verifyPassword( const ::rtl::OUString& rPassword ); + verifyPassword( const ::rtl::OUString& rPassword, uno::Sequence< beans::NamedValue >& o_rEncryptionData ); + virtual ::comphelper::DocPasswordVerifierResult + verifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ); + private: Reference< embed::XStorage > mxStorage; }; -::comphelper::DocPasswordVerifierResult SfxDocPasswordVerifier::verifyPassword( const ::rtl::OUString& rPassword ) +//-------------------------------------------------------------------- +::comphelper::DocPasswordVerifierResult SfxDocPasswordVerifier::verifyPassword( const ::rtl::OUString& rPassword, uno::Sequence< beans::NamedValue >& o_rEncryptionData ) +{ + o_rEncryptionData = ::comphelper::OStorageHelper::CreatePackageEncryptionData( rPassword ); + return verifyEncryptionData( o_rEncryptionData ); +} + + +//-------------------------------------------------------------------- +::comphelper::DocPasswordVerifierResult SfxDocPasswordVerifier::verifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) { ::comphelper::DocPasswordVerifierResult eResult = ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; try { - // check the password - // if the password correct is the stream will be opened successfuly + // check the encryption data + // if the data correct is the stream will be opened successfuly // and immediatelly closed - ::comphelper::OStorageHelper::SetCommonStoragePassword( mxStorage, rPassword ); + ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( mxStorage, rEncryptionData ); mxStorage->openStreamElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "content.xml" ) ), @@ -283,6 +294,8 @@ private: return eResult; } +//==================================================================== + //-------------------------------------------------------------------- sal_uInt32 CheckPasswd_Impl @@ -341,14 +354,28 @@ sal_uInt32 CheckPasswd_Impl if( xInteractionHandler.is() ) { // use the comphelper password helper to request a password + ::rtl::OUString aPassword; + SFX_ITEMSET_ARG( pSet, pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False); + if ( pPasswordItem ) + aPassword = pPasswordItem->GetValue(); + + uno::Sequence< beans::NamedValue > aEncryptionData; + SFX_ITEMSET_ARG( pSet, pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False); + if ( pEncryptionDataItem ) + pEncryptionDataItem->GetValue() >>= aEncryptionData; + ::rtl::OUString aDocumentName = INetURLObject( pFile->GetOrigURL() ).GetMainURL( INetURLObject::DECODE_WITH_CHARSET ); + SfxDocPasswordVerifier aVerifier( xStorage ); - ::rtl::OUString aPassword = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( - aVerifier, ::rtl::OUString(), xInteractionHandler, aDocumentName, comphelper::DocPasswordRequestType_STANDARD ); + aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( + aVerifier, aEncryptionData, aPassword, xInteractionHandler, aDocumentName, comphelper::DocPasswordRequestType_STANDARD ); + + pSet->ClearItem( SID_PASSWORD ); + pSet->ClearItem( SID_ENCRYPTIONDATA ); - if ( aPassword.getLength() > 0 ) + if ( aEncryptionData.getLength() > 0 ) { - pSet->Put( SfxStringItem( SID_PASSWORD, aPassword ) ); + pSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) ); try { diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index b0aae115aa9b..f1b6b28184fb 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -192,6 +192,7 @@ static char const sUseSystemDialog[] = "UseSystemDialog"; static char const sStandardDir[] = "StandardDir"; static char const sBlackList[] = "BlackList"; static char const sModifyPasswordInfo[] = "ModifyPasswordInfo"; +static char const sEncryptionData[] = "EncryptionData"; void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) { @@ -851,6 +852,10 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque { rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) ); } + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sEncryptionData)) ) + { + rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) ); + } #ifdef DBG_UTIL else --nFoundArgs; @@ -1065,6 +1070,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta nAdditional++; if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SFX_ITEM_SET ) nAdditional++; + if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SFX_ITEM_SET ) + nAdditional++; // consider additional arguments nProps += nAdditional; @@ -1200,6 +1207,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta continue; if ( nId == SID_NOAUTOSAVE ) continue; + if ( nId == SID_ENCRYPTIONDATA ) + continue; // used only internally if ( nId == SID_SAVETO ) @@ -1569,6 +1578,11 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModifyPasswordInfo)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } + if ( rSet.GetItemState( SID_ENCRYPTIONDATA, sal_False, &pItem ) == SFX_ITEM_SET ) + { + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sEncryptionData)); + pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); + } } } diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 7198c84b7127..77eece9f231c 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1530,8 +1530,8 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, // check password checkbox if the document had password before if( mbHasPassword ) { - SFX_ITEMSET_ARG( rpSet, pPassItem, SfxStringItem, SID_PASSWORD, FALSE ); - mbPwdCheckBoxState = ( pPassItem != NULL ); + SFX_ITEMSET_ARG( rpSet, pPassItem, SfxBoolItem, SID_PASSWORDINTERACTION, FALSE ); + mbPwdCheckBoxState = ( pPassItem != NULL && pPassItem->GetValue() ); // in case the document has password to modify, the dialog should be shown SFX_ITEMSET_ARG( rpSet, pPassToModifyItem, SfxUnoAnyItem, SID_MODIFYPASSWORDINFO, FALSE ); @@ -1545,7 +1545,9 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, mbSelectionEnabled = sal_False; // the password will be set in case user decide so + rpSet->ClearItem( SID_PASSWORDINTERACTION ); rpSet->ClearItem( SID_PASSWORD ); + rpSet->ClearItem( SID_ENCRYPTIONDATA ); rpSet->ClearItem( SID_RECOMMENDREADONLY ); rpSet->ClearItem( SID_MODIFYPASSWORDINFO ); @@ -1660,7 +1662,30 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList, if ( pPasswordRequest->isPassword() ) { if ( pPasswordRequest->getPassword().getLength() ) - rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) ); + { + // TODO/LATER: The filters should show the password dialog themself in future + if ( bMSType ) + { + // all the current MS-filters use MSCodec_Std97 implementation + uno::Sequence< sal_Int8 > aUniqueID = ::comphelper::DocPasswordHelper::GenerateRandomByteSequence( 16 ); + uno::Sequence< sal_Int8 > aEncryptionKey = ::comphelper::DocPasswordHelper::GenerateStd97Key( pPasswordRequest->getPassword(), aUniqueID ); + + if ( aEncryptionKey.getLength() ) + { + ::comphelper::SequenceAsHashMap aHashData; + aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97EncryptionKey" ) ) ] <<= aEncryptionKey; + aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97UniqueID" ) ) ] <<= aUniqueID; + + rpSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aHashData.getAsConstNamedValueList() ) ) ); + } + else + return ERRCODE_IO_NOTSUPPORTED; + } + else + { + rpSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( ::comphelper::OStorageHelper::CreatePackageEncryptionData( pPasswordRequest->getPassword() ) ) ) ); + } + } if ( pPasswordRequest->getRecommendReadOnly() ) rpSet->Put( SfxBoolItem( SID_RECOMMENDREADONLY, sal_True ) ); diff --git a/sfx2/source/dialog/mailmodelapi.cxx b/sfx2/source/dialog/mailmodelapi.cxx index 16d12f469205..223807d37b11 100644 --- a/sfx2/source/dialog/mailmodelapi.cxx +++ b/sfx2/source/dialog/mailmodelapi.cxx @@ -79,8 +79,6 @@ #include #include -extern sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, String& rPasswd ); - // -------------------------------------------------------------- using namespace ::com::sun::star::beans; using namespace ::com::sun::star::frame; diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk index 572053557e00..705a4c040b1a 100644 --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -42,6 +42,7 @@ EXCEPTIONSFILES=\ $(SLO)$/itemconnect.obj \ $(SLO)$/mailmodel.obj \ $(SLO)$/partwnd.obj \ + $(SLO)$/passwd.obj \ $(SLO)$/recfloat.obj \ $(SLO)$/templdlg.obj \ $(SLO)$/dinfdlg.obj \ diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx index beb43c192810..77d52b814ec1 100644 --- a/sfx2/source/dialog/versdlg.cxx +++ b/sfx2/source/dialog/versdlg.cxx @@ -329,13 +329,13 @@ void SfxVersionDialog::Open_Impl() SfxStringItem aReferer( SID_REFERER, DEFINE_CONST_UNICODE("private:user") ); SfxStringItem aFile( SID_FILE_NAME, pObjShell->GetMedium()->GetName() ); - ::rtl::OUString aPassString; - if ( GetPasswd_Impl( pObjShell->GetMedium()->GetItemSet(), aPassString ) ) + uno::Sequence< beans::NamedValue > aEncryptionData; + if ( GetEncryptionData_Impl( pObjShell->GetMedium()->GetItemSet(), aEncryptionData ) ) { // there is a password, it should be used during the opening - SfxStringItem aPassItem( SID_PASSWORD, aPassString ); + SfxUnoAnyItem aEncryptionDataItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ); pViewFrame->GetDispatcher()->Execute( - SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, &aFile, &aItem, &aTarget, &aReferer, &aPassItem, 0L ); + SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, &aFile, &aItem, &aTarget, &aReferer, &aEncryptionDataItem, 0L ); } else pViewFrame->GetDispatcher()->Execute( diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 29081e8e8418..6b9afa136e46 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -881,17 +881,21 @@ uno::Reference < embed::XStorage > SfxMedium::GetOutputStorage() } //------------------------------------------------------------------ -void SfxMedium::SetPasswordToStorage_Impl() +void SfxMedium::SetEncryptionDataToStorage_Impl() { // in case media-descriptor contains password it should be used on opening if ( pImp->xStorage.is() && pSet ) { - ::rtl::OUString aPasswd; - if ( GetPasswd_Impl( pSet, aPasswd ) ) + uno::Sequence< beans::NamedValue > aEncryptionData; + if ( GetEncryptionData_Impl( pSet, aEncryptionData ) ) { + // replace the password with encryption data + pSet->ClearItem( SID_PASSWORD ); + pSet->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) ); + try { - ::comphelper::OStorageHelper::SetCommonStoragePassword( pImp->xStorage, aPasswd ); + ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( pImp->xStorage, aEncryptionData ); } catch( uno::Exception& ) { @@ -1326,7 +1330,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( sal_Bool bCreateTempIf // TODO/LATER: Get versionlist on demand if ( pImp->xStorage.is() ) { - SetPasswordToStorage_Impl(); + SetEncryptionDataToStorage_Impl(); GetVersionList(); } diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 3c4df7276d6b..6b2b5dcb8c0b 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -978,12 +978,11 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, NULL ); const SfxPoolItem* pItem = NULL; - if ( bPreselectPassword && aDialogParams.GetItemState( SID_PASSWORD, sal_True, &pItem ) != SFX_ITEM_SET ) + if ( bPreselectPassword && aDialogParams.GetItemState( SID_ENCRYPTIONDATA, sal_True, &pItem ) != SFX_ITEM_SET ) { - // the file dialog preselects the password checkbox if the provided mediadescriptor has password entry - // after dialog execution the password entry will be either removed or replaced with the password - // entered by the user - aDialogParams.Put( SfxStringItem( SID_PASSWORD, String() ) ); + // the file dialog preselects the password checkbox if the provided mediadescriptor has encryption data entry + // after dialog execution the password interaction flag will be either removed or not + aDialogParams.Put( SfxBoolItem( SID_PASSWORDINTERACTION, sal_True ) ); } // aStringTypeFN is a pure output parameter, pDialogParams is an in/out parameter @@ -1590,6 +1589,7 @@ sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& DocumentSettingsGuard aSettingsGuard( aModelData.GetModel(), aModelData.IsRecommendReadOnly(), nStoreMode & EXPORT_REQUESTED ); + OSL_ENSURE( aModelData.GetMediaDescr().find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) ) ) == aModelData.GetMediaDescr().end(), "The Password property of MediaDescriptor should not be used here!" ); if ( aOptions.IsDocInfoSave() && ( !aModelData.GetStorable()->hasLocation() || INetURLObject( aModelData.GetStorable()->getLocation() ) != aURL ) ) diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index bb0e6939ead8..ff10b7917142 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -599,8 +599,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // ======================================================================================================== sal_Bool bPreselectPassword = sal_False; - SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pOldPasswordItem, SfxStringItem, SID_PASSWORD, FALSE ); - if ( pOldPasswordItem ) + SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pOldEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, FALSE ); + if ( pOldEncryptionDataItem ) bPreselectPassword = sal_True; uno::Sequence< beans::PropertyValue > aDispatchArgs; diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 037493c61252..c3f532ad1ba6 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -202,16 +202,30 @@ sal_Bool SfxObjectShell::QuerySlotExecutable( USHORT /*nSlotId*/ ) //------------------------------------------------------------------------- -sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, ::rtl::OUString& rPasswd ) +bool GetEncryptionData_Impl( const SfxItemSet* pSet, uno::Sequence< beans::NamedValue >& o_rEncryptionData ) { - const SfxPoolItem* pItem = NULL; - if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_PASSWORD, sal_True, &pItem ) ) + bool bResult = false; + if ( pSet ) { - DBG_ASSERT( pItem->IsA( TYPE(SfxStringItem) ), "wrong item type" ); - rPasswd = ( (const SfxStringItem*)pItem )->GetValue(); - return sal_True; + SFX_ITEMSET_ARG( pSet, pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False); + if ( pEncryptionDataItem ) + { + pEncryptionDataItem->GetValue() >>= o_rEncryptionData; + bResult = true; + } + else + { + SFX_ITEMSET_ARG( pSet, pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False); + if ( pPasswordItem ) + { + ::rtl::OUString aPassword = pPasswordItem->GetValue(); + o_rEncryptionData = ::comphelper::OStorageHelper::CreatePackageEncryptionData( aPassword ); + bResult = true; + } + } } - return sal_False; + + return bResult; } //------------------------------------------------------------------------- @@ -996,15 +1010,15 @@ sal_Bool SfxObjectShell::DoSave() pImp->bIsSaving = sal_True; - ::rtl::OUString aPasswd; + uno::Sequence< beans::NamedValue > aEncryptionData; if ( IsPackageStorageFormat_Impl( *GetMedium() ) ) { - if ( GetPasswd_Impl( GetMedium()->GetItemSet(), aPasswd ) ) + if ( GetEncryptionData_Impl( GetMedium()->GetItemSet(), aEncryptionData ) ) { try { //TODO/MBA: GetOutputStorage?! Special mode, because it's "Save"?! - ::comphelper::OStorageHelper::SetCommonStoragePassword( GetMedium()->GetStorage(), aPasswd ); + ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( GetMedium()->GetStorage(), aEncryptionData ); bOk = sal_True; } catch( uno::Exception& ) @@ -1386,13 +1400,13 @@ sal_Bool SfxObjectShell::SaveTo_Impl } // transfer password from the parameters to the storage - ::rtl::OUString aPasswd; + uno::Sequence< beans::NamedValue > aEncryptionData; sal_Bool bPasswdProvided = sal_False; - if ( GetPasswd_Impl( rMedium.GetItemSet(), aPasswd ) ) + if ( GetEncryptionData_Impl( rMedium.GetItemSet(), aEncryptionData ) ) { bPasswdProvided = sal_True; try { - ::comphelper::OStorageHelper::SetCommonStoragePassword( xMedStorage, aPasswd ); + ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( xMedStorage, aEncryptionData ); bOk = sal_True; } catch( uno::Exception& ) @@ -3154,13 +3168,13 @@ sal_Bool SfxObjectShell::LoadOwnFormat( SfxMedium& rMedium ) SFX_ITEMSET_ARG( rMedium.GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False ); if ( pPasswdItem || ERRCODE_IO_ABORT != CheckPasswd_Impl( this, SFX_APP()->GetPool(), pMedium ) ) { - ::rtl::OUString aPasswd; - if ( GetPasswd_Impl(pMedium->GetItemSet(), aPasswd) ) + uno::Sequence< beans::NamedValue > aEncryptionData; + if ( GetEncryptionData_Impl(pMedium->GetItemSet(), aEncryptionData) ) { try { // the following code must throw an exception in case of failure - ::comphelper::OStorageHelper::SetCommonStoragePassword( xStorage, aPasswd ); + ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( xStorage, aEncryptionData ); } catch( uno::Exception& ) { diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 846cc669b9a7..caf4a26d96e9 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -980,6 +980,8 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& aArgs.remove( "InputStream" ); aArgs.remove( "URL" ); aArgs.remove( "Frame" ); + aArgs.remove( "Password" ); + aArgs.remove( "EncryptionData" ); // TODO/LATER: all the parameters that are accepted by ItemSet of the DocShell must be removed here @@ -1633,6 +1635,11 @@ void SAL_CALL SfxBaseModel::storeAsURL( const ::rtl::OUString& uno::Sequence< beans::PropertyValue > aSequence ; TransformItems( SID_OPENDOC, *m_pData->m_pObjectShell->GetMedium()->GetItemSet(), aSequence ); attachResource( rURL, aSequence ); + +#if OSL_DEBUG_LEVEL > 0 + SFX_ITEMSET_ARG( m_pData->m_pObjectShell->GetMedium()->GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False); + OSL_ENSURE( !pPasswdItem, "There should be no Password property in the document MediaDescriptor!" ); +#endif } } @@ -1891,6 +1898,11 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); if ( pHidItem ) bHidden = pHidItem->GetValue(); + +#if OSL_DEBUG_LEVEL > 0 + SFX_ITEMSET_ARG( pMedium->GetItemSet(), pPasswdItem, SfxStringItem, SID_PASSWORD, sal_False); + OSL_ENSURE( !pPasswdItem, "There should be no Password property in the document MediaDescriptor!" ); +#endif // !TODO: will be done by Framework! pMedium->SetUpdatePickList( !bHidden ); } @@ -2667,49 +2679,41 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL aArgHash.erase( aFilterString ); aArgHash.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ); - // if the password is changed SaveAs should be done - // no password for encrypted document is also a change here - sal_Bool bPassChanged = sal_False; - - ::comphelper::SequenceAsHashMap::iterator aNewPassIter - = aArgHash.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) ) ); - SFX_ITEMSET_ARG( pMedium->GetItemSet(), pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False ); - if ( pPasswordItem && aNewPassIter != aArgHash.end() ) + try { - ::rtl::OUString aNewPass; - aNewPassIter->second >>= aNewPass; - bPassChanged = !aNewPass.equals( pPasswordItem->GetValue() ); + storeSelf( aArgHash.getAsConstPropertyValueList() ); + bSaved = sal_True; } - else if ( pPasswordItem || aNewPassIter != aArgHash.end() ) - bPassChanged = sal_True; - - if ( !bPassChanged ) + catch( const lang::IllegalArgumentException& ) { - try - { - storeSelf( aArgHash.getAsConstPropertyValueList() ); - bSaved = sal_True; - } - catch( const lang::IllegalArgumentException& ) + // some additional arguments do not allow to use saving, SaveAs should be done + // but only for normal documents, the shared documents would be overwritten in this case + // that would mean an information loss + // TODO/LATER: need a new interaction for this case + if ( m_pData->m_pObjectShell->IsDocShared() ) { - // some additional arguments do not allow to use saving, SaveAs should be done - // but only for normal documents, the shared documents would be overwritten in this case - // that would mean an information loss - // TODO/LATER: need a new interaction for this case - if ( m_pData->m_pObjectShell->IsDocShared() ) + m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't store shared document!" ) ) ); + m_pData->m_pObjectShell->StoreLog(); + + uno::Sequence< beans::NamedValue > aNewEncryptionData = aArgHash.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionData" ) ), uno::Sequence< beans::NamedValue >() ); + if ( !aNewEncryptionData.getLength() ) { - m_pData->m_pObjectShell->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't store shared document!" ) ) ); - m_pData->m_pObjectShell->StoreLog(); + ::rtl::OUString aNewPassword = aArgHash.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) ), ::rtl::OUString() ); + aNewEncryptionData = ::comphelper::OStorageHelper::CreatePackageEncryptionData( aNewPassword ); + } + + uno::Sequence< beans::NamedValue > aOldEncryptionData; + GetEncryptionData_Impl( pMedium->GetItemSet(), aOldEncryptionData ); + if ( !aOldEncryptionData.getLength() && !aNewEncryptionData.getLength() ) throw; + else + { + // if the password is changed a special error should be used in case of shared document + throw task::ErrorCodeIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cant change password for shared document." ) ), uno::Reference< uno::XInterface >(), ERRCODE_SFX_SHARED_NOPASSWORDCHANGE ); } } } - else if ( m_pData->m_pObjectShell->IsDocShared() ) - { - // if the password is changed a special error should be used in case of shared document - throw task::ErrorCodeIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cant change password for shared document." ) ), uno::Reference< uno::XInterface >(), ERRCODE_SFX_SHARED_NOPASSWORDCHANGE ); - } } } } -- cgit From 3460624e393c6cd754dae0ca17eb9cda44343f30 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 4 Nov 2010 17:56:39 +0100 Subject: pl08: #163778# use EncryptionData from MediaDescriptor --- filter/inc/filter/msfilter/mscodec.hxx | 67 +++++++++++++---- filter/source/msfilter/mscodec.cxx | 133 ++++++++++++++++++++------------- oox/inc/oox/core/binarycodec.hxx | 50 ++++++++++--- oox/inc/oox/core/filterbase.hxx | 7 +- oox/inc/oox/xls/biffcodec.hxx | 21 +++--- oox/source/core/binarycodec.cxx | 111 ++++++++++++++++++--------- oox/source/core/filterbase.cxx | 4 +- oox/source/core/filterdetect.cxx | 109 ++++++++++++++++++++------- oox/source/xls/biffcodec.cxx | 92 +++++++++++++++++------ 9 files changed, 415 insertions(+), 179 deletions(-) mode change 100755 => 100644 oox/source/core/filterbase.cxx diff --git a/filter/inc/filter/msfilter/mscodec.hxx b/filter/inc/filter/msfilter/mscodec.hxx index 7bad8af6b788..60e3adf1d5ba 100644 --- a/filter/inc/filter/msfilter/mscodec.hxx +++ b/filter/inc/filter/msfilter/mscodec.hxx @@ -28,8 +28,11 @@ #ifndef SVX_MSCODEC_HXX #define SVX_MSCODEC_HXX -#include "rtl/cipher.h" -#include "rtl/digest.h" +#include +#include + +#include +#include #include "filter/msfilter/msfilterdllapi.h" namespace msfilter { @@ -52,6 +55,23 @@ public: */ void InitKey( const sal_uInt8 pnPassData[ 16 ] ); + /** Initializes the algorithm with the encryption data. + + @param aData + The sequence contains the necessary data to initialize + the codec. + */ + sal_Bool InitCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData ); + + /** Retrieves the encryption data + + @return + The sequence contains the necessary data to initialize + the codec. + */ + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetEncryptionData(); + + /** Verifies the validity of the password using the passed key and hash. @precond @@ -105,16 +125,6 @@ public: */ void Skip( sal_Size nBytes ); - // static ----------------------------------------------------------------- - - /** Calculates the 16-bit hash value for the given password. - - The password data may be longer than 16 bytes. The array does not need - to be terminated with a NULL byte (but it can without invalidating the - result). - */ - static sal_uInt16 GetHash( const sal_uInt8* pnPassData, sal_Size nSize ); - protected: sal_uInt8 mpnKey[ 16 ]; /// Encryption key. sal_Size mnOffset; /// Key offset. @@ -185,17 +195,34 @@ public: explicit MSCodec_Std97(); ~MSCodec_Std97(); + /** Initializes the algorithm with the encryption data. + + @param aData + The sequence contains the necessary data to initialize + the codec. + */ + sal_Bool InitCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData ); + + /** Retrieves the encryption data + + @return + The sequence contains the necessary data to initialize + the codec. + */ + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetEncryptionData(); + + /** Initializes the algorithm with the specified password and document ID. @param pPassData Wide character array containing the password. Must be zero terminated, which results in a maximum length of 15 characters. - @param pUnique + @param pDocId Unique document identifier read from or written to the file. */ void InitKey( const sal_uInt16 pPassData[ 16 ], - const sal_uInt8 pUnique[ 16 ] ); + const sal_uInt8 pDocId[ 16 ] ); /** Verifies the validity of the password using the passed salt data. @@ -320,9 +347,18 @@ public: sal_uInt8 pSaltData[16], sal_uInt8 pSaltDigest[16]); -private: + /* allows to get the unique document id from the codec + */ + void GetDocId( sal_uInt8 pDocId[16] ); + void GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] ); +private: + void InitKeyImpl( + const sal_uInt8 pKeyData[64], + const sal_uInt8 pDocId[16] ); + + private: MSFILTER_DLLPRIVATE MSCodec_Std97( const MSCodec_Std97& ); MSFILTER_DLLPRIVATE MSCodec_Std97& operator=( const MSCodec_Std97& ); @@ -330,6 +366,7 @@ private: rtlCipher m_hCipher; rtlDigest m_hDigest; sal_uInt8 m_pDigestValue[ RTL_DIGEST_LENGTH_MD5 ]; + sal_uInt8 m_pDocId[16]; }; // ============================================================================ diff --git a/filter/source/msfilter/mscodec.cxx b/filter/source/msfilter/mscodec.cxx index de17da6bde59..626a91ff4262 100644 --- a/filter/source/msfilter/mscodec.cxx +++ b/filter/source/msfilter/mscodec.cxx @@ -34,12 +34,16 @@ #include #include +#include +#include + #define DEBUG_MSO_ENCRYPTION_STD97 0 #if DEBUG_MSO_ENCRYPTION_STD97 #include #endif +using namespace ::com::sun::star; namespace msfilter { @@ -169,6 +173,37 @@ void MSCodec_Xor95::InitKey( const sal_uInt8 pnPassData[ 16 ] ) } } +sal_Bool MSCodec_Xor95::InitCodec( const uno::Sequence< beans::NamedValue >& aData ) +{ + sal_Bool bResult = sal_False; + + ::comphelper::SequenceAsHashMap aHashData( aData ); + uno::Sequence< sal_Int8 > aKey = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XOR95EncryptionKey" ) ), uno::Sequence< sal_Int8 >() ); + + if ( aKey.getLength() == 16 ) + { + (void)memcpy( mpnKey, aKey.getConstArray(), 16 ); + bResult = sal_True; + + mnKey = (sal_uInt16)aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XOR95BaseKey" ) ), (sal_Int16)0 ); + mnHash = (sal_uInt16)aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XOR95PasswordHash" ) ), (sal_Int16)0 ); + } + else + OSL_ENSURE( sal_False, "Unexpected key size!\n" ); + + return bResult; +} + +uno::Sequence< beans::NamedValue > MSCodec_Xor95::GetEncryptionData() +{ + ::comphelper::SequenceAsHashMap aHashData; + aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XOR95EncryptionKey" ) ) ] <<= uno::Sequence( (sal_Int8*)mpnKey, 16 ); + aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XOR95BaseKey" ) ) ] <<= (sal_Int16)mnKey; + aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XOR95PasswordHash" ) ) ] <<= (sal_Int16)mnHash; + + return aHashData.getAsConstNamedValueList(); +} + bool MSCodec_Xor95::VerifyKey( sal_uInt16 nKey, sal_uInt16 nHash ) const { return (nKey == mnKey) && (nHash == mnHash); @@ -218,11 +253,6 @@ void MSCodec_Xor95::Skip( sal_Size nBytes ) mnOffset = (mnOffset + nBytes) & 0x0F; } -sal_uInt16 MSCodec_Xor95::GetHash( const sal_uInt8* pnPassData, sal_Size nSize ) -{ - return lclGetHash( pnPassData, nSize ); -} - // ============================================================================ MSCodec_Std97::MSCodec_Std97 () @@ -236,11 +266,13 @@ MSCodec_Std97::MSCodec_Std97 () OSL_ASSERT(m_hDigest != 0); (void)memset (m_pDigestValue, 0, sizeof(m_pDigestValue)); + (void)memset (m_pDocId, 0, sizeof(m_pDocId)); } MSCodec_Std97::~MSCodec_Std97 () { (void)memset (m_pDigestValue, 0, sizeof(m_pDigestValue)); + (void)memset (m_pDocId, 0, sizeof(m_pDocId)); rtl_digest_destroy (m_hDigest); rtl_cipher_destroy (m_hCipher); } @@ -276,65 +308,58 @@ static void lcl_PrintDigest(const sal_uInt8* /*pDigest*/, const char* /*msg*/) } #endif -void MSCodec_Std97::InitKey ( - const sal_uInt16 pPassData[16], - const sal_uInt8 pUnique[16]) +sal_Bool MSCodec_Std97::InitCodec( const uno::Sequence< beans::NamedValue >& aData ) { -#if DEBUG_MSO_ENCRYPTION_STD97 - fprintf(stdout, "MSCodec_Std97::InitKey: --begin\n");fflush(stdout); -#endif - sal_uInt8 pKeyData[64]; - int i, n; - - // Fill PassData into KeyData. - (void)memset (pKeyData, 0, sizeof(pKeyData)); - lcl_PrintKeyData(pKeyData, "initial"); - for (i = 0, n = 16; (i < n) && pPassData[i]; i++) - { - pKeyData[2*i ] = sal::static_int_cast< sal_uInt8 >( - (pPassData[i] >> 0) & 0xff); - pKeyData[2*i + 1] = sal::static_int_cast< sal_uInt8 >( - (pPassData[i] >> 8) & 0xff); - } - pKeyData[2*i] = 0x80; - pKeyData[ 56] = sal::static_int_cast< sal_uInt8 >(i << 4); + sal_Bool bResult = sal_False; - lcl_PrintKeyData(pKeyData, "password data"); + ::comphelper::SequenceAsHashMap aHashData( aData ); + uno::Sequence< sal_Int8 > aKey = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97EncryptionKey" ) ), uno::Sequence< sal_Int8 >() ); - // Fill raw digest of KeyData into KeyData. - (void)rtl_digest_updateMD5 ( - m_hDigest, pKeyData, sizeof(pKeyData)); - (void)rtl_digest_rawMD5 ( - m_hDigest, pKeyData, RTL_DIGEST_LENGTH_MD5); - - lcl_PrintKeyData(pKeyData, "raw digest of key data"); - - // Update digest with KeyData and Unique. - for (i = 0; i < 16; i++) + if ( aKey.getLength() == RTL_DIGEST_LENGTH_MD5 ) { - rtl_digest_updateMD5 (m_hDigest, pKeyData, 5); - rtl_digest_updateMD5 (m_hDigest, pUnique, 16); + (void)memcpy( m_pDigestValue, aKey.getConstArray(), RTL_DIGEST_LENGTH_MD5 ); + uno::Sequence< sal_Int8 > aUniqueID = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97UniqueID" ) ), uno::Sequence< sal_Int8 >() ); + if ( aUniqueID.getLength() == 16 ) + { + (void)memcpy( m_pDocId, aUniqueID.getConstArray(), 16 ); + bResult = sal_True; + } + else + OSL_ENSURE( sal_False, "Unexpected document ID!\n" ); } + else + OSL_ENSURE( sal_False, "Unexpected key size!\n" ); - // Update digest with padding. - pKeyData[16] = 0x80; - (void)memset (pKeyData + 17, 0, sizeof(pKeyData) - 17); - pKeyData[56] = 0x80; - pKeyData[57] = 0x0a; + return bResult; +} - lcl_PrintKeyData(pKeyData, "update digest with padding"); +uno::Sequence< beans::NamedValue > MSCodec_Std97::GetEncryptionData() +{ + ::comphelper::SequenceAsHashMap aHashData; + aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97EncryptionKey" ) ) ] <<= uno::Sequence< sal_Int8 >( (sal_Int8*)m_pDigestValue, RTL_DIGEST_LENGTH_MD5 ); + aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97UniqueID" ) ) ] <<= uno::Sequence< sal_Int8 >( (sal_Int8*)m_pDocId, 16 ); - rtl_digest_updateMD5 ( - m_hDigest, &(pKeyData[16]), sizeof(pKeyData) - 16); + return aHashData.getAsConstNamedValueList(); +} +void MSCodec_Std97::InitKey ( + const sal_uInt16 pPassData[16], + const sal_uInt8 pDocId[16]) +{ +#if DEBUG_MSO_ENCRYPTION_STD97 + fprintf(stdout, "MSCodec_Std97::InitKey: --begin\n");fflush(stdout); +#endif + uno::Sequence< sal_Int8 > aKey = ::comphelper::DocPasswordHelper::GenerateStd97Key( pPassData, uno::Sequence< sal_Int8 >( (sal_Int8*)pDocId, 16 ) ); // Fill raw digest of above updates into DigestValue. - rtl_digest_rawMD5 ( - m_hDigest, m_pDigestValue, sizeof(m_pDigestValue)); + + if ( aKey.getLength() == sizeof(m_pDigestValue) ) + (void)memcpy ( m_pDigestValue, aKey.getConstArray(), sizeof(m_pDigestValue) ); + else + memset( m_pDigestValue, 0, sizeof(m_pDigestValue) ); lcl_PrintDigest(m_pDigestValue, "digest value"); - // Erase KeyData array and leave. - (void)memset (pKeyData, 0, sizeof(pKeyData)); + (void)memcpy (m_pDocId, pDocId, 16); } bool MSCodec_Std97::VerifyKey ( @@ -528,6 +553,12 @@ void MSCodec_Std97::GetEncryptKey ( } } +void MSCodec_Std97::GetDocId( sal_uInt8 pDocId[16] ) +{ + if ( sizeof( m_pDocId ) == 16 ) + (void)memcpy( pDocId, m_pDocId, 16 ); +} + // ============================================================================ } // namespace svx diff --git a/oox/inc/oox/core/binarycodec.hxx b/oox/inc/oox/core/binarycodec.hxx index 8abafffa2481..ce57e190f088 100644 --- a/oox/inc/oox/core/binarycodec.hxx +++ b/oox/inc/oox/core/binarycodec.hxx @@ -28,6 +28,9 @@ #ifndef OOX_CORE_BINARYCODEC_HXX #define OOX_CORE_BINARYCODEC_HXX +#include +#include + #include #include @@ -85,6 +88,22 @@ public: */ void initKey( const sal_uInt8 pnPassData[ 16 ] ); + /** Initializes the algorithm with the encryption data. + + @param aData + The sequence contains the necessary data to initialize + the codec. + */ + bool initCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData ); + + /** Retrieves the encryption data + + @return + The sequence contains the necessary data to initialize + the codec. + */ + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > getEncryptionData(); + /** Verifies the validity of the password using the passed key and hash. @precond @@ -150,16 +169,6 @@ public: */ bool skip( sal_Int32 nBytes ); - // static ----------------------------------------------------------------- - - /** Calculates the 16-bit hash value for the given password. - - The password data may be longer than 16 bytes. The array does not need - to be terminated with a null byte (but it can without invalidating the - result). - */ - static sal_uInt16 getHash( const sal_uInt8* pnPassData, sal_Int32 nSize ); - private: CodecType meCodecType; /// Codec type. sal_uInt8 mpnKey[ 16 ]; /// Encryption key. @@ -189,6 +198,22 @@ public: ~BinaryCodec_RCF(); + /** Initializes the algorithm with the encryption data. + + @param aData + The sequence contains the necessary data to initialize + the codec. + */ + bool initCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData ); + + /** Retrieves the encryption data + + @return + The sequence contains the necessary data to initialize + the codec. + */ + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > getEncryptionData(); + /** Initializes the algorithm with the specified password and document ID. @param pnPassData @@ -278,9 +303,14 @@ public: bool skip( sal_Int32 nBytes ); private: + void InitKeyImpl( + const sal_uInt8 pKeyData[64], + const sal_uInt8 pUnique[16] ); + rtlCipher mhCipher; rtlDigest mhDigest; sal_uInt8 mpnDigestValue[ RTL_DIGEST_LENGTH_MD5 ]; + sal_uInt8 mpnUnique[16]; }; // ============================================================================ diff --git a/oox/inc/oox/core/filterbase.hxx b/oox/inc/oox/core/filterbase.hxx index 1757b2be4334..9d9b8dcca515 100644 --- a/oox/inc/oox/core/filterbase.hxx +++ b/oox/inc/oox/core/filterbase.hxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -194,9 +195,9 @@ public: /** Returns a helper for the handling of OLE obejcts. */ ::oox::ole::OleObjectHelper& getOleObjectHelper() const; - /** Requests a password from the media descriptor or from the user. On - success, the password will be inserted into the media descriptor. */ - ::rtl::OUString requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const; + /** Requests the encryption data from the media descriptor or from the user. On + success, the encryption data will be inserted into the media descriptor. */ + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const; /** Imports the raw binary data from the specified stream. @return True, if the data could be imported from the stream. */ diff --git a/oox/inc/oox/xls/biffcodec.hxx b/oox/inc/oox/xls/biffcodec.hxx index 21b3e82006fd..c1c040de095b 100644 --- a/oox/inc/oox/xls/biffcodec.hxx +++ b/oox/inc/oox/xls/biffcodec.hxx @@ -52,10 +52,9 @@ public: /** Derived classes return a clone of the decoder for usage in new streams. */ inline BiffDecoderBase* clone() { return implClone(); } - /** Implementation of the ::comphelper::IDocPasswordVerifier interface, - calls the new virtual function implVerify(). */ - virtual ::comphelper::DocPasswordVerifierResult - verifyPassword( const ::rtl::OUString& rPassword ); + /** Implementation of the ::comphelper::IDocPasswordVerifier interface. */ + virtual ::comphelper::DocPasswordVerifierResult verifyPassword( const ::rtl::OUString& rPassword, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ); + virtual ::comphelper::DocPasswordVerifierResult verifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ); /** Returns true, if the decoder has been initialized correctly. */ inline bool isValid() const { return mbValid; } @@ -73,7 +72,8 @@ private: /** Derived classes implement password verification and initialization of the decoder. */ - virtual bool implVerify( const ::rtl::OUString& rPassword ) = 0; + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > implVerifyPassword( const ::rtl::OUString& rPassword ) = 0; + virtual bool implVerifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData ) = 0; /** Implementation of decryption of a memory block. */ virtual void implDecode( @@ -104,7 +104,9 @@ private: virtual BiffDecoder_XOR* implClone(); /** Implements password verification and initialization of the decoder. */ - virtual bool implVerify( const ::rtl::OUString& rPassword ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > implVerifyPassword( const ::rtl::OUString& rPassword ); + virtual bool implVerifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData ); + /** Implementation of decryption of a memory block. */ virtual void implDecode( @@ -115,7 +117,7 @@ private: private: ::oox::core::BinaryCodec_XOR maCodec; /// Cipher algorithm implementation. - ::std::vector< sal_uInt8 > maPassword; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > maEncryptionData; sal_uInt16 mnKey; sal_uInt16 mnHash; }; @@ -139,7 +141,8 @@ private: virtual BiffDecoder_RCF* implClone(); /** Implements password verification and initialization of the decoder. */ - virtual bool implVerify( const ::rtl::OUString& rPassword ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > implVerifyPassword( const ::rtl::OUString& rPassword ); + virtual bool implVerifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData ); /** Implementation of decryption of a memory block. */ virtual void implDecode( @@ -150,7 +153,7 @@ private: private: ::oox::core::BinaryCodec_RCF maCodec; /// Cipher algorithm implementation. - ::std::vector< sal_uInt16 > maPassword; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > maEncryptionData; ::std::vector< sal_uInt8 > maSalt; ::std::vector< sal_uInt8 > maVerifier; ::std::vector< sal_uInt8 > maVerifierHash; diff --git a/oox/source/core/binarycodec.cxx b/oox/source/core/binarycodec.cxx index 6127524c2aae..954f623f1f91 100644 --- a/oox/source/core/binarycodec.cxx +++ b/oox/source/core/binarycodec.cxx @@ -30,6 +30,11 @@ #include #include "oox/helper/attributelist.hxx" +#include +#include + +using namespace ::com::sun::star; + namespace oox { namespace core { @@ -176,6 +181,37 @@ void BinaryCodec_XOR::initKey( const sal_uInt8 pnPassData[ 16 ] ) } } +bool BinaryCodec_XOR::initCodec( const uno::Sequence< beans::NamedValue >& aData ) +{ + bool bResult = sal_False; + + ::comphelper::SequenceAsHashMap aHashData( aData ); + uno::Sequence< sal_Int8 > aKey = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XOR95EncryptionKey" ) ), uno::Sequence< sal_Int8 >() ); + + if ( aKey.getLength() == 16 ) + { + (void)memcpy( mpnKey, aKey.getConstArray(), 16 ); + bResult = sal_True; + + mnBaseKey = (sal_uInt16)aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XOR95BaseKey" ) ), (sal_Int16)0 ); + mnHash = (sal_uInt16)aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XOR95PasswordHash" ) ), (sal_Int16)0 ); + } + else + OSL_ENSURE( sal_False, "Unexpected key size!\n" ); + + return bResult; +} + +uno::Sequence< beans::NamedValue > BinaryCodec_XOR::getEncryptionData() +{ + ::comphelper::SequenceAsHashMap aHashData; + aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XOR95EncryptionKey" ) ) ] <<= uno::Sequence( (sal_Int8*)mpnKey, 16 ); + aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XOR95BaseKey" ) ) ] <<= (sal_Int16)mnBaseKey; + aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XOR95PasswordHash" ) ) ] <<= (sal_Int16)mnHash; + + return aHashData.getAsConstNamedValueList(); +} + bool BinaryCodec_XOR::verifyKey( sal_uInt16 nKey, sal_uInt16 nHash ) const { return (nKey == mnBaseKey) && (nHash == mnHash); @@ -230,11 +266,6 @@ bool BinaryCodec_XOR::skip( sal_Int32 nBytes ) return true; } -sal_uInt16 BinaryCodec_XOR::getHash( const sal_uInt8* pnPassData, sal_Int32 nSize ) -{ - return lclGetHash( pnPassData, nSize ); -} - // ============================================================================ BinaryCodec_RCF::BinaryCodec_RCF() @@ -246,56 +277,62 @@ BinaryCodec_RCF::BinaryCodec_RCF() OSL_ENSURE( mhDigest != 0, "BinaryCodec_RCF::BinaryCodec_RCF - cannot create digest" ); (void)memset( mpnDigestValue, 0, sizeof( mpnDigestValue ) ); + (void)memset (mpnUnique, 0, sizeof(mpnUnique)); } BinaryCodec_RCF::~BinaryCodec_RCF() { (void)memset( mpnDigestValue, 0, sizeof( mpnDigestValue ) ); + (void)memset (mpnUnique, 0, sizeof(mpnUnique)); rtl_digest_destroy( mhDigest ); rtl_cipher_destroy( mhCipher ); } -void BinaryCodec_RCF::initKey( const sal_uInt16 pnPassData[ 16 ], const sal_uInt8 pnSalt[ 16 ] ) +bool BinaryCodec_RCF::initCodec( const uno::Sequence< beans::NamedValue >& aData ) { - // create little-endian key data array from password data - sal_uInt8 pnKeyData[ 64 ]; - (void)memset( pnKeyData, 0, sizeof( pnKeyData ) ); + bool bResult = sal_False; - const sal_uInt16* pnCurrPass = pnPassData; - const sal_uInt16* pnPassEnd = pnPassData + 16; - sal_uInt8* pnCurrKey = pnKeyData; - size_t nPassSize = 0; - for( ; (pnCurrPass < pnPassEnd) && (*pnCurrPass != 0); ++pnCurrPass, ++nPassSize ) + ::comphelper::SequenceAsHashMap aHashData( aData ); + uno::Sequence< sal_Int8 > aKey = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97EncryptionKey" ) ), uno::Sequence< sal_Int8 >() ); + + if ( aKey.getLength() == RTL_DIGEST_LENGTH_MD5 ) { - *pnCurrKey++ = static_cast< sal_uInt8 >( *pnCurrPass ); - *pnCurrKey++ = static_cast< sal_uInt8 >( *pnCurrPass >> 8 ); + (void)memcpy( mpnDigestValue, aKey.getConstArray(), RTL_DIGEST_LENGTH_MD5 ); + uno::Sequence< sal_Int8 > aUniqueID = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97UniqueID" ) ), uno::Sequence< sal_Int8 >() ); + if ( aUniqueID.getLength() == 16 ) + { + (void)memcpy( mpnUnique, aUniqueID.getConstArray(), 16 ); + bResult = sal_False; + } + else + OSL_ENSURE( sal_False, "Unexpected document ID!\n" ); } - pnKeyData[ 2 * nPassSize ] = 0x80; - pnKeyData[ 56 ] = static_cast< sal_uInt8 >( nPassSize << 4 ); + else + OSL_ENSURE( sal_False, "Unexpected key size!\n" ); - // fill raw digest of key data into key data - (void)rtl_digest_updateMD5( mhDigest, pnKeyData, sizeof( pnKeyData ) ); - (void)rtl_digest_rawMD5( mhDigest, pnKeyData, RTL_DIGEST_LENGTH_MD5 ); + return bResult; +} - // update digest with key data and passed salt data - for( size_t nIndex = 0; nIndex < 16; ++nIndex ) - { - rtl_digest_updateMD5( mhDigest, pnKeyData, 5 ); - rtl_digest_updateMD5( mhDigest, pnSalt, 16 ); - } +uno::Sequence< beans::NamedValue > BinaryCodec_RCF::getEncryptionData() +{ + ::comphelper::SequenceAsHashMap aHashData; + aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97EncryptionKey" ) ) ] <<= uno::Sequence< sal_Int8 >( (sal_Int8*)mpnDigestValue, RTL_DIGEST_LENGTH_MD5 ); + aHashData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97UniqueID" ) ) ] <<= uno::Sequence< sal_Int8 >( (sal_Int8*)mpnUnique, 16 ); - // update digest with padding - pnKeyData[ 16 ] = 0x80; - (void)memset( pnKeyData + 17, 0, sizeof( pnKeyData ) - 17 ); - pnKeyData[ 56 ] = 0x80; - pnKeyData[ 57 ] = 0x0A; - rtl_digest_updateMD5( mhDigest, pnKeyData + 16, sizeof( pnKeyData ) - 16 ); + return aHashData.getAsConstNamedValueList(); +} - // fill raw digest of above updates into digest value - rtl_digest_rawMD5( mhDigest, mpnDigestValue, sizeof( mpnDigestValue ) ); +void BinaryCodec_RCF::initKey( const sal_uInt16 pnPassData[ 16 ], const sal_uInt8 pnSalt[ 16 ] ) +{ + uno::Sequence< sal_Int8 > aKey = ::comphelper::DocPasswordHelper::GenerateStd97Key( pnPassData, uno::Sequence< sal_Int8 >( (sal_Int8*)pnSalt, 16 ) ); + // Fill raw digest of above updates into DigestValue. - // erase key data array and leave - (void)memset( pnKeyData, 0, sizeof( pnKeyData ) ); + if ( aKey.getLength() == sizeof(mpnDigestValue) ) + (void)memcpy ( mpnDigestValue, (const sal_uInt8*)aKey.getConstArray(), sizeof(mpnDigestValue) ); + else + memset( mpnDigestValue, 0, sizeof(mpnDigestValue) ); + + (void)memcpy( mpnUnique, pnSalt, 16 ); } bool BinaryCodec_RCF::verifyKey( const sal_uInt8 pnVerifier[ 16 ], const sal_uInt8 pnVerifierHash[ 16 ] ) diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx old mode 100755 new mode 100644 index 9b7b00988dd0..6d2b98454444 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -67,6 +67,8 @@ using ::comphelper::MediaDescriptor; using ::comphelper::SequenceAsHashMap; using ::oox::ole::OleObjectHelper; +using namespace ::com::sun::star; + namespace oox { namespace core { @@ -399,7 +401,7 @@ OleObjectHelper& FilterBase::getOleObjectHelper() const return *mxImpl->mxOleObjHelper; } -OUString FilterBase::requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const +uno::Sequence< beans::NamedValue > FilterBase::requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const { ::std::vector< OUString > aDefaultPasswords; aDefaultPasswords.push_back( CREATE_OUSTRING( "VelvetSweatshop" ) ); diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index 00244c224778..53d8809330d9 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -65,6 +65,8 @@ using ::com::sun::star::xml::sax::XLocator; using ::comphelper::MediaDescriptor; using ::comphelper::SequenceAsHashMap; +using namespace ::com::sun::star; + namespace oox { namespace core { @@ -366,7 +368,49 @@ void lclDeriveKey( const sal_uInt8* pnHash, sal_uInt32 nHashLen, sal_uInt8* pnKe // ---------------------------------------------------------------------------- -bool lclGenerateEncryptionKey( const PackageEncryptionInfo& rEncrInfo, const OUString& rPassword, sal_uInt8* pnKey, sal_uInt32 nRequiredKeyLen ) +bool lclCheckEncryptionData( const sal_uInt8* pnKey, sal_uInt32 nKeySize, const sal_uInt8* pnVerifier, sal_uInt32 nVerifierSize, const sal_uInt8* pnVerifierHash, sal_uInt32 nVerifierHashSize ) +{ + bool bResult = false; + + // the only currently supported algorithm needs key size 128 + if ( nKeySize == 16 && nVerifierSize == 16 && nVerifierHashSize == 32 ) + { + // check password + EVP_CIPHER_CTX aes_ctx; + EVP_CIPHER_CTX_init( &aes_ctx ); + EVP_DecryptInit_ex( &aes_ctx, EVP_aes_128_ecb(), 0, pnKey, 0 ); + EVP_CIPHER_CTX_set_padding( &aes_ctx, 0 ); + int nOutLen = 0; + sal_uInt8 pnTmpVerifier[ 16 ]; + (void) memset( pnTmpVerifier, 0, sizeof(pnTmpVerifier) ); + + /*int*/ EVP_DecryptUpdate( &aes_ctx, pnTmpVerifier, &nOutLen, pnVerifier, nVerifierSize ); + EVP_CIPHER_CTX_cleanup( &aes_ctx ); + + EVP_CIPHER_CTX_init( &aes_ctx ); + EVP_DecryptInit_ex( &aes_ctx, EVP_aes_128_ecb(), 0, pnKey, 0 ); + EVP_CIPHER_CTX_set_padding( &aes_ctx, 0 ); + sal_uInt8 pnTmpVerifierHash[ 32 ]; + (void) memset( pnTmpVerifierHash, 0, sizeof(pnTmpVerifierHash) ); + + /*int*/ EVP_DecryptUpdate( &aes_ctx, pnTmpVerifierHash, &nOutLen, pnVerifierHash, nVerifierHashSize ); + EVP_CIPHER_CTX_cleanup( &aes_ctx ); + + rtlDigest aDigest = rtl_digest_create( rtl_Digest_AlgorithmSHA1 ); + rtlDigestError aError = rtl_digest_update( aDigest, pnTmpVerifier, sizeof( pnTmpVerifier ) ); + sal_uInt8 pnSha1Hash[ RTL_DIGEST_LENGTH_SHA1 ]; + aError = rtl_digest_get( aDigest, pnSha1Hash, RTL_DIGEST_LENGTH_SHA1 ); + rtl_digest_destroy( aDigest ); + + bResult = ( memcmp( pnSha1Hash, pnTmpVerifierHash, RTL_DIGEST_LENGTH_SHA1 ) == 0 ); + } + + return bResult; +} + +// ---------------------------------------------------------------------------- + +uno::Sequence< beans::NamedValue > lclGenerateEncryptionKey( const PackageEncryptionInfo& rEncrInfo, const OUString& rPassword, sal_uInt8* pnKey, sal_uInt32 nRequiredKeyLen ) { size_t nBufferSize = rEncrInfo.mnSaltSize + 2 * rPassword.getLength(); sal_uInt8* pnBuffer = new sal_uInt8[ nBufferSize ]; @@ -405,30 +449,19 @@ bool lclGenerateEncryptionKey( const PackageEncryptionInfo& rEncrInfo, const OUS lclDeriveKey( pnHash, RTL_DIGEST_LENGTH_SHA1, pnKey, nRequiredKeyLen ); delete[] pnHash; - // check password - EVP_CIPHER_CTX aes_ctx; - EVP_CIPHER_CTX_init( &aes_ctx ); - EVP_DecryptInit_ex( &aes_ctx, EVP_aes_128_ecb(), 0, pnKey, 0 ); - EVP_CIPHER_CTX_set_padding( &aes_ctx, 0 ); - int nOutLen = 0; - sal_uInt8 pnVerifier[ 16 ] = { 0 }; - /*int*/ EVP_DecryptUpdate( &aes_ctx, pnVerifier, &nOutLen, rEncrInfo.mpnEncrVerifier, sizeof( rEncrInfo.mpnEncrVerifier ) ); - EVP_CIPHER_CTX_cleanup( &aes_ctx ); - - EVP_CIPHER_CTX_init( &aes_ctx ); - EVP_DecryptInit_ex( &aes_ctx, EVP_aes_128_ecb(), 0, pnKey, 0 ); - EVP_CIPHER_CTX_set_padding( &aes_ctx, 0 ); - sal_uInt8 pnVerifierHash[ 32 ] = { 0 }; - /*int*/ EVP_DecryptUpdate( &aes_ctx, pnVerifierHash, &nOutLen, rEncrInfo.mpnEncrVerifierHash, sizeof( rEncrInfo.mpnEncrVerifierHash ) ); - EVP_CIPHER_CTX_cleanup( &aes_ctx ); + uno::Sequence< beans::NamedValue > aResult; + if ( lclCheckEncryptionData( pnKey, nRequiredKeyLen, rEncrInfo.mpnEncrVerifier, sizeof( rEncrInfo.mpnEncrVerifier ), rEncrInfo.mpnEncrVerifierHash, sizeof( rEncrInfo.mpnEncrVerifierHash ) ) ) + { + ::comphelper::SequenceAsHashMap aEncryptionData; + aEncryptionData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionKey" ) ) ] <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( pnKey ), nRequiredKeyLen ); + aEncryptionData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionSalt" ) ) ] <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( rEncrInfo.mpnSalt ), rEncrInfo.mnSaltSize ); + aEncryptionData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionVerifier" ) ) ] <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( rEncrInfo.mpnEncrVerifier ), sizeof( rEncrInfo.mpnEncrVerifier ) ); + aEncryptionData[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionVerifierHash" ) ) ] <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( rEncrInfo.mpnEncrVerifierHash ), sizeof( rEncrInfo.mpnEncrVerifierHash ) ); - aDigest = rtl_digest_create( rtl_Digest_AlgorithmSHA1 ); - aError = rtl_digest_update( aDigest, pnVerifier, sizeof( pnVerifier ) ); - sal_uInt8 pnSha1Hash[ RTL_DIGEST_LENGTH_SHA1 ]; - aError = rtl_digest_get( aDigest, pnSha1Hash, RTL_DIGEST_LENGTH_SHA1 ); - rtl_digest_destroy( aDigest ); + aResult = aEncryptionData.getAsConstNamedValueList(); + } - return memcmp( pnSha1Hash, pnVerifierHash, RTL_DIGEST_LENGTH_SHA1 ) == 0; + return aResult; } // the password verifier ------------------------------------------------------ @@ -438,8 +471,8 @@ class PasswordVerifier : public ::comphelper::IDocPasswordVerifier public: explicit PasswordVerifier( const PackageEncryptionInfo& rEncryptInfo ); - virtual ::comphelper::DocPasswordVerifierResult - verifyPassword( const OUString& rPassword ); + virtual ::comphelper::DocPasswordVerifierResult verifyPassword( const ::rtl::OUString& rPassword, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ); + virtual ::comphelper::DocPasswordVerifierResult verifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData ); inline const sal_uInt8* getKey() const { return &maKey.front(); } @@ -454,13 +487,31 @@ PasswordVerifier::PasswordVerifier( const PackageEncryptionInfo& rEncryptInfo ) { } -::comphelper::DocPasswordVerifierResult PasswordVerifier::verifyPassword( const OUString& rPassword ) +::comphelper::DocPasswordVerifierResult PasswordVerifier::verifyPassword( const ::rtl::OUString& rPassword, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ) { // verifies the password and writes the related decryption key into maKey - return lclGenerateEncryptionKey( mrEncryptInfo, rPassword, &maKey.front(), maKey.size() ) ? + o_rEncryptionData = lclGenerateEncryptionKey( mrEncryptInfo, rPassword, &maKey.front(), maKey.size() ); + return ( o_rEncryptionData.getLength() > 0 ) ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; } +::comphelper::DocPasswordVerifierResult PasswordVerifier::verifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData ) +{ + ::comphelper::SequenceAsHashMap aHashData( rEncryptionData ); + uno::Sequence< sal_Int8 > aKey = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionKey" ) ), uno::Sequence< sal_Int8 >() ); + uno::Sequence< sal_Int8 > aVerifier = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionVerifier" ) ), uno::Sequence< sal_Int8 >() ); + uno::Sequence< sal_Int8 > aVerifierHash = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AES128EncryptionVerifierHash" ) ), uno::Sequence< sal_Int8 >() ); + + return lclCheckEncryptionData( + reinterpret_cast< const sal_uInt8* >( aKey.getConstArray() ), + aKey.getLength(), + reinterpret_cast< const sal_uInt8* >( aVerifier.getConstArray() ), + aVerifier.getLength(), + reinterpret_cast< const sal_uInt8* >( aVerifierHash.getConstArray() ), + aVerifierHash.getLength() ) + ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; +} + } // namespace // ---------------------------------------------------------------------------- @@ -520,10 +571,10 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript (according to the verifier), or with an empty string if user has cancelled the password input dialog. */ PasswordVerifier aVerifier( aEncryptInfo ); - OUString aPassword = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( + uno::Sequence< beans::NamedValue > aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( aVerifier, rMediaDesc, ::comphelper::DocPasswordRequestType_MS, &aDefaultPasswords ); - if( aPassword.getLength() == 0 ) + if( aEncryptionData.getLength() == 0 ) { rMediaDesc[ MediaDescriptor::PROP_ABORTED() ] <<= true; } diff --git a/oox/source/xls/biffcodec.cxx b/oox/source/xls/biffcodec.cxx index 2021c21cb08c..0872dcc654df 100644 --- a/oox/source/xls/biffcodec.cxx +++ b/oox/source/xls/biffcodec.cxx @@ -36,6 +36,8 @@ using ::rtl::OUString; using ::rtl::OStringToOUString; using ::oox::core::FilterBase; +using namespace ::com::sun::star; + namespace oox { namespace xls { @@ -50,9 +52,16 @@ BiffDecoderBase::~BiffDecoderBase() { } -::comphelper::DocPasswordVerifierResult BiffDecoderBase::verifyPassword( const OUString& rPassword ) +::comphelper::DocPasswordVerifierResult BiffDecoderBase::verifyPassword( const ::rtl::OUString& rPassword, uno::Sequence< beans::NamedValue >& o_rEncryptionData ) +{ + o_rEncryptionData = implVerifyPassword( rPassword ); + mbValid = ( o_rEncryptionData.getLength() > 0 ); + return mbValid ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; +} + +::comphelper::DocPasswordVerifierResult BiffDecoderBase::verifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) { - mbValid = implVerify( rPassword ); + mbValid = implVerifyEncryptionData( rEncryptionData ); return mbValid ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; } @@ -71,7 +80,6 @@ void BiffDecoderBase::decode( sal_uInt8* pnDestData, const sal_uInt8* pnSrcData, BiffDecoder_XOR::BiffDecoder_XOR( sal_uInt16 nKey, sal_uInt16 nHash ) : maCodec( ::oox::core::BinaryCodec_XOR::CODEC_EXCEL ), - maPassword( 16 ), mnKey( nKey ), mnHash( nHash ) { @@ -80,12 +88,12 @@ BiffDecoder_XOR::BiffDecoder_XOR( sal_uInt16 nKey, sal_uInt16 nHash ) : BiffDecoder_XOR::BiffDecoder_XOR( const BiffDecoder_XOR& rDecoder ) : BiffDecoderBase(), // must be called to prevent compiler warning maCodec( ::oox::core::BinaryCodec_XOR::CODEC_EXCEL ), - maPassword( rDecoder.maPassword ), + maEncryptionData( rDecoder.maEncryptionData ), mnKey( rDecoder.mnKey ), mnHash( rDecoder.mnHash ) { if( isValid() ) - maCodec.initKey( &maPassword.front() ); + maCodec.initCodec( maEncryptionData ); } BiffDecoder_XOR* BiffDecoder_XOR::implClone() @@ -93,24 +101,40 @@ BiffDecoder_XOR* BiffDecoder_XOR::implClone() return new BiffDecoder_XOR( *this ); } -bool BiffDecoder_XOR::implVerify( const OUString& rPassword ) +uno::Sequence< beans::NamedValue > BiffDecoder_XOR::implVerifyPassword( const ::rtl::OUString& rPassword ) { + maEncryptionData.realloc( 0 ); + /* Convert password to a byte string. TODO: this needs some finetuning according to the spec... */ OString aBytePassword = OUStringToOString( rPassword, osl_getThreadTextEncoding() ); sal_Int32 nLen = aBytePassword.getLength(); if( (0 < nLen) && (nLen < 16) ) { - // copy byte string to sal_uInt8 array - maPassword.clear(); - maPassword.resize( 16, 0 ); - memcpy( &maPassword.front(), aBytePassword.getStr(), static_cast< size_t >( nLen ) ); + // init codec + maCodec.initKey( (sal_uInt8*)aBytePassword.getStr() ); + if ( maCodec.verifyKey( mnKey, mnHash ) ) + maEncryptionData = maCodec.getEncryptionData(); + } + + return maEncryptionData; +} + +bool BiffDecoder_XOR::implVerifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) +{ + maEncryptionData.realloc( 0 ); + + if( rEncryptionData.getLength() ) + { // init codec - maCodec.initKey( &maPassword.front() ); - return maCodec.verifyKey( mnKey, mnHash ); + maCodec.initCodec( rEncryptionData ); + + if ( maCodec.verifyKey( mnKey, mnHash ) ) + maEncryptionData = rEncryptionData; } - return false; + + return maEncryptionData.getLength(); } void BiffDecoder_XOR::implDecode( sal_uInt8* pnDestData, const sal_uInt8* pnSrcData, sal_Int64 nStreamPos, sal_uInt16 nBytes ) @@ -141,7 +165,6 @@ sal_Int32 lclGetRcfOffset( sal_Int64 nStreamPos ) // ---------------------------------------------------------------------------- BiffDecoder_RCF::BiffDecoder_RCF( sal_uInt8 pnSalt[ 16 ], sal_uInt8 pnVerifier[ 16 ], sal_uInt8 pnVerifierHash[ 16 ] ) : - maPassword( 16, 0 ), maSalt( pnSalt, pnSalt + 16 ), maVerifier( pnVerifier, pnVerifier + 16 ), maVerifierHash( pnVerifierHash, pnVerifierHash + 16 ) @@ -150,13 +173,13 @@ BiffDecoder_RCF::BiffDecoder_RCF( sal_uInt8 pnSalt[ 16 ], sal_uInt8 pnVerifier[ BiffDecoder_RCF::BiffDecoder_RCF( const BiffDecoder_RCF& rDecoder ) : BiffDecoderBase(), // must be called to prevent compiler warning - maPassword( rDecoder.maPassword ), + maEncryptionData( rDecoder.maEncryptionData ), maSalt( rDecoder.maSalt ), maVerifier( rDecoder.maVerifier ), maVerifierHash( rDecoder.maVerifierHash ) { if( isValid() ) - maCodec.initKey( &maPassword.front(), &maSalt.front() ); + maCodec.initCodec( maEncryptionData ); } BiffDecoder_RCF* BiffDecoder_RCF::implClone() @@ -164,27 +187,48 @@ BiffDecoder_RCF* BiffDecoder_RCF::implClone() return new BiffDecoder_RCF( *this ); } -bool BiffDecoder_RCF::implVerify( const OUString& rPassword ) +uno::Sequence< beans::NamedValue > BiffDecoder_RCF::implVerifyPassword( const ::rtl::OUString& rPassword ) { + maEncryptionData.realloc( 0 ); + sal_Int32 nLen = rPassword.getLength(); if( (0 < nLen) && (nLen < 16) ) { // copy string to sal_uInt16 array - maPassword.clear(); - maPassword.resize( 16, 0 ); + ::std::vector< sal_uInt16 > aPassVect( 16 ); const sal_Unicode* pcChar = rPassword.getStr(); const sal_Unicode* pcCharEnd = pcChar + nLen; - ::std::vector< sal_uInt16 >::iterator aIt = maPassword.begin(); + ::std::vector< sal_uInt16 >::iterator aIt = aPassVect.begin(); for( ; pcChar < pcCharEnd; ++pcChar, ++aIt ) *aIt = static_cast< sal_uInt16 >( *pcChar ); // init codec - maCodec.initKey( &maPassword.front(), &maSalt.front() ); - return maCodec.verifyKey( &maVerifier.front(), &maVerifierHash.front() ); + maCodec.initKey( &aPassVect.front(), &maSalt.front() ); + if ( maCodec.verifyKey( &maVerifier.front(), &maVerifierHash.front() ) ) + maEncryptionData = maCodec.getEncryptionData(); + } + + return maEncryptionData; +} + +bool BiffDecoder_RCF::implVerifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) +{ + maEncryptionData.realloc( 0 ); + + if( rEncryptionData.getLength() ) + { + // init codec + maCodec.initCodec( rEncryptionData ); + + if ( maCodec.verifyKey( &maVerifier.front(), &maVerifierHash.front() ) ) + maEncryptionData = rEncryptionData; } - return false; + + return maEncryptionData.getLength(); } + + void BiffDecoder_RCF::implDecode( sal_uInt8* pnDestData, const sal_uInt8* pnSrcData, sal_Int64 nStreamPos, sal_uInt16 nBytes ) { sal_uInt8* pnCurrDest = pnDestData; @@ -316,7 +360,7 @@ bool BiffCodecHelper::importFilePass( BiffInputStream& rStrm ) mxDecoder = implReadFilePass( rStrm, getBiff() ); // request and verify a password (decoder implements IDocPasswordVerifier) if( mxDecoder.get() ) - getBaseFilter().requestPassword( *mxDecoder ); + getBaseFilter().requestEncryptionData( *mxDecoder ); // correct password is indicated by isValid() function of decoder return mxDecoder.get() && mxDecoder->isValid(); } -- cgit From 837686fdac66100f94b5f80863786d7d20844732 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 4 Nov 2010 17:56:39 +0100 Subject: pl08: #163778# use EncryptionData from MediaDescriptor --- sc/source/filter/excel/excdoc.cxx | 2 +- sc/source/filter/excel/excel.cxx | 2 + sc/source/filter/excel/xeroot.cxx | 64 +++++++++++++++++++++---- sc/source/filter/excel/xestream.cxx | 64 ++++++++++++++----------- sc/source/filter/excel/xicontent.cxx | 2 +- sc/source/filter/excel/xistream.cxx | 88 +++++++++++++++++++++++++--------- sc/source/filter/excel/xlroot.cxx | 6 ++- sc/source/filter/ftools/fapihelper.cxx | 34 ++++++++----- sc/source/filter/inc/fapihelper.hxx | 7 +-- sc/source/filter/inc/xcl97rec.hxx | 6 +-- sc/source/filter/inc/xeroot.hxx | 6 ++- sc/source/filter/inc/xestream.hxx | 18 +++---- sc/source/filter/inc/xistream.hxx | 24 ++++++---- sc/source/filter/inc/xlroot.hxx | 5 +- sc/source/filter/xcl97/xcl97rec.cxx | 33 ++++++------- 15 files changed, 244 insertions(+), 117 deletions(-) diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 458629979172..f20b63efe7ba 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -222,7 +222,7 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList ) else { if( IsDocumentEncrypted() ) - Add( new XclExpFilePass( GetRoot() ) ); + Add( new XclExpFileEncryption( GetRoot() ) ); Add( new XclExpInterfaceHdr( nCodePage ) ); Add( new XclExpUInt16Record( EXC_ID_MMS, 0 ) ); Add( new XclExpInterfaceEnd ); diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index 3a43a23cd624..0c3d7783645a 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -103,6 +103,8 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument aMediaDesc[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pItem->GetValue() ); if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_PASSWORD ) ) ) aMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= ::rtl::OUString( pItem->GetValue() ); + if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_ENCRYPTIONDATA ) ) ) + aMediaDesc[ MediaDescriptor::PROP_ENCRYPTIONDATA() ] = pItem->GetValue(); } aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream(); aMediaDesc[ MediaDescriptor::PROP_INTERACTIONHANDLER() ] <<= rMedium.GetInteractionHandler(); diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index 50e07ae1f2ed..4632a10a088e 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -28,7 +28,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" +#include #include +#include +#include #include #include #include @@ -51,6 +54,8 @@ #include "document.hxx" #include "scextopt.hxx" +using namespace ::com::sun::star; + // Global data ================================================================ XclExpRootData::XclExpRootData( XclBiff eBiff, SfxMedium& rMedium, @@ -241,23 +246,66 @@ bool XclExpRoot::IsDocumentEncrypted() const if (pDocProt && pDocProt->isProtected() && pDocProt->isOptionEnabled(ScDocProtection::STRUCTURE)) return true; - if (GetPassword().Len() > 0) + if ( GetEncryptionData().getLength() > 0 ) // Password is entered directly into the save dialog. return true; return false; } -String XclExpRoot::GetPassword() const +uno::Sequence< beans::NamedValue > XclExpRoot::GenerateEncryptionData( const ::rtl::OUString& aPass ) const { - if( SfxItemSet* pItemSet = GetMedium().GetItemSet() ) + uno::Sequence< beans::NamedValue > aEncryptionData; + + if ( aPass.getLength() > 0 && aPass.getLength() < 16 ) { - const SfxPoolItem* pItem = 0; - if( pItemSet->GetItemState( SID_PASSWORD, TRUE, &pItem ) == SFX_ITEM_SET ) - if( const SfxStringItem* pStrItem = dynamic_cast< const SfxStringItem* >( pItem ) ) - return pStrItem->GetValue(); + TimeValue aTime; + osl_getSystemTime( &aTime ); + rtlRandomPool aRandomPool = rtl_random_createPool (); + rtl_random_addBytes ( aRandomPool, &aTime, 8 ); + + sal_uInt8 pnDocId[16]; + rtl_random_getBytes( aRandomPool, pnDocId, 16 ); + + rtl_random_destroyPool( aRandomPool ); + + sal_uInt16 pnPasswd[16]; + memset( pnPasswd, 0, sizeof( pnPasswd ) ); + for (xub_StrLen nChar = 0; nChar < aPass.getLength(); ++nChar ) + pnPasswd[nChar] = aPass.getStr()[nChar]; + + ::msfilter::MSCodec_Std97 aCodec; + aCodec.InitKey( pnPasswd, pnDocId ); + aEncryptionData = aCodec.GetEncryptionData(); } - return String::EmptyString(); + + return aEncryptionData; +} + +uno::Sequence< beans::NamedValue > XclExpRoot::GetEncryptionData() const +{ + uno::Sequence< beans::NamedValue > aEncryptionData; + SFX_ITEMSET_ARG( GetMedium().GetItemSet(), pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False ); + if ( pEncryptionDataItem ) + pEncryptionDataItem->GetValue() >>= aEncryptionData; + else + { + // try to get the encryption data from the password + SFX_ITEMSET_ARG( GetMedium().GetItemSet(), pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False ); + if ( pPasswordItem && pPasswordItem->GetValue().Len() ) + aEncryptionData = GenerateEncryptionData( pPasswordItem->GetValue() ); + } + + return aEncryptionData; +} + +uno::Sequence< beans::NamedValue > XclExpRoot::GenerateDefaultEncryptionData() const +{ + uno::Sequence< beans::NamedValue > aEncryptionData; + if ( GetDefaultPassword().Len() > 0 ) + aEncryptionData = GenerateEncryptionData( GetDefaultPassword() ); + + return aEncryptionData; } XclExpRootData::XclExpLinkMgrRef XclExpRoot::GetLocalLinkMgrRef() const diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index f828079c8735..b15568e8ce9a 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -65,6 +66,7 @@ using ::utl::OStreamWrapper; using ::std::vector; using namespace formula; +using namespace ::com::sun::star; // ============================================================================ @@ -484,17 +486,16 @@ void XclExpStream::WriteRawZeroBytes( sal_Size nBytes ) // ============================================================================ -XclExpBiff8Encrypter::XclExpBiff8Encrypter( const XclExpRoot& rRoot, const sal_uInt8 nDocId[16], - const sal_uInt8 nSalt[16] ) : +XclExpBiff8Encrypter::XclExpBiff8Encrypter( const XclExpRoot& rRoot ) : mrRoot(rRoot), mnOldPos(STREAM_SEEK_TO_END), mbValid(false) { - String aPass = rRoot.GetPassword(); - if (aPass.Len() == 0) + uno::Sequence< beans::NamedValue > aEncryptionData = rRoot.GetEncryptionData(); + if ( aEncryptionData.getLength() == 0 ) // Empty password. Get the default biff8 password. - aPass = rRoot.GetDefaultPassword(); - Init(aPass, nDocId, nSalt); + aEncryptionData = rRoot.GenerateDefaultEncryptionData(); + Init( aEncryptionData ); } XclExpBiff8Encrypter::~XclExpBiff8Encrypter() @@ -506,9 +507,22 @@ bool XclExpBiff8Encrypter::IsValid() const return mbValid; } -void XclExpBiff8Encrypter::GetSaltDigest( sal_uInt8 nSaltDigest[16] ) const +void XclExpBiff8Encrypter::GetSaltDigest( sal_uInt8 pnSaltDigest[16] ) const { - memcpy(nSaltDigest, mnSaltDigest, 16); + if ( sizeof( mpnSaltDigest ) == 16 ) + memcpy( pnSaltDigest, mpnSaltDigest, 16 ); +} + +void XclExpBiff8Encrypter::GetSalt( sal_uInt8 pnSalt[16] ) const +{ + if ( sizeof( mpnSalt ) == 16 ) + memcpy( pnSalt, mpnSalt, 16 ); +} + +void XclExpBiff8Encrypter::GetDocId( sal_uInt8 pnDocId[16] ) const +{ + if ( sizeof( mpnDocId ) == 16 ) + memcpy( pnDocId, mpnDocId, 16 ); } void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt8 nData ) @@ -565,36 +579,32 @@ void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_Int32 nData ) Encrypt(rStrm, static_cast(nData)); } -void XclExpBiff8Encrypter::Init( const String& aPass, const sal_uInt8 nDocId[16], - const sal_uInt8 nSalt[16] ) +void XclExpBiff8Encrypter::Init( const uno::Sequence< beans::NamedValue >& aEncryptionData ) { - memset(mnSaltDigest, 0, sizeof(mnSaltDigest)); + mbValid = false; - xub_StrLen nLen = aPass.Len(); - bool bValid = (0 < nLen) && (nLen < 16); - if ( bValid ) + if ( maCodec.InitCodec( aEncryptionData ) ) { - // transform String to sal_uInt16 array - memset(mnPassw, 0, sizeof(mnPassw)); - for (xub_StrLen nChar = 0; nChar < nLen; ++nChar) - mnPassw[nChar] = static_cast(aPass.GetChar(nChar)); + maCodec.GetDocId( mpnDocId ); - // copy document ID - memcpy(mnDocId, nDocId, sizeof(mnDocId)); + // generate the salt here + TimeValue aTime; + osl_getSystemTime( &aTime ); + rtlRandomPool aRandomPool = rtl_random_createPool (); + rtl_random_addBytes( aRandomPool, &aTime, 8 ); + rtl_random_getBytes( aRandomPool, mpnSalt, 16 ); + rtl_random_destroyPool( aRandomPool ); - // init codec - maCodec.InitKey(mnPassw, mnDocId); + memset( mpnSaltDigest, 0, sizeof( mpnSaltDigest ) ); // generate salt hash. ::msfilter::MSCodec_Std97 aCodec; - aCodec.InitKey(mnPassw, mnDocId); - aCodec.CreateSaltDigest(nSalt, mnSaltDigest); + aCodec.InitCodec( aEncryptionData ); + aCodec.GetDigestFromSalt( mpnSalt, mpnSaltDigest ); // verify to make sure it's in good shape. - bValid = maCodec.VerifyKey(nSalt, mnSaltDigest); + mbValid = maCodec.VerifyKey( mpnSalt, mpnSaltDigest ); } - - mbValid = bValid; } sal_uInt32 XclExpBiff8Encrypter::GetBlockPos( sal_Size nStrmPos ) const diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index fb1eb9a3bf44..b210d18f479c 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -1118,7 +1118,7 @@ ErrCode XclImpDecryptHelper::ReadFilepass( XclImpStream& rStrm ) // request and verify a password (decrypter implements IDocPasswordVerifier) if( xDecr.is() ) - rStrm.GetRoot().RequestPassword( *xDecr ); + rStrm.GetRoot().RequestEncryptionData( *xDecr ); // return error code (success, wrong password, etc.) return xDecr.is() ? xDecr->GetError() : EXC_ENCR_ERROR_UNSUPP_CRYPT; diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index 98db9dcb4471..6b4851292e11 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -38,6 +38,8 @@ using ::rtl::OString; using ::rtl::OUString; using ::rtl::OUStringToOString; +using namespace ::com::sun::star; + // ============================================================================ // Decryption // ============================================================================ @@ -69,9 +71,16 @@ XclImpDecrypterRef XclImpDecrypter::Clone() const return xNewDecr; } -::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyPassword( const OUString& rPassword ) +::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyPassword( const ::rtl::OUString& rPassword, uno::Sequence< beans::NamedValue >& o_rEncryptionData ) +{ + o_rEncryptionData = OnVerifyPassword( rPassword ); + mnError = o_rEncryptionData.getLength() ? ERRCODE_NONE : ERRCODE_ABORT; + return o_rEncryptionData.getLength() ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; +} + +::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) { - bool bValid = OnVerify( rPassword ); + bool bValid = OnVerifyEncryptionData( rEncryptionData ); mnError = bValid ? ERRCODE_NONE : ERRCODE_ABORT; return bValid ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; } @@ -110,7 +119,6 @@ sal_uInt16 XclImpDecrypter::Read( SvStream& rStrm, void* pData, sal_uInt16 nByte // ---------------------------------------------------------------------------- XclImpBiff5Decrypter::XclImpBiff5Decrypter( sal_uInt16 nKey, sal_uInt16 nHash ) : - maPassword( 16 ), mnKey( nKey ), mnHash( nHash ) { @@ -118,12 +126,12 @@ XclImpBiff5Decrypter::XclImpBiff5Decrypter( sal_uInt16 nKey, sal_uInt16 nHash ) XclImpBiff5Decrypter::XclImpBiff5Decrypter( const XclImpBiff5Decrypter& rSrc ) : XclImpDecrypter( rSrc ), - maPassword( rSrc.maPassword ), + maEncryptionData( rSrc.maEncryptionData ), mnKey( rSrc.mnKey ), mnHash( rSrc.mnHash ) { if( IsValid() ) - maCodec.InitKey( &maPassword.front() ); + maCodec.InitCodec( maEncryptionData ); } XclImpBiff5Decrypter* XclImpBiff5Decrypter::OnClone() const @@ -131,24 +139,40 @@ XclImpBiff5Decrypter* XclImpBiff5Decrypter::OnClone() const return new XclImpBiff5Decrypter( *this ); } -bool XclImpBiff5Decrypter::OnVerify( const OUString& rPassword ) +uno::Sequence< beans::NamedValue > XclImpBiff5Decrypter::OnVerifyPassword( const ::rtl::OUString& rPassword ) { + maEncryptionData.realloc( 0 ); + /* Convert password to a byte string. TODO: this needs some finetuning according to the spec... */ OString aBytePassword = OUStringToOString( rPassword, osl_getThreadTextEncoding() ); sal_Int32 nLen = aBytePassword.getLength(); if( (0 < nLen) && (nLen < 16) ) { - // copy byte string to sal_uInt8 array - maPassword.clear(); - maPassword.resize( 16, 0 ); - memcpy( &maPassword.front(), aBytePassword.getStr(), static_cast< size_t >( nLen ) ); + // init codec + maCodec.InitKey( (sal_uInt8*)aBytePassword.getStr() ); + if ( maCodec.VerifyKey( mnKey, mnHash ) ) + maEncryptionData = maCodec.GetEncryptionData(); + } + + return maEncryptionData; +} + +bool XclImpBiff5Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) +{ + maEncryptionData.realloc( 0 ); + + if( rEncryptionData.getLength() ) + { // init codec - maCodec.InitKey( &maPassword.front() ); - return maCodec.VerifyKey( mnKey, mnHash ); + maCodec.InitCodec( rEncryptionData ); + + if ( maCodec.VerifyKey( mnKey, mnHash ) ) + maEncryptionData = rEncryptionData; } - return false; + + return maEncryptionData.getLength(); } void XclImpBiff5Decrypter::OnUpdate( sal_Size /*nOldStrmPos*/, sal_Size nNewStrmPos, sal_uInt16 nRecSize ) @@ -168,7 +192,6 @@ sal_uInt16 XclImpBiff5Decrypter::OnRead( SvStream& rStrm, sal_uInt8* pnData, sal XclImpBiff8Decrypter::XclImpBiff8Decrypter( sal_uInt8 pnSalt[ 16 ], sal_uInt8 pnVerifier[ 16 ], sal_uInt8 pnVerifierHash[ 16 ] ) : - maPassword( 16, 0 ), maSalt( pnSalt, pnSalt + 16 ), maVerifier( pnVerifier, pnVerifier + 16 ), maVerifierHash( pnVerifierHash, pnVerifierHash + 16 ) @@ -177,13 +200,13 @@ XclImpBiff8Decrypter::XclImpBiff8Decrypter( sal_uInt8 pnSalt[ 16 ], XclImpBiff8Decrypter::XclImpBiff8Decrypter( const XclImpBiff8Decrypter& rSrc ) : XclImpDecrypter( rSrc ), - maPassword( rSrc.maPassword ), + maEncryptionData( rSrc.maEncryptionData ), maSalt( rSrc.maSalt ), maVerifier( rSrc.maVerifier ), maVerifierHash( rSrc.maVerifierHash ) { if( IsValid() ) - maCodec.InitKey( &maPassword.front(), &maSalt.front() ); + maCodec.InitCodec( maEncryptionData ); } XclImpBiff8Decrypter* XclImpBiff8Decrypter::OnClone() const @@ -191,25 +214,44 @@ XclImpBiff8Decrypter* XclImpBiff8Decrypter::OnClone() const return new XclImpBiff8Decrypter( *this ); } -bool XclImpBiff8Decrypter::OnVerify( const OUString& rPassword ) +uno::Sequence< beans::NamedValue > XclImpBiff8Decrypter::OnVerifyPassword( const ::rtl::OUString& rPassword ) { + maEncryptionData.realloc( 0 ); + sal_Int32 nLen = rPassword.getLength(); if( (0 < nLen) && (nLen < 16) ) { // copy string to sal_uInt16 array - maPassword.clear(); - maPassword.resize( 16, 0 ); + ::std::vector< sal_uInt16 > aPassVect( 16 ); const sal_Unicode* pcChar = rPassword.getStr(); const sal_Unicode* pcCharEnd = pcChar + nLen; - ::std::vector< sal_uInt16 >::iterator aIt = maPassword.begin(); + ::std::vector< sal_uInt16 >::iterator aIt = aPassVect.begin(); for( ; pcChar < pcCharEnd; ++pcChar, ++aIt ) *aIt = static_cast< sal_uInt16 >( *pcChar ); // init codec - maCodec.InitKey( &maPassword.front(), &maSalt.front() ); - return maCodec.VerifyKey( &maVerifier.front(), &maVerifierHash.front() ); + maCodec.InitKey( &aPassVect.front(), &maSalt.front() ); + if ( maCodec.VerifyKey( &maVerifier.front(), &maVerifierHash.front() ) ) + maEncryptionData = maCodec.GetEncryptionData(); } - return false; + + return maEncryptionData; +} + +bool XclImpBiff8Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) +{ + maEncryptionData.realloc( 0 ); + + if( rEncryptionData.getLength() ) + { + // init codec + maCodec.InitCodec( rEncryptionData ); + + if ( maCodec.VerifyKey( &maVerifier.front(), &maVerifierHash.front() ) ) + maEncryptionData = rEncryptionData; + } + + return maEncryptionData.getLength(); } void XclImpBiff8Decrypter::OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 /*nRecSize*/ ) diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 2b2180db5e6a..c6d6c5b9246a 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -71,6 +71,8 @@ using ::com::sun::star::frame::XFrame; using ::com::sun::star::frame::XFramesSupplier; using ::com::sun::star::lang::XMultiServiceFactory; +using namespace ::com::sun::star; + // Global data ================================================================ #ifdef DBG_UTIL @@ -240,11 +242,11 @@ sal_Int32 XclRoot::GetHmmFromPixelY( double fPixelY ) const return static_cast< sal_Int32 >( fPixelY * mrData.mfScreenPixelY + 0.5 ); } -String XclRoot::RequestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const +uno::Sequence< beans::NamedValue > XclRoot::RequestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const { ::std::vector< OUString > aDefaultPasswords; aDefaultPasswords.push_back( mrData.maDefPassword ); - return ScfApiHelper::QueryPasswordForMedium( mrData.mrMedium, rVerifier, &aDefaultPasswords ); + return ScfApiHelper::QueryEncryptionDataForMedium( mrData.mrMedium, rVerifier, &aDefaultPasswords ); } bool XclRoot::HasVbaStorage() const diff --git a/sc/source/filter/ftools/fapihelper.cxx b/sc/source/filter/ftools/fapihelper.cxx index eeef52aed550..185923b28277 100644 --- a/sc/source/filter/ftools/fapihelper.cxx +++ b/sc/source/filter/ftools/fapihelper.cxx @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include #include @@ -59,6 +61,8 @@ using ::com::sun::star::lang::XServiceName; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER; +using namespace ::com::sun::star; + // Static helper functions ==================================================== OUString ScfApiHelper::GetServiceName( Reference< XInterface > xInt ) @@ -136,25 +140,33 @@ Reference< XInterface > ScfApiHelper::CreateInstanceWithArgs( return CreateInstanceWithArgs( ::comphelper::getProcessServiceFactory(), rServiceName, rArgs ); } -String ScfApiHelper::QueryPasswordForMedium( SfxMedium& rMedium, +uno::Sequence< beans::NamedValue > ScfApiHelper::QueryEncryptionDataForMedium( SfxMedium& rMedium, ::comphelper::IDocPasswordVerifier& rVerifier, const ::std::vector< OUString >* pDefaultPasswords ) { - OUString aMediaPassword; - SfxItemSet* pItemSet = rMedium.GetItemSet(); - const SfxPoolItem *pPasswordItem; - if( pItemSet && (SFX_ITEM_SET == pItemSet->GetItemState( SID_PASSWORD, TRUE, &pPasswordItem )) ) - aMediaPassword = static_cast< const SfxStringItem* >( pPasswordItem )->GetValue(); + uno::Sequence< beans::NamedValue > aEncryptionData; + SFX_ITEMSET_ARG( rMedium.GetItemSet(), pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False); + if ( pEncryptionDataItem ) + pEncryptionDataItem->GetValue() >>= aEncryptionData; + + ::rtl::OUString aPassword; + SFX_ITEMSET_ARG( rMedium.GetItemSet(), pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False); + if ( pPasswordItem ) + aPassword = pPasswordItem->GetValue(); + OUString aDocName = INetURLObject( rMedium.GetOrigURL() ).GetName( INetURLObject::DECODE_WITH_CHARSET ); bool bIsDefaultPassword = false; - OUString aPassword = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( - rVerifier, aMediaPassword, rMedium.GetInteractionHandler(), aDocName, + aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( + rVerifier, aEncryptionData, aPassword, rMedium.GetInteractionHandler(), aDocName, ::comphelper::DocPasswordRequestType_MS, pDefaultPasswords, &bIsDefaultPassword ); - if( !bIsDefaultPassword && (aPassword.getLength() > 0) && pItemSet ) - pItemSet->Put( SfxStringItem( SID_PASSWORD, aPassword ) ); + rMedium.GetItemSet()->ClearItem( SID_PASSWORD ); + rMedium.GetItemSet()->ClearItem( SID_ENCRYPTIONDATA ); + + if( !bIsDefaultPassword && (aEncryptionData.getLength() > 0) ) + rMedium.GetItemSet()->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) ); - return aPassword; + return aEncryptionData; } // Property sets ============================================================== diff --git a/sc/source/filter/inc/fapihelper.hxx b/sc/source/filter/inc/fapihelper.hxx index 8c204f1cef35..699a4e28720a 100644 --- a/sc/source/filter/inc/fapihelper.hxx +++ b/sc/source/filter/inc/fapihelper.hxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include "ftools.hxx" @@ -106,9 +107,9 @@ public: const ::rtl::OUString& rServiceName, const UnoAnySequence& rArgs ); - /** Opens a password dialog and returns the entered password. - @return The entered password or an empty string on 'Cancel' or any error. */ - static String QueryPasswordForMedium( SfxMedium& rMedium, + /** Opens a password dialog and returns the encryption data. + @return The encryption data or an empty sequence on 'Cancel' or any error. */ + static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > QueryEncryptionDataForMedium( SfxMedium& rMedium, ::comphelper::IDocPasswordVerifier& rVerifier, const ::std::vector< ::rtl::OUString >* pDefaultPasswords = 0 ); }; diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx index 201562fa752c..8afbe946d2f7 100644 --- a/sc/source/filter/inc/xcl97rec.hxx +++ b/sc/source/filter/inc/xcl97rec.hxx @@ -478,11 +478,11 @@ public: // ============================================================================ -class XclExpFilePass : public XclExpRecord +class XclExpFileEncryption : public XclExpRecord { public: - explicit XclExpFilePass( const XclExpRoot& rRoot ); - virtual ~XclExpFilePass(); + explicit XclExpFileEncryption( const XclExpRoot& rRoot ); + virtual ~XclExpFileEncryption(); private: virtual void WriteBody( XclExpStream& rStrm ); diff --git a/sc/source/filter/inc/xeroot.hxx b/sc/source/filter/inc/xeroot.hxx index 980590f9d4ff..ba51abdef1a2 100644 --- a/sc/source/filter/inc/xeroot.hxx +++ b/sc/source/filter/inc/xeroot.hxx @@ -28,6 +28,8 @@ #ifndef SC_XEROOT_HXX #define SC_XEROOT_HXX +#include + #include "xlroot.hxx" // Forward declarations of objects in public use ============================== @@ -158,7 +160,9 @@ public: bool IsDocumentEncrypted() const; - String GetPassword() const; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GenerateEncryptionData( const ::rtl::OUString& aPass ) const; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetEncryptionData() const; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GenerateDefaultEncryptionData() const; private: diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx index 3308827441dd..38acef2783e8 100644 --- a/sc/source/filter/inc/xestream.hxx +++ b/sc/source/filter/inc/xestream.hxx @@ -30,6 +30,8 @@ #ifndef SC_XESTREAM_HXX #define SC_XESTREAM_HXX +#include + #include #include #include @@ -216,13 +218,14 @@ private: class XclExpBiff8Encrypter { public: - explicit XclExpBiff8Encrypter( const XclExpRoot& rRoot, const sal_uInt8 nDocId[16], - const sal_uInt8 nSalt[16] ); + explicit XclExpBiff8Encrypter( const XclExpRoot& rRoot ); ~XclExpBiff8Encrypter(); bool IsValid() const; - void GetSaltDigest( sal_uInt8 nSaltDigest[16] ) const; + void GetSaltDigest( sal_uInt8 pnSaltDigest[16] ) const; + void GetSalt( sal_uInt8 pnSalt[16] ) const; + void GetDocId( sal_uInt8 pnDocId[16] ) const; void Encrypt( SvStream& rStrm, sal_uInt8 nData ); void Encrypt( SvStream& rStrm, sal_uInt16 nData ); @@ -238,17 +241,16 @@ public: void EncryptBytes( SvStream& rStrm, ::std::vector& aBytes ); private: - void Init( const String& aPass, const sal_uInt8 nDocId[16], - const sal_uInt8 nSalt[16] ); + void Init( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ); sal_uInt32 GetBlockPos( sal_Size nStrmPos ) const; sal_uInt16 GetOffsetInBlock( sal_Size nStrmPos ) const; private: ::msfilter::MSCodec_Std97 maCodec; /// Crypto algorithm implementation. - sal_uInt16 mnPassw[16]; /// Cached password data for copy construction. - sal_uInt8 mnDocId[16]; /// Cached document ID for copy construction. - sal_uInt8 mnSaltDigest[16]; + sal_uInt8 mpnDocId[16]; + sal_uInt8 mpnSalt[16]; + sal_uInt8 mpnSaltDigest[16]; const XclExpRoot& mrRoot; sal_Size mnOldPos; /// Last known stream position diff --git a/sc/source/filter/inc/xistream.hxx b/sc/source/filter/inc/xistream.hxx index 9b27077d78e7..4aec7c337a32 100644 --- a/sc/source/filter/inc/xistream.hxx +++ b/sc/source/filter/inc/xistream.hxx @@ -64,10 +64,9 @@ public: /** Creates a (ref-counted) copy of this decrypter object. */ XclImpDecrypterRef Clone() const; - /** Implementation of the ::comphelper::IDocPasswordVerifier interface, - calls the new virtual function implVerify(). */ - virtual ::comphelper::DocPasswordVerifierResult - verifyPassword( const ::rtl::OUString& rPassword ); + /** Implementation of the ::comphelper::IDocPasswordVerifier interface */ + virtual ::comphelper::DocPasswordVerifierResult verifyPassword( const ::rtl::OUString& rPassword, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ); + virtual ::comphelper::DocPasswordVerifierResult verifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData ); /** Updates the decrypter on start of a new record or after seeking stream. */ void Update( SvStream& rStrm, sal_uInt16 nRecSize ); @@ -84,7 +83,10 @@ private: virtual XclImpDecrypter* OnClone() const = 0; /** Derived classes implement password verification and initialization of the decoder. */ - virtual bool OnVerify( const ::rtl::OUString& rPassword ) = 0; + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > + OnVerifyPassword( const ::rtl::OUString& rPassword ) = 0; + virtual bool OnVerifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData ) = 0; + /** Implementation of updating the decrypter. */ virtual void OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 nRecSize ) = 0; /** Implementation of the decryption. */ @@ -111,7 +113,9 @@ private: /** Implementation of cloning this object. */ virtual XclImpBiff5Decrypter* OnClone() const; /** Implements password verification and initialization of the decoder. */ - virtual bool OnVerify( const ::rtl::OUString& rPassword ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > + OnVerifyPassword( const ::rtl::OUString& rPassword ); + virtual bool OnVerifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData ); /** Implementation of updating the decrypter. */ virtual void OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 nRecSize ); /** Implementation of the decryption. */ @@ -119,7 +123,7 @@ private: private: ::msfilter::MSCodec_XorXLS95 maCodec; /// Crypto algorithm implementation. - ::std::vector< sal_uInt8 > maPassword; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > maEncryptionData; sal_uInt16 mnKey; sal_uInt16 mnHash; }; @@ -140,7 +144,9 @@ private: /** Implementation of cloning this object. */ virtual XclImpBiff8Decrypter* OnClone() const; /** Implements password verification and initialization of the decoder. */ - virtual bool OnVerify( const ::rtl::OUString& rPassword ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > + OnVerifyPassword( const ::rtl::OUString& rPassword ); + virtual bool OnVerifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rEncryptionData ); /** Implementation of updating the decrypter. */ virtual void OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 nRecSize ); /** Implementation of the decryption. */ @@ -153,7 +159,7 @@ private: private: ::msfilter::MSCodec_Std97 maCodec; /// Crypto algorithm implementation. - ::std::vector< sal_uInt16 > maPassword; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > maEncryptionData; ::std::vector< sal_uInt8 > maSalt; ::std::vector< sal_uInt8 > maVerifier; ::std::vector< sal_uInt8 > maVerifierHash; diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx index 2f029c74baa9..44ded449cd76 100644 --- a/sc/source/filter/inc/xlroot.hxx +++ b/sc/source/filter/inc/xlroot.hxx @@ -28,6 +28,8 @@ #ifndef SC_XLROOT_HXX #define SC_XLROOT_HXX +#include + #include #include #include "xlconst.hxx" @@ -196,7 +198,8 @@ public: /** Returns the default password used for stream encryption. */ inline const String& GetDefaultPassword() const { return mrData.maDefPassword; } /** Requests and verifies a password from the medium or the user. */ - String RequestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > + RequestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) const; /** Returns the OLE2 root storage of the imported/exported file. @return Pointer to root storage or 0, if the file is a simple stream. */ diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index df6bdcbbe671..209bbc83f6c3 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1251,27 +1251,18 @@ void XclDelta::SaveXml( XclExpXmlStream& rStrm ) // ============================================================================ -XclExpFilePass::XclExpFilePass( const XclExpRoot& rRoot ) : +XclExpFileEncryption::XclExpFileEncryption( const XclExpRoot& rRoot ) : XclExpRecord(0x002F, 54), mrRoot(rRoot) { } -XclExpFilePass::~XclExpFilePass() +XclExpFileEncryption::~XclExpFileEncryption() { } -void XclExpFilePass::WriteBody( XclExpStream& rStrm ) +void XclExpFileEncryption::WriteBody( XclExpStream& rStrm ) { - static const sal_uInt8 nDocId[] = { - 0x17, 0xf7, 0x01, 0x08, 0xea, 0xad, 0x30, 0x5c, - 0x1a, 0x95, 0xa5, 0x75, 0xd6, 0x79, 0xcd, 0x8d }; - - - static const sal_uInt8 nSalt[] = { - 0xa4, 0x5b, 0xf7, 0xe9, 0x9f, 0x55, 0x21, 0xc5, - 0xc5, 0x56, 0xa8, 0x0d, 0x39, 0x05, 0x3a, 0xb4 }; - // 0x0000 - neither standard nor strong encryption // 0x0001 - standard or strong encryption rStrm << static_cast(0x0001); @@ -1281,13 +1272,17 @@ void XclExpFilePass::WriteBody( XclExpStream& rStrm ) sal_uInt16 nStdEnc = 0x0001; rStrm << nStdEnc << nStdEnc; - sal_uInt8 nSaltHash[16]; - XclExpEncrypterRef xEnc( new XclExpBiff8Encrypter(mrRoot, nDocId, nSalt) ); - xEnc->GetSaltDigest(nSaltHash); - - rStrm.Write(nDocId, 16); - rStrm.Write(nSalt, 16); - rStrm.Write(nSaltHash, 16); + sal_uInt8 pnDocId[16]; + sal_uInt8 pnSalt[16]; + sal_uInt8 pnSaltHash[16]; + XclExpEncrypterRef xEnc( new XclExpBiff8Encrypter(mrRoot) ); + xEnc->GetDocId(pnDocId); + xEnc->GetSalt(pnSalt); + xEnc->GetSaltDigest(pnSaltHash); + + rStrm.Write(pnDocId, 16); + rStrm.Write(pnSalt, 16); + rStrm.Write(pnSaltHash, 16); rStrm.SetEncrypter(xEnc); } -- cgit From 9ba9a27d921c28488444b3cd016dd5eb12c7525a Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 4 Nov 2010 17:56:39 +0100 Subject: pl08: #163778# use EncryptionData from MediaDescriptor --- comphelper/inc/comphelper/docpasswordhelper.hxx | 63 +++++++++- comphelper/inc/comphelper/mediadescriptor.hxx | 1 + comphelper/inc/comphelper/storagehelper.hxx | 11 +- comphelper/source/misc/docpasswordhelper.cxx | 152 +++++++++++++++++++----- comphelper/source/misc/mediadescriptor.cxx | 6 + comphelper/source/misc/storagehelper.cxx | 52 +++++++- 6 files changed, 244 insertions(+), 41 deletions(-) diff --git a/comphelper/inc/comphelper/docpasswordhelper.hxx b/comphelper/inc/comphelper/docpasswordhelper.hxx index dbbb68372a07..7e9f06318a26 100644 --- a/comphelper/inc/comphelper/docpasswordhelper.hxx +++ b/comphelper/inc/comphelper/docpasswordhelper.hxx @@ -28,6 +28,7 @@ #ifndef COMPHELPER_DOCPASSWORDHELPR_HXX #define COMPHELPER_DOCPASSWORDHELPR_HXX +#include #include "comphelper/comphelperdllapi.h" #include #include "comphelper/docpasswordrequest.hxx" @@ -53,7 +54,7 @@ enum DocPasswordVerifierResult /** Base class for a password verifier used by the DocPasswordHelper class below. - Users have to implement the virtual function and pass an instance of the + Users have to implement the virtual functions and pass an instance of the verifier to one of the password request functions. */ class COMPHELPER_DLLPUBLIC IDocPasswordVerifier @@ -63,6 +64,14 @@ public: /** Will be called everytime a password needs to be verified. + @param rPassword + The password to be verified + + @param o_rEncryptionData + Output parameter, that is filled with the EncryptionData generated + from the password. The data is filled only if the validation was + successful. + @return The result of the verification. - DocPasswordVerifierResult_OK, if and only if the passed password is valid and can be used to process the related document. @@ -72,7 +81,23 @@ public: occured while password verification. The password request loop will be aborted. */ - virtual DocPasswordVerifierResult verifyPassword( const ::rtl::OUString& rPassword ) = 0; + virtual DocPasswordVerifierResult verifyPassword( const ::rtl::OUString& rPassword, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ) = 0; + + /** Will be called everytime an encryption data needs to be verified. + + @param rEncryptionData + The data will be validated + + @return The result of the verification. + - DocPasswordVerifierResult_OK, if and only if the passed encryption data + is valid and can be used to process the related document. + - DocPasswordVerifierResult_WRONG_PASSWORD, if the encryption data is + wrong. + - DocPasswordVerifierResult_ABORT, if an unrecoverable error + occured while data verification. The password request loop + will be aborted. + */ + virtual DocPasswordVerifierResult verifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ) = 0; }; @@ -195,6 +220,35 @@ public: // ------------------------------------------------------------------------ + /** This helper function generates a random sequence of bytes of + requested length. + */ + + static ::com::sun::star::uno::Sequence< sal_Int8 > GenerateRandomByteSequence( + sal_Int32 nLength ); + + // ------------------------------------------------------------------------ + + /** This helper function generates a byte sequence representing the + key digest value used by MSCodec_Std97 codec. + */ + + static ::com::sun::star::uno::Sequence< sal_Int8 > GenerateStd97Key( + const ::rtl::OUString& aPassword, + const ::com::sun::star::uno::Sequence< sal_Int8 >& aDocId ); + + // ------------------------------------------------------------------------ + + /** This helper function generates a byte sequence representing the + key digest value used by MSCodec_Std97 codec. + */ + + static ::com::sun::star::uno::Sequence< sal_Int8 > GenerateStd97Key( + const sal_uInt16 pPassData[16], + const ::com::sun::star::uno::Sequence< sal_Int8 >& aDocId ); + + // ------------------------------------------------------------------------ + /** This helper function tries to request and verify a password to load a protected document. @@ -248,8 +302,9 @@ public: passed password verifier. If empty, no valid password has been found, or the user has chossen to cancel password input. */ - static ::rtl::OUString requestAndVerifyDocPassword( + static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestAndVerifyDocPassword( IDocPasswordVerifier& rVerifier, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rMediaEncData, const ::rtl::OUString& rMediaPassword, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& rxInteractHandler, @@ -300,7 +355,7 @@ public: passed password verifier. If empty, no valid password has been found, or the user has chossen to cancel password input. */ - static ::rtl::OUString requestAndVerifyDocPassword( + static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestAndVerifyDocPassword( IDocPasswordVerifier& rVerifier, MediaDescriptor& rMediaDesc, DocPasswordRequestType eRequestType, diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx b/comphelper/inc/comphelper/mediadescriptor.hxx index 7d2333045390..01fa8059b284 100644 --- a/comphelper/inc/comphelper/mediadescriptor.hxx +++ b/comphelper/inc/comphelper/mediadescriptor.hxx @@ -78,6 +78,7 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap static const ::rtl::OUString& PROP_DEEPDETECTION(); static const ::rtl::OUString& PROP_DETECTSERVICE(); static const ::rtl::OUString& PROP_DOCUMENTSERVICE(); + static const ::rtl::OUString& PROP_ENCRYPTIONDATA(); static const ::rtl::OUString& PROP_EXTENSION(); static const ::rtl::OUString& PROP_FILENAME(); static const ::rtl::OUString& PROP_FILTERNAME(); diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx index b7e5704c4d68..9d44b42e9514 100644 --- a/comphelper/inc/comphelper/storagehelper.hxx +++ b/comphelper/inc/comphelper/storagehelper.hxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -43,6 +44,9 @@ #define ZIP_STORAGE_FORMAT_STRING ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ZipFormat" ) ) #define OFOPXML_STORAGE_FORMAT_STRING ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OFOPXMLFormat" ) ) +#define PACKAGE_ENCRYPTIONDATA_SHA1UTF8 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA1UTF8EncryptionKey" ) ) +#define PACKAGE_ENCRYPTIONDATA_SHA1MS1252 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PackageSHA1MS1252EncryptionKey" ) ) + namespace comphelper { class COMPHELPER_DLLPUBLIC OStorageHelper @@ -112,9 +116,9 @@ public: = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >() ) throw ( ::com::sun::star::uno::Exception ); - static void SetCommonStoragePassword( + static void SetCommonStorageEncryptionData( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, - const ::rtl::OUString& aPass ) + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) throw ( ::com::sun::star::uno::Exception ); // the following method supports only storages of OOo formats @@ -159,6 +163,9 @@ public: sal_Bool bRepairStorage = sal_False ) throw ( ::com::sun::star::uno::Exception ); + static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > + CreatePackageEncryptionData( const ::rtl::OUString& aPassword ); + static sal_Bool IsValidZipEntryFileName( const ::rtl::OUString& aName, sal_Bool bSlashAllowed ); static sal_Bool IsValidZipEntryFileName( const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed ); diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 37941352ae28..697f221d9c80 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -84,16 +84,9 @@ uno::Sequence< beans::PropertyValue > DocPasswordHelper::GenerateNewModifyPasswo { uno::Sequence< beans::PropertyValue > aResult; - uno::Sequence< sal_Int8 > aSalt( 16 ); + uno::Sequence< sal_Int8 > aSalt = GenerateRandomByteSequence( 16 ); sal_Int32 nCount = 1024; - TimeValue aTime; - osl_getSystemTime( &aTime ); - rtlRandomPool aRandomPool = rtl_random_createPool (); - rtl_random_addBytes ( aRandomPool, &aTime, 8 ); - - rtl_random_getBytes ( aRandomPool, aSalt.getArray(), 16 ); - uno::Sequence< sal_Int8 > aNewHash = GeneratePBKDF2Hash( aPassword, aSalt, nCount, 16 ); if ( aNewHash.getLength() ) { @@ -108,9 +101,6 @@ uno::Sequence< beans::PropertyValue > DocPasswordHelper::GenerateNewModifyPasswo aResult[3].Value <<= aNewHash; } - // Clean up random pool memory - rtl_random_destroyPool ( aRandomPool ); - return aResult; } @@ -282,9 +272,98 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( } // ============================================================================ +/*static*/ uno::Sequence< sal_Int8 > DocPasswordHelper::GenerateRandomByteSequence( sal_Int32 nLength ) +{ + uno::Sequence< sal_Int8 > aResult( nLength ); + + TimeValue aTime; + osl_getSystemTime( &aTime ); + rtlRandomPool aRandomPool = rtl_random_createPool (); + rtl_random_addBytes ( aRandomPool, &aTime, 8 ); + rtl_random_getBytes ( aRandomPool, aResult.getArray(), nLength ); + rtl_random_destroyPool ( aRandomPool ); -/*static*/ OUString DocPasswordHelper::requestAndVerifyDocPassword( + return aResult; +} + + +// ============================================================================ +/*static*/ uno::Sequence< sal_Int8 > DocPasswordHelper::GenerateStd97Key( const ::rtl::OUString& aPassword, const uno::Sequence< sal_Int8 >& aDocId ) +{ + uno::Sequence< sal_Int8 > aResultKey; + if ( aPassword.getLength() && aDocId.getLength() == 16 ) + { + sal_uInt16 pPassData[16]; + memset( pPassData, 0, sizeof(pPassData) ); + + sal_Int32 nPassLen = ::std::min< sal_Int32 >( aPassword.getLength(), 15 ); + (void)memcpy( pPassData, aPassword.getStr(), nPassLen * sizeof(pPassData[0]) ); + + aResultKey = GenerateStd97Key( pPassData, aDocId ); + } + + return aResultKey; +} + +// ============================================================================ +/*static*/ uno::Sequence< sal_Int8 > DocPasswordHelper::GenerateStd97Key( const sal_uInt16 pPassData[16], const uno::Sequence< sal_Int8 >& aDocId ) +{ + uno::Sequence< sal_Int8 > aResultKey; + if ( pPassData[0] && aDocId.getLength() == 16 ) + { + sal_uInt8 pKeyData[64]; + (void)memset( pKeyData, 0, sizeof(pKeyData) ); + + sal_Int32 nInd = 0; + + // Fill PassData into KeyData. + for ( nInd = 0; nInd < 16 && pPassData[nInd]; nInd++) + { + pKeyData[2*nInd] = sal::static_int_cast< sal_uInt8 >( (pPassData[nInd] >> 0) & 0xff ); + pKeyData[2*nInd + 1] = sal::static_int_cast< sal_uInt8 >( (pPassData[nInd] >> 8) & 0xff ); + } + + pKeyData[2*nInd] = 0x80; + pKeyData[56] = sal::static_int_cast< sal_uInt8 >( nInd << 4 ); + + // Fill raw digest of KeyData into KeyData. + rtlDigest hDigest = rtl_digest_create ( rtl_Digest_AlgorithmMD5 ); + (void)rtl_digest_updateMD5 ( + hDigest, pKeyData, sizeof(pKeyData)); + (void)rtl_digest_rawMD5 ( + hDigest, pKeyData, RTL_DIGEST_LENGTH_MD5); + + // Update digest with KeyData and Unique. + for ( nInd = 0; nInd < 16; nInd++ ) + { + rtl_digest_updateMD5( hDigest, pKeyData, 5 ); + rtl_digest_updateMD5( hDigest, (const sal_uInt8*)aDocId.getConstArray(), aDocId.getLength() ); + } + + // Update digest with padding. + pKeyData[16] = 0x80; + (void)memset (pKeyData + 17, 0, sizeof(pKeyData) - 17); + pKeyData[56] = 0x80; + pKeyData[57] = 0x0a; + + rtl_digest_updateMD5( hDigest, &(pKeyData[16]), sizeof(pKeyData) - 16 ); + + // Fill raw digest of above updates + aResultKey.realloc( RTL_DIGEST_LENGTH_MD5 ); + rtl_digest_rawMD5 ( hDigest, (sal_uInt8*)aResultKey.getArray(), aResultKey.getLength() ); + + // Erase KeyData array and leave. + (void)memset (pKeyData, 0, sizeof(pKeyData)); + } + + return aResultKey; +} + +// ============================================================================ + +/*static*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > DocPasswordHelper::requestAndVerifyDocPassword( IDocPasswordVerifier& rVerifier, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rMediaEncData, const OUString& rMediaPassword, const Reference< XInteractionHandler >& rxInteractHandler, const OUString& rDocumentName, @@ -292,7 +371,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( const ::std::vector< OUString >* pDefaultPasswords, bool* pbIsDefaultPassword ) { - OUString aPassword; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > aEncData; DocPasswordVerifierResult eResult = DocPasswordVerifierResult_WRONG_PASSWORD; // first, try provided default passwords @@ -302,23 +381,32 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( { for( ::std::vector< OUString >::const_iterator aIt = pDefaultPasswords->begin(), aEnd = pDefaultPasswords->end(); (eResult == DocPasswordVerifierResult_WRONG_PASSWORD) && (aIt != aEnd); ++aIt ) { - aPassword = *aIt; - OSL_ENSURE( aPassword.getLength() > 0, "DocPasswordHelper::requestAndVerifyDocPassword - unexpected empty default password" ); - if( aPassword.getLength() > 0 ) + OSL_ENSURE( aIt->getLength() > 0, "DocPasswordHelper::requestAndVerifyDocPassword - unexpected empty default password" ); + if( aIt->getLength() > 0 ) { - eResult = rVerifier.verifyPassword( aPassword ); + eResult = rVerifier.verifyPassword( *aIt, aEncData ); if( pbIsDefaultPassword ) *pbIsDefaultPassword = eResult == DocPasswordVerifierResult_OK; } } } + // try media encryption data (skip, if result is OK or ABORT) + if( eResult == DocPasswordVerifierResult_WRONG_PASSWORD ) + { + if( rMediaEncData.getLength() > 0 ) + { + eResult = rVerifier.verifyEncryptionData( rMediaEncData ); + if( eResult == DocPasswordVerifierResult_OK ) + aEncData = rMediaEncData; + } + } + // try media password (skip, if result is OK or ABORT) if( eResult == DocPasswordVerifierResult_WRONG_PASSWORD ) { - aPassword = rMediaPassword; - if( aPassword.getLength() > 0 ) - eResult = rVerifier.verifyPassword( aPassword ); + if( rMediaPassword.getLength() > 0 ) + eResult = rVerifier.verifyPassword( rMediaPassword, aEncData ); } // request a password (skip, if result is OK or ABORT) @@ -332,9 +420,8 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( rxInteractHandler->handle( xRequest ); if( pRequest->isPassword() ) { - aPassword = pRequest->getPassword(); - if( aPassword.getLength() > 0 ) - eResult = rVerifier.verifyPassword( aPassword ); + if( pRequest->getPassword().getLength() > 0 ) + eResult = rVerifier.verifyPassword( pRequest->getPassword(), aEncData ); } else { @@ -347,15 +434,17 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( { } - return (eResult == DocPasswordVerifierResult_OK) ? aPassword : OUString(); + return (eResult == DocPasswordVerifierResult_OK) ? aEncData : uno::Sequence< beans::NamedValue >(); } -/*static*/ OUString DocPasswordHelper::requestAndVerifyDocPassword( +/*static*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > DocPasswordHelper::requestAndVerifyDocPassword( IDocPasswordVerifier& rVerifier, MediaDescriptor& rMediaDesc, DocPasswordRequestType eRequestType, const ::std::vector< OUString >* pDefaultPasswords ) { + uno::Sequence< beans::NamedValue > aMediaEncData = rMediaDesc.getUnpackedValueOrDefault( + MediaDescriptor::PROP_ENCRYPTIONDATA(), uno::Sequence< beans::NamedValue >() ); OUString aMediaPassword = rMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_PASSWORD(), OUString() ); Reference< XInteractionHandler > xInteractHandler = rMediaDesc.getUnpackedValueOrDefault( @@ -364,14 +453,17 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( MediaDescriptor::PROP_URL(), OUString() ); bool bIsDefaultPassword = false; - OUString aPassword = requestAndVerifyDocPassword( - rVerifier, aMediaPassword, xInteractHandler, aDocumentName, eRequestType, pDefaultPasswords, &bIsDefaultPassword ); + uno::Sequence< beans::NamedValue > aEncryptionData = requestAndVerifyDocPassword( + rVerifier, aMediaEncData, aMediaPassword, xInteractHandler, aDocumentName, eRequestType, pDefaultPasswords, &bIsDefaultPassword ); + + rMediaDesc.erase( MediaDescriptor::PROP_PASSWORD() ); + rMediaDesc.erase( MediaDescriptor::PROP_ENCRYPTIONDATA() ); // insert valid password into media descriptor (but not a default password) - if( (aPassword.getLength() > 0) && !bIsDefaultPassword ) - rMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= aPassword; + if( (aEncryptionData.getLength() > 0) && !bIsDefaultPassword ) + rMediaDesc[ MediaDescriptor::PROP_ENCRYPTIONDATA() ] <<= aEncryptionData; - return aPassword; + return aEncryptionData; } // ============================================================================ diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index 9e02afe8c56c..143f8ba4dfa2 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -112,6 +112,12 @@ const ::rtl::OUString& MediaDescriptor::PROP_DOCUMENTSERVICE() return sProp; } +const ::rtl::OUString& MediaDescriptor::PROP_ENCRYPTIONDATA() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("EncryptionData")); + return sProp; +} + const ::rtl::OUString& MediaDescriptor::PROP_EXTENSION() { static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("Extension")); diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index db5ba71cd876..60ffa965fcf1 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -28,12 +28,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_comphelper.hxx" #include -#include +#include #include #include #include +#include #include +#include + #include #include @@ -236,16 +239,16 @@ uno::Reference< io::XInputStream > OStorageHelper::GetInputStreamFromURL( } // ---------------------------------------------------------------------- -void OStorageHelper::SetCommonStoragePassword( +void OStorageHelper::SetCommonStorageEncryptionData( const uno::Reference< embed::XStorage >& xStorage, - const ::rtl::OUString& aPass ) + const uno::Sequence< beans::NamedValue >& aEncryptionData ) throw ( uno::Exception ) { - uno::Reference< embed::XEncryptionProtectedSource > xEncrSet( xStorage, uno::UNO_QUERY ); + uno::Reference< embed::XEncryptionProtectedSource2 > xEncrSet( xStorage, uno::UNO_QUERY ); if ( !xEncrSet.is() ) throw io::IOException(); // TODO - xEncrSet->setEncryptionPassword( aPass ); + xEncrSet->setEncryptionData( aEncryptionData ); } // ---------------------------------------------------------------------- @@ -418,6 +421,45 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream( return xTempStorage; } +// ---------------------------------------------------------------------- +uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData( const ::rtl::OUString& aPassword ) +{ + // TODO/LATER: Should not the method be part of DocPasswordHelper? + uno::Sequence< beans::NamedValue > aEncryptionData; + if ( aPassword.getLength() ) + { + // MS_1252 encoding was used for SO60 document format password encoding, + // this encoding supports only a minor subset of nonascii characters, + // but for compatibility reasons it has to be used for old document formats + aEncryptionData.realloc( 2 ); + aEncryptionData[0].Name = PACKAGE_ENCRYPTIONDATA_SHA1UTF8; + aEncryptionData[1].Name = PACKAGE_ENCRYPTIONDATA_SHA1MS1252; + + rtl_TextEncoding pEncoding[2] = { RTL_TEXTENCODING_UTF8, RTL_TEXTENCODING_MS_1252 }; + + for ( sal_Int32 nInd = 0; nInd < 2; nInd++ ) + { + ::rtl::OString aByteStrPass = ::rtl::OUStringToOString( aPassword, pEncoding[nInd] ); + + sal_uInt8 pBuffer[RTL_DIGEST_LENGTH_SHA1]; + rtlDigestError nError = rtl_digest_SHA1( aByteStrPass.getStr(), + aByteStrPass.getLength(), + pBuffer, + RTL_DIGEST_LENGTH_SHA1 ); + + if ( nError != rtl_Digest_E_None ) + { + aEncryptionData.realloc( 0 ); + break; + } + + aEncryptionData[nInd].Value <<= uno::Sequence< sal_Int8 >( (sal_Int8*)pBuffer, RTL_DIGEST_LENGTH_SHA1 ); + } + } + + return aEncryptionData; +} + // ---------------------------------------------------------------------- sal_Bool OStorageHelper::IsValidZipEntryFileName( const ::rtl::OUString& aName, sal_Bool bSlashAllowed ) { -- cgit From fc6443a92f54248125638bc7fc32a3026cf2038f Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 4 Nov 2010 17:56:39 +0100 Subject: pl08: #163778# use EncryptionData from MediaDescriptor --- sw/source/filter/ww8/wrtww8.cxx | 92 +++++++++++++---------- sw/source/filter/ww8/wrtww8.hxx | 7 +- sw/source/filter/ww8/ww8par.cxx | 161 ++++++++++++++++++++++++++++------------ sw/source/ui/app/docsh.cxx | 18 +---- 4 files changed, 176 insertions(+), 102 deletions(-) mode change 100755 => 100644 sw/source/ui/app/docsh.cxx diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index e22ca1c9b731..ba074e7c3558 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -112,6 +112,8 @@ #include "dbgoutsw.hxx" #include +#include +#include #include #include #include @@ -2995,20 +2997,54 @@ void MSWordExportBase::ExportDocument( bool bWriteAll ) pDoc->SetRedlineMode( (RedlineMode_t)(mnRedlineMode) ); } -String SwWW8Writer::GetPassword() +bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec ) { - String sUniPassword; + uno::Sequence< beans::NamedValue > aEncryptionData; + if ( mpMedium ) { - SfxItemSet* pSet = mpMedium->GetItemSet(); + SFX_ITEMSET_ARG( mpMedium->GetItemSet(), pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False ); + if ( pEncryptionDataItem && ( pEncryptionDataItem->GetValue() >>= aEncryptionData ) && !rCodec.InitCodec( aEncryptionData ) ) + { + OSL_ENSURE( false, "Unexpected EncryptionData!" ); + aEncryptionData.realloc( 0 ); + } + + if ( !aEncryptionData.getLength() ) + { + // try to generate the encryption data based on password + SFX_ITEMSET_ARG( mpMedium->GetItemSet(), pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False ); + if ( pPasswordItem && pPasswordItem->GetValue().Len() && pPasswordItem->GetValue().Len() <= 15 ) + { + // Generate random number with a seed of time as salt. + TimeValue aTime; + osl_getSystemTime( &aTime ); + rtlRandomPool aRandomPool = rtl_random_createPool (); + rtl_random_addBytes ( aRandomPool, &aTime, 8 ); - const SfxPoolItem* pPasswordItem = NULL; - if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_PASSWORD, sal_True, &pPasswordItem ) ) - if( pPasswordItem != NULL ) - sUniPassword = ( (const SfxStringItem*)pPasswordItem )->GetValue(); + sal_uInt8 pDocId[ 16 ]; + rtl_random_getBytes( aRandomPool, pDocId, 16 ); + + rtl_random_destroyPool( aRandomPool ); + + sal_Unicode aPassword[16]; + memset( aPassword, 0, sizeof( aPassword ) ); + for ( xub_StrLen nChar = 0; nChar < pPasswordItem->GetValue().Len(); ++nChar ) + aPassword[nChar] = pPasswordItem->GetValue().GetChar(nChar); + + rCodec.InitKey( aPassword, pDocId ); + aEncryptionData = rCodec.GetEncryptionData(); + + mpMedium->GetItemSet()->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) ); + } + } + + if ( aEncryptionData.getLength() ) + mpMedium->GetItemSet()->ClearItem( SID_PASSWORD ); } - return sUniPassword; + // nonempty encryption data means hier that the codec was successfuly initialized + return ( aEncryptionData.getLength() != 0 ); } void WW8Export::ExportDocument_Impl() @@ -3042,8 +3078,6 @@ void WW8Export::ExportDocument_Impl() Strm().SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - String sUniPassword( GetWriter().GetPassword() ); - utl::TempFile aTempMain; aTempMain.EnableKillingFile(); utl::TempFile aTempTable; @@ -3051,13 +3085,10 @@ void WW8Export::ExportDocument_Impl() utl::TempFile aTempData; aTempData.EnableKillingFile(); - bool bEncrypt = false; - - xub_StrLen nLen = sUniPassword.Len(); - if ( nLen > 0 && nLen <= 15) // Password has been set + msfilter::MSCodec_Std97 aCtx; + bool bEncrypt = m_pWriter ? m_pWriter->InitStd97CodecUpdateMedium( aCtx ) : false; + if ( bEncrypt ) { - bEncrypt =true; - GetWriter().SetStream( aTempMain.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE ) ); @@ -3121,24 +3152,6 @@ void WW8Export::ExportDocument_Impl() if ( bEncrypt ) { - // Generate random number with a seed of time as salt. - TimeValue aTime; - osl_getSystemTime( &aTime ); - rtlRandomPool aRandomPool = rtl_random_createPool (); - rtl_random_addBytes ( aRandomPool, &aTime, 8 ); - - sal_uInt8 aDocId[ 16 ] = {0}; - rtl_random_getBytes( aRandomPool, aDocId, 16 ); - - rtl_random_destroyPool( aRandomPool ); - - sal_Unicode aPassword[16] = {0}; - for (xub_StrLen nChar = 0; nChar < nLen; ++nChar ) - aPassword[nChar] = sUniPassword.GetChar(nChar); - - msfilter::MSCodec_Std97 aCtx; - aCtx.InitKey(aPassword, aDocId); - SvStream *pStrmTemp, *pTableStrmTemp, *pDataStrmTemp; pStrmTemp = &xWwStrm; pTableStrmTemp = &xTableStrm; @@ -3155,11 +3168,14 @@ void WW8Export::ExportDocument_Impl() sal_uInt32 nEncType = 0x10001; *pTableStrmTemp << nEncType; - sal_uInt8 pSaltData[16] = {0}; - sal_uInt8 pSaltDigest[16] = {0}; - aCtx.GetEncryptKey( aDocId, pSaltData, pSaltDigest ); + sal_uInt8 pDocId[16]; + aCtx.GetDocId( pDocId ); + + sal_uInt8 pSaltData[16]; + sal_uInt8 pSaltDigest[16]; + aCtx.GetEncryptKey( pDocId, pSaltData, pSaltDigest ); - pTableStrmTemp->Write( aDocId, 16 ); + pTableStrmTemp->Write( pDocId, 16 ); pTableStrmTemp->Write( pSaltData, 16 ); pTableStrmTemp->Write( pSaltDigest, 16 ); diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 3c2f0d4d6d13..ed90edfae619 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -52,6 +52,11 @@ #include // einige Forward Deklarationen +namespace msfilter +{ + class MSCodec_Std97; +} + class SwAttrIter; class AttributeOutputBase; class DocxAttributeOutput; @@ -855,7 +860,7 @@ public: static void WriteString_xstz(SvStream& rStrm, const String& rStr, bool bAddZero); - String GetPassword(); + bool InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec ); using StgWriter::Write; virtual ULONG Write( SwPaM&, SfxMedium&, const String* = 0 ); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 24f36b047a4e..48ea093ad552 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -29,16 +29,20 @@ #include "precompiled_sw.hxx" /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ -#include #include #include + +#include #include #include #include +#include #include #include #include +#include +#include #include #include #include @@ -107,6 +111,7 @@ #include #include +#include #include #include @@ -4344,6 +4349,90 @@ namespace return aPassw; } + uno::Sequence< beans::NamedValue > InitXorWord95Codec( ::msfilter::MSCodec_XorWord95& rCodec, SfxMedium& rMedium, WW8Fib* pWwFib ) + { + uno::Sequence< beans::NamedValue > aEncryptionData; + SFX_ITEMSET_ARG( rMedium.GetItemSet(), pEncryptionData, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False ); + if ( pEncryptionData && ( pEncryptionData->GetValue() >>= aEncryptionData ) && !rCodec.InitCodec( aEncryptionData ) ) + aEncryptionData.realloc( 0 ); + + if ( !aEncryptionData.getLength() ) + { + String sUniPassword = QueryPasswordForMedium( rMedium ); + + ByteString sPassword(sUniPassword, WW8Fib::GetFIBCharset( pWwFib->chseTables ) ); + + xub_StrLen nLen = sPassword.Len(); + if( nLen <= 15 ) + { + sal_uInt8 pPassword[16]; + memset( pPassword, 0, sizeof( pPassword ) ); + + for (xub_StrLen nChar = 0; nChar < sPassword.Len(); ++nChar ) + pPassword[nChar] = sPassword.GetChar(nChar); + + rCodec.InitKey( pPassword ); + aEncryptionData = rCodec.GetEncryptionData(); + + // the export supports RC4 algorithm only, so we have to generate the related EncryptionData as well, + // so that Save can export the document without asking for a password; + // as result there will be EncryptionData for both algorithms in the MediaDescriptor + ::msfilter::MSCodec_Std97 aCodec97; + + // Generate random number with a seed of time as salt. + TimeValue aTime; + osl_getSystemTime( &aTime ); + rtlRandomPool aRandomPool = rtl_random_createPool(); + rtl_random_addBytes ( aRandomPool, &aTime, 8 ); + + sal_uInt8 pDocId[ 16 ]; + rtl_random_getBytes( aRandomPool, pDocId, 16 ); + + rtl_random_destroyPool( aRandomPool ); + + sal_uInt16 pStd97Pass[16]; + memset( pStd97Pass, 0, sizeof( pStd97Pass ) ); + for (xub_StrLen nChar = 0; nChar < nLen; ++nChar ) + pStd97Pass[nChar] = sUniPassword.GetChar(nChar); + + aCodec97.InitKey( pStd97Pass, pDocId ); + + // merge the EncryptionData, there should be no conflicts + ::comphelper::SequenceAsHashMap aEncryptionHash( aEncryptionData ); + aEncryptionHash.update( ::comphelper::SequenceAsHashMap( aCodec97.GetEncryptionData() ) ); + aEncryptionHash >> aEncryptionData; + } + } + + return aEncryptionData; + } + + uno::Sequence< beans::NamedValue > InitStd97Codec( ::msfilter::MSCodec_Std97& rCodec, sal_uInt8 pDocId[16], SfxMedium& rMedium ) + { + uno::Sequence< beans::NamedValue > aEncryptionData; + SFX_ITEMSET_ARG( rMedium.GetItemSet(), pEncryptionData, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False ); + if ( pEncryptionData && ( pEncryptionData->GetValue() >>= aEncryptionData ) && !rCodec.InitCodec( aEncryptionData ) ) + aEncryptionData.realloc( 0 ); + + if ( !aEncryptionData.getLength() ) + { + String sUniPassword = QueryPasswordForMedium( rMedium ); + + xub_StrLen nLen = sUniPassword.Len(); + if ( nLen <= 15 ) + { + sal_Unicode pPassword[16]; + memset( pPassword, 0, sizeof( pPassword ) ); + for (xub_StrLen nChar = 0; nChar < nLen; ++nChar ) + pPassword[nChar] = sUniPassword.GetChar(nChar); + + rCodec.InitKey( pPassword, pDocId ); + aEncryptionData = rCodec.GetEncryptionData(); + } + } + + return aEncryptionData; + } } ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) @@ -4397,31 +4486,22 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) if (bDecrypt) { nErrRet = ERRCODE_SVX_WRONGPASS; - switch (eAlgo) + SfxMedium* pMedium = mpDocShell->GetMedium(); + + if ( pMedium ) { - default: - nErrRet = ERRCODE_SVX_READ_FILTER_CRYPT; - break; - case XOR: + switch (eAlgo) { - String sUniPassword = - QueryPasswordForMedium(*(mpDocShell->GetMedium())); - - ByteString sPassword(sUniPassword, - WW8Fib::GetFIBCharset(pWwFib->chseTables)); - - xub_StrLen nLen = sPassword.Len(); - // DR: do not cut a wrong (too long) password - if( nLen <= 15 ) + default: + nErrRet = ERRCODE_SVX_READ_FILTER_CRYPT; + break; + case XOR: { - sal_uInt8 aPassword[16] = {0}; - - for (xub_StrLen nChar = 0; nChar < sPassword.Len(); ++nChar ) - aPassword[nChar] = sPassword.GetChar(nChar); - msfilter::MSCodec_XorWord95 aCtx; - aCtx.InitKey(aPassword); - if (aCtx.VerifyKey(pWwFib->nKey, pWwFib->nHash)) + uno::Sequence< beans::NamedValue > aEncryptionData = InitXorWord95Codec( aCtx, *pMedium, pWwFib ); + + // if initialization has failed the EncryptionData should be empty + if ( aEncryptionData.getLength() && aCtx.VerifyKey( pWwFib->nKey, pWwFib->nHash ) ) { nErrRet = 0; pTempMain = MakeTemp(aDecryptMain); @@ -4453,22 +4533,15 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) DecryptXOR(aCtx, *pDataStream, aDecryptData); pDataStream = &aDecryptData; } + + pMedium->GetItemSet()->ClearItem( SID_PASSWORD ); + pMedium->GetItemSet()->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) ); } } - } - break; - case RC4: - { - String sUniPassword = - QueryPasswordForMedium(*(mpDocShell->GetMedium())); - - xub_StrLen nLen = sUniPassword.Len(); - // DR: do not cut a wrong (too long) password - if (nLen <= 15) + break; + case RC4: { - sal_Unicode aPassword[16] = {0}; - for (xub_StrLen nChar = 0; nChar < nLen; ++nChar ) - aPassword[nChar] = sUniPassword.GetChar(nChar); + msfilter::MSCodec_Std97 aCtx; sal_uInt8 aDocId[ 16 ]; pTableStream->Read(aDocId, 16); @@ -4477,9 +4550,9 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) sal_uInt8 aSaltHash[ 16 ]; pTableStream->Read(aSaltHash, 16); - msfilter::MSCodec_Std97 aCtx; - aCtx.InitKey(aPassword, aDocId); - if (aCtx.VerifyKey(aSaltData, aSaltHash)) + // if initialization has failed the EncryptionData should be empty + uno::Sequence< beans::NamedValue > aEncryptionData = InitStd97Codec( aCtx, aDocId, *pMedium ); + if ( aEncryptionData.getLength() && aCtx.VerifyKey( aSaltData, aSaltHash ) ) { nErrRet = 0; @@ -4498,17 +4571,13 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) DecryptRC4(aCtx, *pDataStream, aDecryptData); pDataStream = &aDecryptData; } - SfxMedium* pMedium = mpDocShell->GetMedium(); - if ( pMedium ) - { - SfxItemSet* pSet = pMedium->GetItemSet(); - if ( pSet ) - pSet->Put( SfxStringItem(SID_PASSWORD, sUniPassword) ); - } + + pMedium->GetItemSet()->ClearItem( SID_PASSWORD ); + pMedium->GetItemSet()->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) ); } } + break; } - break; } if (nErrRet == 0) diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx old mode 100755 new mode 100644 index c7ee43255f3b..866829e03632 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -209,23 +209,7 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr, return 0; } } - if(rMedium.IsStorage()) - { - //SvStorageRef aStor( rMedium.GetStorage() ); - const SfxItemSet* pSet = rMedium.GetItemSet(); - const SfxPoolItem *pItem; - if(pSet && SFX_ITEM_SET == pSet->GetItemState(SID_PASSWORD, TRUE, &pItem)) - { - DBG_ASSERT(pItem->IsA( TYPE(SfxStringItem) ), "Fehler Parametertype"); - comphelper::OStorageHelper::SetCommonStoragePassword( rMedium.GetStorage(), ((const SfxStringItem *)pItem)->GetValue() ); - } - // Fuer's Dokument-Einfuegen noch die FF-Version, wenn's der - // eigene Filter ist. - ASSERT( /*pRead != ReadSw3 || */pRead != ReadXML || pFlt->GetVersion(), - "Am Filter ist keine FF-Version gesetzt" ); - //if( (pRead == ReadSw3 || pRead == ReadXML) && pFlt->GetVersion() ) - // aStor->SetVersion( (long)pFlt->GetVersion() ); - } + // #i30171# set the UpdateDocMode at the SwDocShell SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False); nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE; -- cgit From fcd3252f26e20158ce96af5a7cc3a53e65616a4e Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 4 Nov 2010 17:56:39 +0100 Subject: pl08: #163778# use EncryptionData from MediaDescriptor --- package/source/xstor/ohierarchyholder.cxx | 21 +- package/source/xstor/ohierarchyholder.hxx | 18 +- package/source/xstor/owriteablestream.cxx | 206 ++++++----- package/source/xstor/owriteablestream.hxx | 38 +- package/source/xstor/xstorage.cxx | 586 +++++++++++++++++------------- package/source/xstor/xstorage.hxx | 66 +++- package/source/zippackage/ZipPackage.cxx | 2 +- 7 files changed, 552 insertions(+), 385 deletions(-) diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index 8e22b2b3a093..32ebc7068ec3 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -29,7 +29,7 @@ #include "precompiled_package.hxx" #include #include -#include +#include #include #include "ohierarchyholder.hxx" @@ -41,7 +41,7 @@ using namespace ::com::sun::star; //=============================================== //----------------------------------------------- -uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, OStringList_Impl& aListPath, sal_Int32 nStreamMode, const ::rtl::OUString& aPass ) +uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, OStringList_Impl& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { uno::Reference< embed::XStorage > xOwnStor( m_xWeakOwnStorage.get(), uno::UNO_QUERY_THROW ); @@ -49,7 +49,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStream throw io::IOException(); uno::Reference< embed::XExtendedStorageStream > xResult = - m_xChild->GetStreamHierarchically( nStorageMode, aListPath, nStreamMode, aPass ); + m_xChild->GetStreamHierarchically( nStorageMode, aListPath, nStreamMode, aEncryptionData ); if ( !xResult.is() ) throw uno::RuntimeException(); @@ -88,7 +88,7 @@ OStringList_Impl OHierarchyHolder_Impl::GetListPathFromString( const ::rtl::OUSt //=============================================== //----------------------------------------------- -uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, OStringList_Impl& aListPath, sal_Int32 nStreamMode, const ::rtl::OUString& aPass ) +uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, OStringList_Impl& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -110,11 +110,16 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStrea if ( !aListPath.size() ) { - uno::Reference< embed::XHierarchicalStorageAccess > xHStorage( xOwnStor, uno::UNO_QUERY_THROW ); - if ( !aPass.getLength() ) + if ( !aEncryptionData.size() ) + { + uno::Reference< embed::XHierarchicalStorageAccess > xHStorage( xOwnStor, uno::UNO_QUERY_THROW ); xResult = xHStorage->openStreamElementByHierarchicalName( aNextName, nStreamMode ); + } else - xResult = xHStorage->openEncryptedStreamElementByHierarchicalName( aNextName, nStreamMode, aPass ); + { + uno::Reference< embed::XHierarchicalStorageAccess2 > xHStorage( xOwnStor, uno::UNO_QUERY_THROW ); + xResult = xHStorage->openEncryptedStreamByHierarchicalName( aNextName, nStreamMode, aEncryptionData.getAsConstNamedValueList() ); + } uno::Reference< embed::XTransactedObject > xTransact( xResult, uno::UNO_QUERY ); if ( xTransact.is() ) @@ -150,7 +155,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStrea aElement = new OHierarchyElement_Impl( NULL, xChildStorage ); } - xResult = aElement->GetStreamHierarchically( nStorageMode, aListPath, nStreamMode, aPass ); + xResult = aElement->GetStreamHierarchically( nStorageMode, aListPath, nStreamMode, aEncryptionData ); if ( !xResult.is() ) throw uno::RuntimeException(); diff --git a/package/source/xstor/ohierarchyholder.hxx b/package/source/xstor/ohierarchyholder.hxx index 17c14d3a6001..d36d784ac839 100644 --- a/package/source/xstor/ohierarchyholder.hxx +++ b/package/source/xstor/ohierarchyholder.hxx @@ -33,6 +33,8 @@ #include #include +#include + #include #include @@ -90,10 +92,10 @@ public: void RemoveElement( const ::rtl::Reference< OHierarchyElement_Impl >& aRef ); ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > - GetStreamHierarchically( sal_Int32 nStorageMode, - OStringList_Impl& aPath, - sal_Int32 nStreamMode, - const ::rtl::OUString& aPassword = ::rtl::OUString() ); + GetStreamHierarchically( sal_Int32 nStorageMode, + OStringList_Impl& aPath, + sal_Int32 nStreamMode, + const ::comphelper::SequenceAsHashMap& aEncryptionData = ::comphelper::SequenceAsHashMap() ); void RemoveStreamHierarchically( OStringList_Impl& aListPath ); @@ -127,10 +129,10 @@ public: static OStringList_Impl GetListPathFromString( const ::rtl::OUString& aPath ); ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > - GetStreamHierarchically( sal_Int32 nStorageMode, - OStringList_Impl& aListPath, - sal_Int32 nStreamMode, - const ::rtl::OUString& aPassword = ::rtl::OUString() ); + GetStreamHierarchically( sal_Int32 nStorageMode, + OStringList_Impl& aListPath, + sal_Int32 nStreamMode, + const ::comphelper::SequenceAsHashMap& aEncryptionData = ::comphelper::SequenceAsHashMap() ); void RemoveStreamHierarchically( OStringList_Impl& aListPath ); }; diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index be11586bc4fb..9eefd8383cb3 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -64,29 +64,25 @@ using namespace ::com::sun::star; namespace package { //----------------------------------------------- -uno::Sequence< sal_Int8 > MakeKeyFromPass( const ::rtl::OUString& aPass, sal_Bool bUseUTF ) +bool PackageEncryptionDatasEqual( const ::comphelper::SequenceAsHashMap& aHash1, const ::comphelper::SequenceAsHashMap& aHash2 ) { - // MS_1252 encoding was used for SO60 document format password encoding, - // this encoding supports only a minor subset of nonascii characters, - // but for compatibility reasons it has to be used for old document formats - - ::rtl::OString aByteStrPass; - if ( bUseUTF ) - aByteStrPass = ::rtl::OUStringToOString( aPass, RTL_TEXTENCODING_UTF8 ); - else - aByteStrPass = ::rtl::OUStringToOString( aPass, RTL_TEXTENCODING_MS_1252 ); - - sal_uInt8 pBuffer[RTL_DIGEST_LENGTH_SHA1]; - rtlDigestError nError = rtl_digest_SHA1( aByteStrPass.getStr(), - aByteStrPass.getLength(), - pBuffer, - RTL_DIGEST_LENGTH_SHA1 ); - - if ( nError != rtl_Digest_E_None ) - throw uno::RuntimeException(); - - return uno::Sequence< sal_Int8 >( (sal_Int8*)pBuffer, RTL_DIGEST_LENGTH_SHA1 ); + bool bResult = ( aHash1.size() && aHash1.size() == aHash2.size() ); + for ( ::comphelper::SequenceAsHashMap::const_iterator aIter = aHash1.begin(); + bResult && aIter != aHash1.end(); + aIter++ ) + { + uno::Sequence< sal_Int8 > aKey1; + bResult = ( ( aIter->second >>= aKey1 ) && aKey1.getLength() ); + if ( bResult ) + { + uno::Sequence< sal_Int8 > aKey2 = aHash2.getUnpackedValueOrDefault( aIter->first, uno::Sequence< sal_Int8 >() ); + bResult = ( aKey1.getLength() == aKey2.getLength() ); + for ( sal_Int32 nInd = 0; bResult && nInd < aKey1.getLength(); nInd++ ) + bResult = ( aKey1[nInd] == aKey2[nInd] ); + } + } + return bResult; } //----------------------------------------------- @@ -255,8 +251,8 @@ OWriteStream_Impl::OWriteStream_Impl( OStorage_Impl* pParent, , m_xFactory( xFactory ) , m_pParent( pParent ) , m_bForceEncrypted( bForceEncrypted ) -, m_bUseCommonPass( !bForceEncrypted && nStorageType == embed::StorageFormats::PACKAGE ) -, m_bHasCachedPassword( sal_False ) +, m_bUseCommonEncryption( !bForceEncrypted && nStorageType == embed::StorageFormats::PACKAGE ) +, m_bHasCachedEncryptionData( sal_False ) , m_bCompressedSetExplicit( !bDefaultCompress ) , m_xPackage( xPackage ) , m_bHasInsertedStreamOptimization( sal_False ) @@ -363,7 +359,7 @@ sal_Bool OWriteStream_Impl::IsEncrypted() if ( m_nStorageType != embed::StorageFormats::PACKAGE ) return sal_False; - if ( m_bForceEncrypted || m_bHasCachedPassword ) + if ( m_bForceEncrypted || m_bHasCachedEncryptionData ) return sal_True; if ( m_aTempURL.getLength() || m_xCacheStream.is() ) @@ -410,7 +406,7 @@ sal_Bool OWriteStream_Impl::IsEncrypted() if ( !bWasEncr && bToBeEncr && !aKey.getLength() ) { // the stream is intended to use common storage password - m_bUseCommonPass = sal_True; + m_bUseCommonEncryption = sal_True; return sal_False; } else @@ -432,8 +428,8 @@ void OWriteStream_Impl::SetDecrypted() // remove encryption m_bForceEncrypted = sal_False; - m_bHasCachedPassword = sal_False; - m_aPass = ::rtl::OUString(); + m_bHasCachedEncryptionData = sal_False; + m_aEncryptionData.clear(); for ( sal_Int32 nInd = 0; nInd < m_aProps.getLength(); nInd++ ) { @@ -443,12 +439,15 @@ void OWriteStream_Impl::SetDecrypted() } //----------------------------------------------- -void OWriteStream_Impl::SetEncryptedWithPass( const ::rtl::OUString& aPass ) +void OWriteStream_Impl::SetEncrypted( const ::comphelper::SequenceAsHashMap& aEncryptionData ) { OSL_ENSURE( m_nStorageType == embed::StorageFormats::PACKAGE, "The encryption is supported only for package storages!\n" ); if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); + if ( !aEncryptionData.size() ) + throw uno::RuntimeException(); + GetStreamProperties(); // let the stream be modified @@ -462,10 +461,10 @@ void OWriteStream_Impl::SetEncryptedWithPass( const ::rtl::OUString& aPass ) m_aProps[nInd].Value <<= sal_True; } - m_bUseCommonPass = sal_False; // very important to set it to false + m_bUseCommonEncryption = sal_False; // very important to set it to false - m_bHasCachedPassword = sal_True; - m_aPass = aPass; + m_bHasCachedEncryptionData = sal_True; + m_aEncryptionData = aEncryptionData; } //----------------------------------------------- @@ -796,7 +795,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt xPropertySet->setPropertyValue( aProps[nInd].Name, aProps[nInd].Value ); } else if ( m_nStorageType == embed::StorageFormats::PACKAGE && aProps[nInd].Name.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) - aProps[nInd].Value >>= m_bUseCommonPass; + aProps[nInd].Value >>= m_bUseCommonEncryption; else throw lang::IllegalArgumentException(); @@ -815,7 +814,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt m_bCompressedSetExplicit = sal_True; } - if ( m_bUseCommonPass ) + if ( m_bUseCommonEncryption ) { if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); @@ -914,7 +913,7 @@ void OWriteStream_Impl::Commit() xPropertySet->setPropertyValue( m_aProps[nInd].Name, m_aProps[nInd].Value ); } - if ( m_bUseCommonPass ) + if ( m_bUseCommonEncryption ) { if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); @@ -925,13 +924,13 @@ void OWriteStream_Impl::Commit() xPropertySet->setPropertyValue( ::rtl::OUString::createFromAscii( "Encrypted" ), uno::makeAny( sal_True ) ); } - else if ( m_bHasCachedPassword ) + else if ( m_bHasCachedEncryptionData ) { if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException(); xPropertySet->setPropertyValue( ::rtl::OUString::createFromAscii( "EncryptionKey" ), - uno::makeAny( ::package::MakeKeyFromPass( m_aPass, sal_True ) ) ); + uno::makeAny( m_aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) ) ); } // the stream should be free soon, after package is stored @@ -969,9 +968,9 @@ void OWriteStream_Impl::Revert() m_bHasDataToFlush = sal_False; - m_bUseCommonPass = sal_True; - m_bHasCachedPassword = sal_False; - m_aPass = ::rtl::OUString(); + m_bUseCommonEncryption = sal_True; + m_bHasCachedEncryptionData = sal_False; + m_aEncryptionData.clear(); if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { @@ -1007,7 +1006,7 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::GetStreamProperties() //----------------------------------------------- uno::Sequence< beans::PropertyValue > OWriteStream_Impl::InsertOwnProps( const uno::Sequence< beans::PropertyValue >& aProps, - sal_Bool bUseCommonPass ) + sal_Bool bUseCommonEncryption ) { uno::Sequence< beans::PropertyValue > aResult( aProps ); sal_Int32 nLen = aResult.getLength(); @@ -1017,13 +1016,13 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::InsertOwnProps( for ( sal_Int32 nInd = 0; nInd < nLen; nInd++ ) if ( aResult[nInd].Name.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) { - aResult[nInd].Value <<= bUseCommonPass; + aResult[nInd].Value <<= bUseCommonEncryption; return aResult; } aResult.realloc( ++nLen ); aResult[nLen - 1].Name = ::rtl::OUString::createFromAscii( "UseCommonStoragePasswordEncryption" ); - aResult[nLen - 1].Value <<= bUseCommonPass; + aResult[nLen - 1].Value <<= bUseCommonEncryption; } else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { @@ -1172,11 +1171,11 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::ReadPackageStreamProper //----------------------------------------------- void OWriteStream_Impl::CopyInternallyTo_Impl( const uno::Reference< io::XStream >& xDestStream, - const ::rtl::OUString& aPass ) + const ::comphelper::SequenceAsHashMap& aEncryptionData ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; - OSL_ENSURE( !m_bUseCommonPass, "The stream can not be encrypted!" ); + OSL_ENSURE( !m_bUseCommonEncryption, "The stream can not be encrypted!" ); if ( m_nStorageType != embed::StorageFormats::PACKAGE ) throw packages::NoEncryptionException(); @@ -1187,16 +1186,16 @@ void OWriteStream_Impl::CopyInternallyTo_Impl( const uno::Reference< io::XStream } else { - uno::Reference< io::XStream > xOwnStream = GetStream( embed::ElementModes::READ, aPass, sal_False ); + uno::Reference< io::XStream > xOwnStream = GetStream( embed::ElementModes::READ, aEncryptionData, sal_False ); if ( !xOwnStream.is() ) throw io::IOException(); // TODO OStorage_Impl::completeStorageStreamCopy_Impl( xOwnStream, xDestStream, m_nStorageType, GetAllRelationshipsIfAny() ); } - uno::Reference< embed::XEncryptionProtectedSource > xEncr( xDestStream, uno::UNO_QUERY ); + uno::Reference< embed::XEncryptionProtectedSource2 > xEncr( xDestStream, uno::UNO_QUERY ); if ( xEncr.is() ) - xEncr->setEncryptionPassword( aPass ); + xEncr->setEncryptionData( aEncryptionData.getAsConstNamedValueList() ); } //----------------------------------------------- @@ -1236,7 +1235,7 @@ void OWriteStream_Impl::CopyInternallyTo_Impl( const uno::Reference< io::XStream } //----------------------------------------------- -uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMode, const ::rtl::OUString& aPass, sal_Bool bHierarchyAccess ) +uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData, sal_Bool bHierarchyAccess ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; @@ -1254,9 +1253,9 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod if ( !xPropertySet.is() ) throw uno::RuntimeException(); - if ( m_bHasCachedPassword ) + if ( m_bHasCachedEncryptionData ) { - if ( !m_aPass.equals( aPass ) ) + if ( !::package::PackageEncryptionDatasEqual( m_aEncryptionData, aEncryptionData ) ) throw packages::WrongPasswordException(); // the correct key must be set already @@ -1264,26 +1263,26 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod } else { - SetEncryptionKeyProperty_Impl( xPropertySet, ::package::MakeKeyFromPass( aPass, sal_True ) ); + SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) ); try { xResultStream = GetStream_Impl( nStreamMode, bHierarchyAccess ); - m_bUseCommonPass = sal_False; // very important to set it to false - m_bHasCachedPassword = sal_True; - m_aPass = aPass; + m_bUseCommonEncryption = sal_False; // very important to set it to false + m_bHasCachedEncryptionData = sal_True; + m_aEncryptionData = aEncryptionData; } catch( packages::WrongPasswordException& ) { // retry with different encoding - SetEncryptionKeyProperty_Impl( xPropertySet, ::package::MakeKeyFromPass( aPass, sal_False ) ); + SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1MS1252, uno::Sequence< sal_Int8 >() ) ); try { // the stream must be cashed to be resaved xResultStream = GetStream_Impl( nStreamMode | embed::ElementModes::SEEKABLE, bHierarchyAccess ); - m_bUseCommonPass = sal_False; // very important to set it to false - m_bHasCachedPassword = sal_True; - m_aPass = aPass; + m_bUseCommonEncryption = sal_False; // very important to set it to false + m_bHasCachedEncryptionData = sal_True; + m_aEncryptionData = aEncryptionData; // the stream must be resaved with new password encryption if ( nStreamMode & embed::ElementModes::WRITE ) @@ -1343,10 +1342,10 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod if ( IsEncrypted() ) { - ::rtl::OUString aGlobalPass; + ::comphelper::SequenceAsHashMap aGlobalEncryptionData; try { - aGlobalPass = GetCommonRootPass(); + aGlobalEncryptionData = GetCommonRootEncryptionData(); } catch( packages::NoEncryptionException& aNoEncryptionException ) { @@ -1356,7 +1355,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod throw packages::WrongPasswordException(); } - xResultStream = GetStream( nStreamMode, aGlobalPass, bHierarchyAccess ); + xResultStream = GetStream( nStreamMode, aGlobalEncryptionData, bHierarchyAccess ); } else xResultStream = GetStream_Impl( nStreamMode, bHierarchyAccess ); @@ -1385,7 +1384,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre if ( !xInStream.is() ) throw io::IOException(); - OInputCompStream* pStream = new OInputCompStream( *this, xInStream, InsertOwnProps( m_aProps, m_bUseCommonPass ), m_nStorageType ); + OInputCompStream* pStream = new OInputCompStream( *this, xInStream, InsertOwnProps( m_aProps, m_bUseCommonEncryption ), m_nStorageType ); uno::Reference< io::XStream > xCompStream( static_cast< ::cppu::OWeakObject* >( pStream ), uno::UNO_QUERY ); @@ -1410,7 +1409,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre if ( !xInStream.is() ) throw io::IOException(); - OInputSeekStream* pStream = new OInputSeekStream( *this, xInStream, InsertOwnProps( m_aProps, m_bUseCommonPass ), m_nStorageType ); + OInputSeekStream* pStream = new OInputSeekStream( *this, xInStream, InsertOwnProps( m_aProps, m_bUseCommonEncryption ), m_nStorageType ); uno::Reference< io::XStream > xSeekStream( static_cast< ::cppu::OWeakObject* >( pStream ), uno::UNO_QUERY ); @@ -1512,7 +1511,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetRawInStream() } //----------------------------------------------- -::rtl::OUString OWriteStream_Impl::GetCommonRootPass() +::comphelper::SequenceAsHashMap OWriteStream_Impl::GetCommonRootEncryptionData() throw ( packages::NoEncryptionException ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; @@ -1520,7 +1519,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetRawInStream() if ( m_nStorageType != embed::StorageFormats::PACKAGE || !m_pParent ) throw packages::NoEncryptionException(); - return m_pParent->GetCommonRootPass(); + return m_pParent->GetCommonRootEncryptionData(); } //----------------------------------------------- @@ -1559,11 +1558,11 @@ void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io: if ( !xInStream.is() ) throw io::IOException(); - // TODO: remember last state of m_bUseCommonPass + // TODO: remember last state of m_bUseCommonEncryption if ( !xTargetStream.is() ) xTargetStream = uno::Reference< io::XStream > ( static_cast< ::cppu::OWeakObject* >( - new OInputSeekStream( xInStream, InsertOwnProps( aProps, m_bUseCommonPass ), m_nStorageType ) ), + new OInputSeekStream( xInStream, InsertOwnProps( aProps, m_bUseCommonEncryption ), m_nStorageType ) ), uno::UNO_QUERY_THROW ); } @@ -1580,10 +1579,10 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar if ( IsEncrypted() ) { // an encrypted stream must contain input stream - ::rtl::OUString aGlobalPass; + ::comphelper::SequenceAsHashMap aGlobalEncryptionData; try { - aGlobalPass = GetCommonRootPass(); + aGlobalEncryptionData = GetCommonRootEncryptionData(); } catch( packages::NoEncryptionException& aNoEncryptionException ) { @@ -1593,7 +1592,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar throw packages::WrongPasswordException(); } - GetCopyOfLastCommit( xTargetStream, aGlobalPass ); + GetCopyOfLastCommit( xTargetStream, aGlobalEncryptionData ); } else { @@ -1602,12 +1601,12 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar // in case of new inserted package stream it is possible that input stream still was not set GetStreamProperties(); - CreateReadonlyCopyBasedOnData( xDataToCopy, m_aProps, m_bUseCommonPass, xTargetStream ); + CreateReadonlyCopyBasedOnData( xDataToCopy, m_aProps, m_bUseCommonEncryption, xTargetStream ); } } //----------------------------------------------- -void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTargetStream, const ::rtl::OUString& aPass ) +void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTargetStream, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ); @@ -1620,12 +1619,12 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar uno::Reference< io::XInputStream > xDataToCopy; - if ( m_bHasCachedPassword ) + if ( m_bHasCachedEncryptionData ) { // TODO: introduce last commited cashed password information and use it here // that means "use common pass" also should be remembered on flash - uno::Sequence< sal_Int8 > aNewKey = ::package::MakeKeyFromPass( aPass, sal_True ); - uno::Sequence< sal_Int8 > aOldKey = ::package::MakeKeyFromPass( aPass, sal_False ); + uno::Sequence< sal_Int8 > aNewKey = aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ); + uno::Sequence< sal_Int8 > aOldKey = aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1MS1252, uno::Sequence< sal_Int8 >() ); uno::Reference< beans::XPropertySet > xProps( m_xPackageStream, uno::UNO_QUERY ); if ( !xProps.is() ) @@ -1647,7 +1646,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar else { uno::Reference< beans::XPropertySet > xPropertySet( m_xPackageStream, uno::UNO_QUERY ); - SetEncryptionKeyProperty_Impl( xPropertySet, ::package::MakeKeyFromPass( aPass, sal_True ) ); + SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) ); try { xDataToCopy = m_xPackageStream->getDataStream(); @@ -1660,7 +1659,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar } catch( packages::WrongPasswordException& aWrongPasswordException ) { - SetEncryptionKeyProperty_Impl( xPropertySet, ::package::MakeKeyFromPass( aPass, sal_False ) ); + SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1MS1252, uno::Sequence< sal_Int8 >() ) ); try { xDataToCopy = m_xPackageStream->getDataStream(); @@ -1696,7 +1695,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar // in case of new inserted package stream it is possible that input stream still was not set GetStreamProperties(); - CreateReadonlyCopyBasedOnData( xDataToCopy, m_aProps, m_bUseCommonPass, xTargetStream ); + CreateReadonlyCopyBasedOnData( xDataToCopy, m_aProps, m_bUseCommonEncryption, xTargetStream ); } //----------------------------------------------- @@ -2028,6 +2027,7 @@ uno::Any SAL_CALL OWriteStream::queryInterface( const uno::Type& rType ) { aReturn <<= ::cppu::queryInterface ( rType + , static_cast ( this ) , static_cast ( this ) ); } else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) @@ -2080,7 +2080,7 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() { if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE ) { - m_pData->m_pTypeCollection = new ::cppu::OTypeCollection + ::cppu::OTypeCollection aTmpCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) , ::getCppuType( ( const uno::Reference< io::XInputStream >* )NULL ) , ::getCppuType( ( const uno::Reference< io::XOutputStream >* )NULL ) @@ -2088,11 +2088,15 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() , ::getCppuType( ( const uno::Reference< io::XSeekable >* )NULL ) , ::getCppuType( ( const uno::Reference< io::XTruncate >* )NULL ) , ::getCppuType( ( const uno::Reference< lang::XComponent >* )NULL ) + , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource2 >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XExtendedStorageStream >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XTransactedObject >* )NULL ) - , ::getCppuType( ( const uno::Reference< embed::XTransactionBroadcaster >* )NULL ) - , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); + , ::getCppuType( ( const uno::Reference< embed::XTransactionBroadcaster >* )NULL ) ); + + m_pData->m_pTypeCollection = new ::cppu::OTypeCollection + ( ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) + , aTmpCollection.getTypes() ); } else if ( m_pData->m_nStorageType == embed::StorageFormats::OFOPXML ) { @@ -2138,6 +2142,7 @@ uno::Sequence< uno::Type > SAL_CALL OWriteStream::getTypes() , ::getCppuType( ( const uno::Reference< io::XSeekable >* )NULL ) , ::getCppuType( ( const uno::Reference< io::XTruncate >* )NULL ) , ::getCppuType( ( const uno::Reference< lang::XComponent >* )NULL ) + , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource2 >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource >* )NULL ) , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); } @@ -2713,7 +2718,7 @@ void SAL_CALL OWriteStream::setEncryptionPassword( const ::rtl::OUString& aPass OSL_ENSURE( m_pImpl->m_xPackageStream.is(), "No package stream is set!\n" ); - m_pImpl->SetEncryptedWithPass( aPass ); + m_pImpl->SetEncrypted( ::comphelper::OStorageHelper::CreatePackageEncryptionData( aPass ) ); ModifyParentUnlockMutex_Impl( aGuard ); } @@ -2740,6 +2745,27 @@ void SAL_CALL OWriteStream::removeEncryption() ModifyParentUnlockMutex_Impl( aGuard ); } +//----------------------------------------------- +void SAL_CALL OWriteStream::setEncryptionData( const uno::Sequence< beans::NamedValue >& aEncryptionData ) + throw (io::IOException, uno::RuntimeException) +{ + ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + + CheckInitOnDemand(); + + if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException(); + } + + OSL_ENSURE( m_pImpl->m_xPackageStream.is(), "No package stream is set!\n" ); + + m_pImpl->SetEncrypted( aEncryptionData ); + + ModifyParentUnlockMutex_Impl( aGuard ); +} + //----------------------------------------------- sal_Bool SAL_CALL OWriteStream::hasByID( const ::rtl::OUString& sID ) throw ( io::IOException, @@ -3181,24 +3207,24 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa else if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && aPropertyName.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) { - sal_Bool bUseCommonPass = sal_False; - if ( aValue >>= bUseCommonPass ) + sal_Bool bUseCommonEncryption = sal_False; + if ( aValue >>= bUseCommonEncryption ) { if ( m_bInitOnDemand && m_pImpl->m_bHasInsertedStreamOptimization ) { // the data stream is provided to the packagestream directly - m_pImpl->m_bUseCommonPass = bUseCommonPass; + m_pImpl->m_bUseCommonEncryption = bUseCommonEncryption; } - else if ( bUseCommonPass ) + else if ( bUseCommonEncryption ) { - if ( !m_pImpl->m_bUseCommonPass ) + if ( !m_pImpl->m_bUseCommonEncryption ) { m_pImpl->SetDecrypted(); - m_pImpl->m_bUseCommonPass = sal_True; + m_pImpl->m_bUseCommonEncryption = sal_True; } } else - m_pImpl->m_bUseCommonPass = sal_False; + m_pImpl->m_bUseCommonEncryption = sal_False; } else throw lang::IllegalArgumentException(); //TODO @@ -3293,7 +3319,7 @@ uno::Any SAL_CALL OWriteStream::getPropertyValue( const ::rtl::OUString& aProp ) } else if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE && aPropertyName.equalsAscii( "UseCommonStoragePasswordEncryption" ) ) - return uno::makeAny( m_pImpl->m_bUseCommonPass ); + return uno::makeAny( m_pImpl->m_bUseCommonEncryption ); else if ( aPropertyName.equalsAscii( "Size" ) ) { CheckInitOnDemand(); diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index 0d4a29893887..08f862b22f6c 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -53,6 +53,8 @@ #include #include +#include + #include #include "ocompinstream.hxx" @@ -75,7 +77,7 @@ namespace cppu { namespace package { void StaticAddLog( const ::rtl::OUString& aMessage ); - ::com::sun::star::uno::Sequence< sal_Int8 > MakeKeyFromPass( const ::rtl::OUString& aPass, sal_Bool bUseUTF ); + bool PackageEncryptionDatasEqual( const ::comphelper::SequenceAsHashMap& aHash1, const ::comphelper::SequenceAsHashMap& aHash2 ); } struct WSInternalData_Impl @@ -127,9 +129,9 @@ struct OWriteStream_Impl : public PreCreationStruct sal_Bool m_bForceEncrypted; - sal_Bool m_bUseCommonPass; - sal_Bool m_bHasCachedPassword; - ::rtl::OUString m_aPass; + sal_Bool m_bUseCommonEncryption; + sal_Bool m_bHasCachedEncryptionData; + ::comphelper::SequenceAsHashMap m_aEncryptionData; sal_Bool m_bCompressedSetExplicit; @@ -161,12 +163,12 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStream_Impl( sal_Int32 nStreamMode, sal_Bool bHierarchyAccess ); - ::rtl::OUString GetCommonRootPass() throw ( ::com::sun::star::packages::NoEncryptionException ); + ::comphelper::SequenceAsHashMap GetCommonRootEncryptionData() throw ( ::com::sun::star::packages::NoEncryptionException ); ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > ReadPackageStreamProperties(); ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > InsertOwnProps( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps, - sal_Bool bUseCommonPass ); + sal_Bool bUseCommonEncryption ); public: OWriteStream_Impl( @@ -186,7 +188,7 @@ public: void AddLog( const ::rtl::OUString& aMessage ); - sal_Bool UsesCommonPass_Impl() { return m_bUseCommonPass; } + sal_Bool UsesCommonEncryption_Impl() { return m_bUseCommonEncryption; } sal_Bool HasTempFile_Impl() { return ( m_aTempURL.getLength() != 0 ); } sal_Bool IsTransacted(); @@ -198,13 +200,14 @@ public: void SetToBeCommited() { m_bFlushed = sal_True; } - sal_Bool HasCachedPassword() { return m_bHasCachedPassword; } - ::rtl::OUString GetCachedPassword() { return m_aPass; } + sal_Bool HasCachedEncryptionData() { return m_bHasCachedEncryptionData; } + ::comphelper::SequenceAsHashMap& GetCachedEncryptionData() { return m_aEncryptionData; } + sal_Bool IsModified() { return m_bHasDataToFlush || m_bFlushed; } sal_Bool IsEncrypted(); void SetDecrypted(); - void SetEncryptedWithPass( const ::rtl::OUString& aPass ); + void SetEncrypted( const ::comphelper::SequenceAsHashMap& aEncryptionData ); void DisposeWrappers(); @@ -226,12 +229,12 @@ public: ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > GetAllRelationshipsIfAny(); void CopyInternallyTo_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xDestStream, - const ::rtl::OUString& aPass ); + const ::comphelper::SequenceAsHashMap& aEncryptionData ); void CopyInternallyTo_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xDestStream ); ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStream( sal_Int32 nStreamMode, - const ::rtl::OUString& aPass, + const ::comphelper::SequenceAsHashMap& aEncryptionData, sal_Bool bHierarchyAccess ); ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStream( @@ -247,13 +250,13 @@ public: void CreateReadonlyCopyBasedOnData( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xDataToCopy, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps, - sal_Bool bUseCommonPass, + sal_Bool bUseCommonEncryption, ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream ); void GetCopyOfLastCommit( ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream ); void GetCopyOfLastCommit( ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream, - const ::rtl::OUString& aPass ); + const ::comphelper::SequenceAsHashMap& aEncryptionData ); void CommitStreamRelInfo( @@ -272,7 +275,7 @@ class OWriteStream : ::com::sun::star::lang::XTypeProvider , public ::com::sun::star::embed::XExtendedStorageStream , public ::com::sun::star::io::XSeekable , public ::com::sun::star::io::XTruncate - , public ::com::sun::star::embed::XEncryptionProtectedSource + , public ::com::sun::star::embed::XEncryptionProtectedSource2 , public ::com::sun::star::embed::XRelationshipAccess , public ::com::sun::star::embed::XTransactedObject , public ::com::sun::star::embed::XTransactionBroadcaster @@ -366,6 +369,9 @@ public: throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException ); + //XEncryptionProtectedSource2 + virtual void SAL_CALL setEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + //XRelationshipAccess virtual ::sal_Bool SAL_CALL hasByID( const ::rtl::OUString& sID ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getTargetByID( const ::rtl::OUString& sID ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 9c90c4ce35dd..db3ca63f649d 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -207,7 +207,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > xInputStream, , m_bListCreated( sal_False ) , m_xFactory( xFactory ) , m_xProperties( xProperties ) -, m_bHasCommonPassword( sal_False ) +, m_bHasCommonEncryptionData( sal_False ) , m_pParent( NULL ) , m_bControlMediaType( sal_False ) , m_bMTFallbackUsed( sal_False ) @@ -247,7 +247,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > xStream, , m_bListCreated( sal_False ) , m_xFactory( xFactory ) , m_xProperties( xProperties ) -, m_bHasCommonPassword( sal_False ) +, m_bHasCommonEncryptionData( sal_False ) , m_pParent( NULL ) , m_bControlMediaType( sal_False ) , m_bMTFallbackUsed( sal_False ) @@ -291,7 +291,7 @@ OStorage_Impl::OStorage_Impl( OStorage_Impl* pParent, , m_xPackageFolder( xPackageFolder ) , m_xPackage( xPackage ) , m_xFactory( xFactory ) -, m_bHasCommonPassword( sal_False ) +, m_bHasCommonEncryptionData( sal_False ) , m_pParent( pParent ) // can be empty in case of temporary readonly substorages and relation storage , m_bControlMediaType( sal_False ) , m_bMTFallbackUsed( sal_False ) @@ -748,10 +748,9 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes { try { - ::rtl::OUString aCommonPass = GetCommonRootPass(); - uno::Reference< embed::XEncryptionProtectedSource > xEncr( xDest, uno::UNO_QUERY ); + uno::Reference< embed::XEncryptionProtectedSource2 > xEncr( xDest, uno::UNO_QUERY ); if ( xEncr.is() ) - xEncr->setEncryptionPassword( aCommonPass ); + xEncr->setEncryptionData( GetCommonRootEncryptionData().getAsConstNamedValueList() ); } catch( packages::NoEncryptionException& aNoEncryptionException ) { @@ -855,7 +854,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, { aStrProps.realloc( ++nNum ); aStrProps[nNum-1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseCommonStoragePasswordEncryption" ) ); - aStrProps[nNum-1].Value <<= (sal_Bool)( pElement->m_pStream->UsesCommonPass_Impl() ); + aStrProps[nNum-1].Value <<= (sal_Bool)( pElement->m_pStream->UsesCommonEncryption_Impl() ); } else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { @@ -913,15 +912,15 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, OSL_ENSURE( sal_False, "Encryption is only supported in package storage!\n" ); throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } - else if ( pElement->m_pStream->HasCachedPassword() + else if ( pElement->m_pStream->HasCachedEncryptionData() && ( pElement->m_pStream->IsModified() || pElement->m_pStream->HasWriteOwner_Impl() ) ) { - ::rtl::OUString aCommonPass; - sal_Bool bHasCommonPass = sal_False; + ::comphelper::SequenceAsHashMap aCommonEncryptionData; + sal_Bool bHasCommonEncryptionData = sal_False; try { - aCommonPass = GetCommonRootPass(); - bHasCommonPass = sal_True; + aCommonEncryptionData = GetCommonRootEncryptionData(); + bHasCommonEncryptionData = sal_True; } catch( packages::NoEncryptionException& aNoEncryptionException ) { @@ -929,7 +928,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No Encryption" ) ) ); } - if ( bHasCommonPass && pElement->m_pStream->GetCachedPassword().equals( aCommonPass ) ) + if ( bHasCommonEncryptionData && ::package::PackageEncryptionDatasEqual( pElement->m_pStream->GetCachedEncryptionData(), aCommonEncryptionData ) ) { // If the stream can be opened with the common storage password // it must be stored with the common storage password as well @@ -947,13 +946,14 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, else { // the stream is already opened for writing or was changed + uno::Reference< embed::XStorage2 > xDest2( xDest, uno::UNO_QUERY_THROW ); uno::Reference< io::XStream > xSubStr = - xDest->openEncryptedStreamElement( aName, + xDest2->openEncryptedStream( aName, embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE, - pElement->m_pStream->GetCachedPassword() ); + pElement->m_pStream->GetCachedEncryptionData().getAsConstNamedValueList() ); OSL_ENSURE( xSubStr.is(), "No destination substream!\n" ); - pElement->m_pStream->CopyInternallyTo_Impl( xSubStr, pElement->m_pStream->GetCachedPassword() ); + pElement->m_pStream->CopyInternallyTo_Impl( xSubStr, pElement->m_pStream->GetCachedEncryptionData() ); } } else @@ -1360,7 +1360,7 @@ void OStorage_Impl::Revert() } //----------------------------------------------- -::rtl::OUString OStorage_Impl::GetCommonRootPass() +::comphelper::SequenceAsHashMap OStorage_Impl::GetCommonRootEncryptionData() throw ( packages::NoEncryptionException ) { ::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() ) ; @@ -1370,17 +1370,17 @@ void OStorage_Impl::Revert() if ( m_bIsRoot ) { - if ( !m_bHasCommonPassword ) + if ( !m_bHasCommonEncryptionData ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - return m_aCommonPassword; + return m_aCommonEncryptionData; } else { if ( !m_pParent ) throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - return m_pParent->GetCommonRootPass(); + return m_pParent->GetCommonRootEncryptionData(); } } @@ -1679,8 +1679,8 @@ void OStorage_Impl::ClearElement( SotElement_Impl* pElement ) //----------------------------------------------- void OStorage_Impl::CloneStreamElement( const ::rtl::OUString& aStreamName, - sal_Bool bPassProvided, - const ::rtl::OUString& aPass, + sal_Bool bEncryptionDataProvided, + const ::comphelper::SequenceAsHashMap& aEncryptionData, uno::Reference< io::XStream >& xTargetStream ) throw ( embed::InvalidStorageException, lang::IllegalArgumentException, @@ -1712,8 +1712,8 @@ void OStorage_Impl::CloneStreamElement( const ::rtl::OUString& aStreamName, // storage. The only problem is that some package streams can be accessed from outside // at the same time ( now solwed by wrappers that remember own position ). - if ( bPassProvided ) - pElement->m_pStream->GetCopyOfLastCommit( xTargetStream, aPass ); + if ( bEncryptionDataProvided ) + pElement->m_pStream->GetCopyOfLastCommit( xTargetStream, aEncryptionData ); else pElement->m_pStream->GetCopyOfLastCommit( xTargetStream ); } @@ -2247,6 +2247,7 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType ) ( rType , static_cast ( this ) , static_cast ( this ) + , static_cast ( this ) , static_cast ( this ) , static_cast ( this ) , static_cast ( this ) @@ -2254,8 +2255,15 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType ) , static_cast ( this ) , static_cast ( this ) , static_cast ( this ) - , static_cast ( this ) - , static_cast ( this ) ); + , static_cast ( this ) ); + + if ( aReturn.hasValue() == sal_True ) + return aReturn ; + + aReturn <<= ::cppu::queryInterface + ( rType + , static_cast ( this ) + , static_cast ( this ) ); if ( aReturn.hasValue() == sal_True ) return aReturn ; @@ -2267,7 +2275,8 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType ) aReturn <<= ::cppu::queryInterface ( rType , static_cast ( this ) - , static_cast ( this ) ); + , static_cast ( this ) + , static_cast ( this ) ); } else { @@ -2322,10 +2331,12 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes() m_pData->m_pTypeCollection = new ::cppu::OTypeCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XStorage >* )NULL ) + , ::getCppuType( ( const uno::Reference< embed::XStorage2 >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XStorageRawAccess >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XTransactedObject >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XTransactionBroadcaster >* )NULL ) , ::getCppuType( ( const uno::Reference< util::XModifiable >* )NULL ) + , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource2 >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource >* )NULL ) , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) ); } @@ -2334,6 +2345,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes() m_pData->m_pTypeCollection = new ::cppu::OTypeCollection ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XStorage >* )NULL ) + , ::getCppuType( ( const uno::Reference< embed::XStorage2 >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XStorageRawAccess >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XTransactedObject >* )NULL ) , ::getCppuType( ( const uno::Reference< embed::XTransactionBroadcaster >* )NULL ) @@ -2576,100 +2588,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::openEncryptedStreamElement( { RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::openEncryptedStreamElement" ); - ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); - - if ( !m_pImpl ) - { - ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); - throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - } - - if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) - packages::NoEncryptionException(); - - if ( ( nOpenMode & embed::ElementModes::WRITE ) && m_pData->m_bReadOnlyWrap ) - throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied - - if ( !aPass.getLength() ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 3 ); - - uno::Reference< io::XStream > xResult; - try - { - SotElement_Impl *pElement = OpenStreamElement_Impl( aStreamName, nOpenMode, sal_True ); - OSL_ENSURE( pElement && pElement->m_pStream, "In case element can not be created an exception must be thrown!" ); - - xResult = pElement->m_pStream->GetStream( nOpenMode, aPass, sal_False ); - OSL_ENSURE( xResult.is(), "The method must throw exception instead of removing empty result!\n" ); - - if ( m_pData->m_bReadOnlyWrap ) - { - // before the storage disposes the stream it must deregister itself as listener - uno::Reference< lang::XComponent > xStreamComponent( xResult, uno::UNO_QUERY ); - if ( !xStreamComponent.is() ) - throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - - MakeLinkToSubComponent_Impl( xStreamComponent ); - } - } - catch( embed::InvalidStorageException& aInvalidStorageException ) - { - m_pImpl->AddLog( aInvalidStorageException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( lang::IllegalArgumentException& aIllegalArgumentException ) - { - m_pImpl->AddLog( aIllegalArgumentException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( packages::NoEncryptionException& aNoEncryptionException ) - { - m_pImpl->AddLog( aNoEncryptionException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( packages::WrongPasswordException& aWrongPasswordException ) - { - m_pImpl->AddLog( aWrongPasswordException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) - { - m_pImpl->AddLog( aStorageWrappedTargetException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( io::IOException& aIOException ) - { - m_pImpl->AddLog( aIOException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( uno::RuntimeException& aRuntimeException ) - { - m_pImpl->AddLog( aRuntimeException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( uno::Exception& aException ) - { - m_pImpl->AddLog( aException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - - uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't open encrypted stream stream!" ) ), - uno::Reference< io::XInputStream >(), - aCaught ); - } - - aGuard.clear(); - - BroadcastModifiedIfNecessary(); - - return xResult; + return openEncryptedStream( aStreamName, nOpenMode, ::comphelper::OStorageHelper::CreatePackageEncryptionData( aPass ) ); } //----------------------------------------------- @@ -2856,7 +2775,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneStreamElement( const ::rtl try { uno::Reference< io::XStream > xResult; - m_pImpl->CloneStreamElement( aStreamName, sal_False, ::rtl::OUString(), xResult ); + m_pImpl->CloneStreamElement( aStreamName, sal_False, ::comphelper::SequenceAsHashMap(), xResult ); if ( !xResult.is() ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); return xResult; @@ -2923,80 +2842,7 @@ uno::Reference< io::XStream > SAL_CALL OStorage::cloneEncryptedStreamElement( { RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::cloneEncryptedStreamElement" ); - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); - - if ( !m_pImpl ) - { - ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); - throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - } - - if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) - packages::NoEncryptionException(); - - if ( !aPass.getLength() ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); - - try - { - uno::Reference< io::XStream > xResult; - m_pImpl->CloneStreamElement( aStreamName, sal_True, aPass, xResult ); - if ( !xResult.is() ) - throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - return xResult; - } - catch( embed::InvalidStorageException& aInvalidStorageException ) - { - m_pImpl->AddLog( aInvalidStorageException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( lang::IllegalArgumentException& aIllegalArgumentException ) - { - m_pImpl->AddLog( aIllegalArgumentException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( packages::NoEncryptionException& aNoEncryptionException ) - { - m_pImpl->AddLog( aNoEncryptionException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( packages::WrongPasswordException& aWrongPasswordException ) - { - m_pImpl->AddLog( aWrongPasswordException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( io::IOException& aIOException ) - { - m_pImpl->AddLog( aIOException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) - { - m_pImpl->AddLog( aStorageWrappedTargetException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( uno::RuntimeException& aRuntimeException ) - { - m_pImpl->AddLog( aRuntimeException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - throw; - } - catch( uno::Exception& aException ) - { - m_pImpl->AddLog( aException.Message ); - m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - - uno::Any aCaught( ::cppu::getCaughtException() ); - throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't clone encrypted stream!" ) ), - uno::Reference< io::XInputStream >(), - aCaught ); - } + return cloneEncryptedStream( aStreamName, ::comphelper::OStorageHelper::CreatePackageEncryptionData( aPass ) ); } //----------------------------------------------- @@ -3720,6 +3566,210 @@ void SAL_CALL OStorage::moveElementTo( const ::rtl::OUString& aElementName, BroadcastModifiedIfNecessary(); } +//____________________________________________________________________________________________________ +// XStorage2 +//____________________________________________________________________________________________________ + +//----------------------------------------------- +uno::Reference< io::XStream > SAL_CALL OStorage::openEncryptedStream( + const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode, const uno::Sequence< beans::NamedValue >& aEncryptionData ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + packages::NoEncryptionException, + packages::WrongPasswordException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::openEncryptedStream" ); + + ::osl::ResettableMutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + + if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } + + if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) + packages::NoEncryptionException(); + + if ( ( nOpenMode & embed::ElementModes::WRITE ) && m_pData->m_bReadOnlyWrap ) + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // TODO: access denied + + if ( !aEncryptionData.getLength() ) + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 3 ); + + uno::Reference< io::XStream > xResult; + try + { + SotElement_Impl *pElement = OpenStreamElement_Impl( aStreamName, nOpenMode, sal_True ); + OSL_ENSURE( pElement && pElement->m_pStream, "In case element can not be created an exception must be thrown!" ); + + xResult = pElement->m_pStream->GetStream( nOpenMode, aEncryptionData, sal_False ); + OSL_ENSURE( xResult.is(), "The method must throw exception instead of removing empty result!\n" ); + + if ( m_pData->m_bReadOnlyWrap ) + { + // before the storage disposes the stream it must deregister itself as listener + uno::Reference< lang::XComponent > xStreamComponent( xResult, uno::UNO_QUERY ); + if ( !xStreamComponent.is() ) + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + + MakeLinkToSubComponent_Impl( xStreamComponent ); + } + } + catch( embed::InvalidStorageException& aInvalidStorageException ) + { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( lang::IllegalArgumentException& aIllegalArgumentException ) + { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( packages::NoEncryptionException& aNoEncryptionException ) + { + m_pImpl->AddLog( aNoEncryptionException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( packages::WrongPasswordException& aWrongPasswordException ) + { + m_pImpl->AddLog( aWrongPasswordException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) + { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( io::IOException& aIOException ) + { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( uno::RuntimeException& aRuntimeException ) + { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( uno::Exception& aException ) + { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + + uno::Any aCaught( ::cppu::getCaughtException() ); + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't open encrypted stream stream!" ) ), + uno::Reference< io::XInputStream >(), + aCaught ); + } + + aGuard.clear(); + + BroadcastModifiedIfNecessary(); + + return xResult; +} + +//----------------------------------------------- +uno::Reference< io::XStream > SAL_CALL OStorage::cloneEncryptedStream( + const ::rtl::OUString& aStreamName, + const uno::Sequence< beans::NamedValue >& aEncryptionData ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + packages::NoEncryptionException, + packages::WrongPasswordException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::cloneEncryptedStream" ); + + ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + + if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } + + if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) + packages::NoEncryptionException(); + + if ( !aEncryptionData.getLength() ) + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); + + try + { + uno::Reference< io::XStream > xResult; + m_pImpl->CloneStreamElement( aStreamName, sal_True, aEncryptionData, xResult ); + if ( !xResult.is() ) + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + return xResult; + } + catch( embed::InvalidStorageException& aInvalidStorageException ) + { + m_pImpl->AddLog( aInvalidStorageException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( lang::IllegalArgumentException& aIllegalArgumentException ) + { + m_pImpl->AddLog( aIllegalArgumentException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( packages::NoEncryptionException& aNoEncryptionException ) + { + m_pImpl->AddLog( aNoEncryptionException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( packages::WrongPasswordException& aWrongPasswordException ) + { + m_pImpl->AddLog( aWrongPasswordException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( io::IOException& aIOException ) + { + m_pImpl->AddLog( aIOException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( embed::StorageWrappedTargetException& aStorageWrappedTargetException ) + { + m_pImpl->AddLog( aStorageWrappedTargetException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( uno::RuntimeException& aRuntimeException ) + { + m_pImpl->AddLog( aRuntimeException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + throw; + } + catch( uno::Exception& aException ) + { + m_pImpl->AddLog( aException.Message ); + m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); + + uno::Any aCaught( ::cppu::getCaughtException() ); + throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't clone encrypted stream!" ) ), + uno::Reference< io::XInputStream >(), + aCaught ); + } +} + + //____________________________________________________________________________________________________ // XStorageRawAccess //____________________________________________________________________________________________________ @@ -4608,6 +4658,15 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) io::IOException ) { RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::setEncryptionPassword" ); + setEncryptionData( ::comphelper::OStorageHelper::CreatePackageEncryptionData( aPass ) ); +} + +//----------------------------------------------- +void SAL_CALL OStorage::removeEncryption() + throw ( uno::RuntimeException, + io::IOException ) +{ + RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::removeEncryption" ); ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); @@ -4620,8 +4679,7 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface must be visible only for package storage - OSL_ENSURE( m_pData->m_bIsRoot, "setEncryptionPassword() method is not available for nonroot storages!\n" ); - + OSL_ENSURE( m_pData->m_bIsRoot, "removeEncryption() method is not available for nonroot storages!\n" ); if ( m_pData->m_bIsRoot ) { try { @@ -4639,12 +4697,15 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ), + throw lang::WrappedTargetRuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ), uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ), aCaught ); } + // TODO: check if the password is valid + // update all streams that was encrypted with old password + uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY ); if ( !xPackPropSet.is() ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); @@ -4652,10 +4713,10 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) try { xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ), - uno::makeAny( ::package::MakeKeyFromPass( aPass, sal_True ) ) ); + uno::makeAny( uno::Sequence< sal_Int8 >() ) ); - m_pImpl->m_bHasCommonPassword = sal_True; - m_pImpl->m_aCommonPassword = aPass; + m_pImpl->m_bHasCommonEncryptionData = sal_False; + m_pImpl->m_aCommonEncryptionData.clear(); } catch( uno::Exception& aException ) { @@ -4668,12 +4729,15 @@ void SAL_CALL OStorage::setEncryptionPassword( const ::rtl::OUString& aPass ) } } -//----------------------------------------------- -void SAL_CALL OStorage::removeEncryption() - throw ( uno::RuntimeException, - io::IOException ) +//____________________________________________________________________________________________________ +// XEncryptionProtectedSource2 +//____________________________________________________________________________________________________ + +void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValue >& aEncryptionData ) + throw ( io::IOException, + uno::RuntimeException ) { - RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::removeEncryption" ); + RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::setEncryptionData" ); ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); @@ -4686,8 +4750,10 @@ void SAL_CALL OStorage::removeEncryption() if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface must be visible only for package storage - OSL_ENSURE( m_pData->m_bIsRoot, "removeEncryption() method is not available for nonroot storages!\n" ); + if ( !aEncryptionData.getLength() ) + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected empty encryption data!") ), uno::Reference< uno::XInterface >() ); + OSL_ENSURE( m_pData->m_bIsRoot, "setEncryptionData() method is not available for nonroot storages!\n" ); if ( m_pData->m_bIsRoot ) { try { @@ -4705,38 +4771,37 @@ void SAL_CALL OStorage::removeEncryption() m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); uno::Any aCaught( ::cppu::getCaughtException() ); - throw lang::WrappedTargetRuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ), + throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ), uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ), aCaught ); } - // TODO: check if the password is valid - // update all streams that was encrypted with old password - uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY ); if ( !xPackPropSet.is() ) throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); try { + ::comphelper::SequenceAsHashMap aEncryptionMap( aEncryptionData ); xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ), - uno::makeAny( uno::Sequence< sal_Int8 >() ) ); + uno::makeAny( aEncryptionMap.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) ) ); - m_pImpl->m_bHasCommonPassword = sal_False; - m_pImpl->m_aCommonPassword = ::rtl::OUString(); + m_pImpl->m_bHasCommonEncryptionData = sal_True; + m_pImpl->m_aCommonEncryptionData = aEncryptionMap; } catch( uno::Exception& aException ) { m_pImpl->AddLog( aException.Message ); m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) ); - OSL_ENSURE( sal_False, "The call must not fail, it is pretty simple!" ); throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); } } + } + //____________________________________________________________________________________________________ // XPropertySet //____________________________________________________________________________________________________ @@ -5954,7 +6019,7 @@ void SAL_CALL OStorage::copyStreamElementData( const ::rtl::OUString& aStreamNam try { uno::Reference< io::XStream > xNonconstRef = xTargetStream; - m_pImpl->CloneStreamElement( aStreamName, sal_False, ::rtl::OUString(), xNonconstRef ); + m_pImpl->CloneStreamElement( aStreamName, sal_False, ::comphelper::SequenceAsHashMap(), xNonconstRef ); OSL_ENSURE( xNonconstRef == xTargetStream, "The provided stream reference seems not be filled in correctly!\n" ); if ( xNonconstRef != xTargetStream ) @@ -6082,6 +6147,55 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted io::IOException, embed::StorageWrappedTargetException, uno::RuntimeException ) +{ + return openEncryptedStreamByHierarchicalName( aStreamPath, nOpenMode, ::comphelper::OStorageHelper::CreatePackageEncryptionData( sPassword ) ); +} + +//----------------------------------------------- +void SAL_CALL OStorage::removeStreamElementByHierarchicalName( const ::rtl::OUString& aStreamPath ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + container::NoSuchElementException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); + + if ( !m_pImpl ) + { + ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); + throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); + } + + if ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) + throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); + + if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) ) + throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // Access denied + + OStringList_Impl aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); + OSL_ENSURE( aListPath.size(), "The result list must not be empty!" ); + + if ( !m_pData->m_rHierarchyHolder.is() ) + m_pData->m_rHierarchyHolder = new OHierarchyHolder_Impl( + uno::Reference< embed::XStorage >( static_cast< embed::XStorage* >( this ) ) ); + + m_pData->m_rHierarchyHolder->RemoveStreamHierarchically( aListPath ); +} + +//____________________________________________________________________________________________________ +// XHierarchicalStorageAccess2 +//____________________________________________________________________________________________________ + +uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncryptedStreamByHierarchicalName( const ::rtl::OUString& aStreamPath, ::sal_Int32 nOpenMode, const uno::Sequence< beans::NamedValue >& aEncryptionData ) + throw ( embed::InvalidStorageException, + lang::IllegalArgumentException, + packages::NoEncryptionException, + packages::WrongPasswordException, + io::IOException, + embed::StorageWrappedTargetException, + uno::RuntimeException ) { ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); @@ -6097,7 +6211,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted if ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( !sPassword.getLength() ) + if ( !aEncryptionData.getLength() ) throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 3 ); if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) @@ -6117,7 +6231,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted OSL_ENSURE( pElement && pElement->m_pStream, "In case element can not be created an exception must be thrown!" ); xResult = uno::Reference< embed::XExtendedStorageStream >( - pElement->m_pStream->GetStream( nOpenMode, sPassword, sal_True ), + pElement->m_pStream->GetStream( nOpenMode, aEncryptionData, sal_True ), uno::UNO_QUERY_THROW ); } else @@ -6131,7 +6245,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted ( m_pImpl->m_nStorageMode & embed::ElementModes::READWRITE ), aListPath, nOpenMode, - sPassword ); + aEncryptionData ); } if ( !xResult.is() ) @@ -6140,36 +6254,4 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted return xResult; } -//----------------------------------------------- -void SAL_CALL OStorage::removeStreamElementByHierarchicalName( const ::rtl::OUString& aStreamPath ) - throw ( embed::InvalidStorageException, - lang::IllegalArgumentException, - container::NoSuchElementException, - io::IOException, - embed::StorageWrappedTargetException, - uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() ); - - if ( !m_pImpl ) - { - ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) ); - throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); - } - - if ( !aStreamPath.getLength() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, sal_True ) ) - throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected entry name syntax." ) ), uno::Reference< uno::XInterface >(), 1 ); - - if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) ) - throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // Access denied - - OStringList_Impl aListPath = OHierarchyHolder_Impl::GetListPathFromString( aStreamPath ); - OSL_ENSURE( aListPath.size(), "The result list must not be empty!" ); - - if ( !m_pData->m_rHierarchyHolder.is() ) - m_pData->m_rHierarchyHolder = new OHierarchyHolder_Impl( - uno::Reference< embed::XStorage >( static_cast< embed::XStorage* >( this ) ) ); - - m_pData->m_rHierarchyHolder->RemoveStreamHierarchically( aListPath ); -} diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index f1c50e4d67bd..a49de3af6f3a 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -29,14 +29,14 @@ #define __XSTORAGE_HXX_ #include -#include +#include #include -#include +#include #include #include #include #include -#include +#include #include #include #include @@ -52,8 +52,10 @@ #include #include #include + #include #include +#include #include "mutexholder.hxx" @@ -157,8 +159,8 @@ struct OStorage_Impl ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream; // ??? may be stored in properties ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream; // ??? may be stored in properties ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_xProperties; - sal_Bool m_bHasCommonPassword; - ::rtl::OUString m_aCommonPassword; + sal_Bool m_bHasCommonEncryptionData; + ::comphelper::SequenceAsHashMap m_aCommonEncryptionData; // must be empty in case of root storage OStorage_Impl* m_pParent; @@ -231,7 +233,7 @@ struct OStorage_Impl void Commit(); void Revert(); - ::rtl::OUString GetCommonRootPass() throw ( ::com::sun::star::packages::NoEncryptionException ); + ::comphelper::SequenceAsHashMap GetCommonRootEncryptionData() throw ( ::com::sun::star::packages::NoEncryptionException ); void CopyToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest, sal_Bool bDirect ); @@ -264,7 +266,7 @@ struct OStorage_Impl void CloneStreamElement( const ::rtl::OUString& aStreamName, sal_Bool bPassProvided, - const ::rtl::OUString& aPass, + const ::comphelper::SequenceAsHashMap& aEncryptionData, ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream ) throw ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, @@ -289,18 +291,18 @@ struct OStorage_Impl class OStorage : public ::com::sun::star::lang::XTypeProvider - , public ::com::sun::star::embed::XStorage + , public ::com::sun::star::embed::XStorage2 , public ::com::sun::star::embed::XStorageRawAccess , public ::com::sun::star::embed::XTransactedObject , public ::com::sun::star::embed::XTransactionBroadcaster , public ::com::sun::star::util::XModifiable // , public ::com::sun::star::container::XNameAccess // , public ::com::sun::star::lang::XComponent - , public ::com::sun::star::embed::XEncryptionProtectedSource + , public ::com::sun::star::embed::XEncryptionProtectedSource2 , public ::com::sun::star::beans::XPropertySet , public ::com::sun::star::embed::XOptimizedStorage , public ::com::sun::star::embed::XRelationshipAccess - , public ::com::sun::star::embed::XHierarchicalStorageAccess + , public ::com::sun::star::embed::XHierarchicalStorageAccess2 , public ::cppu::OWeakObject { OStorage_Impl* m_pImpl; @@ -489,6 +491,28 @@ public: ::com::sun::star::embed::StorageWrappedTargetException, ::com::sun::star::uno::RuntimeException ); + //____________________________________________________________________________________________________ + // XStorage2 + //____________________________________________________________________________________________________ + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openEncryptedStream( const ::rtl::OUString& sStreamName, ::sal_Int32 nOpenMode, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::NoEncryptionException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneEncryptedStream( const ::rtl::OUString& sStreamName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::NoEncryptionException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException); + //____________________________________________________________________________________________________ // XStorageRawAccess //____________________________________________________________________________________________________ @@ -615,6 +639,16 @@ public: throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException ); + //____________________________________________________________________________________________________ + // XEncryptionProtectedSource2 + //____________________________________________________________________________________________________ + + virtual void SAL_CALL setEncryptionData( + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) + throw ( ::com::sun::star::io::IOException, + ::com::sun::star::uno::RuntimeException ); + + //____________________________________________________________________________________________________ // XPropertySet //____________________________________________________________________________________________________ @@ -800,6 +834,18 @@ public: ::com::sun::star::embed::StorageWrappedTargetException, ::com::sun::star::uno::RuntimeException); + //____________________________________________________________________________________________________ + // XHierarchicalStorageAccess2 + //____________________________________________________________________________________________________ + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openEncryptedStreamByHierarchicalName( const ::rtl::OUString& sStreamName, ::sal_Int32 nOpenMode, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData ) + throw ( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::NoEncryptionException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException, + ::com::sun::star::uno::RuntimeException ); }; diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 9ba26e0100c5..846ba7710298 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1650,7 +1650,7 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const throw PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EncryptionKey") ) ) { - if (!( aValue >>= m_aEncryptionKey ) ) + if (!( aValue >>= m_aEncryptionKey ) || m_aEncryptionKey.getLength() == 0 ) throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 ); } else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UseManifest") ) ) -- cgit From fc4b708fcafd872d0d5ffd7d4c2fdf010f60b0ad Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 4 Nov 2010 17:56:39 +0100 Subject: pl08: #163778# use EncryptionData from MediaDescriptor --- offapi/com/sun/star/document/MediaDescriptor.idl | 29 +++- .../sun/star/embed/XEncryptionProtectedSource2.idl | 65 ++++++++ .../sun/star/embed/XHierarchicalStorageAccess2.idl | 109 ++++++++++++++ offapi/com/sun/star/embed/XStorage2.idl | 165 +++++++++++++++++++++ offapi/com/sun/star/embed/makefile.mk | 3 + 5 files changed, 368 insertions(+), 3 deletions(-) create mode 100644 offapi/com/sun/star/embed/XEncryptionProtectedSource2.idl create mode 100644 offapi/com/sun/star/embed/XHierarchicalStorageAccess2.idl create mode 100644 offapi/com/sun/star/embed/XStorage2.idl diff --git a/offapi/com/sun/star/document/MediaDescriptor.idl b/offapi/com/sun/star/document/MediaDescriptor.idl index 36da721cc159..fa7ce3dc99c3 100644 --- a/offapi/com/sun/star/document/MediaDescriptor.idl +++ b/offapi/com/sun/star/document/MediaDescriptor.idl @@ -39,6 +39,10 @@ #include #endif +#ifndef __com_sun_star_beans_NamedValue_idl__ +#include +#endif + #ifndef __com_sun_star_util_URL_idl__ #include #endif @@ -163,6 +167,23 @@ published service MediaDescriptor */ [optional,property] string DocumentTitle; + //------------------------------------------------------------------------- + /** encryption information for encryption/decryption of documents + +

+ It contains the necessary information for encryption/decryption of + a component (if necessary). + If neither password nor encryption data is specified, loading of + a password protected document will fail, storing will be done without + encryption. If both are provided, the encryption data is used + ( if the filter supports it ). +

+

+ The encryption data is generated based on the password. +

+ */ + [optional,property] sequence< ::com::sun::star::beans::NamedValue > EncryptionData; + //------------------------------------------------------------------------- /** same as MediaDescriptor::URL @@ -365,9 +386,11 @@ published service MediaDescriptor /** pasword for loading storing documents

- It caontains a password for loading or storing a component (if necessary). - If no password is specified, loading of a password protected document - will fail, storing will be done without encryption. + It contains a password for loading or storing a component (if necessary). + If neither password nor encryption data is specified, loading of + a password protected document will fail, storing will be done without + encryption. If both are provided, the encryption data is used + ( if the filter supports it ).

*/ [optional,property] string Password; diff --git a/offapi/com/sun/star/embed/XEncryptionProtectedSource2.idl b/offapi/com/sun/star/embed/XEncryptionProtectedSource2.idl new file mode 100644 index 000000000000..e590a5764178 --- /dev/null +++ b/offapi/com/sun/star/embed/XEncryptionProtectedSource2.idl @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_embed_XEncryptionProtectedSource2_idl__ +#define __com_sun_star_embed_XEncryptionProtectedSource2_idl__ + +#ifndef __com_sun_star_embed_XEncryptionProtectedSource_idl__ +#include +#endif + +#ifndef __com_sun_star_beans_NamedValue_idl__ +#include +#endif + +//============================================================================ + +module com { module sun { module star { module embed { + +//============================================================================ +/** This interface allows to set a password for an object. + */ +published interface XEncryptionProtectedSource2: XEncryptionProtectedSource +{ + // ----------------------------------------------------------------------- + /** sets an encryption data for the object. + + @param aEncryptionData + the new encryption data + + @throws ::com::sun::star::io::IOException + in case the data could not be set + */ + void setEncryptionData( [in] sequence< ::com::sun::star::beans::NamedValue > aEncryptionData ) + raises( ::com::sun::star::io::IOException ); +}; + +//============================================================================ + +}; }; }; }; + +#endif + diff --git a/offapi/com/sun/star/embed/XHierarchicalStorageAccess2.idl b/offapi/com/sun/star/embed/XHierarchicalStorageAccess2.idl new file mode 100644 index 000000000000..0df83ea33580 --- /dev/null +++ b/offapi/com/sun/star/embed/XHierarchicalStorageAccess2.idl @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_embed_XHierarchicalStorageAccess2_idl__ +#define __com_sun_star_embed_XHierarchicalStorageAccess2_idl__ + +#ifndef __com_sun_star_embed_XHierarchicalStorageAccess_idl__ +#include +#endif + +#ifndef __com_sun_star_beans_NamedValue_idl__ +#include +#endif + +//============================================================================ + + module com { module sun { module star { module embed { + +//============================================================================ +/** This interface extends XHierarchicalStorageAccess interface. + */ +interface XHierarchicalStorageAccess2 : XHierarchicalStorageAccess +{ + // ----------------------------------------------------------------------- + /** allows to get access to a child encrypted stream with encryption data + using hierarchical path. + +

+ If storage does not allow any encryption this method will always throw + NoEncryptionException. +

+ +

+ In case the stream is open in readonly mode the + XStream::getOutputStream + method will return an empty reference. +

+ + @param sStreamPath + the path to the substream that should be open + + @param nOpenMode + a mode the stream should be open in, + can be a combination of ElementModes values + + @param aEncryptionData + this parameter allowes to specify an encryption data for the + stream, the data must be correct, otherwise an + exception will be thrown + + @throws ::com::sun::star::embed::InvalidStorageException + this storage is in invalid state for any reason + + @throws ::com::sun::star::lang::IllegalArgumentException + one of provided arguments is illegal + + @throws ::com::sun::star::packages::NoEncryptionException + the stream is not encrypted + + @throws ::com::sun::star::packages::WrongPasswordException + the provided password is wrong + + @throws ::com::sun::star::io::IOException + in case of io errors during stream opening + + @throws ::com::sun::star::embed::StorageWrappedTargetException + wraps other exceptions + */ + XExtendedStorageStream openEncryptedStreamByHierarchicalName( + [in] string sStreamName, + [in] long nOpenMode, + [in] sequence< ::com::sun::star::beans::NamedValue > aEncryptionData ) + raises( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::NoEncryptionException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException ); +}; + +//============================================================================ + +}; }; }; }; + +#endif + diff --git a/offapi/com/sun/star/embed/XStorage2.idl b/offapi/com/sun/star/embed/XStorage2.idl new file mode 100644 index 000000000000..cf4f9907b66e --- /dev/null +++ b/offapi/com/sun/star/embed/XStorage2.idl @@ -0,0 +1,165 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef __com_sun_star_embed_XStorage2_idl__ +#define __com_sun_star_embed_XStorage2_idl__ + +#ifndef __com_sun_star_embed_XStorage_idl__ +#include +#endif + +#ifndef __com_sun_star_beans_NamedValue_idl__ +#include +#endif + + +//============================================================================ + + module com { module sun { module star { module embed { + +//============================================================================ +/** This interface extends the base XStorage interface. + */ +interface XStorage2 : XStorage +{ + // ----------------------------------------------------------------------- + /** allows to get access to a child encrypted stream with EncryptionData. + +

+ If storage does not allow any encryption this method will always throw + NoEncryptionException. +

+ +

+ In case the stream is open in readonly mode the + XStream::getOutputStream + method will return an empty reference. +

+ + @param sStreamName + the name of the substream that should be open + + @param nOpenMode + a mode the stream should be open in, + can be a combination of ElementModes values + + @param aEncryptionData + this parameter allowes to specify an encryption data to decrypt the + stream, the encryption data must be correct, otherwise an + exception will be thrown + + @throws ::com::sun::star::embed::InvalidStorageException + this storage is in invalid state for any reason + + @throws ::com::sun::star::lang::IllegalArgumentException + one of provided arguments is illegal + + @throws ::com::sun::star::packages::NoEncryptionException + the stream is not encrypted + + @throws ::com::sun::star::packages::WrongPasswordException + the provided encryption data is wrong + + @throws ::com::sun::star::io::IOException + in case of io errors during stream opening + + @throws ::com::sun::star::embed::StorageWrappedTargetException + wraps other exceptions + */ + ::com::sun::star::io::XStream openEncryptedStream( + [in] string sStreamName, + [in] long nOpenMode, + [in] sequence< ::com::sun::star::beans::NamedValue > aEncryptionData ) + raises( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::NoEncryptionException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException ); + + // ----------------------------------------------------------------------- + /** allows to get readonly copy of a child encrypted stream with encryption + data. + +

+ If storage does not allow any encryption this method will always throw + NoEncryptionException. +

+ +

+ The stream is open in readonly mode so the + XStream::getOutputStream + method will return an empty reference. +

+ +

+ This method allows to specify encryption data for the child stream + explicitly. +

+ + @param sStreamName + the name of the substream that should be copied + + @param aEncryptionData + this parameter allowes to specify an encryption data for the + stream, the encryption data must be correct, otherwise an + exception will be thrown + + @throws ::com::sun::star::embed::InvalidStorageException + this storage is in invalid state for any reason + + @throws ::com::sun::star::lang::IllegalArgumentException + one of provided arguments is illegal + + @throws ::com::sun::star::packages::NoEncryptionException + the stream is not encrypted + + @throws ::com::sun::star::packages::WrongPasswordException + the provided encryption data is wrong + + @throws ::com::sun::star::io::IOException + in case of io errors during stream opening + + @throws ::com::sun::star::embed::StorageWrappedTargetException + wraps other exceptions + */ + ::com::sun::star::io::XStream cloneEncryptedStream( + [in] string sStreamName, + [in] sequence< ::com::sun::star::beans::NamedValue > aEncryptionData ) + raises( ::com::sun::star::embed::InvalidStorageException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::packages::NoEncryptionException, + ::com::sun::star::packages::WrongPasswordException, + ::com::sun::star::io::IOException, + ::com::sun::star::embed::StorageWrappedTargetException ); +}; + +//============================================================================ + +}; }; }; }; + +#endif + diff --git a/offapi/com/sun/star/embed/makefile.mk b/offapi/com/sun/star/embed/makefile.mk index 349017452ef3..8ee156af48ba 100644 --- a/offapi/com/sun/star/embed/makefile.mk +++ b/offapi/com/sun/star/embed/makefile.mk @@ -77,6 +77,7 @@ IDLFILES=\ XLinkCreator.idl\ XLinkFactory.idl\ XEncryptionProtectedSource.idl\ + XEncryptionProtectedSource2.idl\ XInplaceClient.idl\ XInsertObjectDialog.idl\ XWindowSupplier.idl\ @@ -89,9 +90,11 @@ IDLFILES=\ XTransferableSupplier.idl\ XComponentSupplier.idl\ XStorage.idl\ + XStorage2.idl\ XStorageRawAccess.idl\ XExtendedStorageStream.idl\ XHierarchicalStorageAccess.idl\ + XHierarchicalStorageAccess2.idl\ XHatchWindowController.idl\ XHatchWindowFactory.idl\ XHatchWindow.idl\ -- cgit From e3c793047f798f8b6acc55e5f550003ededc9544 Mon Sep 17 00:00:00 2001 From: os Date: Fri, 5 Nov 2010 08:55:21 +0100 Subject: #i97951# type change USHORT->sal_uInt32 to prevent overflow in column width calculation --- sw/source/filter/html/htmltabw.cxx | 12 ++++++----- sw/source/filter/inc/wrtswtbl.hxx | 36 ++++++++++++++++---------------- sw/source/filter/writer/wrtswtbl.cxx | 40 ++++++++++++++++++------------------ sw/source/filter/xml/xmltble.cxx | 34 +++++++++++++++--------------- 4 files changed, 62 insertions(+), 60 deletions(-) diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index 43b83557a149..91b026ca6770 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -98,7 +98,7 @@ class SwHTMLWrtTable : public SwWriteTable sal_Bool bTop, sal_Bool bBottom, sal_Bool bLeft, sal_Bool bRight ); public: - SwHTMLWrtTable( const SwTableLines& rLines, long nWidth, sal_uInt16 nBWidth, + SwHTMLWrtTable( const SwTableLines& rLines, long nWidth, sal_uInt32 nBWidth, sal_Bool bRel, USHORT nNumOfRowsToRepeat, sal_uInt16 nLeftSub=0, sal_uInt16 nRightSub=0 ); SwHTMLWrtTable( const SwHTMLTableLayout *pLayoutInfo ); @@ -111,7 +111,7 @@ public: SwHTMLWrtTable::SwHTMLWrtTable( const SwTableLines& rLines, long nWidth, - sal_uInt16 nBWidth, sal_Bool bRel, USHORT nNumOfRowsToRepeat, + sal_uInt32 nBWidth, sal_Bool bRel, USHORT nNumOfRowsToRepeat, sal_uInt16 nLSub, sal_uInt16 nRSub ) : SwWriteTable( rLines, nWidth, nBWidth, bRel, MAX_DEPTH, nLSub, nRSub, nNumOfRowsToRepeat ) { @@ -337,7 +337,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, #ifndef PURE_HTML long nWidth = 0; - sal_uInt16 nPrcWidth = USHRT_MAX; + sal_uInt32 nPrcWidth = ULONG_MAX; if( bOutWidth ) { if( bLayoutExport ) @@ -471,7 +471,9 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, } else { - sal_uInt16 nTWidth, nBWidth, nLSub, nRSub; + sal_uInt16 nTWidth; + sal_uInt32 nBWidth; + sal_uInt16 nLSub, nRSub; if( HasRelWidths() ) { nTWidth = 100; @@ -845,7 +847,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, ByteString sOutStr( '<' ); sOutStr += OOO_STRING_SVTOOLS_HTML_col; - sal_uInt16 nWidth; + sal_uInt32 nWidth; sal_Bool bRel; if( bLayoutExport ) { diff --git a/sw/source/filter/inc/wrtswtbl.hxx b/sw/source/filter/inc/wrtswtbl.hxx index 5bbf776351a1..c47ac7809bd0 100644 --- a/sw/source/filter/inc/wrtswtbl.hxx +++ b/sw/source/filter/inc/wrtswtbl.hxx @@ -61,7 +61,7 @@ class SwWriteTableCell long nHeight; // fixe/Mindest-Hoehe der Zeile - USHORT nWidthOpt; // Breite aus Option; + sal_uInt32 nWidthOpt; // Breite aus Option; USHORT nRow; // Start-Zeile USHORT nCol; // Start-Spalte @@ -99,7 +99,7 @@ public: nWidthOpt = nWidth; bPrcWidthOpt = bPrc; } - USHORT GetWidthOpt() const { return nWidthOpt; } + sal_uInt32 GetWidthOpt() const { return nWidthOpt; } BOOL HasPrcWidthOpt() const { return bPrcWidthOpt; } }; @@ -180,9 +180,9 @@ SV_DECL_PTRARR_SORT_DEL( SwWriteTableRows, SwWriteTableRowPtr, 5, 5 ) class SwWriteTableCol { - USHORT nPos; // End Position der Spalte + sal_uInt32 nPos; // End Position der Spalte - USHORT nWidthOpt; + sal_uInt32 nWidthOpt; BOOL bRelWidthOpt : 1; BOOL bOutWidth : 1; // Spaltenbreite ausgeben? @@ -191,9 +191,9 @@ public: BOOL bLeftBorder : 1; // Welche Umrandungen sind da? BOOL bRightBorder : 1; - SwWriteTableCol( USHORT nPosition ); + SwWriteTableCol( sal_uInt32 nPosition ); - USHORT GetPos() const { return nPos; } + sal_uInt32 GetPos() const { return nPos; } void SetLeftBorder( BOOL bBorder ) { bLeftBorder = bBorder; } BOOL HasLeftBorder() const { return bLeftBorder; } @@ -207,11 +207,11 @@ public: inline int operator==( const SwWriteTableCol& rCol ) const; inline int operator<( const SwWriteTableCol& rCol ) const; - void SetWidthOpt( USHORT nWidth, BOOL bRel ) + void SetWidthOpt( sal_uInt32 nWidth, BOOL bRel ) { nWidthOpt = nWidth; bRelWidthOpt = bRel; } - USHORT GetWidthOpt() const { return nWidthOpt; } + sal_uInt32 GetWidthOpt() const { return nWidthOpt; } BOOL HasRelWidthOpt() const { return bRelWidthOpt; } }; @@ -248,14 +248,14 @@ protected: USHORT nBorder; // Dicke der ausseren Umrandung USHORT nInnerBorder; // Dicke der inneren Umrandung - USHORT nBaseWidth; // Bezugsgroesse fur Breiten SwFmtFrmSize + sal_uInt32 nBaseWidth; // Bezugsgroesse fur Breiten SwFmtFrmSize USHORT nHeadEndRow; // letzte Zeile des Tabellen-Kopfes USHORT nLeftSub; USHORT nRightSub; - long nTabWidth; // Absolute/Relative Breite der Tabelle + sal_uInt32 nTabWidth; // Absolute/Relative Breite der Tabelle BOOL bRelWidths : 1; // Breiten relativ ausgeben? BOOL bUseLayoutHeights : 1; // Layout zur Hoehenbestimmung nehmen? @@ -271,16 +271,16 @@ protected: virtual BOOL ShouldExpandSub( const SwTableBox *pBox, BOOL bExpandedBefore, USHORT nDepth ) const; - void CollectTableRowsCols( long nStartRPos, USHORT nStartCPos, + void CollectTableRowsCols( long nStartRPos, sal_uInt32 nStartCPos, long nParentLineHeight, - USHORT nParentLineWidth, + sal_uInt32 nParentLineWidth, const SwTableLines& rLines, USHORT nDepth ); void FillTableRowsCols( long nStartRPos, USHORT nStartRow, - USHORT nStartCPos, USHORT nStartCol, + sal_uInt32 nStartCPos, USHORT nStartCol, long nParentLineHeight, - USHORT nParentLineWidth, + sal_uInt32 nParentLineWidth, const SwTableLines& rLines, const SvxBrushItem* pLineBrush, USHORT nDepth, @@ -292,14 +292,14 @@ protected: USHORT nRowSpan, USHORT nColSpan, USHORT &rTopBorder, USHORT &rBottomBorder ); - USHORT GetBaseWidth() const { return nBaseWidth; } + sal_uInt32 GetBaseWidth() const { return nBaseWidth; } BOOL HasRelWidths() const { return bRelWidths; } public: - static long GetBoxWidth( const SwTableBox *pBox ); + static sal_uInt32 GetBoxWidth( const SwTableBox *pBox ); - USHORT GetRawWidth( USHORT nCol, USHORT nColSpan ) const; + sal_uInt32 GetRawWidth( USHORT nCol, USHORT nColSpan ) const; USHORT GetAbsWidth( USHORT nCol, USHORT nColSpan ) const; USHORT GetRelWidth( USHORT nCol, USHORT nColSpan ) const; USHORT GetPrcWidth( USHORT nCol, USHORT nColSpan ) const; @@ -317,7 +317,7 @@ protected: public: - SwWriteTable( const SwTableLines& rLines, long nWidth, USHORT nBWidth, + SwWriteTable( const SwTableLines& rLines, long nWidth, sal_uInt32 nBWidth, BOOL bRel, USHORT nMaxDepth = USHRT_MAX, USHORT nLeftSub=0, USHORT nRightSub=0, sal_uInt32 nNumOfRowsToRepeat=0 ); SwWriteTable( const SwHTMLTableLayout *pLayoutInfo ); diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx index 9c889fd2519b..9fd6bd3804b5 100644 --- a/sw/source/filter/writer/wrtswtbl.cxx +++ b/sw/source/filter/writer/wrtswtbl.cxx @@ -92,7 +92,7 @@ SwWriteTableCell *SwWriteTableRow::AddCell( const SwTableBox *pBox, //----------------------------------------------------------------------- -SwWriteTableCol::SwWriteTableCol(USHORT nPosition) +SwWriteTableCol::SwWriteTableCol(sal_uInt32 nPosition) : nPos(nPosition), nWidthOpt(0), bRelWidthOpt(false), bOutWidth(true), bLeftBorder(true), bRightBorder(true) { @@ -100,13 +100,13 @@ SwWriteTableCol::SwWriteTableCol(USHORT nPosition) //----------------------------------------------------------------------- -long SwWriteTable::GetBoxWidth( const SwTableBox *pBox ) +sal_uInt32 SwWriteTable::GetBoxWidth( const SwTableBox *pBox ) { const SwFrmFmt *pFmt = pBox->GetFrmFmt(); const SwFmtFrmSize& aFrmSize= (const SwFmtFrmSize&)pFmt->GetFmtAttr( RES_FRM_SIZE ); - return aFrmSize.GetSize().Width(); + return sal::static_int_cast(aFrmSize.GetSize().Width()); } long SwWriteTable::GetLineHeight( const SwTableLine *pLine ) @@ -306,9 +306,9 @@ USHORT SwWriteTable::MergeBoxBorders( const SwTableBox *pBox, } -USHORT SwWriteTable::GetRawWidth( USHORT nCol, USHORT nColSpan ) const +sal_uInt32 SwWriteTable::GetRawWidth( USHORT nCol, USHORT nColSpan ) const { - USHORT nWidth = aCols[nCol+nColSpan-1]->GetPos(); + sal_uInt32 nWidth = aCols[nCol+nColSpan-1]->GetPos(); if( nCol > 0 ) nWidth = nWidth - aCols[nCol-1]->GetPos(); @@ -352,7 +352,7 @@ USHORT SwWriteTable::GetRightSpace( USHORT nCol, USHORT nColSpan ) const USHORT SwWriteTable::GetAbsWidth( USHORT nCol, USHORT nColSpan ) const { - long nWidth = GetRawWidth( nCol, nColSpan ); + sal_uInt32 nWidth = GetRawWidth( nCol, nColSpan ); if( nBaseWidth != nTabWidth ) { nWidth *= nTabWidth; @@ -419,9 +419,9 @@ BOOL SwWriteTable::ShouldExpandSub(const SwTableBox *pBox, BOOL /*bExpandedBefor } void SwWriteTable::CollectTableRowsCols( long nStartRPos, - USHORT nStartCPos, + sal_uInt32 nStartCPos, long nParentLineHeight, - USHORT nParentLineWidth, + sal_uInt32 nParentLineWidth, const SwTableLines& rLines, USHORT nDepth ) { @@ -429,7 +429,7 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, USHORT nLines = rLines.Count(); #ifdef DBG_UTIL - USHORT nEndCPos = 0; + sal_uInt32 nEndCPos = 0; #endif long nRPos = nStartRPos; @@ -484,16 +484,16 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); USHORT nBoxes = rBoxes.Count(); - USHORT nCPos = nStartCPos; + sal_uInt32 nCPos = nStartCPos; for( USHORT nBox=0; nBoxGetTabBoxes(); sal_uInt16 nBoxes = rBoxes.Count(); - sal_uInt16 nCPos = 0U; + sal_uInt32 nCPos = 0U; for( sal_uInt16 nBox=0U; nBoxGetColumns(); - sal_uInt16 nCPos = 0U; + sal_uInt32 nCPos = 0U; sal_uInt16 nColumns = rCols.Count(); for( sal_uInt16 nColumn=0U; nColumnGetPos(); sal_uInt32 nWidth = nCPos - nOldCPos; @@ -634,7 +634,7 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines, nColAbsWidth += (nBaseWidth/2UL); nColAbsWidth /= nBaseWidth; } - pColumn->SetWidthOpt( (sal_uInt16)nColAbsWidth, sal_False ); + pColumn->SetWidthOpt( nColAbsWidth, sal_False ); } ULONG nExpPos = 0; @@ -678,16 +678,16 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines, const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); sal_uInt16 nBoxes = rBoxes.Count(); - sal_uInt16 nCPos = 0U; + sal_uInt32 nCPos = 0U; sal_uInt16 nCol = 0U; for( sal_uInt16 nBox=0U; nBoxGetWidth(); + nCPos = pLines->GetWidth(); // Und ihren Index @@ -959,7 +959,7 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine, const SwTableBoxes& rBoxes = rLine.GetTabBoxes(); sal_uInt16 nBoxes = rBoxes.Count(); - sal_uInt16 nCPos = 0U; + sal_uInt32 nCPos = 0U; sal_uInt16 nCol = 0U; for( sal_uInt16 nBox=0U; nBox Date: Fri, 5 Nov 2010 11:26:52 +0100 Subject: #i112413# for statement fixed --- sw/source/ui/envelp/mailmrge.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 141adf35ddf0..43ef58b11d7c 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -779,7 +779,7 @@ bool SwMailMergeDlg::ExecQryShell() m_aSelection.realloc(nEnd - nStart + 1); Any* pSelection = m_aSelection.getArray(); - for (sal_Int32 i = nStart; i != nEnd; ++i, ++pSelection) + for (sal_Int32 i = nStart; i <= nEnd; ++i, ++pSelection) *pSelection <<= i; } else if (aAllRB.IsChecked() ) -- cgit From ee1eea2290eb17c427efa9deecac83b1c354bca1 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Fri, 5 Nov 2010 15:58:35 +0100 Subject: pl08: #163778# check SID_PASSWORD also here --- sfx2/source/doc/objserv.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index ff10b7917142..b0be3638f2a4 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -600,7 +600,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) sal_Bool bPreselectPassword = sal_False; SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pOldEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, FALSE ); - if ( pOldEncryptionDataItem ) + SFX_ITEMSET_ARG( GetMedium()->GetItemSet(), pOldPasswordItem, SfxStringItem, SID_PASSWORD, FALSE ); + if ( pOldEncryptionDataItem || pOldPasswordItem ) bPreselectPassword = sal_True; uno::Sequence< beans::PropertyValue > aDispatchArgs; -- cgit From c095077decb7470df00f343be3068e894a2fd582 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 5 Nov 2010 16:14:26 +0100 Subject: remove duplicate entry for passwd.obj --- sfx2/source/dialog/makefile.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk index 705a4c040b1a..572053557e00 100644 --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -42,7 +42,6 @@ EXCEPTIONSFILES=\ $(SLO)$/itemconnect.obj \ $(SLO)$/mailmodel.obj \ $(SLO)$/partwnd.obj \ - $(SLO)$/passwd.obj \ $(SLO)$/recfloat.obj \ $(SLO)$/templdlg.obj \ $(SLO)$/dinfdlg.obj \ -- cgit From af20ce4d3a9c404be88534ef4c99344f8df9dc44 Mon Sep 17 00:00:00 2001 From: os Date: Mon, 8 Nov 2010 13:07:04 +0100 Subject: #i112630# detect pdf filter by mimetype instead of calling GetFiltet4Extension() --- sw/source/ui/dbui/mmoutputpage.cxx | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 0fe1a3717ca1..ee2803e73aad 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -1106,8 +1106,6 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) if(nRet != RET_OK && nRet != RET_YES) return 0; } - //create the send dialog - SwSendMailDialog* pDlg = new SwSendMailDialog( pButton, rConfigItem ); //add the documents sal_uInt32 nBegin = 0; sal_uInt32 nEnd = 0; @@ -1133,7 +1131,26 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) switch( nDocType ) { case MM_DOCTYPE_OOO : break; - case MM_DOCTYPE_PDF : bIsPDF = true; break; + case MM_DOCTYPE_PDF : bIsPDF = true; + { + //the method SwIOSystemGetFilterOfFormat( ) returns the template filter + //because it uses the same user data :-( + SfxFilterMatcher aMatcher( pFilterContainer->GetName() ); + SfxFilterMatcherIter aIter( &aMatcher ); + const SfxFilter* pFilter = aIter.First(); + String sFilterMime( String::CreateFromAscii( "application/pdf" )); + while ( pFilter ) + { + if( pFilter->GetMimeType() == sFilterMime && pFilter->CanExport() ) + { + pSfxFlt = pFilter; + break; + } + pFilter = aIter.Next(); + } + + } + break; case MM_DOCTYPE_WORD: { //the method SwIOSystemGetFilterOfFormat( ) returns the template filter @@ -1239,6 +1256,8 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY); xStore->storeToURL( sTargetTempURL, aValues ); + //create the send dialog + SwSendMailDialog* pDlg = new SwSendMailDialog( pButton, rConfigItem ); pDlg->SetDocumentCount( nEnd ); pDlg->ShowDialog(); //help to force painting the dialog -- cgit From f0b6b3f4772228de80bde7b06414a2ed1ae8500f Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 8 Nov 2010 15:23:02 +0100 Subject: pl08: #163778# fix nonpro build --- oox/inc/oox/dump/dumperbase.hxx | 4 ++-- oox/source/dump/biffdumper.cxx | 2 +- oox/source/dump/dumperbase.cxx | 16 +++++++++------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/oox/inc/oox/dump/dumperbase.hxx b/oox/inc/oox/dump/dumperbase.hxx index ed1a3e1fc938..d9acaa1f1011 100644 --- a/oox/inc/oox/dump/dumperbase.hxx +++ b/oox/inc/oox/dump/dumperbase.hxx @@ -910,7 +910,7 @@ public: void eraseNameList( const ::rtl::OUString& rListName ); NameListRef getNameList( const ::rtl::OUString& rListName ) const; - ::rtl::OUString requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ); inline bool isPasswordCancelled() const { return mbPwCancelled; } protected: @@ -1011,7 +1011,7 @@ public: template< typename Type > bool hasName( const NameListWrapper& rListWrp, Type nKey ) const; - ::rtl::OUString requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ); bool isPasswordCancelled() const; protected: diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx index 30938f9ebbe6..b78c993a0968 100644 --- a/oox/source/dump/biffdumper.cxx +++ b/oox/source/dump/biffdumper.cxx @@ -2324,7 +2324,7 @@ void WorkbookStreamObject::implDumpRecordBody() rStrm.seekToStart(); BiffDecoderRef xDecoder = BiffCodecHelper::implReadFilePass( rStrm, eBiff ); if( xDecoder.get() ) - cfg().requestPassword( *xDecoder ); + cfg().requestEncryptionData( *xDecoder ); setBinaryOnlyMode( !xDecoder || !xDecoder->isValid() ); } break; diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx index 807a5ec74715..53452765288a 100644 --- a/oox/source/dump/dumperbase.cxx +++ b/oox/source/dump/dumperbase.cxx @@ -65,6 +65,8 @@ using ::com::sun::star::io::XTextOutputStream; using ::comphelper::MediaDescriptor; using ::oox::core::FilterBase; +using namespace ::com::sun::star; + namespace oox { namespace dump { @@ -1581,18 +1583,18 @@ NameListRef SharedConfigData::getNameList( const OUString& rListName ) const return xList; } -OUString SharedConfigData::requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) +uno::Sequence< beans::NamedValue > SharedConfigData::requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) { - OUString aPassword; + uno::Sequence< beans::NamedValue > aEncryptionData; if( !mbPwCancelled ) { ::std::vector< OUString > aDefaultPasswords; aDefaultPasswords.push_back( CREATE_OUSTRING( "VelvetSweatshop" ) ); - aPassword = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( + aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( rVerifier, mrMediaDesc, ::comphelper::DocPasswordRequestType_MS, &aDefaultPasswords ); - mbPwCancelled = aPassword.getLength() == 0; + mbPwCancelled = aEncryptionData.getLength() == 0; } - return aPassword; + return aEncryptionData; } bool SharedConfigData::implIsValid() const @@ -1764,9 +1766,9 @@ NameListRef Config::getNameList( const String& rListName ) const return implGetNameList( rListName ); } -OUString Config::requestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) +uno::Sequence< beans::NamedValue > Config::requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier ) { - return mxCfgData->requestPassword( rVerifier ); + return mxCfgData->requestEncryptionData( rVerifier ); } bool Config::isPasswordCancelled() const -- cgit From d9412918c0ef7b1bc85b76e431ac0d8f8de0b87b Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Mon, 8 Nov 2010 15:23:02 +0100 Subject: pl08: #163778# fix nonpro build --- sc/source/filter/excel/excel.cxx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index 0c3d7783645a..90ac8011a4bf 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #include #include @@ -99,12 +101,17 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument SfxItemSet* pItemSet = rMedium.GetItemSet(); if( pItemSet ) { - if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_FILE_NAME ) ) ) - aMediaDesc[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pItem->GetValue() ); - if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_PASSWORD ) ) ) - aMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= ::rtl::OUString( pItem->GetValue() ); - if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_ENCRYPTIONDATA ) ) ) - aMediaDesc[ MediaDescriptor::PROP_ENCRYPTIONDATA() ] = pItem->GetValue(); + SFX_ITEMSET_ARG( pItemSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, sal_False); + if( pFileNameItem ) + aMediaDesc[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pFileNameItem->GetValue() ); + + SFX_ITEMSET_ARG( pItemSet, pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False); + if( pPasswordItem ) + aMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= ::rtl::OUString( pPasswordItem->GetValue() ); + + SFX_ITEMSET_ARG( pItemSet, pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False); + if( pEncryptionDataItem ) + aMediaDesc[ MediaDescriptor::PROP_ENCRYPTIONDATA() ] = pEncryptionDataItem->GetValue(); } aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream(); aMediaDesc[ MediaDescriptor::PROP_INTERACTIONHANDLER() ] <<= rMedium.GetInteractionHandler(); -- cgit From a8d5dde93273eccd3783cb5839c10490c328bb4e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 8 Nov 2010 16:19:30 +0100 Subject: remove a warning --- filter/source/msfilter/mscodec.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/filter/source/msfilter/mscodec.cxx b/filter/source/msfilter/mscodec.cxx index 626a91ff4262..7387e566f24e 100644 --- a/filter/source/msfilter/mscodec.cxx +++ b/filter/source/msfilter/mscodec.cxx @@ -277,6 +277,7 @@ MSCodec_Std97::~MSCodec_Std97 () rtl_cipher_destroy (m_hCipher); } +#if 0 #if DEBUG_MSO_ENCRYPTION_STD97 static void lcl_PrintKeyData(const sal_uInt8* pKeyData, const char* msg) { @@ -293,6 +294,7 @@ static void lcl_PrintKeyData(const sal_uInt8* /*pKeyData*/, const char* /*msg*/) { } #endif +#endif #if DEBUG_MSO_ENCRYPTION_STD97 static void lcl_PrintDigest(const sal_uInt8* pDigest, const char* msg) -- cgit From 2a1bd4a1b592979cc6a7dd69ece04d2f8467e42d Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Tue, 9 Nov 2010 18:49:51 +0100 Subject: pl08: #163135# reduce lifetime of cleartext passwords --- filter/source/pdf/impdialog.cxx | 16 ++++++++-------- filter/source/pdf/impdialog.hxx | 6 ++++-- filter/source/pdf/pdfexport.cxx | 31 ++++++++++++++++++++++--------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index d542d47ec449..1adbbc63619c 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -33,7 +33,9 @@ #include "vcl/svapp.hxx" #include "vcl/msgbox.hxx" #include "sfx2/passwd.hxx" -#include "com/sun/star/uno/Sequence.hxx" + +#include "comphelper/storagehelper.hxx" + #include "com/sun/star/text/XTextRange.hpp" #include "com/sun/star/drawing/XShapes.hpp" #include "com/sun/star/container/XIndexAccess.hpp" @@ -392,8 +394,8 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() nElementAdded--; //add the permission password - aRet[ aRet.getLength() - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PermissionPassword" ) ); - aRet[ aRet.getLength() - nElementAdded ].Value <<= OUString( msOwnerPassword ); + aRet[ aRet.getLength() - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PreparedPermissionPassword" ) ); + aRet[ aRet.getLength() - nElementAdded ].Value <<= maPreparedOwnerPassword; nElementAdded--; // this should be the last added... @@ -1108,7 +1110,7 @@ void ImpPDFTabSecurityPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) paParent->mxPreparedPasswords = mxPreparedPasswords; paParent->mbRestrictPermissions = mbHaveOwnerPassword; - paParent->msOwnerPassword = msOwnerPassword; + paParent->maPreparedOwnerPassword = maPreparedOwnerPassword; //verify print status paParent->mnPrint = 0; @@ -1200,14 +1202,12 @@ IMPL_LINK( ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl, void*, EMPTYARG ) mxPreparedPasswords = vcl::PDFWriter::InitEncryption( aOwnerPW, aUserPW, true ); - // FIXME: used as parameter for hybrid PDF if( mbHaveOwnerPassword ) { - // force deep copy, not ref count - msOwnerPassword = rtl::OUString( aOwnerPW.getStr(), aOwnerPW.getLength() ); + maPreparedOwnerPassword = comphelper::OStorageHelper::CreatePackageEncryptionData( aOwnerPW ); } else - msOwnerPassword = rtl::OUString(); + maPreparedOwnerPassword = Sequence< NamedValue >(); // trash clear text passwords string memory rtl_zeroMemory( (void*)aUserPW.getStr(), aUserPW.getLength() ); diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index 743a41fcc032..3fd98c775e0d 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -44,6 +44,8 @@ #include "sfx2/tabdlg.hxx" +#include "com/sun/star/beans/NamedValue.hpp" + // ---------------- // - ImpPDFDialog - // ---------------- @@ -128,7 +130,7 @@ protected: sal_Bool mbEncrypt; sal_Bool mbRestrictPermissions; - rtl::OUString msOwnerPassword; + com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > maPreparedOwnerPassword; sal_Int32 mnPrint; sal_Int32 mnChangesAllowed; sal_Bool mbCanCopyOrExtract; @@ -344,7 +346,7 @@ class ImpPDFTabSecurityPage : public SfxTabPage bool mbHaveOwnerPassword; bool mbHaveUserPassword; - rtl::OUString msOwnerPassword; + com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > maPreparedOwnerPassword; String msOwnerPwdTitle; com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > mxPreparedPasswords; diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 22c2d2979bb8..2c0b1c5736f3 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -50,6 +50,7 @@ #include "svtools/filter.hxx" #include "svl/solar.hrc" #include "comphelper/string.hxx" +#include "comphelper/storagehelper.hxx" #include "unotools/streamwrap.hxx" #include "com/sun/star/io/XSeekable.hpp" @@ -260,12 +261,12 @@ sal_Bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, Reference< com: class PDFExportStreamDoc : public vcl::PDFOutputStream { - Reference< XComponent > m_xSrcDoc; - rtl::OUString m_aPassWd; + Reference< XComponent > m_xSrcDoc; + Sequence< beans::NamedValue > m_aPreparedPassword; public: - PDFExportStreamDoc( const Reference< XComponent >& xDoc, const rtl::OUString& rPwd ) + PDFExportStreamDoc( const Reference< XComponent >& xDoc, const Sequence& rPwd ) : m_xSrcDoc( xDoc ), - m_aPassWd( rPwd ) + m_aPreparedPassword( rPwd ) {} virtual ~PDFExportStreamDoc(); @@ -281,15 +282,16 @@ void PDFExportStreamDoc::write( const Reference< XOutputStream >& xStream ) Reference< com::sun::star::frame::XStorable > xStore( m_xSrcDoc, UNO_QUERY ); if( xStore.is() ) { - Sequence< beans::PropertyValue > aArgs( m_aPassWd.getLength() ? 3 : 2 ); + Sequence< beans::PropertyValue > aArgs( 2 + m_aPreparedPassword.getLength() ); aArgs.getArray()[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) ); aArgs.getArray()[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OutputStream" ) ); aArgs.getArray()[1].Value <<= xStream; - if( m_aPassWd.getLength() ) + for( sal_Int32 i = 0; i < m_aPreparedPassword.getLength(); ++i ) { - aArgs.getArray()[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) ); - aArgs.getArray()[2].Value <<= m_aPassWd; + aArgs.getArray()[i+2].Name = m_aPreparedPassword[i].Name; + aArgs.getArray()[i+2].Value = m_aPreparedPassword[i].Value; } + try { xStore->storeToURL( OUString( RTL_CONSTASCII_USTRINGPARAM( "private:stream" ) ), @@ -403,6 +405,7 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue PDFWriter::PDFWriterContext aContext; rtl::OUString aOpenPassword, aPermissionPassword; Reference< beans::XMaterialHolder > xEnc; + Sequence< beans::NamedValue > aPreparedPermissionPassword; // getting the string for the creator @@ -530,6 +533,8 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue rFilterData[ nData ].Value >>= aPermissionPassword; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PreparedPasswords" ) ) ) rFilterData[ nData ].Value >>= xEnc; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PreparedPermissionPassword" ) ) ) + rFilterData[ nData ].Value >>= aPreparedPermissionPassword; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Printing" ) ) ) rFilterData[ nData ].Value >>= mnPrintAllowed; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Changes" ) ) ) @@ -710,7 +715,15 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue aContext.Encryption.CanExtractForAccessibility = mbCanExtractForAccessibility; if( mbEncrypt && ! xEnc.is() ) xEnc = PDFWriter::InitEncryption( aPermissionPassword, aOpenPassword, aContext.Encryption.Security128bit ); + if( mbEncrypt && aPermissionPassword.getLength() && ! aPreparedPermissionPassword.getLength() ) + aPreparedPermissionPassword = comphelper::OStorageHelper::CreatePackageEncryptionData( aPermissionPassword ); } + // after this point we don't need the legacy clear passwords anymore + // however they are still inside the passed filter data sequence + // which is sadly out out our control + aPermissionPassword = rtl::OUString(); + aOpenPassword = rtl::OUString(); + /* * FIXME: the entries are only implicitly defined by the resource file. Should there * ever be an additional form submit format this could get invalid. @@ -786,7 +799,7 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue // get mimetype OUString aSrcMimetype = getMimetypeForDocument( mxMSF, mxSrcDoc ); pPDFWriter->AddStream( aSrcMimetype, - new PDFExportStreamDoc( mxSrcDoc, aPermissionPassword ), + new PDFExportStreamDoc( mxSrcDoc, aPreparedPermissionPassword ), false ); } -- cgit From 32d199dcdb1009e5e1ea8995d5728fed75dfdd0a Mon Sep 17 00:00:00 2001 From: sj Date: Wed, 10 Nov 2010 18:26:26 +0100 Subject: impress202: #i93300# fixed crash loading 96bit tiffs --- filter/source/graphicfilter/itiff/itiff.cxx | 370 +++++++++++++++------------- 1 file changed, 195 insertions(+), 175 deletions(-) diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index f10b8a15f3ef..6f356b042d28 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -764,245 +764,259 @@ BOOL TIFFReader::ConvertScanline( ULONG nY ) } else if ( nPhotometricInterpretation == 2 && nSamplesPerPixel >= 3 ) { - ULONG nMinMax = nMinSampleValue * 255 / ( nMaxSampleValue - nMinSampleValue ); - for ( nx = 0; nx < nImageWidth; nx++ ) + if ( nMaxSampleValue > nMinSampleValue ) { - if ( nPlanes < 3 ) - { - nRed = GetBits( pMap[ 0 ], ( nx * nSamplesPerPixel + 0 ) * nBitsPerSample, nBitsPerSample ); - nGreen = GetBits( pMap[ 1 ], ( nx * nSamplesPerPixel + 1 ) * nBitsPerSample, nBitsPerSample ); - nBlue = GetBits( pMap[ 2 ], ( nx * nSamplesPerPixel + 2 ) * nBitsPerSample, nBitsPerSample ); - } - else + ULONG nMinMax = nMinSampleValue * 255 / ( nMaxSampleValue - nMinSampleValue ); + for ( nx = 0; nx < nImageWidth; nx++ ) { - nRed = GetBits( pMap[ 0 ], nx * nBitsPerSample, nBitsPerSample ); - nGreen = GetBits( pMap[ 1 ], nx * nBitsPerSample, nBitsPerSample ); - nBlue = GetBits( pMap[ 2 ], nx * nBitsPerSample, nBitsPerSample ); + if ( nPlanes < 3 ) + { + nRed = GetBits( pMap[ 0 ], ( nx * nSamplesPerPixel + 0 ) * nBitsPerSample, nBitsPerSample ); + nGreen = GetBits( pMap[ 1 ], ( nx * nSamplesPerPixel + 1 ) * nBitsPerSample, nBitsPerSample ); + nBlue = GetBits( pMap[ 2 ], ( nx * nSamplesPerPixel + 2 ) * nBitsPerSample, nBitsPerSample ); + } + else + { + nRed = GetBits( pMap[ 0 ], nx * nBitsPerSample, nBitsPerSample ); + nGreen = GetBits( pMap[ 1 ], nx * nBitsPerSample, nBitsPerSample ); + nBlue = GetBits( pMap[ 2 ], nx * nBitsPerSample, nBitsPerSample ); + } + pAcc->SetPixel( nY, nx, Color( (BYTE)( nRed - nMinMax ), (BYTE)( nGreen - nMinMax ), (BYTE)(nBlue - nMinMax) ) ); } - pAcc->SetPixel( nY, nx, Color( (BYTE)( nRed - nMinMax ), (BYTE)( nGreen - nMinMax ), (BYTE)(nBlue - nMinMax) ) ); } } else if ( nPhotometricInterpretation == 5 && nSamplesPerPixel == 3 ) { - ULONG nMinMax = nMinSampleValue * 255 / ( nMaxSampleValue - nMinSampleValue ); - for ( nx = 0; nx < nImageWidth; nx++ ) + if ( nMaxSampleValue > nMinSampleValue ) { - if ( nPlanes < 3 ) - { - nRed = GetBits( pMap[ 0 ],( nx * nSamplesPerPixel + 0 ) * nBitsPerSample, nBitsPerSample ); - nGreen = GetBits( pMap[ 0 ],( nx * nSamplesPerPixel + 1 ) * nBitsPerSample, nBitsPerSample ); - nBlue = GetBits( pMap[ 0 ],( nx * nSamplesPerPixel + 2 ) * nBitsPerSample, nBitsPerSample ); - } - else + ULONG nMinMax = nMinSampleValue * 255 / ( nMaxSampleValue - nMinSampleValue ); + for ( nx = 0; nx < nImageWidth; nx++ ) { - nRed = GetBits( pMap[ 0 ], nx * nBitsPerSample, nBitsPerSample ); - nGreen = GetBits( pMap[ 1 ], nx * nBitsPerSample, nBitsPerSample ); - nBlue = GetBits( pMap[ 2 ], nx * nBitsPerSample, nBitsPerSample ); + if ( nPlanes < 3 ) + { + nRed = GetBits( pMap[ 0 ],( nx * nSamplesPerPixel + 0 ) * nBitsPerSample, nBitsPerSample ); + nGreen = GetBits( pMap[ 0 ],( nx * nSamplesPerPixel + 1 ) * nBitsPerSample, nBitsPerSample ); + nBlue = GetBits( pMap[ 0 ],( nx * nSamplesPerPixel + 2 ) * nBitsPerSample, nBitsPerSample ); + } + else + { + nRed = GetBits( pMap[ 0 ], nx * nBitsPerSample, nBitsPerSample ); + nGreen = GetBits( pMap[ 1 ], nx * nBitsPerSample, nBitsPerSample ); + nBlue = GetBits( pMap[ 2 ], nx * nBitsPerSample, nBitsPerSample ); + } + nRed = 255 - (BYTE)( nRed - nMinMax ); + nGreen = 255 - (BYTE)( nGreen - nMinMax ); + nBlue = 255 - (BYTE)( nBlue - nMinMax ); + pAcc->SetPixel( nY, nx, Color( (BYTE) nRed, (BYTE) nGreen, (BYTE) nBlue ) ); } - nRed = 255 - (BYTE)( nRed - nMinMax ); - nGreen = 255 - (BYTE)( nGreen - nMinMax ); - nBlue = 255 - (BYTE)( nBlue - nMinMax ); - pAcc->SetPixel( nY, nx, Color( (BYTE) nRed, (BYTE) nGreen, (BYTE) nBlue ) ); } } else if( nPhotometricInterpretation == 5 && nSamplesPerPixel == 4 ) { - BYTE nSamp[ 4 ]; - BYTE nSampLast[ 4 ] = { 0, 0, 0, 0 }; - long nBlack; - - for( nx = 0; nx < nImageWidth; nx++ ) + if ( nMaxSampleValue > nMinSampleValue ) { - // sind die Werte als Differenz abgelegt? - if( 2 == nPredictor ) + BYTE nSamp[ 4 ]; + BYTE nSampLast[ 4 ] = { 0, 0, 0, 0 }; + long nBlack; + + for( nx = 0; nx < nImageWidth; nx++ ) { - for( ns = 0; ns < 4; ns++ ) + // sind die Werte als Differenz abgelegt? + if( 2 == nPredictor ) { - if( nPlanes < 3 ) - nSampLast[ ns ] = nSampLast[ ns ] + (BYTE) GetBits( pMap[ 0 ], ( nx * nSamplesPerPixel + ns ) * nBitsPerSample, nBitsPerSample ); - else - nSampLast[ ns ] = nSampLast[ ns ] + (BYTE) GetBits( pMap[ ns ], nx * nBitsPerSample, nBitsPerSample ); - nSamp[ ns ] = nSampLast[ ns ]; + for( ns = 0; ns < 4; ns++ ) + { + if( nPlanes < 3 ) + nSampLast[ ns ] = nSampLast[ ns ] + (BYTE) GetBits( pMap[ 0 ], ( nx * nSamplesPerPixel + ns ) * nBitsPerSample, nBitsPerSample ); + else + nSampLast[ ns ] = nSampLast[ ns ] + (BYTE) GetBits( pMap[ ns ], nx * nBitsPerSample, nBitsPerSample ); + nSamp[ ns ] = nSampLast[ ns ]; + } } - } - else - { - for( ns = 0; ns < 4; ns++ ) + else { - if( nPlanes < 3 ) - nSamp[ ns ] = (BYTE) GetBits( pMap[ 0 ], ( nx * nSamplesPerPixel + ns ) * nBitsPerSample, nBitsPerSample ); - else - nSamp[ ns ]= (BYTE) GetBits( pMap[ ns ], nx * nBitsPerSample, nBitsPerSample ); + for( ns = 0; ns < 4; ns++ ) + { + if( nPlanes < 3 ) + nSamp[ ns ] = (BYTE) GetBits( pMap[ 0 ], ( nx * nSamplesPerPixel + ns ) * nBitsPerSample, nBitsPerSample ); + else + nSamp[ ns ]= (BYTE) GetBits( pMap[ ns ], nx * nBitsPerSample, nBitsPerSample ); + } } + nBlack = nSamp[ 3 ]; + nRed = (BYTE) Max( 0L, 255L - ( ( (long) nSamp[ 0 ] + nBlack - ( ( (long) nMinSampleValue ) << 1 ) ) * + 255L/(long)(nMaxSampleValue-nMinSampleValue) ) ); + nGreen = (BYTE) Max( 0L, 255L - ( ( (long) nSamp[ 1 ] + nBlack - ( ( (long) nMinSampleValue ) << 1 ) ) * + 255L/(long)(nMaxSampleValue-nMinSampleValue) ) ); + nBlue = (BYTE) Max( 0L, 255L - ( ( (long) nSamp[ 2 ] + nBlack - ( ( (long) nMinSampleValue ) << 1 ) ) * + 255L/(long)(nMaxSampleValue-nMinSampleValue) ) ); + pAcc->SetPixel( nY, nx, Color ( (BYTE)nRed, (BYTE)nGreen, (BYTE)nBlue ) ); } - nBlack = nSamp[ 3 ]; - nRed = (BYTE) Max( 0L, 255L - ( ( (long) nSamp[ 0 ] + nBlack - ( ( (long) nMinSampleValue ) << 1 ) ) * - 255L/(long)(nMaxSampleValue-nMinSampleValue) ) ); - nGreen = (BYTE) Max( 0L, 255L - ( ( (long) nSamp[ 1 ] + nBlack - ( ( (long) nMinSampleValue ) << 1 ) ) * - 255L/(long)(nMaxSampleValue-nMinSampleValue) ) ); - nBlue = (BYTE) Max( 0L, 255L - ( ( (long) nSamp[ 2 ] + nBlack - ( ( (long) nMinSampleValue ) << 1 ) ) * - 255L/(long)(nMaxSampleValue-nMinSampleValue) ) ); - pAcc->SetPixel( nY, nx, Color ( (BYTE)nRed, (BYTE)nGreen, (BYTE)nBlue ) ); - } } } else if ( nSamplesPerPixel == 1 && ( nPhotometricInterpretation <= 1 || nPhotometricInterpretation == 3 ) ) { - ULONG nMinMax = ( ( 1 << nDstBitsPerPixel ) - 1 ) / ( nMaxSampleValue - nMinSampleValue ); - BYTE* pt = pMap[ 0 ]; - BYTE nShift; - - switch ( nDstBitsPerPixel ) + if ( nMaxSampleValue > nMinSampleValue ) { - case 8 : + ULONG nMinMax = ( ( 1 << nDstBitsPerPixel ) - 1 ) / ( nMaxSampleValue - nMinSampleValue ); + BYTE* pt = pMap[ 0 ]; + BYTE nShift; + + switch ( nDstBitsPerPixel ) { - BYTE nLast; - if ( bByteSwap ) + case 8 : { - if ( nPredictor == 2 ) + BYTE nLast; + if ( bByteSwap ) { - nLast = BYTESWAP( (BYTE)*pt++ ); - for ( nx = 0; nx < nImageWidth; nx++ ) + if ( nPredictor == 2 ) { - pAcc->SetPixel( nY, nx, nLast ); - nLast = nLast + *pt++; + nLast = BYTESWAP( (BYTE)*pt++ ); + for ( nx = 0; nx < nImageWidth; nx++ ) + { + pAcc->SetPixel( nY, nx, nLast ); + nLast = nLast + *pt++; + } } - } - else - { - for ( nx = 0; nx < nImageWidth; nx++ ) + else { - nLast = *pt++; - pAcc->SetPixel( nY, nx, (BYTE)( ( (BYTESWAP((ULONG)nLast ) - nMinSampleValue ) * nMinMax ) ) ); + for ( nx = 0; nx < nImageWidth; nx++ ) + { + nLast = *pt++; + pAcc->SetPixel( nY, nx, (BYTE)( ( (BYTESWAP((ULONG)nLast ) - nMinSampleValue ) * nMinMax ) ) ); + } } } - } - else - { - if ( nPredictor == 2 ) + else { - nLast = *pt++; - for ( nx = 0; nx < nImageWidth; nx++ ) + if ( nPredictor == 2 ) { - pAcc->SetPixel( nY, nx, nLast ); - nLast = nLast + *pt++; + nLast = *pt++; + for ( nx = 0; nx < nImageWidth; nx++ ) + { + pAcc->SetPixel( nY, nx, nLast ); + nLast = nLast + *pt++; + } } - } - else - { - for ( nx = 0; nx < nImageWidth; nx++ ) + else { - pAcc->SetPixel( nY, nx, (BYTE)( ( (ULONG)*pt++ - nMinSampleValue ) * nMinMax ) ); + for ( nx = 0; nx < nImageWidth; nx++ ) + { + pAcc->SetPixel( nY, nx, (BYTE)( ( (ULONG)*pt++ - nMinSampleValue ) * nMinMax ) ); + } } } } - } - break; + break; - case 7 : - case 6 : - case 5 : - case 4 : - case 3 : - case 2 : - { - for ( nx = 0; nx < nImageWidth; nx++ ) + case 7 : + case 6 : + case 5 : + case 4 : + case 3 : + case 2 : { - nVal = ( GetBits( pt, nx * nBitsPerSample, nBitsPerSample ) - nMinSampleValue ) * nMinMax; - pAcc->SetPixel( nY, nx, (BYTE)nVal ); + for ( nx = 0; nx < nImageWidth; nx++ ) + { + nVal = ( GetBits( pt, nx * nBitsPerSample, nBitsPerSample ) - nMinSampleValue ) * nMinMax; + pAcc->SetPixel( nY, nx, (BYTE)nVal ); + } } - } - break; + break; - case 1 : - { - if ( bByteSwap ) + case 1 : { - nx = 0; - nByteCount = ( nImageWidth >> 3 ) + 1; - while ( --nByteCount ) + if ( bByteSwap ) { - nByteVal = *pt++; - pAcc->SetPixel( nY, nx++, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, nx++, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, nx++, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, nx++, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, nx++, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, nx++, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, nx++, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, nx++, nByteVal ); - } - if ( nImageWidth & 7 ) - { - nByteVal = *pt++; - while ( nx < nImageWidth ) + nx = 0; + nByteCount = ( nImageWidth >> 3 ) + 1; + while ( --nByteCount ) { + nByteVal = *pt++; + pAcc->SetPixel( nY, nx++, nByteVal & 1 ); + nByteVal >>= 1; + pAcc->SetPixel( nY, nx++, nByteVal & 1 ); + nByteVal >>= 1; + pAcc->SetPixel( nY, nx++, nByteVal & 1 ); + nByteVal >>= 1; + pAcc->SetPixel( nY, nx++, nByteVal & 1 ); + nByteVal >>= 1; + pAcc->SetPixel( nY, nx++, nByteVal & 1 ); + nByteVal >>= 1; + pAcc->SetPixel( nY, nx++, nByteVal & 1 ); + nByteVal >>= 1; pAcc->SetPixel( nY, nx++, nByteVal & 1 ); nByteVal >>= 1; + pAcc->SetPixel( nY, nx++, nByteVal ); + } + if ( nImageWidth & 7 ) + { + nByteVal = *pt++; + while ( nx < nImageWidth ) + { + pAcc->SetPixel( nY, nx++, nByteVal & 1 ); + nByteVal >>= 1; + } } } - } - else - { - nx = 7; - nByteCount = ( nImageWidth >> 3 ) + 1; - while ( --nByteCount ) - { - nByteVal = *pt++; - pAcc->SetPixel( nY, nx, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, --nx, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, --nx, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, --nx, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, --nx, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, --nx, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, --nx, nByteVal & 1 ); - nByteVal >>= 1; - pAcc->SetPixel( nY, --nx, nByteVal ); - nx += 15; - } - if ( nImageWidth & 7 ) + else { - nx -= 7; - nByteVal = *pt++; - nShift = 7; - while ( nx < nImageWidth ) + nx = 7; + nByteCount = ( nImageWidth >> 3 ) + 1; + while ( --nByteCount ) { - pAcc->SetPixel( nY, nx++, ( nByteVal >> nShift ) & 1); + nByteVal = *pt++; + pAcc->SetPixel( nY, nx, nByteVal & 1 ); + nByteVal >>= 1; + pAcc->SetPixel( nY, --nx, nByteVal & 1 ); + nByteVal >>= 1; + pAcc->SetPixel( nY, --nx, nByteVal & 1 ); + nByteVal >>= 1; + pAcc->SetPixel( nY, --nx, nByteVal & 1 ); + nByteVal >>= 1; + pAcc->SetPixel( nY, --nx, nByteVal & 1 ); + nByteVal >>= 1; + pAcc->SetPixel( nY, --nx, nByteVal & 1 ); + nByteVal >>= 1; + pAcc->SetPixel( nY, --nx, nByteVal & 1 ); + nByteVal >>= 1; + pAcc->SetPixel( nY, --nx, nByteVal ); + nx += 15; + } + if ( nImageWidth & 7 ) + { + nx -= 7; + nByteVal = *pt++; + nShift = 7; + while ( nx < nImageWidth ) + { + pAcc->SetPixel( nY, nx++, ( nByteVal >> nShift ) & 1); + } } } } - } - break; + break; - default : - return FALSE; + default : + return FALSE; + } } } else if ( ( nSamplesPerPixel == 2 ) && ( nBitsPerSample == 8 ) && ( nPlanarConfiguration == 1 ) && ( pColorMap == 0 ) ) // grayscale { - ULONG nMinMax = ( ( 1 << 8 /*nDstBitsPerPixel*/ ) - 1 ) / ( nMaxSampleValue - nMinSampleValue ); - BYTE* pt = pMap[ 0 ]; - if ( nByte1 == 'I' ) - pt++; - for ( nx = 0; nx < nImageWidth; nx++, pt += 2 ) + if ( nMaxSampleValue > nMinSampleValue ) { - pAcc->SetPixel( nY, nx, (BYTE)( ( (ULONG)*pt - nMinSampleValue ) * nMinMax ) ); + ULONG nMinMax = ( ( 1 << 8 /*nDstBitsPerPixel*/ ) - 1 ) / ( nMaxSampleValue - nMinSampleValue ); + BYTE* pt = pMap[ 0 ]; + if ( nByte1 == 'I' ) + pt++; + for ( nx = 0; nx < nImageWidth; nx++, pt += 2 ) + { + pAcc->SetPixel( nY, nx, (BYTE)( ( (ULONG)*pt - nMinSampleValue ) * nMinMax ) ); + } } } else @@ -1207,11 +1221,17 @@ BOOL TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic ) if ( pTIFF->IsEof() ) nNextIfd = 0; } + if ( !nBitsPerSample || ( nBitsPerSample > 32 ) ) + bStatus = FALSE; if ( bStatus ) { if ( nMaxSampleValue == 0 ) - nMaxSampleValue = ( 1 << nBitsPerSample ) - 1; - + { + if ( nBitsPerSample == 32 ) // sj: i93300, compiler bug, 1 << 32 gives 1 one 32bit windows platforms, + nMaxSampleValue = 0xffffffff; // (up from 80286 only the lower 5 bits are used when shifting a 32bit register) + else + nMaxSampleValue = ( 1 << nBitsPerSample ) - 1; + } if ( nPhotometricInterpretation == 2 || nPhotometricInterpretation == 5 || nPhotometricInterpretation == 6 ) nDstBitsPerPixel = 24; else if ( nBitsPerSample*nSamplesPerPixel <= 1 ) -- cgit From cf75a223f4a5020fcafe190c57d90428aa2d557e Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 12 Nov 2010 13:20:35 +0100 Subject: pl08: #i111050# adapt to new static service registration --- filter/source/pdf/pdffilter.component | 3 +++ 1 file changed, 3 insertions(+) diff --git a/filter/source/pdf/pdffilter.component b/filter/source/pdf/pdffilter.component index 36766b61eb97..438d697a77b1 100644 --- a/filter/source/pdf/pdffilter.component +++ b/filter/source/pdf/pdffilter.component @@ -34,4 +34,7 @@ + + + -- cgit From 43d6955ed4d042d57762ae5a379f27e27126634f Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 12 Nov 2010 16:14:48 +0100 Subject: pl08: #i115553# fix a PDF/A and transparencies again --- filter/source/pdf/pdfexport.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 2c0b1c5736f3..7e9ba8d9a13b 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -1010,8 +1010,15 @@ void PDFExport::showErrors( const std::set< PDFWriter::ErrorCode >& rErrors ) sal_Bool PDFExport::ImplExportPage( PDFWriter& rWriter, PDFExtOutDevData& rPDFExtOutDevData, const GDIMetaFile& rMtf ) { - vcl::PDFWriter::PlayMetafileContext aCtx; + const Size aSizePDF( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_POINT ) ); + Point aOrigin; + Rectangle aPageRect( aOrigin, rMtf.GetPrefSize() ); + sal_Bool bRet = sal_True; + rWriter.NewPage( aSizePDF.Width(), aSizePDF.Height() ); + rWriter.SetMapMode( rMtf.GetPrefMapMode() ); + + vcl::PDFWriter::PlayMetafileContext aCtx; GDIMetaFile aMtf; if( mbRemoveTransparencies ) { @@ -1028,14 +1035,6 @@ sal_Bool PDFExport::ImplExportPage( PDFWriter& rWriter, PDFExtOutDevData& rPDFEx aCtx.m_nJPEGQuality = mnQuality; - const Size aSizePDF( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_POINT ) ); - Point aOrigin; - Rectangle aPageRect( aOrigin, rMtf.GetPrefSize() ); - sal_Bool bRet = sal_True; - - rWriter.NewPage( aSizePDF.Width(), aSizePDF.Height() ); - rWriter.SetMapMode( rMtf.GetPrefMapMode() ); - basegfx::B2DRectangle aB2DRect( aPageRect.Left(), aPageRect.Top(), aPageRect.Right(), aPageRect.Bottom() ); rWriter.SetClipRegion( basegfx::B2DPolyPolygon( basegfx::tools::createPolygonFromRect( aB2DRect ) ) ); -- cgit From 831bb211b6d19b21848908114ced092fec5bd343 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Fri, 12 Nov 2010 16:14:48 +0100 Subject: pl08: #i115553# fix a PDF/A and transparencies again --- vcl/source/gdi/print2.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 25ba80003fd7..5c2a742a10ba 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -407,6 +407,7 @@ static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevic { const MetaLineAction& rMetaLineAction = static_cast(rAct); aActionBounds = Rectangle( rMetaLineAction.GetStartPoint(), rMetaLineAction.GetEndPoint() ); + aActionBounds.Justify(); const long nLineWidth(rMetaLineAction.GetLineInfo().GetWidth()); if(nLineWidth) { -- cgit From f1c428c560e2b0e3abee2e5d53685711165da1cd Mon Sep 17 00:00:00 2001 From: "Oliver Craemer [oc]" Date: Mon, 15 Nov 2010 10:50:20 +0100 Subject: #i115582# [c_updt1.bas] reenabling special handling for Linux in tFileRecentDocuments --- testautomation/spreadsheet/required/includes/c_upd_filemenu.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testautomation/spreadsheet/required/includes/c_upd_filemenu.inc b/testautomation/spreadsheet/required/includes/c_upd_filemenu.inc index ea8efd09dd2c..38c25d41bde5 100644 --- a/testautomation/spreadsheet/required/includes/c_upd_filemenu.inc +++ b/testautomation/spreadsheet/required/includes/c_upd_filemenu.inc @@ -358,10 +358,10 @@ endcase testcase tFileRecentDocuments -'if gPlatform = "lin" then -' warnlog "#110649# Due to bug this testcase is not available" -' goto endsub -'end if +if gPlatform = "lin" then + warnlog "#110649# Due to bug this testcase is not available" + goto endsub +end if dim sTestFile as string -- cgit From f2473c4c8a6b1a261a7b29ef17d8c2dc567e9849 Mon Sep 17 00:00:00 2001 From: "Philipp Lohmann [pl]" Date: Mon, 15 Nov 2010 13:33:31 +0100 Subject: pl08: #163135# fix a snafu in encryption data handling (thanks mav!) --- filter/source/pdf/pdfexport.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 7e9ba8d9a13b..382dd12eeb83 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -282,14 +282,14 @@ void PDFExportStreamDoc::write( const Reference< XOutputStream >& xStream ) Reference< com::sun::star::frame::XStorable > xStore( m_xSrcDoc, UNO_QUERY ); if( xStore.is() ) { - Sequence< beans::PropertyValue > aArgs( 2 + m_aPreparedPassword.getLength() ); + Sequence< beans::PropertyValue > aArgs( 2 + ((m_aPreparedPassword.getLength() > 0) ? 1 : 0) ); aArgs.getArray()[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) ); aArgs.getArray()[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OutputStream" ) ); aArgs.getArray()[1].Value <<= xStream; - for( sal_Int32 i = 0; i < m_aPreparedPassword.getLength(); ++i ) + if( m_aPreparedPassword.getLength() ) { - aArgs.getArray()[i+2].Name = m_aPreparedPassword[i].Name; - aArgs.getArray()[i+2].Value = m_aPreparedPassword[i].Value; + aArgs.getArray()[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionData" ) ); + aArgs.getArray()[2].Value <<= m_aPreparedPassword; } try -- cgit From c0398862334d70c0ecd81833569dc279a628b5e6 Mon Sep 17 00:00:00 2001 From: Christian Lippka ORACLE Date: Mon, 15 Nov 2010 15:50:02 +0100 Subject: impress202: #i113748# applied patch to resolv memory leak for XMLTextListAutoStylePoolEntry_Impl --- xmloff/source/text/XMLTextListAutoStylePool.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xmloff/source/text/XMLTextListAutoStylePool.cxx b/xmloff/source/text/XMLTextListAutoStylePool.cxx index b1b9f039c6b4..f7cbe73acd1b 100644 --- a/xmloff/source/text/XMLTextListAutoStylePool.cxx +++ b/xmloff/source/text/XMLTextListAutoStylePool.cxx @@ -185,7 +185,15 @@ XMLTextListAutoStylePool::XMLTextListAutoStylePool( SvXMLExport& rExp ) : XMLTextListAutoStylePool::~XMLTextListAutoStylePool() { + // The XMLTextListAutoStylePoolEntry_Impl object in the pool need delete explicitly in dtor. + ULONG nCount = pPool->Count(); + while ( nCount-- ) + delete pPool->Remove(nCount); delete pPool; + + nCount = pNames->Count(); + while ( nCount-- ) + delete pNames->Remove(nCount); delete pNames; } -- cgit From 7dc99ab5eb641809a6babd847a31434504e0ceac Mon Sep 17 00:00:00 2001 From: os Date: Wed, 17 Nov 2010 07:36:16 +0100 Subject: #i115608# #i115583# msword library component registration added --- sw/prj/d.lst | 1 + sw/source/filter/ww8/rtfexportfilter.cxx | 39 -------------------------------- sw/util/msword.component | 37 ++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 39 deletions(-) create mode 100644 sw/util/msword.component diff --git a/sw/prj/d.lst b/sw/prj/d.lst index 0cb261c5f0f1..38c4f5046fc8 100644 --- a/sw/prj/d.lst +++ b/sw/prj/d.lst @@ -37,6 +37,7 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\swreport\statusbar ..\%__SRC%\bin\sw*.res %_DEST%\bin%_EXT%\sw*.res ..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.* ..\%__SRC%\misc\swd.component %_DEST%\xml%_EXT%\swd.component +..\%__SRC%\misc\msword.component %_DEST%\xml%_EXT%\msword.component ..\uiconfig\swriter\menubar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\swriter\menubar\*.xml ..\uiconfig\swxform\menubar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\swxform\menubar\*.xml diff --git a/sw/source/filter/ww8/rtfexportfilter.cxx b/sw/source/filter/ww8/rtfexportfilter.cxx index 53608bf73661..31b298a06017 100644 --- a/sw/source/filter/ww8/rtfexportfilter.cxx +++ b/sw/source/filter/ww8/rtfexportfilter.cxx @@ -143,45 +143,6 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey ) -{ - sal_Bool bRet = sal_False; - - if( pRegistryKey ) - { - try - { - uno::Reference< registry::XRegistryKey > xNewKey1( - static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey( - OUString::createFromAscii( IMPL_NAME_RTFEXPORT "/UNO/SERVICES/" ) ) ); - xNewKey1->createKey( RtfExport_getSupportedServiceNames().getConstArray()[0] ); - - bRet = sal_True; - } - catch( registry::InvalidRegistryException& ) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException (rtfexport)!" ); - } - - try - { - uno::Reference< registry::XRegistryKey > xNewKey1( - static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey( - OUString::createFromAscii( IMPL_NAME_RTFIMPORT "/UNO/SERVICES/" ) ) ); - xNewKey1->createKey( RtfExport_getSupportedServiceNames().getConstArray()[0] ); - - bRet = sal_True; - } - catch( registry::InvalidRegistryException& ) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException (rtfimport)!" ); - } - } - - return bRet; -} - - // ------------------------ // - component_getFactory - // ------------------------ diff --git a/sw/util/msword.component b/sw/util/msword.component new file mode 100644 index 000000000000..84ae7aaf965f --- /dev/null +++ b/sw/util/msword.component @@ -0,0 +1,37 @@ + + + + + + + + + + + -- cgit From 98170a58add19fa056e37ad5f033605f840c1747 Mon Sep 17 00:00:00 2001 From: os Date: Wed, 17 Nov 2010 14:34:12 +0100 Subject: msword.component added --- sw/util/makefile.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk index 6fa4bd5432e2..5d474b4325a3 100644 --- a/sw/util/makefile.mk +++ b/sw/util/makefile.mk @@ -375,7 +375,7 @@ SHL5LIBS=$(SLB)$/$(TARGET_VBA).lib .INCLUDE : target.mk -ALLTAR : $(MISC)/sw.component $(MISC)/swd.component $(MISC)/vbaswobj.component +ALLTAR : $(MISC)/sw.component $(MISC)/swd.component $(MISC)/vbaswobj.component $(MISC)/msword.component $(MISC)/sw.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ sw.component @@ -394,3 +394,9 @@ $(MISC)/vbaswobj.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ $(XSLTPROC) --nonet --stringparam uri \ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL5TARGETN:f)' -o $@ \ $(SOLARENV)/bin/createcomponent.xslt vbaswobj.component + +$(MISC)/msword.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + msword.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL5TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt msword.component -- cgit From 731881b92ce7131aff3f78ee8cd9d7c9c524174e Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 17 Nov 2010 15:16:52 +0100 Subject: sb136: #i115386# prefer en[-US] over empty xml:lang value, to accomodate existing extensions with bad .xcu content --- configmgr/source/childaccess.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index c20fa49fb18c..d387f351de30 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -282,8 +282,8 @@ css::uno::Any ChildAccess::asValue() { if (!Components::allLocales(locale)) { // Find best match using an adaption of RFC 4647 lookup matching // rules, removing "-" or "_" delimited segments from the end; - // defaults are the empty string locale, the "en-US" locale, the - // "en" locale, the first child (if any), or a nil value (even + // defaults are the "en-US" locale, the "en" locale, the empty + // string locale, the first child (if any), or a nil value (even // though it may be illegal for the given property), in that // order: rtl::Reference< ChildAccess > child; @@ -296,6 +296,9 @@ css::uno::Any ChildAccess::asValue() { while (i > 0 && locale[i] != '-' && locale[i] != '_') { --i; } + if (i == 0) { + break; + } locale = locale.copy(0, i); } if (!child.is()) { @@ -305,10 +308,13 @@ css::uno::Any ChildAccess::asValue() { child = getChild( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en"))); if (!child.is()) { - std::vector< rtl::Reference< ChildAccess > > all( - getAllChildren()); - if (!all.empty()) { - child = all.front(); + child = getChild(rtl::OUString()); + if (!child.is()) { + std::vector< rtl::Reference< ChildAccess > > + all(getAllChildren()); + if (!all.empty()) { + child = all.front(); + } } } } -- cgit From 697265b8e2ebd60b74747b4e451fdfffde243776 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 17 Nov 2010 15:17:56 +0100 Subject: sb136: #i114155# partially revert fix for i108776 to avoid ABI incompatibility of jvmaccess library --- solenv/bin/addsym.awk | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/solenv/bin/addsym.awk b/solenv/bin/addsym.awk index 52efcb4ab740..621ca2e4bc42 100644 --- a/solenv/bin/addsym.awk +++ b/solenv/bin/addsym.awk @@ -26,16 +26,29 @@ #************************************************************************* # Add certain symbol patterns to the first global section. +# +# The below code fails with 'perverted' mapfiles (using a strange line layout, +# or containing version UDK_3_0_0 without a global section, ...). BEGIN { state = 0 } -/\{/ && state == 1 { exit 1 } #TODO: print error explanation to stderr? -/^[\t ]*UDK_3_0_0[\t ]*\{/ && state == 0 { state = 1 } -/^[\t ]*global[\t ]*:/ && state == 1 { state = 2 } -{ print } +END { + if (state == 0) { + print "# Weak RTTI symbols for C++ exceptions:" + print "UDK_3_0_0 {" + print "global:" + print "_ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions" + if (ENVIRON["USE_SYSTEM_STL"] != "YES") + print "_ZN4_STL7num_put*; # for STLport" + print "};" + } +} state == 2 { print "_ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions" if (ENVIRON["USE_SYSTEM_STL"] != "YES") print "_ZN4_STL7num_put*; # for STLport" state = 3 } -END { if (state != 3) exit 1 } #TODO: print error explanation to stderr? +# #i66636# - ??? +/^[\t ]*UDK_3_0_0[\t ]*\{/ { state = 1 } +/^[\t ]*global[\t ]*:/ && state == 1 { state = 2 } +{ print } -- cgit From afdec552412b32d78d7a118935c0cd8941483fdc Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 17 Nov 2010 15:17:56 +0100 Subject: sb136: #i114155# partially revert fix for i108776 to avoid ABI incompatibility of jvmaccess library --- jvmaccess/util/cc5_solaris_sparc.map | 4 ++-- jvmaccess/util/gcc3.map | 4 ++-- jvmaccess/util/msvc_win32_intel.map | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jvmaccess/util/cc5_solaris_sparc.map b/jvmaccess/util/cc5_solaris_sparc.map index bb59a648f4c5..e2cb767dc65e 100644 --- a/jvmaccess/util/cc5_solaris_sparc.map +++ b/jvmaccess/util/cc5_solaris_sparc.map @@ -25,7 +25,7 @@ # #************************************************************************* -UDK_3_0_0 { +UDK_3.1 { global: # jvmaccess/virtualmachine.hxx: __1cJjvmaccessOVirtualMachineLAttachGuardRCreationException2t6M_v_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException() @@ -52,7 +52,7 @@ UDK_3.2 { __1cJjvmaccesscQ__RTTI__1CpnJjvmaccessOVirtualMachineLAttachGuardRCreationException__; # RTTI for jvmaccess::VirtualMachine::AttachGuard::CreationException * __1cJjvmaccesscR__RTTI__1CpknJjvmaccessOVirtualMachineLAttachGuardRCreationException__; # RTTI for jvmaccess::VirtualMachine::AttachGuard::CreationException const * __1cJjvmaccessOVirtualMachine2t5B6MpnHJavaVM__ibpnHJNIEnv___v_; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *) #Nvariant 1 -} UDK_3_0_0; +} UDK_3.1; UDK_3.3 { global: diff --git a/jvmaccess/util/gcc3.map b/jvmaccess/util/gcc3.map index 707645d2c829..330651a1cf6e 100644 --- a/jvmaccess/util/gcc3.map +++ b/jvmaccess/util/gcc3.map @@ -25,7 +25,7 @@ # #************************************************************************* -UDK_3_0_0 { +UDK_3.1 { global: # jvmaccess/virtualmachine.hxx: _ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionC1Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException() @@ -59,7 +59,7 @@ UDK_3.2 { # We put the '*' at the beginning because its unlikely that these symbols will ever be a postfix of another symbol. _*ZN9jvmaccess14VirtualMachineC1EP10_Jv_JavaVMibP10_Jv_JNIEnv; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *) _*ZN9jvmaccess14VirtualMachineC2EP10_Jv_JavaVMibP10_Jv_JNIEnv; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *) -} UDK_3_0_0; +} UDK_3.1; UDK_3.3 { global: diff --git a/jvmaccess/util/msvc_win32_intel.map b/jvmaccess/util/msvc_win32_intel.map index 4620b1caa940..fd148b1892ba 100644 --- a/jvmaccess/util/msvc_win32_intel.map +++ b/jvmaccess/util/msvc_win32_intel.map @@ -1,4 +1,4 @@ -UDK_3_0_0 { +UDK_3.1 { global: # jvmaccess/virtualmachine.hxx: ??0CreationException@AttachGuard@VirtualMachine@jvmaccess@@QAE@XZ; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException() @@ -15,7 +15,7 @@ UDK_3_0_0 { UDK_3.2 { global: -} UDK_3_0_0; +} UDK_3.1; UDK_3.3 { global: -- cgit From c6f4c90e0228a389aa08a3f7c39c965e8ae0fc0f Mon Sep 17 00:00:00 2001 From: os Date: Thu, 18 Nov 2010 08:26:12 +0100 Subject: #i115608# msword component registration --- sw/util/makefile.mk | 2 +- sw/util/msword.map | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk index 5d474b4325a3..98c616b7036d 100644 --- a/sw/util/makefile.mk +++ b/sw/util/makefile.mk @@ -398,5 +398,5 @@ $(MISC)/vbaswobj.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ $(MISC)/msword.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ msword.component $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL5TARGETN:f)' -o $@ \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL4TARGETN:f)' -o $@ \ $(SOLARENV)/bin/createcomponent.xslt msword.component diff --git a/sw/util/msword.map b/sw/util/msword.map index d2a9d9b4f7e1..6a4f01ffa7f7 100644 --- a/sw/util/msword.map +++ b/sw/util/msword.map @@ -7,7 +7,6 @@ UDK_3_0_0 { SaveOrDelMSVBAStorage_ww8; GetSaveWarningOfMSVBAStorage_ww8; component_getImplementationEnvironment; - component_writeInfo; component_getFactory; local: *; -- cgit From 07c07807b45885bd712dd69e4596459dd2f798e8 Mon Sep 17 00:00:00 2001 From: os Date: Thu, 18 Nov 2010 08:26:12 +0100 Subject: #i115608# msword component registration --- postprocess/packcomponents/makefile.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/postprocess/packcomponents/makefile.mk b/postprocess/packcomponents/makefile.mk index 521b69abdb5c..4cc574249fae 100644 --- a/postprocess/packcomponents/makefile.mk +++ b/postprocess/packcomponents/makefile.mk @@ -98,6 +98,7 @@ my_components = \ mcnttype \ migrationoo2 \ msforms \ + msword \ mysql \ odbc \ offacc \ -- cgit From 113baa8f6f740a96960c9040a142ff0f95c05726 Mon Sep 17 00:00:00 2001 From: os Date: Thu, 18 Nov 2010 10:09:31 +0100 Subject: RtfFilter component added --- writerfilter/util/writerfilter.component | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/writerfilter/util/writerfilter.component b/writerfilter/util/writerfilter.component index 5d4c628df978..7a81b6cc3a2b 100644 --- a/writerfilter/util/writerfilter.component +++ b/writerfilter/util/writerfilter.component @@ -35,4 +35,8 @@ + + + + -- cgit From 2708eda59ad5f985f04c43fc1ab90e3af8b1d626 Mon Sep 17 00:00:00 2001 From: obo Date: Thu, 18 Nov 2010 14:09:19 +0100 Subject: masterfix OOO330: #i114049# Presentation minimizer 1.0.1 does not install on OOO330m15, #i113990# presenter console does not work with multiple screens --- sdext/source/minimizer/description.xml | 2 +- sdext/source/presenter/description.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdext/source/minimizer/description.xml b/sdext/source/minimizer/description.xml index 64a67a05b343..a4f172d0ebe6 100755 --- a/sdext/source/minimizer/description.xml +++ b/sdext/source/minimizer/description.xml @@ -17,7 +17,7 @@ - + diff --git a/sdext/source/presenter/description.xml b/sdext/source/presenter/description.xml index ede52f0bf1bb..19fefec6de8a 100755 --- a/sdext/source/presenter/description.xml +++ b/sdext/source/presenter/description.xml @@ -8,7 +8,7 @@ - + -- cgit From 30fe5345da00839957da39ccc91d8fa13260bda4 Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Thu, 18 Nov 2010 14:44:07 +0100 Subject: native349 #i115652# language independent Wizard bitmaps --- scp2/source/ooo/directory_ooo.scp | 10 +++++----- scp2/source/ooo/file_extra_ooo.scp | 7 +++---- scp2/source/ooo/module_hidden_ooo.scp | 1 + scp2/source/ooo/module_lang_template.scp | 1 - 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/scp2/source/ooo/directory_ooo.scp b/scp2/source/ooo/directory_ooo.scp index cc805f9e8288..4b20c6de7cc1 100644 --- a/scp2/source/ooo/directory_ooo.scp +++ b/scp2/source/ooo/directory_ooo.scp @@ -965,6 +965,11 @@ Directory gid_Dir_Share_Template_Wizard DosName = "wizard"; End +Directory gid_Dir_Share_Template_Wizard_Bitmap + ParentID = gid_Dir_Share_Template_Wizard; + DosName = "bitmap"; +End + Directory gid_Dir_Share_Template_Wizard_Letter ParentID = gid_Dir_Share_Template_Wizard; DosName = "letter"; @@ -1025,11 +1030,6 @@ Directory gid_Dir_Template_Wizard DIR_IDENT_ALL_LANG(wizard); End -Directory gid_Dir_Template_Wizard_Bitmap - ParentID = gid_Dir_Template_Wizard; - DIR_IDENT_ALL_LANG(bitmap); -End - Directory gid_Dir_Template_Wizard_Web ParentID = gid_Dir_Template_Wizard; DIR_IDENT_ALL_LANG(web); diff --git a/scp2/source/ooo/file_extra_ooo.scp b/scp2/source/ooo/file_extra_ooo.scp index dbea12eee10c..ee8c46f2c33e 100644 --- a/scp2/source/ooo/file_extra_ooo.scp +++ b/scp2/source/ooo/file_extra_ooo.scp @@ -365,10 +365,9 @@ File gid_File_Extra_Tplpresntimpr_Lang End File gid_File_Extra_Tplwizbitmap - Dir = gid_Dir_Template_Wizard_Bitmap; - TXT_FILE_BODY; - Styles = (ARCHIVE, DONT_OVERWRITE); - EXTRA_IDENT_ALL_LANG(tplwizbitmap.zip); + Dir = gid_Dir_Share_Template_Wizard_Bitmap; + ARCHIVE_TXT_FILE_BODY; + Name = "tplwizbitmap.zip"; End File gid_File_Extra_Tplwizdesktop_Lang diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp index e8c20f99ca94..e1bc26118011 100644 --- a/scp2/source/ooo/module_hidden_ooo.scp +++ b/scp2/source/ooo/module_hidden_ooo.scp @@ -454,6 +454,7 @@ Module gid_Module_Root_Files_6 gid_File_Extra_Gallwwwgraf, gid_File_Extra_Migration, gid_File_Extra_Migration_Lang_Multi, + gid_File_Extra_Tplwizbitmap, gid_File_Extra_Tplwizletter, gid_File_Extra_Tplwizletter_en_US, gid_File_Extra_Tplwizletter_de, diff --git a/scp2/source/ooo/module_lang_template.scp b/scp2/source/ooo/module_lang_template.scp index 8ffeadc2e99a..a21016e409d3 100755 --- a/scp2/source/ooo/module_lang_template.scp +++ b/scp2/source/ooo/module_lang_template.scp @@ -35,7 +35,6 @@ Module gid_Module_Langpack_Basis_Template gid_File_Extra_Tpllayoutimpr_Lang, gid_File_Extra_Tplpresntimpr_Lang, gid_File_Extra_Tplwizagenda_Lang, - gid_File_Extra_Tplwizbitmap, gid_File_Extra_Tplwizdesktop_Lang, gid_File_Extra_Tplwizfax_Lang, gid_File_Extra_Tplwizletter_Lang, -- cgit From 782eec28953a86989c45cf504583531ef65df3ea Mon Sep 17 00:00:00 2001 From: Ingo Schmidt Date: Thu, 18 Nov 2010 14:44:07 +0100 Subject: native349 #i115652# language independent Wizard bitmaps --- wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java | 4 ++-- wizards/com/sun/star/wizards/common/Desktop.java | 4 ++-- wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java | 2 +- wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java | 2 +- wizards/com/sun/star/wizards/web/FTPDialog.java | 2 +- wizards/com/sun/star/wizards/web/WWD_Startup.java | 2 +- wizards/source/euro/Init.xba | 2 +- wizards/source/formwizard/tools.xba | 2 +- wizards/source/importwizard/Main.xba | 2 +- wizards/source/schedule/CalendarMain.xba | 2 +- wizards/source/template/Samples.xba | 2 +- wizards/source/tutorials/Functions.xba | 8 ++++---- wizards/source/tutorials/ShowInfoDialog.xba | 4 ++-- wizards/source/webwizard/Language.xba | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java index 26aa9d2d8486..bc09829daea1 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java @@ -213,7 +213,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog try { sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard"); sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", ""); - sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/bitmap"); + sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap"); } catch (NoValidPathException e) { e.printStackTrace(); } @@ -302,7 +302,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog try { sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user"); - sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/bitmap"); + sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap"); } catch (NoValidPathException e) { e.printStackTrace(); } diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java index c9292b58c1b4..8902696c37b4 100644 --- a/wizards/com/sun/star/wizards/common/Desktop.java +++ b/wizards/com/sun/star/wizards/common/Desktop.java @@ -378,7 +378,7 @@ public class Desktop { TemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard"); UserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", ""); - BitmapPath = FileAccess.combinePaths(xMSF, TemplatePath, "/wizard/bitmap"); + BitmapPath = FileAccess.combinePaths(xMSF, TemplatePath, "/../wizard/bitmap"); WorkPath = FileAccess.getOfficePath(xMSF, "Work", "", ""); } catch (NoValidPathException nopathexception) @@ -417,7 +417,7 @@ public class Desktop { try { - String sBitmapPath = FileAccess.combinePaths(_xMSF, getTemplatePath(_xMSF), "/wizard/bitmap"); + String sBitmapPath = FileAccess.combinePaths(_xMSF, getTemplatePath(_xMSF), "/../wizard/bitmap"); return sBitmapPath; } catch (NoValidPathException nopathexception) diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java index 0cc5268accc0..6163cd143894 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java @@ -381,7 +381,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog { sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard"); sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", ""); - sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/bitmap"); + sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap"); } catch (NoValidPathException e) { diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java index f992ef98b56b..7cc587a2c63c 100644 --- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java +++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java @@ -1294,7 +1294,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog { sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard"); sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", ""); - sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/bitmap"); + sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap"); } catch (NoValidPathException e) { diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.java b/wizards/com/sun/star/wizards/web/FTPDialog.java index 2085704cf359..ca6f70add7b6 100644 --- a/wizards/com/sun/star/wizards/web/FTPDialog.java +++ b/wizards/com/sun/star/wizards/web/FTPDialog.java @@ -187,7 +187,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID publish = p; - imagesDirectory = FileAccess.connectURLs(((CGSettings) (publish.root)).soTemplateDir, "wizard/bitmap/"); + imagesDirectory = FileAccess.connectURLs(((CGSettings) (publish.root)).soTemplateDir, "../wizard/bitmap/"); //Load Resources resources = new FTPDialogResources(xmsf); diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.java b/wizards/com/sun/star/wizards/web/WWD_Startup.java index 818781cd0bf3..200f70a32383 100644 --- a/wizards/com/sun/star/wizards/web/WWD_Startup.java +++ b/wizards/com/sun/star/wizards/web/WWD_Startup.java @@ -241,7 +241,7 @@ public abstract class WWD_Startup extends WWD_General String soTemplateDir = FileAccess.getOfficePath(xmsf, "Template", "share", "/wizard"); - String exclamationURL = FileAccess.connectURLs(soTemplateDir, "wizard/bitmap/caution_16.png"); + String exclamationURL = FileAccess.connectURLs(soTemplateDir, "../wizard/bitmap/caution_16.png"); this.drawNaviBar(); this.buildStep1(); this.buildStep2(); diff --git a/wizards/source/euro/Init.xba b/wizards/source/euro/Init.xba index 45fdafdbafe5..2de1252c7e48 100644 --- a/wizards/source/euro/Init.xba +++ b/wizards/source/euro/Init.xba @@ -550,7 +550,7 @@ Dim Isthere as Boolean InitializeLocales(oLocale) InitializeCurrencies() InitializeControls() - BitmapDir = GetOfficeSubPath("Template", "wizard/bitmap") + BitmapDir = GetOfficeSubPath("Template", "../wizard/bitmap") If BitmapDir = "" Then Stop End If diff --git a/wizards/source/formwizard/tools.xba b/wizards/source/formwizard/tools.xba index 174987e35971..8b40b8379c10 100644 --- a/wizards/source/formwizard/tools.xba +++ b/wizards/source/formwizard/tools.xba @@ -304,7 +304,7 @@ End Function Function GetFormWizardPaths() as Boolean - FormPath = GetOfficeSubPath("Template","wizard/bitmap") + FormPath = GetOfficeSubPath("Template","../wizard/bitmap") If FormPath <> "" Then WebWizardPath = GetOfficeSubPath("Template","wizard/web") If WebWizardPath <> "" Then diff --git a/wizards/source/importwizard/Main.xba b/wizards/source/importwizard/Main.xba index 2c25c6abebd0..3415d0ee8dd8 100644 --- a/wizards/source/importwizard/Main.xba +++ b/wizards/source/importwizard/Main.xba @@ -274,7 +274,7 @@ End Sub Function GetImportWizardPaths() as Boolean - SOBitmapPath = GetOfficeSubPath("Template", "wizard/bitmap") + SOBitmapPath = GetOfficeSubPath("Template", "../wizard/bitmap") If SOBitmapPath <> "" Then SOWorkPath = GetPathSettings("Work", False) If SOWorkPath <> "" Then diff --git a/wizards/source/schedule/CalendarMain.xba b/wizards/source/schedule/CalendarMain.xba index bfe49121dbd3..2deb51cca84d 100644 --- a/wizards/source/schedule/CalendarMain.xba +++ b/wizards/source/schedule/CalendarMain.xba @@ -82,7 +82,7 @@ Dim iThisMonth as Integer DlgCalModel = DlgCalendar.Model LoadLanguage(sCurLangLocale) CalInitGlobalVariablesDate() - BitmapDir = GetOfficeSubPath("Template","wizard/bitmap") + BitmapDir = GetOfficeSubPath("Template","../wizard/bitmap") DlgCalModel.imgCountry.ImageURL = BitmapDir & sBitmapFilename CalChoosenLand = -2 CalLoadOwnData() diff --git a/wizards/source/template/Samples.xba b/wizards/source/template/Samples.xba index b64ddc12db17..118fb37d0c49 100644 --- a/wizards/source/template/Samples.xba +++ b/wizards/source/template/Samples.xba @@ -86,7 +86,7 @@ Dim MaxIndex as Integer DialogModel = StylesDialog.Model TemplateDir = GetPathSettings("Template", False, 0) StylesDir = GetOfficeSubPath("Template", "wizard/styles/") - sQueryPath = GetOfficeSubPath("Template", "wizard/bitmap/") + sQueryPath = GetOfficeSubPath("Template", "../wizard/bitmap/") DialogModel.Title = GetResText(STYLES) DialogModel.cmdCancel.Label = GetResText(STYLES+2) DialogModel.cmdOk.Label = GetResText(STYLES+3) diff --git a/wizards/source/tutorials/Functions.xba b/wizards/source/tutorials/Functions.xba index 6524ec19338c..c1b464acaf9d 100644 --- a/wizards/source/tutorials/Functions.xba +++ b/wizards/source/tutorials/Functions.xba @@ -78,15 +78,15 @@ Sub setMaxMinImage(param As String) iPos = InStr(templatePath,"/") If(iPos > 0) Then If(param = "MAX") Then - bitmapPath = templatePath & "/wizard/bitmap/maximize.bmp" + bitmapPath = templatePath & "../wizard/bitmap/maximize.bmp" ElseIf(param = "MIN") Then - bitmapPath = templatePath & "/wizard/bitmap/minimize.bmp" + bitmapPath = templatePath & "../wizard/bitmap/minimize.bmp" End If Else If(param = "MAX") Then - bitmapPath = templatePath & "\wizard\bitmap\maximize.bmp" + bitmapPath = templatePath & "..\wizard\bitmap\maximize.bmp" ElseIf(param = "MIN") Then - bitmapPath = templatePath & "\wizard\bitmap\minimize.bmp" + bitmapPath = templatePath & "..\wizard\bitmap\minimize.bmp" End If End If 'printdbgInfo oCommandButton.Model diff --git a/wizards/source/tutorials/ShowInfoDialog.xba b/wizards/source/tutorials/ShowInfoDialog.xba index 4bb0f608d9b6..61c2ed96731f 100644 --- a/wizards/source/tutorials/ShowInfoDialog.xba +++ b/wizards/source/tutorials/ShowInfoDialog.xba @@ -148,9 +148,9 @@ sub setImage(whatever as Object) Dim bitmapPath As String iPos = InStr(templatePath,"/") if(iPos > 0) Then - bitmapPath = templatePath & "/wizard/bitmap/tutorial_background.gif" + bitmapPath = templatePath & "../wizard/bitmap/tutorial_background.gif" Else - bitmapPath = templatePath & "\wizard\bitmap\tutorial_background.gif" + bitmapPath = templatePath & "..\wizard\bitmap\tutorial_background.gif" End If dim props(0) as new com.sun.star.beans.PropertyValue diff --git a/wizards/source/webwizard/Language.xba b/wizards/source/webwizard/Language.xba index 1aa26fac30cb..1c6b8c194e98 100644 --- a/wizards/source/webwizard/Language.xba +++ b/wizards/source/webwizard/Language.xba @@ -30,7 +30,7 @@ Dim TemplatePath as String If PhotosDir <> "" Then TemplatePath = GetOfficeSubPath("Template", "wizard/web/") If TemplatePath <> "" Then - SOBitmapPath = GetOfficeSubPath("Template", "wizard/bitmap") + SOBitmapPath = GetOfficeSubPath("Template", "../wizard/bitmap") If SOBitmapPath <> "" Then GetWebwizardPaths() = True Exit Function -- cgit From f580253e94f625e204989fdca1433b322909903d Mon Sep 17 00:00:00 2001 From: sj Date: Thu, 18 Nov 2010 16:11:07 +0100 Subject: impress202: #i114750# fixed WordWrap also for report Wizard --- xmloff/source/draw/XMLGraphicsDefaultStyle.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx index 92aa1ce17140..af3a0ce941e5 100644 --- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx +++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx @@ -117,7 +117,11 @@ void XMLGraphicsDefaultStyle::SetDefaults() ((nUPD > 300) && (nUPD <= 330)) ) ) bWordWrapDefault = sal_False; - xDefaults->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextWordWrap" ) ), Any( bWordWrapDefault ) ); + + const OUString sTextWordWrap( RTL_CONSTASCII_USTRINGPARAM( "TextWordWrap" ) ); + Reference< XPropertySetInfo > xInfo( xDefaults->getPropertySetInfo() ); + if ( xInfo->hasPropertyByName( sTextWordWrap ) ) + xDefaults->setPropertyValue( sTextWordWrap, Any( bWordWrapDefault ) ); FillPropertySet( xDefaults ); } -- cgit From d35307cddf79a53a0a47f915d976407778d9fd60 Mon Sep 17 00:00:00 2001 From: Release Engineering Date: Thu, 18 Nov 2010 19:10:50 +0100 Subject: OOO330 --- solenv/inc/minor.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index e22bfc3b7c0b..6b224831e369 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -1,5 +1,5 @@ RSCVERSION=330 -RSCREVISION=330m15(Build:9546) -BUILD=9546 -LAST_MINOR=m15 +RSCREVISION=330m16(Build:9549) +BUILD=9549 +LAST_MINOR=m16 SOURCEVERSION=OOO330 -- cgit From 772e57adce746f4c3e42c2333828d6c068f30fbb Mon Sep 17 00:00:00 2001 From: os Date: Fri, 19 Nov 2010 08:02:17 +0100 Subject: SfxItemPool access --- sw/source/filter/ww8/rtfexport.cxx | 26 ++++++++++++++++---------- sw/source/filter/ww8/wrtw8sty.cxx | 10 ++++++---- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index f4f3f7166fe0..f899d2160e86 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -525,8 +525,8 @@ void RtfExport::ExportDocument_Impl() // protected section in the document. { const SfxItemPool& rPool = pDoc->GetAttrPool(); - USHORT nMaxItem = rPool.GetItemCount2(RES_PROTECT); - for( USHORT n = 0; n < nMaxItem; ++n ) + sal_uInt32 const nMaxItem = rPool.GetItemCount2(RES_PROTECT); + for (sal_uInt32 n = 0; n < nMaxItem; ++n) { const SvxProtectItem* pProtect = (const SvxProtectItem*)rPool.GetItem2(RES_PROTECT, n); if (pProtect && pProtect->IsCntntProtected()) @@ -997,7 +997,7 @@ void RtfExport::OutColorTable() { // Build the table from rPool since the colors provided to // RtfAttributeOutput callbacks are too late. - USHORT n, nMaxItem; + sal_uInt32 nMaxItem; const SfxItemPool& rPool = pDoc->GetAttrPool(); // char color @@ -1009,7 +1009,7 @@ void RtfExport::OutColorTable() RES_CHRATR_COLOR ) )) InsColor( pCol->GetValue() ); nMaxItem = rPool.GetItemCount2(RES_CHRATR_COLOR); - for( n = 0; n < nMaxItem; ++n ) + for (sal_uInt32 n = 0; n < nMaxItem; ++n) { if( 0 != (pCol = (const SvxColorItem*)rPool.GetItem2( RES_CHRATR_COLOR, n ) ) ) @@ -1019,7 +1019,7 @@ void RtfExport::OutColorTable() const SvxUnderlineItem* pUnder = (const SvxUnderlineItem*)GetDfltAttr( RES_CHRATR_UNDERLINE ); InsColor( pUnder->GetColor() ); nMaxItem = rPool.GetItemCount2(RES_CHRATR_UNDERLINE); - for( n = 0; n < nMaxItem;n++) + for (sal_uInt32 n = 0; n < nMaxItem; ++n) { if( 0 != (pUnder = (const SvxUnderlineItem*)rPool.GetItem2( RES_CHRATR_UNDERLINE, n ) ) ) InsColor( pUnder->GetColor() ); @@ -1029,7 +1029,7 @@ void RtfExport::OutColorTable() const SvxOverlineItem* pOver = (const SvxOverlineItem*)GetDfltAttr( RES_CHRATR_OVERLINE ); InsColor( pOver->GetColor() ); nMaxItem = rPool.GetItemCount2(RES_CHRATR_OVERLINE); - for( n = 0; n < nMaxItem;n++) + for (sal_uInt32 n = 0; n < nMaxItem; ++n) { if( 0 != (pOver = (const SvxOverlineItem*)rPool.GetItem2( RES_CHRATR_OVERLINE, n ) ) ) InsColor( pOver->GetColor() ); @@ -1052,12 +1052,14 @@ void RtfExport::OutColorTable() InsColor( pBkgrd->GetColor() ); } nMaxItem = rPool.GetItemCount2( *pIds ); - for( n = 0; n < nMaxItem; ++n ) + for (sal_uInt32 n = 0; n < nMaxItem; ++n) + { if( 0 != (pBkgrd = (const SvxBrushItem*)rPool.GetItem2( *pIds , n ) )) { InsColor( pBkgrd->GetColor() ); } + } } // shadow color @@ -1071,12 +1073,14 @@ void RtfExport::OutColorTable() InsColor( pShadow->GetColor() ); } nMaxItem = rPool.GetItemCount2(RES_SHADOW); - for( n = 0; n < nMaxItem; ++n ) + for (sal_uInt32 n = 0; n < nMaxItem; ++n) + { if( 0 != (pShadow = (const SvxShadowItem*)rPool.GetItem2( RES_SHADOW, n ) ) ) { InsColor( pShadow->GetColor() ); } + } } // frame border color @@ -1086,12 +1090,14 @@ void RtfExport::OutColorTable() RES_BOX ) )) InsColorLine( *pBox ); nMaxItem = rPool.GetItemCount2(RES_BOX); - for( n = 0; n < nMaxItem; ++n ) + for (sal_uInt32 n = 0; n < nMaxItem; ++n) + { if( 0 != (pBox = (const SvxBoxItem*)rPool.GetItem2( RES_BOX, n ) )) InsColorLine( *pBox ); + } } - for( n = 0; n < m_aColTbl.size(); n++ ) + for (size_t n = 0; n < m_aColTbl.size(); ++n) { const Color& rCol = m_aColTbl[ n ]; if( n || COL_AUTO != rCol.GetColor() ) diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 4d16a5646536..ab7a8c4e3a0e 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -784,14 +784,16 @@ void wwFontHelper::InitFontTable(bool bWrtWW8,const SwDoc& rDoc) const USHORT aTypes[] = { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_FONT, 0 }; for (const USHORT* pId = aTypes; *pId; ++pId) { - USHORT nMaxItem = rPool.GetItemCount2( *pId ); - for( USHORT nGet = 0; nGet < nMaxItem; ++nGet ) - if( 0 != (pFont = (const SvxFontItem*)rPool.GetItem2( - *pId, nGet )) ) + sal_uInt32 const nMaxItem = rPool.GetItemCount2( *pId ); + for (sal_uInt32 nGet = 0; nGet < nMaxItem; ++nGet) + { + pFont = (const SvxFontItem*)rPool.GetItem2( *pId, nGet ); + if (0 != pFont) { GetId(wwFont(pFont->GetFamilyName(), pFont->GetPitch(), pFont->GetFamily(), pFont->GetCharSet(),bWrtWW8)); } + } } } -- cgit From 1b0ca19e6a11b0f7b46631276c6e561c14b4714b Mon Sep 17 00:00:00 2001 From: "Wolfram Garten [wg]" Date: Fri, 19 Nov 2010 11:20:52 +0100 Subject: i115673:[Automation]: replace old documentation style --- .../optional/includes/global/g_arrangealign.inc | 142 +- .../optional/includes/global/g_convertto.inc | 221 ++- .../optional/includes/global/g_customshapes.inc | 138 +- .../graphics/optional/includes/global/g_format.inc | 1509 ++++++++-------- .../graphics/optional/includes/global/g_line.inc | 242 +-- .../optional/includes/global/g_spellcheck.inc | 4 +- .../optional/includes/impress/i_headerfooter.inc | 220 ++- .../optional/includes/impress/i_pengine1.inc | 336 ++-- .../optional/includes/impress/i_pengine2.inc | 163 +- .../optional/includes/impress/i_slidelayer.inc | 181 +- .../optional/includes/impress/i_slideshow.inc | 489 ++--- .../optional/includes/impress/i_slideshow2.inc | 227 ++- .../optional/includes/impress/i_slideshow3.inc | 1905 ++++++++++---------- 13 files changed, 3024 insertions(+), 2753 deletions(-) diff --git a/testautomation/graphics/optional/includes/global/g_arrangealign.inc b/testautomation/graphics/optional/includes/global/g_arrangealign.inc index 48c6599efa72..f0b749e915b4 100644 --- a/testautomation/graphics/optional/includes/global/g_arrangealign.inc +++ b/testautomation/graphics/optional/includes/global/g_arrangealign.inc @@ -32,29 +32,35 @@ '\****************************************************************************** testcase tiDatei_Fuer_Anordnen_Erstellen - dim sTemp as string - dim i as integer - dim zaehler as integer - '/// This function creates the document, that will be used as reference and working object inthe following cases :-) ///' - '///'Dim Datei ' somewhere global :-) defined in calling sub! :sub im_107c_ /// - call hNewDocument - call sSelectEmptyLayout '/// new document ///' - if Dir(Datei)<>"" then app.Kill(Datei) ' kill old file - for Zaehler = 1 to 3 '/// create 3 overlapping objects ///' + dim sTemp as string + dim i as integer + dim zaehler as integer + printlog "This function creates the document, that will be used as reference and working object inthe following cases :-)" + 'Dim Datei ' somewhere global :-) defined in calling sub! :sub im_107c_ + printlog "new document " + call hNewDocument + call sSelectEmptyLayout + if Dir(Datei)<>"" then app.Kill(Datei) ' kill old file + printlog "create 3 overlapping objects " + for Zaehler = 1 to 3 Kontext Select Case Zaehler Case 1: WL_SD_Wuerfel - gMouseMove (20,5, 80,60) '/// cubicel 20,5, 80,60 /// + printlog "cubicel 20,5, 80,60" + gMouseMove (20,5, 80,60) Printlog " Object start ---------------------- "+ Zaehler +" cubicel " Case 2: WL_SD_RechteckVoll - gMouseMove (40,35, 90,90) '/// rectangel 40,35, 90,90 /// - Printlog " Object start ---------------------- "+ Zaehler +" rectangel " + printlog "rectangel 40,35, 90,90" + gMouseMove (40,35, 90,90) + Printlog " Object start ---------------------- "+ Zaehler +" rectangel " Case 3: WL_SD_Torus - gMouseMove (1,35, 60,95) '/// donut ;-) 1,35, 60,95 /// + printlog "donut 1,35, 60,95 " + gMouseMove (1,35, 60,95) Printlog " Object start ---------------------- "+ Zaehler +" donut " End Select sleep (1) - FormatArea '/// assign different area properties for created objects (use rnd function)///' + printlog "assign different area properties for created objects (use rnd function)" + FormatArea sleep (1) kontext Select Case Zaehler @@ -75,12 +81,13 @@ testcase tiDatei_Fuer_Anordnen_Erstellen TabFarben.OK End Select sleep 1 - ContextPositionAndSize '/// save position and size values into varialbes ///' + printlog "save position and size values into varialbes " + ContextPositionAndSize sleep (1) kontext active.SetPage TabPositionAndSize kontext "TabPositionAndSize" - '/// the variables : Ueber_Text_[1-3] get set here ! with x position of object/// + printlog "the variables : Ueber_Text_[1-3] get set here ! with x position of object" Select Case Zaehler Case 1: Ueber_Text_1 = PositionX.GetText : printlog "xpos: "+zaehler+": "+PositionX.GetText Case 2: Ueber_Text_2 = PositionX.GetText : printlog "xpos: "+zaehler+": "+PositionX.GetText @@ -90,41 +97,43 @@ testcase tiDatei_Fuer_Anordnen_Erstellen gMouseClick 96,5 next Zaehler sleep 1 - call hFileSaveAsKill (Datei) '/// save document ///' + printlog "save document " + call hFileSaveAsKill (Datei) printlog "OK saved at ", Datei sleep 1 - '/// select in default order and take Position X in mind ;-) ///' - '///+ has to be from bottom to top: cubicel, rectangel, donut ///' + printlog "select in default order and take Position X in mind ;-)" + printlog "+ has to be from bottom to top: cubicel, rectangel, donut" sPrintCheckOrder (TRUE) - call hCloseDocument '/// close document ///' + printlog "close document " + call hCloseDocument endcase 'tiDatei_Fuer_Anordnen_Erstellen '------------------------------------------------------------------------------- testcase tdContextSendBackward dim sTemp as string - '/// open created document 'with 3 figures' ///' + printlog "open created document 'with 3 figures'" if (hFileOpen (Datei)) then sleep 10 sPrintCheckOrder (TRUE) - '/// select the middle object: rectangle, with keys: [TAB],[TAB] ///' + printlog "select the middle object: rectangle, with keys: [TAB],[TAB]" hTypeKeys ("") - '/// Send Backward / [Strg]+[-] -> one level more to the back ///' + printlog "Send Backward / [Strg]+[-] -> one level more to the back" WL_TB_ANORDNUNG_WeiterNachHinten - '///+ has to be from bottom to top: rectangel cubicel donut ///' + printlog "+ has to be from bottom to top: rectangel cubicel donut" sleep 2 sPrintCheckOrder - '/// deselect all ///' + printlog "deselect all" hTypeKeys ("") sleep 2 - '/// select the middle object: cubical, with keys: [TAB],[TAB] ///' + printlog "select the middle object: cubical, with keys: [TAB],[TAB]" hTypeKeys ("") sleep 2 sTemp = fGetPositionX if sTemp <> Ueber_Text_1 then warnlog "Arrangement is wrong; is: "+sTemp+"; should: "+Ueber_Text_1+";" end if - '/// close document ///' + printlog "close document" Call hCloseDocument endif sleep 2 @@ -134,18 +143,18 @@ endcase 'tdContextSendBackward testcase tdContextBringForward dim sTemp as string - '/// open created document 'with 3 figures' ///' + printlog "open created document 'with 3 figures'" if (hFileOpen (Datei)) then sleep 10 sPrintCheckOrder (TRUE) - '/// select the middle object: rectangle, with keys: [TAB],[TAB] ///' + printlog "select the middle object: rectangle, with keys: [TAB],[TAB]" hTypeKeys ("") - '/// Bring Forward / [Strg]+[+] -> one level more to the front ///' + printlog "Bring Forward / [Strg]+[+] -> one level more to the front" WL_TB_ANORDNUNG_WeiterNachVorn - '/// has to be from bottom to top: cubicel donut rectangel ///' + printlog "has to be from bottom to top: cubicel donut rectangel" sleep 1 sPrintCheckOrder - '/// select the middle object: donut, with keys: [TAB],[TAB] ///' + printlog "select the middle object: donut, with keys: [TAB],[TAB]" hTypeKeys ("") sleep 2 sTemp = fGetPositionX @@ -153,7 +162,7 @@ testcase tdContextBringForward warnlog "Arrangement is wrong; is: "+sTemp+"; should: "+Ueber_Text_3+";" end if sleep 1 - '/// close document ///' + printlog "close document" Call hCloseDocument endif @@ -162,18 +171,18 @@ endcase 'tdContextBringForward testcase tdContextSendToBack dim sTemp as string - '/// open created document 'with 3 figures' ///' + printlog "open created document 'with 3 figures'" if (hFileOpen (Datei)) then sleep 10 sPrintCheckOrder (TRUE) - '/// select the top object: donut, with keys: [TAB],[TAB],[TAB] ///' + printlog "select the top object: donut, with keys: [TAB],[TAB],[TAB]" hTypeKeys ("") - '/// Send to Back / [Strg]+[Shift]+[-] -> backmost object ///' + printlog "Send to Back / [Strg]+[Shift]+[-] -> backmost object" OL_DRAW_GanzNachHinten - '/// has to be from bottom to top: rectangel cubicel donut ///' + printlog "has to be from bottom to top: rectangel cubicel donut" sleep 3 sPrintCheckOrder - '/// select the middle object: cubical, with keys: [TAB],[TAB] ///' + printlog "select the middle object: cubical, with keys: [TAB],[TAB]" hTypeKeys ("") sleep 1 sTemp = fGetPositionX @@ -181,7 +190,7 @@ testcase tdContextSendToBack warnlog "Arrangement is wrong; is: "+sTemp+"; should: "+Ueber_Text_1+";" end if sleep 3 - '/// close document ///' + printlog "close document" Call hCloseDocument endif @@ -190,17 +199,17 @@ endcase 'tdContextSendToBack testcase tdContextBringToFront dim sTemp as string - '/// open created document 'with 3 figures' ///' + printlog "open created document 'with 3 figures'" if (hFileOpen (Datei)) then sleep 10 sPrintCheckOrder (TRUE) - '/// select the bottom object: cubical, with keys: [TAB] ///' + printlog "select the bottom object: cubical, with keys: [TAB]" hTypeKeys ("") - '/// Bring to Front / [Strg]+[Shift]+[+] -> frontmost object ///' + printlog "Bring to Front / [Strg]+[Shift]+[+] -> frontmost object" OL_DRAW_GanzNachVorn - '/// has to be from bottom to top: rectangel, donut, cubicel ///' + printlog "has to be from bottom to top: rectangel, donut, cubicel" sPrintCheckOrder - '/// select the middle object: donut, with keys: [TAB],[TAB] ///' + printlog "select the middle object: donut, with keys: [TAB],[TAB]" hTypeKeys ("") sleep 1 sTemp = fGetPositionX @@ -208,7 +217,7 @@ testcase tdContextBringToFront warnlog "Arrangement is wrong; is: "+sTemp+"; should: "+Ueber_Text_3+";" end if sleep 3 - '/// close document ///' + printlog "close document" Call hCloseDocument endif @@ -217,26 +226,26 @@ endcase 'tdContextBringToFront testcase tdContextInFrontOfObject dim sTemp as string - '/// open created document 'with 3 figures' ///' + printlog "open created document 'with 3 figures'" if (hFileOpen (Datei)) then sleep 10 sPrintCheckOrder (TRUE) - '/// select the top object: donut, with keys: [TAB],[TAB],[TAB] ///' + printlog "select the top object: donut, with keys: [TAB],[TAB],[TAB]" hTypeKeys ("") - '/// In Front of object ///' + printlog "In Front of object" OL_DRAW_VorDasObjekt - '/// left click the cubicel with the mouse ///' + printlog "left click the cubicel with the mouse" gMouseClick 50,5 - '/// has to be from bottom to top: cubicel, donut, rectangel ///' + printlog "has to be from bottom to top: cubicel, donut, rectangel" sPrintCheckOrder sleep 1 - '/// select the middle object: donut, with keys: [TAB],[TAB] ///' + printlog "select the middle object: donut, with keys: [TAB],[TAB]" hTypeKeys ("") sTemp = fGetPositionX if sTemp <> Ueber_Text_3 then printlog "DISABLED the WARNLOG, because mouseaction is not always the same :-( : Arrangement is wrong; is: "+sTemp+"; should: "+Ueber_Text_3+";" end if - '/// close document ///' + printlog "close document" Call hCloseDocument endif @@ -245,27 +254,27 @@ endcase 'tdContextInFrontOfObject testcase tdContextBehindObject dim sTemp as string - '/// open created document 'with 3 figures' ///' + printlog "open created document 'with 3 figures'" if (hFileOpen (Datei)) then sleep 10 sPrintCheckOrder (TRUE) - '/// select the top object: donut, with keys: [TAB],[TAB],[TAB] ///' + printlog "select the top object: donut, with keys: [TAB],[TAB],[TAB]" hTypeKeys ("") - '/// Behind object ///' + printlog "Behind object" OL_DRAW_HinterDasObjekt sleep 1 - '/// left click the cubicel with the mouse ///' + printlog "left click the cubicel with the mouse" gMouseClick 50,5 - '/// has to be from bottom to top: donut, cubicel, rectangel ///' + printlog "has to be from bottom to top: donut, cubicel, rectangel" sPrintCheckOrder sleep 1 - '/// select the bottom object: donut, with keys: [TAB] ///' + printlog "select the bottom object: donut, with keys: [TAB]" hTypeKeys ("") sTemp = fGetPositionX if sTemp <> Ueber_Text_3 then printlog "DISABLED the WARNLOG, because mouseaction is not always tthe same Arrangement is wrong; is: "+sTemp+"; should: "+Ueber_Text_3+";" end if - '/// close document ///' + printlog "close document" Call hCloseDocument endif @@ -276,17 +285,17 @@ testcase tdContextReverse dim sTemp as string dim sTemp2 as string dim i as integer - '/// open created document 'with 3 figures' ///' + printlog "open created document 'with 3 figures'" if (hFileOpen (Datei)) then sleep 10 sPrintCheckOrder (TRUE) - '/// Edit->Select All ///' + printlog "Edit->Select All" EditSelectAll sleep 3 - '/// Reverse ///' + printlog "Reverse" WL_TB_ANORDNUNG_Vertauschen sPrintCheckOrder - '/// select in default order and take Position X in mind ;-) ///' + printlog "select in default order and take Position X in mind ;-)" hTypeKeys ("") for i = 1 to 3 hTypeKeys ("") @@ -300,10 +309,9 @@ testcase tdContextReverse warnlog " - " + i + " Arrangement is wrong; is: "+sTemp+"; should: "+sTemp2+";" end if next i - '/// close document ///' - Call hCloseDocument '/// close document ///' + printlog "close document" + Call hCloseDocument endif endcase 'tdContextReverse -'------------------------------------------------------------------------------- - +'------------------------------------------------------------------------------- \ No newline at end of file diff --git a/testautomation/graphics/optional/includes/global/g_convertto.inc b/testautomation/graphics/optional/includes/global/g_convertto.inc index 33eb157bc465..3a829b1ef275 100644 --- a/testautomation/graphics/optional/includes/global/g_convertto.inc +++ b/testautomation/graphics/optional/includes/global/g_convertto.inc @@ -30,15 +30,6 @@ '* short description : '* '************************************************************************************** -' #1 tiAendernUmwandelnInPolygon -' #1 tiModifyConvertToPolygon -' #1 tdContextConvertIntoBitmap -' #1 tiAendernUmwandelnInKurve -' #1 tiAendernUmwandelnInPolygonGrafik -' #1 tiAendernUmwandelnIn3D -' #1 tiAendernUmwandelnIn3DRotationskoerper -' #1 tiAendernUmwandelnInMetaFile -'\************************************************************************************* ' Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\columbia.dxf") ' Call hGrafikEinfuegen ConvertPath ( gTesttoolPath + "global\input\graf_inp\enter.bmp" ) @@ -52,29 +43,29 @@ ' Call tdContextConvertIntoMetaFile testcase tiModifyConvertToPolygon - Dim PosX as string - Dim PosY as string - Dim Maxanzahl as string - Dim Minanzahl as string + Dim PosX as string + Dim PosY as string + Dim Maxanzahl as string + Dim Minanzahl as string - Call hNewDocument - Call sSelectEmptyLayout - sleep 3 - hTextrahmenErstellen ("This is a text that will be transformed into a Polygon-object", 10,10,60,30) - sleep 1 - hTypeKeys "" - sleep 1 - EditSelectAll - sleep 1 - ContextConvertIntoPolygon - sleep 1 - ContextPositionAndSize - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - PosX = Width.GetText - PosY = Height.GetText - TabPositionAndSize.OK + Call hNewDocument + Call sSelectEmptyLayout + sleep 3 + hTextrahmenErstellen ("This is a text that will be transformed into a Polygon-object", 10,10,60,30) + sleep 1 + hTypeKeys "" + sleep 1 + EditSelectAll + sleep 1 + ContextConvertIntoPolygon + sleep 1 + ContextPositionAndSize + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + PosX = Width.GetText + PosY = Height.GetText + TabPositionAndSize.OK sleep 1 FormatCharacter Kontext @@ -120,7 +111,7 @@ testcase tiModifyConvertToPolygon Kontext Active.SetPage TabPositionAndSize Kontext "TabPositionAndSize" - '/// compare width and heigth to control is it is still text ///' + printlog "compare width and heigth to control is it is still text" if ( Width.GetText = PosX or Height.GetText = PosY ) Then Printlog "- Text converted into polygon" else @@ -133,7 +124,7 @@ testcase tiModifyConvertToPolygon Call hNewDocument sleep 3 - '/// insert graphic (input\\impress\\grafik\\sample.bmp)///' + printlog "insert graphic (input\\impress\\grafik\\sample.bmp)" Call hGrafikEinfuegen ConvertPath ( gTesttoolPath + "global\input\graf_inp\enter.bmp" ) sleep 3 ContextConvertIntoPolygon @@ -142,9 +133,11 @@ testcase tiModifyConvertToPolygon MaxAnzahl = Farbanzahl.GetText Farbanzahl.More 1 If Maxanzahl < Farbanzahl.GetText Then Warnlog "- Maximum value could be raised." - Farbanzahl.ToMin '/// set color to min ///' + printlog "set color to min" + Farbanzahl.ToMin MinAnzahl = Farbanzahl.GetText - Farbanzahl.Less 1 '/// try to set a value lower than minimum ///' + printlog "try to set a value lower than minimum" + Farbanzahl.Less 1 If Farbanzahl.GetText < Minanzahl then Warnlog "- Minimum value could be lowered." Farbanzahl.SetText "2" Vorschau.Click @@ -166,18 +159,20 @@ endcase 'tiModifyConvertToPolygon '-------------------------------------------------------- testcase tdContextConvertIntoBitmap - Call hNewDocument '/// new document ///' - sleep 3 - InsertGraphicsFromFile '/// insert graphic ///' - sleep 3 - kontext "Active" + printlog "new document" + Call hNewDocument + sleep 3 + printlog "insert graphic" + InsertGraphicsFromFile + sleep 3 + kontext "Active" if Active.Exists Then - Active.OK + Active.OK end if - sleep 5 - Kontext "GrafikEinfuegenDlg" - sleep 2 -'/// uses input\\impress\\grafik\\columbia.dxf /// + sleep 5 + Kontext "GrafikEinfuegenDlg" + sleep 2 +printlog " uses input\impress\grafik\columbia.dxf" Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\columbia.dxf") sleep 2 Oeffnen.Click @@ -192,44 +187,53 @@ testcase tdContextConvertIntoBitmap end if Kontext "DocumentImpress" try - ContextConvertIntoBitmap '/// convert dxf file to bitmap ///' + printlog "convert dxf file to bitmap" + ContextConvertIntoBitmap sleep 1 Printlog "- Convert into bitmap works" catch Warnlog "- Convert into bitmap does not work" endcatch - sleep 2 - Call hCloseDocument '/// close document ///' - + sleep 2 + printlog "close document" + Call hCloseDocument + endcase 'tdContextConvertIntoBitmap '-------------------------------------------------------- testcase tiAendernUmwandelnInKurve Printlog " ----- ContextConvertIntoCurve testen" - - Call hNewDocument '/// New impress document///' + printlog "New impress document" + Call hNewDocument Call sSelectEmptyLayout - Call hTextrahmenErstellen ("I test,test,test,test only, if it works for you",20,20,60,30) '/// create textbox///' - sleep 2 - Kontext "DocumentImpress" - gMouseDoubleClick 70,70 '/// deselect textbox ///' - sleep 2 - EditSelectAll '/// select textbox ///' - sleep 2 - ContextConvertIntoCurve '/// convert into curve ///' - sleep 3 - gMouseClick 30,15 + printlog "create textbox" + Call hTextrahmenErstellen ("I test,test,test,test only, if it works for you",20,20,60,30) + sleep 2 + Kontext "DocumentImpress" + printlog "deselect textbox " + gMouseDoubleClick 70,70 + sleep 2 + printlog "select textbox " + EditSelectAll + sleep 2 + printlog "convert into curve " + ContextConvertIntoCurve + sleep 3 + gMouseClick 30,15 - hTypeKeys "",3 '/// try to select 3 letters ///' + printlog "try to select 3 letters " + hTypeKeys "",3 try - EditCopy '/// try edit copy to check if its still text ///' + printlog "try edit copy to check if its still text " + EditCopy Warnlog " - Convert into curve, seperate letters should not be selectable anymore" catch Printlog " - Text converted into a curve" endcatch - Call hCloseDocument '/// close document ///' + printlog "close document " + Call hCloseDocument endcase 'tiAendernUmwandelnInKurve '-------------------------------------------------------- @@ -237,13 +241,15 @@ testcase tiAendernUmwandelnInPolygonGrafik Printlog "- Context/ConvertIntoPolygon" - Call hNewDocument '/// new document ///' + printlog "new document " + Call hNewDocument Call sSelectEmptyLayout - InsertGraphicsFromFile '/// insert graphic (desp.bmp) ///' + printlog "insert graphic (desp.bmp) " + InsertGraphicsFromFile Kontext "GrafikEinfuegenDlg" - '///use graphic : input\\impress\\grafik\\desp.bmp /// + printlog "use graphic : input\impress\grafik\desp.bmp" Dateiname.SetText ConvertPath ( gTesttoolPath + "global\input\graf_inp\desp.bmp" ) Oeffnen.Click sleep 3 @@ -251,53 +257,66 @@ testcase tiAendernUmwandelnInPolygonGrafik EditSelectAll sleep 1 - ContextConvertIntoPolygon '/// convert into polygon ///' + printlog " convert into polygon " + ContextConvertIntoPolygon Kontext "UmwandelnInPolygon" Printlog "- Testing vectorize dialog" - Farbanzahl.ToMax '/// set number of colors to max ///' + printlog "set number of colors to max" + Farbanzahl.ToMax if Farbanzahl.GetText <> "32" Then Warnlog "- Maximum value for color depth should be 32, but it is: " + Farbanzahl.GetText - Farbanzahl.ToMin '/// set number of colors to min ///' + printlog "set number of colors to min" + Farbanzahl.ToMin sleep 1 if Farbanzahl.GetText <> "8" Then Warnlog "- Minimum value for color depth should be 8 but it is: " + Farbanzahl.GetText sleep 2 - Punktreduktion.SetText "50" '/// set point reduction to 50 ///' + printlog "set point reduction to 50 " + Punktreduktion.SetText "50" sleep 2 if Punktreduktion.GetText <> "32 Pixel" Then Warnlog "- Maximum value should be 32, but it is: " + Punktreduktion.GetText sleep 1 - Punktreduktion.SetText "-50" '/// set an out of range value ///' + printlog "set an out of range value" + Punktreduktion.SetText "-50" sleep 1 if Punktreduktion.GetText <> "0 Pixel" Then Warnlog "- Minimum value should be 0, but it is: " + Punktreduktion.GetText - Loecherfuellen.Uncheck '/// uncheck fill holes ///' + printlog "uncheck fill holes" + Loecherfuellen.Uncheck if Not Kachelgroesse.IsEnabled Then Printlog "- Control disabled." else Warnlog "- Control should be disabled if Fill is not checked." end if - Vorschau.Click '/// open preview ///' + printlog "open preview" + Vorschau.Click sleep 2 - UmwandelnInPolygon.OK '/// close dialog ///' + printlog "close dialog " + UmwandelnInPolygon.OK sleep 5 - Call hCloseDocument '/// close document ///' + printlog "close document" + Call hCloseDocument endcase 'tiAendernUmwandelnInPolygonGrafik '-------------------------------------------------------- testcase tiAendernUmwandelnIn3D Printlog "- Convert into 3D" - Call hNewDocument - sleep 1 '/// new impress document ///' - hRechteckErstellen (10,10,40,40) '/// create rectangle ///' - '/// convert into 3D ///' + printlog "new impress document " + Call hNewDocument + sleep 1 + printlog "create rectangle" + hRechteckErstellen (10,10,40,40) + printlog "convert into 3D " sleep 2 gMouseclick 35,35 sleep 1 try - ContextConvertInto3D '/// try to access convert ito 3d a 2nd time, should be impossible using a 3d object as source ///' + printlog "try to access convert ito 3d a 2nd time, should be impossible using a 3d object as source " + ContextConvertInto3D Printlog "- Convert into 3D works" catch Warnlog "- Convert into 3D does not work" endcatch - Call hCloseDocument '/// close document '/// + printlog "close document" + Call hCloseDocument endcase 'tiAendernUmwandelnIn3D '-------------------------------------------------------- @@ -307,11 +326,14 @@ testcase tiAendernUmwandelnIn3DRotationskoerper Dim PosX Dim PosY - Call hNewDocument '/// new document '/// + printlog "new document" + Call hNewDocument Kontext "DocumentImpress" - hRechteckErstellen (20,20,50,50) '/// create rectangle ///' + printlog "create rectangle" + hRechteckErstellen (20,20,50,50) sleep 1 - ContextPositionAndSize '/// get position values for the rectangle ///' + printlog "get position values for the rectangle " + ContextPositionAndSize Kontext Active.SetPage TabPositionAndSize Kontext "TabPositionAndSize" @@ -320,26 +342,31 @@ testcase tiAendernUmwandelnIn3DRotationskoerper TabPositionAndSize.OK sleep 1 Kontext "DocumentImpress" - ContextConvertInto3DRotationObject '/// convert into 3d lathe object ///' + printlog "convert into 3d lathe object" + ContextConvertInto3DRotationObject sleep 2 ContextPositionAndSize Kontext - Active.SetPage TabPositionAndSize '/// control changes in position values to confirm convert action ///' + printlog "control changes in position values to confirm convert action" + Active.SetPage TabPositionAndSize Kontext "TabPositionAndSize" if PositionX.GetText = PosX and PositionY.GetText = PosY Then Warnlog "- No change in position or dimension, converting seemd not to work" TabPositionAndSize.OK sleep 1 - Call hCloseDocument '/// close document ///' + printlog "close document " + Call hCloseDocument endcase 'tiAendernUmwandelnIn3DRotationskoerper '-------------------------------------------------------- testcase tiAendernUmwandelnInMetaFile Printlog "- ConvertIntoMetaFile" - - Call hNewDocument '/// new document ///' + + printlog "new document " + Call hNewDocument sleep 3 - InsertGraphicsFromFile '/// insert graphic ///' + printlog "insert graphic" + InsertGraphicsFromFile sleep 1 kontext "Active" sleep 1 @@ -349,21 +376,21 @@ testcase tiAendernUmwandelnInMetaFile sleep 1 Kontext "GrafikEinfuegenDlg" sleep 2 - '/// uses input\\impress\\grafik\\desp.gif") /// + printlog " uses input\impress\grafik\desp.gif" Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\purzel.gif") sleep 2 Oeffnen.Click sleep 5 Kontext "DocumentImpress" try - ContextConvertIntoMetafile '/// convert bitmap into metafile ///' + printlog "convert bitmap into metafile" + ContextConvertIntoMetafile sleep 2 Printlog "- Convert into Metafile does work" catch Warnlog "- Convert into Metafile does not work" endcatch sleep 2 - Call hCloseDocument '/// close document ///' - -endcase 'tiAendernUmwandelnInMetaFile - + printlog "close document" + Call hCloseDocument +endcase 'tiAendernUmwandelnInMetaFile \ No newline at end of file diff --git a/testautomation/graphics/optional/includes/global/g_customshapes.inc b/testautomation/graphics/optional/includes/global/g_customshapes.inc index 28c2e22ed301..1a38090914e6 100644 --- a/testautomation/graphics/optional/includes/global/g_customshapes.inc +++ b/testautomation/graphics/optional/includes/global/g_customshapes.inc @@ -38,20 +38,19 @@ testcase tCustomshapes dim counter as Integer dim MakeInto3Dcounter as Integer - '/// Create new document ///' + printlog "Create new document " Call hNewDocument Call sSelectEmptyLayout - if gApplication = "DRAW" then + if gApplication = "DRAW" then Kontext "Documentdraw" - else '(Impress) + else '(Impress) Kontext "DocumentImpress" - endif - kontext "Toolbar" - sleep 1 - printlog "insert a Smiley." - '/// From the toolbar: Insert three objects: ///' - '/// insert a Smiley. ///' - kontext "Toolbar" + endif + kontext "Toolbar" + sleep 1 + printlog "From the toolbar: Insert three objects: " + printlog "1st: insert a Smiley. " + kontext "Toolbar" if Toolbar.Exists then if Toolbar.IsVisible then sleep 1 @@ -73,17 +72,15 @@ testcase tCustomshapes kontext "SymbolShapes" SymbolShapes.Close - '/// Unmark all objects ///' + printlog "Unmark all objects " hTypeKeys "" - '/// Mark the Smiley ///' + printlog "Mark the Smiley " hTypeKeys "" printlog "Rename the object to 'First'." - '/// Rename the object to 'First' ///" hOpenContextMenu sleep 2 - 'Choose rename. if hMenuFindSelect(27027, true, 15) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -93,11 +90,9 @@ testcase tCustomshapes NameField.SetText "First" NameDlgObject.OK - printlog "Set the object -Title/Description to 'SecondTitle' and 'SecondText'" - '/// Open the Context-menu and set the description of the object to 'First' ///" + printlog "Open the Context-menu and set the description of the object to 'First'" hOpenContextMenu sleep (2) - 'Choose "Description" if hMenuFindSelect(27033, true, 14) = false then Warnlog "Context-Menu-entry `Description` was not found. Therefore the test ends." Call hCloseDocument @@ -115,8 +110,7 @@ testcase tCustomshapes endif gMouseClick 90, 90 - printlog "Insert a Triangle." - '/// Insert a Triangle ///' + printlog "2nd: Insert a Triangle " kontext "Toolbar" if Toolbar.Exists then if Toolbar.IsVisible then @@ -138,16 +132,14 @@ testcase tCustomshapes BasicShapes.Close sleep 1 - '/// Unmark all objects ///' + printlog "Unmark all objects " hTypeKeys "" - '/// Mark the Triangle ///' + printlog "Mark the Triangle " hTypeKeys "", 2 - printlog "Rename the object into 'Second'." - '/// Rename the object into 'Second'. ///' + printlog "Rename the object into 'Second'. " hOpenContextMenu sleep 2 - 'Choose rename. if hMenuFindSelect(27027, true, 15) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -159,11 +151,9 @@ testcase tCustomshapes NameField.SetText "Second" NameDlgObject.OK - printlog "Set the object -Title/Description to 'SecondTitle' and 'SecondText'." - '/// Open the Context-menu and set the description of the object to 'SecondTitle' and 'SecondText' ///" + printlog "Open the Context-menu and set the description of the object to 'SecondTitle' and 'SecondText'" hOpenContextMenu sleep (2) - 'Choose "Description" if hMenuFindSelect(27033, true, 14) = false then Warnlog "Context-Menu-entry `Description` was not found. Therefore the test ends." Call hCloseDocument @@ -181,14 +171,13 @@ testcase tCustomshapes endif gMouseClick 90, 90 - printlog "Insert Thinking-cloud." - '/// Insert Thinking-cloud. ///' + printlog "3rd: Insert Thinking-cloud." kontext "Toolbar" if Toolbar.Exists then if Toolbar.IsVisible then sleep 1 try - CalloutShapes.TearOff ' insert Thinking-cloud + CalloutShapes.TearOff catch warnlog "bug for GH from FHA; .tearoff doesnt tell success" endcatch @@ -206,16 +195,14 @@ testcase tCustomshapes Callouts.Close sleep 1 - '/// Unmark all objects ///' + printlog "Unmark all objects " hTypeKeys "" - '/// Mark the cloud ///' + printlog "Mark the cloud " hTypeKeys "", 3 - printlog "Rename the object to 'Third'." - '/// Rename the object to 'Third'. ///' + printlog "Rename the object to 'Third'. " hOpenContextMenu sleep 2 - 'Choose rename. if hMenuFindSelect(27027, true, 15) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -225,11 +212,9 @@ testcase tCustomshapes NameField.SetText "Third" NameDlgObject.OK - printlog "Set the object -Title/Description to 'ThirdTitle' and 'ThirdText'." - '/// Open the Context-menu and set the description of the object to 'First' ///" + printlog "Open the Context-menu and set the description of the object to 'First'" hOpenContextMenu sleep (2) - 'Choose "Description" if hMenuFindSelect(27033, true, 14) = false then Warnlog "Context-Menu-entry `Description` was not found. Therefore the test ends." Call hCloseDocument @@ -247,8 +232,7 @@ testcase tCustomshapes endif gMouseClick 90, 90 - printlog "Change all objects into 3D." - '/// Change all objects into 3D. ///' + printlog "Change all objects into 3D. " if gApplication = "DRAW" then Kontext "Documentdraw" else '(Impress) @@ -294,9 +278,8 @@ testcase tCustomshapes hTypeKeys "" Next MakeInto3Dcounter - printlog "See if the objects still are Custom Shapes." - '/// See if the objects still are Custom Shapes ///' - '/// We do so by moving the lower part of the the thinking-cloud. ///' + printlog "See if the objects still are Custom Shapes " + printlog "We do so by moving the lower part of the the thinking-cloud. " gMouseClick 90, 1 hTypeKeys "" @@ -313,8 +296,7 @@ testcase tCustomshapes gMouseClick 90, 1 hTypeKeys "" - printlog "Check the name of the selected object (should be 'First')" - '/// Check the name of the selected object (should be 'First') ///' + printlog "Check the name of the selected object (should be 'First') " hOpenContextMenu sleep 2 'Choose rename. @@ -334,7 +316,6 @@ testcase tCustomshapes NameDlgObject.OK printlog "Open the Context-menu and check if the description of the object is right" - '/// Open the Context-menu and check if the description of the object is right ///" hOpenContextMenu sleep (2) 'Choose "Description" @@ -363,10 +344,9 @@ testcase tCustomshapes gMouseClick 90, 1 hTypeKeys "" - '/// Check the name of the selected object (should be 'Second') ///' + printlog "Check the name of the selected object (should be 'Second') " hOpenContextMenu sleep 2 - 'Choose rename. if hMenuFindSelect(27027, true, 15) = false then Warnlog " Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -383,7 +363,6 @@ testcase tCustomshapes NameDlgObject.OK printlog "Open the Context-menu and check if the description of the object is right" - '/// Open the Context-menu and check if the description of the object is right ///" hOpenContextMenu sleep (2) 'Choose "Description" @@ -416,7 +395,7 @@ testcase tCustomshapes gMouseClick 90, 1 hTypeKeys "" - '/// Check the name of the selected object (should be "Third") ///' + printlog "Check the name of the selected object (should be Third) " hOpenContextMenu sleep 2 'Choose rename. @@ -436,7 +415,6 @@ testcase tCustomshapes NameDlgObject.OK printlog "Open the Context-menu and check if the description of the object is right" - '/// Open the Context-menu and check if the description of the object is right ///" hOpenContextMenu sleep (2) 'Choose "Description" @@ -468,14 +446,14 @@ testcase tCustomshapes endif printlog "End of test. Close the document." - Call hCloseDocument '/// Close Document ///' + Call hCloseDocument endcase 'tCustomshapes '--------------------------------------------------------- testcase tFormatPaintbrush dim counter, ZaehlerVerlauf, j as Integer - '/// Hatching ///' + printlog "Hatching " dim HatchingDistance as string dim HatchingAngle as string dim HatchingLineType as string @@ -524,23 +502,24 @@ testcase tFormatPaintbrush dim front_value as string dim background_value as string - '/// Create new document ///' + printlog "Create new document " Call hNewDocument - '/// Create a new rectangle ///' + printlog "Create a new rectangle " hRechteckErstellen ( 10, 10, 30, 30 ) FormatArea - '/// Switch to Tabpage "Area" ///' + printlog "Switch to Tabpage Area " Kontext Active.SetPage TabArea Kontext "TabArea" sleep 1 - FillOptions.Select 4 '/// Select hatching, control after closing and reopening dialog if changes are recognized ///' - '/// Switch to Tabpage "Hatching" ///' + printlog "Select hatching, control after closing and reopening dialog if changes are recognized " + FillOptions.Select 4 + printlog "Switch to Tabpage Hatching " Kontext Active.setpage TabSchraffuren Kontext "TabSchraffuren" - '/// Get the values for the Rectangle ///' + printlog "Get the values for the Rectangle " HatchingDistance = Abstand.GetText HatchingAngle = Winkel.GetText 'Definition @@ -551,7 +530,7 @@ testcase tFormatPaintbrush sleep 1 ' FormatArea - '/// Switch to Tabpage "Shaddow" ///' + printlog "Switch to Tabpage Shaddow " Kontext Active.setpage TabSchatten Kontext "TabSchatten" @@ -565,7 +544,7 @@ testcase tFormatPaintbrush endif sleep 1 - '/// Switch to Tabpage "Transparency" ///' + printlog "Switch to Tabpage Transparency " Kontext Active.SetPage TabTransparenz Kontext "TabTransparenz" @@ -583,7 +562,7 @@ testcase tFormatPaintbrush MFEnd_value = MFEndwert.GetText sleep 1 - '/// Switch to Tabpage "Color" ///' + printlog "Switch to Tabpage Color " Kontext Active.setpage TabFarben Kontext "TabFarben" @@ -603,7 +582,7 @@ testcase tFormatPaintbrush endif sleep 1 - '/// Switch to Tabpage "Gradient" ///' + printlog "Switch to Tabpage Gradient " Kontext Active.setpage TabFarbverlaeufe Kontext "TabFarbverlaeufe" @@ -619,7 +598,7 @@ testcase tFormatPaintbrush tovalue_value = BisWert.GetText sleep 1 - '/// Switch to Tabpage "Bitmap" ///' + printlog "Switch to Tabpage Bitmap " Kontext Active.setpage TabBitmap Kontext "TabBitmap" @@ -627,11 +606,11 @@ testcase tFormatPaintbrush front_value = Vordergrund.GetSelText background_value = Hintergrund.GetSelText sleep 1 - '/// Close the FormatArea-dialogue with "OK" ///' + printlog "Close the FormatArea-dialogue with OK " TabBitmap.OK sleep 2 - '/// Create a second rectangle, and use the "Paintbrush-icon" to copy the settings for the first rectangle onto the new one ///' + printlog "Create a second rectangle, and use the Paintbrush-icon to copy the settings for the first rectangle onto the new one " hRechteckErstellen ( 70, 70, 90, 90 ) if gApplication = "DRAW" then kontext "Documentdraw" @@ -659,21 +638,23 @@ testcase tFormatPaintbrush sleep 1 endif - '/// Check if the Formatting is like the first one. ///' + printlog "Check if the Formatting is like the first one. " FormatArea - '/// Switch to Tabpage "Area" ///' + printlog "Switch to Tabpage Area " Kontext Active.SetPage TabArea Kontext "TabArea" -' if FillOptions.GetSelIndex <> 4 then '/// The selected value should be 'no fill' ///' +' if FillOptions.GetSelIndex <> 4 then printlog "The selected value should be 'no fill' " ' warnlog "The FillOptions-value was not transferred correctly." ' else ' printlog "The FillOptions-value was transferred correctly." ' endif - sleep 1 '/// control if changes are still there after closing and reopening dialog ///' - FillOptions.Select 4 '/// Select hatching, control after closing and reopening dialog if changes are recognized ///' - '/// Switch to Tabpage "Hatching" ///' + sleep 1 + printlog "control if changes are still there after closing and reopening dialog " + FillOptions.Select 4 + printlog "Select hatching, control after closing and reopening dialog if changes are recognized " + printlog "Switch to Tabpage Hatching " kontext Active.setpage TabSchraffuren kontext "TabSchraffuren" @@ -693,7 +674,7 @@ testcase tFormatPaintbrush endif sleep 1 - '/// Switch to Tabpage "Shaddow" ///' + printlog "Switch to Tabpage Shaddow " Kontext Active.setpage TabSchatten Kontext "TabSchatten" @@ -718,7 +699,7 @@ testcase tFormatPaintbrush endif sleep 1 - '/// Switch to Tabpage "Transparency" ///' + printlog "Switch to Tabpage Transparency " Kontext Active.SetPage TabTransparenz Kontext "TabTransparenz" @@ -757,7 +738,7 @@ testcase tFormatPaintbrush endif sleep 1 - '/// Switch to Tabpage "Color" ///' + printlog "Switch to Tabpage Color " Kontext Active.setpage TabFarben Kontext "TabFarben" @@ -798,7 +779,7 @@ testcase tFormatPaintbrush endif sleep 1 - '/// Switch to Tabpage "Gradient" ///' + printlog "Switch to Tabpage Gradient " Kontext Active.setpage TabFarbverlaeufe Kontext "TabFarbverlaeufe" @@ -831,7 +812,7 @@ testcase tFormatPaintbrush endif sleep 1 - '/// Switch to Tabpage "Bitmap" ///' + printlog "Switch to Tabpage Bitmap " Kontext Active.setpage TabBitmap Kontext "TabBitmap" @@ -843,6 +824,7 @@ testcase tFormatPaintbrush endif sleep 1 TabBitmap.OK - Call hCloseDocument '/// Close Document ///' + printlog "Close Document " + Call hCloseDocument endcase 'tFormatPaintbrush diff --git a/testautomation/graphics/optional/includes/global/g_format.inc b/testautomation/graphics/optional/includes/global/g_format.inc index 8cf37d5432a3..671eea72db1e 100644 --- a/testautomation/graphics/optional/includes/global/g_format.inc +++ b/testautomation/graphics/optional/includes/global/g_format.inc @@ -46,267 +46,265 @@ testcase tiFormatText Dim ZaehlerEffekt dim sTemp as string - '/// open application ///' + printlog "open application" Call hNewDocument Call sSelectEmptyLayout - '/// create a textbox with text ///' - Call hTextrahmenErstellen ("This is a text, which, I hope, in Staroffice, will be automaticly formatted. Should that not be the case, then it doesn't matter.",20,20,70,20) + printlog "create a textbox with text" + Call hTextrahmenErstellen ("This is a text, which, I hope, in Openoffice, will be automaticly formatted. Should that not be the case, then it doesn't matter.",20,20,70,20) WaitSlot (1000) - '/// click outside of textbox, to leave edit mode of textbox and deselect it ///' + printlog "click outside of textbox, to leave edit mode of textbox and deselect it" gMouseClick 99,99 - '/// type key [TAB] to select textbox again ///' + printlog "type key [TAB] to select textbox again" hTypeKeys "" - '/// Format->Position and Size ///' + printlog "Format->Position and Size" FormatPositionAndSize - Kontext - '/// select tabpage 'Format and Size' on dialog 'Position and Size' ///' - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - sleep 2 - '/// get and remember Position: 'Position X' ///' - a = PositionX.GetText - '/// close dialog 'Position and Size' with OK ///' - TabPositionAndSize.OK + Kontext + printlog "select tabpage 'Format and Size' on dialog 'Position and Size'" + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + sleep 2 + printlog "get and remember Position: 'Position X'" + a = PositionX.GetText + printlog "close dialog 'Position and Size' with OK" + TabPositionAndSize.OK - '/// Format -> Text... ///' + printlog "Format -> Text..." FormatTextDraw - Kontext - '/// select tabpage 'Text' ///' - Active.SetPage TabText - Kontext "TabText" - '/// Check checkbox 'Fit width to text' ///' - BreiteAnTextAnpassen.Check - '/// leave dialog with OK ///' - TabText.OK + Kontext + printlog "select tabpage 'Text'" + Active.SetPage TabText + Kontext "TabText" + printlog "Check checkbox 'Fit width to text'" + BreiteAnTextAnpassen.Check + printlog "leave dialog with OK" + TabText.OK + printlog "Dialog should have been resized and moved now!" - '/// Dialog should have been resized and moved now! ///' - - '/// Format->Position and Size ///' + printlog "Format->Position and Size" ContextPositionAndSize - Kontext - '/// select tabpage 'Format and Size' on dialog 'Position and Size' ///' - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - WaitSlot (2000) - '/// compare 'Position X' with saved value - has to be different ///' - sTemp = PositionX.GetText - if (sTemp <> a) Then - Printlog " - Fit to frame does work" - else - warnlog " - Fit to frame doesn't work: expected: '" + a + "' is: '" + + "'" - end if - '/// get and remember Position: 'Position Y' ///' - b=PositionY.GetText - TabPositionAndSize.OK + Kontext + printlog "select tabpage 'Format and Size' on dialog 'Position and Size'" + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + WaitSlot (2000) + printlog "compare 'Position X' with saved value - has to be different" + sTemp = PositionX.GetText + if (sTemp <> a) Then + Printlog " - Fit to frame does work" + else + warnlog " - Fit to frame doesn't work: expected: '" + a + "' is: '" + + "'" + end if + printlog "get and remember Position: 'Position Y'" + b=PositionY.GetText + TabPositionAndSize.OK - '/// Format -> Text... ///' + printlog "Format -> Text..." FormatTextDraw - Kontext - '/// select tabpage 'Text' ///' - Active.SetPage TabText - Kontext "TabText" - '/// UNCheck checkbox 'Fit width to text' ///' - BreiteAnTextAnpassen.Uncheck - '/// check checkbox 'Fit height to text' ///' - HoeheAnTextAnpassen.Check - '/// if checkbox 'Fit to frame' is enabled: this state only happens, if 'Fit height to text' and 'Fit width to text' are checked ///' - if AmRahmenAnpassen.IsEnabled Then - WarnLog " - checkbox 'Fit to frame' is enabled, which is wrong!" - else - PrintLog " - checkbox 'Fit to frame' is disabled." - end if - WaitSlot (1000) - '/// UNcheck checkbox 'Fit height to text' ///' - HoeheAnTextAnpassen.UnCheck - '/// UNCheck checkbox 'Fit width to text' ///' - BreiteAnTextAnpassen.UnCheck - '/// if checkbox 'Fit to frame' is disabled: this state only happens, if 'Fit height to text' and/or 'Fit width to text' are checked ///' - if AmRahmenAnpassen.IsEnabled Then - PrintLog " - checkbox 'Fit to frame' is enabled." - else - WarnLog " - checkbox 'Fit to frame' is disabled, which is wrong!" - end if -' PrintLog "Full width: " + GanzeBreite.IsChecked - '/// set metric field 'Left' to 10 ///' - Links.SetText "10" - '/// set metric field 'Right' to 10 ///' - Rechts.SetText "10" - '/// set metric field 'Top' to 10 ///' - Oben.SetText "10" - '/// set metric field 'Bottom' to 10 ///' - Unten.SetText "10" - '/// leave dialog with OK ///' - TabText.OK + Kontext + printlog "select tabpage 'Text'" + Active.SetPage TabText + Kontext "TabText" + printlog "UNCheck checkbox 'Fit width to text'" + BreiteAnTextAnpassen.Uncheck + printlog "check checkbox 'Fit height to text'" + HoeheAnTextAnpassen.Check + printlog "if checkbox 'Fit to frame' is enabled: this state only happens, if 'Fit height to text' and 'Fit width to text' are checked" + if AmRahmenAnpassen.IsEnabled Then + WarnLog " - checkbox 'Fit to frame' is enabled, which is wrong!" + else + PrintLog " - checkbox 'Fit to frame' is disabled." + end if + WaitSlot (1000) + printlog "UNcheck checkbox 'Fit height to text'" + HoeheAnTextAnpassen.UnCheck + printlog "UNCheck checkbox 'Fit width to text'" + BreiteAnTextAnpassen.UnCheck + printlog "if checkbox 'Fit to frame' is disabled: this state only happens, if 'Fit height to text' and/or 'Fit width to text' are checked" + if AmRahmenAnpassen.IsEnabled Then + PrintLog " - checkbox 'Fit to frame' is enabled." + else + WarnLog " - checkbox 'Fit to frame' is disabled, which is wrong!" + end if + printlog "set metric field 'Left' to 10" + Links.SetText "10" + printlog "set metric field 'Right' to 10" + Rechts.SetText "10" + printlog "set metric field 'Top' to 10" + Oben.SetText "10" + printlog "set metric field 'Bottom' to 10" + Unten.SetText "10" + printlog "leave dialog with OK" + TabText.OK - '/// Edit -> Select All ///' + printlog "Edit -> Select All" EditSelectAll - '/// type Keys [Strg]+[x] to cut object ///' + printlog "type Keys [Strg]+[x] to cut object" hTypeKeys "" - '/// No object exists in dokument right now! ///' - '/// Format -> Text... ///' + printlog "No object exists in dokument right now!" + printlog "Format -> Text..." FormatTextDraw - Kontext - '/// select tabpage 'Text' ///' - Active.SetPage TabText - Kontext "TabText" - '/// check checkbox 'Adjust to contour' ///' - Konturfluss.Check - '/// now every other control on the dialog has to get disabled ///' - if ((AmRahmenAnpassen.IsEnabled=False) And (Links.IsEnabled=False) And (Rechts.IsEnabled=False) And (Oben.IsEnabled=False) And (Unten.IsEnabled =False)) Then - PrintLog " - Adjust to contour is working" - else - WarnLog " - contourflow aktivated doesn't work it's supposed to" - end if - '/// leave dialog with OK ///' - TabText.OK + Kontext + printlog "select tabpage 'Text'" + Active.SetPage TabText + Kontext "TabText" + printlog "check checkbox 'Adjust to contour'" + Konturfluss.Check + printlog "now every other control on the dialog has to get disabled" + if ((AmRahmenAnpassen.IsEnabled=False) And (Links.IsEnabled=False) And (Rechts.IsEnabled=False) And (Oben.IsEnabled=False) And (Unten.IsEnabled =False)) Then + PrintLog " - Adjust to contour is working" + else + WarnLog " - contourflow aktivated doesn't work it's supposed to" + end if + printlog "leave dialog with OK" + TabText.OK - '/// create a textbox with text ///' - Call hTextrahmenErstellen ("blablablablablablablablablablablabla",20,20,60,60) + printlog "create a textbox with text" + Call hTextrahmenErstellen ("Just some test-text...",20,20,60,60) WaitSlot (5000) - '/// Format -> Text... ///' + printlog "Format -> Text..." FormatTextDraw - Kontext - '/// select tabpage 'Text Animation' ///' - Active.SetPage TabLauftext - Kontext "TabLauftext" + Kontext + printlog "select tabpage 'Text Animation'" + Active.SetPage TabLauftext + Kontext "TabLauftext" - ZaehlerEffekt = Effekt.GetItemCount - if (ZaehlerEffekt <> 5) then - qaerrorlog "There are now more or less than 5 Effects - Change testcase! " + ZaehlerEffekt + ZaehlerEffekt = Effekt.GetItemCount + if (ZaehlerEffekt <> 5) then + qaerrorlog "There are now more or less than 5 Effects - Change testcase! " + ZaehlerEffekt + end if + for n=1 to ZaehlerEffekt + Effekt.Select n + printlog n + ": '" + Effekt.getSelText + "' -------------------------------" + if (n > 2) then + printlog "test all directions" + for i = 1 to 4 + printlog "" + i + select case i + case 1: NachOben.click + case 2: NachLinks.click + case 3: NachRechts.click + case 4: NachUnten.click + end select + sFormatTextDrawAnimation + next i end if - for n=1 to ZaehlerEffekt - Effekt.Select n - printlog "" + n + ": '" + Effekt.getSelText + "' -------------------------------" - if (n > 2) then - '/// test all directions ///' - for i = 1 to 4 - printlog "" + i - select case i - case 1: NachOben.click - case 2: NachLinks.click - case 3: NachRechts.click - case 4: NachUnten.click - end select - sFormatTextDrawAnimation - next i - end if - if ((n > 1) AND (n < 5)) then - '/// test all Start/End Text visibility ///' - for i = 1 to 4 - printlog "" + i - select case i - case 1: TextSichtbarBeimStarten.check : TextSichtbarBeimBeenden.uncheck - case 2: TextSichtbarBeimBeenden.check - case 3: TextSichtbarBeimStarten.uncheck - case 4: TextSichtbarBeimBeenden.uncheck - end select - sFormatTextDrawAnimation - next i - end if - if ((n > 1) AND (n < 5)) then - '/// test all Animation cycles ///' - for i = 1 to 3 - printlog "" + i - select case i - case 1: Endlos.check - case 2: Endlos.UnCheck : Anzahl.typeKeys ("") - case 3: If Endlos.IsChecked = true then - QaErrorLog "#i74067# - Checkbox checked when it shouldn't have been." - Endlos.UnCheck - end if - Anzahl.setText ("1") - end select - sFormatTextDrawAnimation - next i - end if - if (n > 2) then - '/// test all Increment ///' - for i = 1 to 4 - printlog "" + i - select case i - case 1: Pixel.check : Schrittweite.setText("1") - case 2: printlog "#114551# Loop, if Step greater than object size" - case 3: Pixel.UnCheck : Schrittweite.typeKeys ("") - case 4: printlog "#114551# Loop, if Step greater than object size" - end select - sFormatTextDrawAnimation - next i - end if - if (n > 1) then - '/// test all Delay ///' - for i = 1 to 3 - printlog "" + i - select case i - case 1: Automatisch.check - case 2: Automatisch.UnCheck : Verzoegerung.setText("1") - case 3: Verzoegerung.typeKeys ("") - end select - sFormatTextDrawAnimation - next i - end if - next n - TabLauftext.OK + if ((n > 1) AND (n < 5)) then + printlog "test all Start/End Text visibility" + for i = 1 to 4 + printlog "" + i + select case i + case 1: TextSichtbarBeimStarten.check : TextSichtbarBeimBeenden.uncheck + case 2: TextSichtbarBeimBeenden.check + case 3: TextSichtbarBeimStarten.uncheck + case 4: TextSichtbarBeimBeenden.uncheck + end select + sFormatTextDrawAnimation + next i + end if + if ((n > 1) AND (n < 5)) then + printlog "test all Animation cycles" + for i = 1 to 3 + printlog "" + i + select case i + case 1: Endlos.check + case 2: Endlos.UnCheck : Anzahl.typeKeys ("") + case 3: If Endlos.IsChecked = true then + QaErrorLog "#i74067# - Checkbox checked when it shouldn't have been." + Endlos.UnCheck + end if + Anzahl.setText ("1") + end select + sFormatTextDrawAnimation + next i + end if + if (n > 2) then + printlog "test all Increment" + for i = 1 to 4 + printlog "" + i + select case i + case 1: Pixel.check : Schrittweite.setText("1") + case 2: printlog "#114551# Loop, if Step greater than object size" + case 3: Pixel.UnCheck : Schrittweite.typeKeys ("") + case 4: printlog "#114551# Loop, if Step greater than object size" + end select + sFormatTextDrawAnimation + next i + end if + if (n > 1) then + printlog "test all Delay" + for i = 1 to 3 + printlog "" + i + select case i + case 1: Automatisch.check + case 2: Automatisch.UnCheck : Verzoegerung.setText("1") + case 3: Verzoegerung.typeKeys ("") + end select + sFormatTextDrawAnimation + next i + end if + next n + TabLauftext.OK Call hCloseDocument endcase 'tiFormatText '------------------------------------------------------------------------------- testcase tdFormatLayer - '/// open application ///' + printlog "open application" Call hNewDocument - '/// Edit->Layer->Insert (in DRAW also via Insert->Layer) ///' + printlog "Edit->Layer->Insert (in DRAW also via Insert->Layer)" InsertLayer - Kontext "EbeneEinfuegenDlg" - EbenenName.SetText " Test 4" - LayerTitle.SetText " Test no 4" - LayerDescription.SetText " This is the Description of the Layer." - EbeneEinfuegenDlg.OK + Kontext "EbeneEinfuegenDlg" + EbenenName.SetText " Test 4" + LayerTitle.SetText " Test no 4" + LayerDescription.SetText " This is the Description of the Layer." + EbeneEinfuegenDlg.OK - '/// Edit->Layer->Modify (in DRAW also via Format->Layer)///' + printlog "Edit->Layer->Modify (in DRAW also via Format->Layer)" FormatLayer - Kontext "EbeneAendernDlg" - if EbenenName.GetText = " Test 4" Then - EbenenName.SetText "Layer 5" - end if - if LayerTitle.GetText = " Test no 4" Then - LayerTitle.SetText "Layer test 5" - end if - if LayerDescription.GetText = " This is the Description of the Layer." Then - LayerDescription.SetText " This is the changed Description of the Layer." - end if + Kontext "EbeneAendernDlg" + if EbenenName.GetText = " Test 4" Then + EbenenName.SetText "Layer 5" + end if + if LayerTitle.GetText = " Test no 4" Then + LayerTitle.SetText "Layer test 5" + end if + if LayerDescription.GetText = " This is the Description of the Layer." Then + LayerDescription.SetText " This is the changed Description of the Layer." + end if - Sichtbar.Check - Druckbar.Check - Gesperrt.Check - EbeneAendernDlg.OK + Sichtbar.Check + Druckbar.Check + Gesperrt.Check + EbeneAendernDlg.OK - '/// Edit->Layer->Modify (in DRAW also via Format->Layer)///' + printlog "Edit->Layer->Modify (in DRAW also via Format->Layer)" FormatLayer - Kontext "EbeneAendernDlg" - if EbenenName.GetText <> "Layer 5" Then - WarnLog " Name-Value either didn't change at all, or was empty. Expected: 'Layer 5', but was: " + EbenenName.GetText - end if - if LayerTitle.GetText <> "Layer test 5" Then - WarnLog " Title-Value either didn't change at all, or was empty. Expected: 'Layer test 5', but was: " + LayerTitle.GetText - end if - if LayerDescription.GetText <> " This is the changed Description of the Layer." Then - WarnLog " Description-Value either didn't change at all, or was empty. Expected: ' This is the changed Description of the Layer.', but was: " + LayerDescription.GetText - end if - - if Sichtbar.IsChecked=False Then - WarnLog " Value changed: visible" - end if - if Druckbar.IsChecked=False Then - WarnLog " Value changed: printable" - end if - if Gesperrt.IsChecked=False then - WarnLog " Value changed: locked" - end if - EbeneAendernDlg.OK + Kontext "EbeneAendernDlg" + if EbenenName.GetText <> "Layer 5" Then + WarnLog " Name-Value either didn't change at all, or was empty. Expected: 'Layer 5', but was: " + EbenenName.GetText + end if + if LayerTitle.GetText <> "Layer test 5" Then + WarnLog " Title-Value either didn't change at all, or was empty. Expected: 'Layer test 5', but was: " + LayerTitle.GetText + end if + if LayerDescription.GetText <> " This is the changed Description of the Layer." Then + WarnLog " Description-Value either didn't change at all, or was empty. Expected: ' This is the changed Description of the Layer.', but was: " + LayerDescription.GetText + end if - '/// close application ///' + if Sichtbar.IsChecked=False Then + WarnLog " Value changed: visible" + end if + if Druckbar.IsChecked=False Then + WarnLog " Value changed: printable" + end if + if Gesperrt.IsChecked=False then + WarnLog " Value changed: locked" + end if + EbeneAendernDlg.OK + + printlog "close application" Call hCloseDocument endcase 'tdFormatLayer @@ -326,29 +324,29 @@ testcase tdFormatConnector end if Call hNewDocument - '/// insert connector /// - kontext "Connectorsbar" - if Connectorsbar.Exists then - Connectorsbar.Close - end if + printlog "insert connector" + kontext "Connectorsbar" + if Connectorsbar.Exists then + Connectorsbar.Close + end if - kontext "Toolbar" - Sleep (1) - try - Verbinder.TearOff ' insert connector - catch - warnlog "bug for GH from TBO; .tearoff doesn't tell success" - endcatch + kontext "Toolbar" + Sleep (1) + try + Verbinder.TearOff ' insert connector + catch + warnlog "bug for GH from TBO; .tearoff doesn't tell success" + endcatch kontext "Connectorsbar" Verbinder.click gMouseMove ( 10,10,30,30) Call hCloseDocument - '/// Open file with a finished scenario ///' - hFileOpen ConvertPath (gTesttoolPath + "graphics\required\input\FormatConnector." + ExtensionString) + printlog "Open file with a finished scenario" + hFileOpen ConvertPath (gTesttoolPath + "graphics\required\input\FormatConnector." + ExtensionString) sleep (1) - '/// Check if the document is writable ///' + printlog "Check if the document is writable" if fIsDocumentWritable = false then ' Make the document writable and check if it's succesfull if fMakeDocumentWritable = false then @@ -358,82 +356,84 @@ testcase tdFormatConnector end if gMouseClick 1,1 - '/// Press TAB three times to select the connector. ///' + printlog "Press TAB three times to select the connector." hTypekeys "" hTypekeys "" hTypekeys "" WaitSlot (1000) - hTypeKeys "" 'OpenContextMenu(true) + printlog "OpenContextMenu(true)" + hTypeKeys "" sleep (3) - hMenuSelectNr(2) ' Connector + printlog "Select Connector" + hMenuSelectNr(2) Kontext "Verbinder" - Typ.Select 2 ' the one with 2 from 3 posibilities to set a value... + Typ.Select 2 ' the one with 2 from 3 posibilities to set a value... Sleep (1) - AnfangHorizontal.SetText "1" - Verbinder.TypeKeys "" - AnfangVertikal.SetText "1" + AnfangHorizontal.SetText "1" + Verbinder.TypeKeys "" + AnfangVertikal.SetText "1" + Verbinder.TypeKeys "" + EndeHorizontal.SetText "1" + Verbinder.TypeKeys "" + EndeVertikal.SetText "1" + Verbinder.TypeKeys "" + printlog EndeVertikal.getText + try + Linie1.SetText "10" Verbinder.TypeKeys "" - EndeHorizontal.SetText "1" + sTemp = Linie1.getText + sUnit = GetMeasUnit(sTemp) + cDecSep = GetDecimalSeperator(sTemp) + catch + PrintLog " Lineoffset not activated -> you have to choose another linetype: 1" + endcatch + try + Linie2.SetText "10" Verbinder.TypeKeys "" - EndeVertikal.SetText "1" + catch + PrintLog " Lineoffset not activated -> you have to choose another linetype: 2" + endcatch + try + Linie3.SetText "10" Verbinder.TypeKeys "" - printlog EndeVertikal.getText - try - Linie1.SetText "10" - Verbinder.TypeKeys "" - sTemp = Linie1.getText - sUnit = GetMeasUnit(sTemp) - cDecSep = GetDecimalSeperator(sTemp) - catch - PrintLog " Lineoffset not activated -> you have to choose another linetype: 1" - endcatch - try - Linie2.SetText "10" - Verbinder.TypeKeys "" - catch - PrintLog " Lineoffset not activated -> you have to choose another linetype: 2" - endcatch - try - Linie3.SetText "10" - Verbinder.TypeKeys "" - catch - PrintLog " Lineoffset not activated -> you have to choose another linetype: 3 when will this be enabled ?" - endcatch + catch + PrintLog " Lineoffset not activated -> you have to choose another linetype: 3 when will this be enabled ?" + endcatch Verbinder.OK FormatConnector - Kontext "Verbinder" - sTemp = AnfangHorizontal.GetText + Kontext "Verbinder" + sTemp = AnfangHorizontal.GetText - if fCompareTwoValues(sTemp, "1"+cDecSep+"00"+sUnit) Then - WarnLog " value not changed" - printlog "AnfangHorizontal = is '" + sTemp + "' should: '"+"1"+cDecSep+"00"+sUnit+"'" - end if - if fCompareTwoValues(AnfangVertikal.GetText, "1"+cDecSep+"00"+sUnit) Then - WarnLog " value not changed" - printlog "AnfangVertikal.GetText = " + AnfangVertikal.GetText - end if - if fCompareTwoValues(EndeHorizontal.GetText, "1"+cDecSep+"00"+sUnit) Then - WarnLog " value not changed" - printlog "EndeHorizontal.GetText = " + EndeHorizontal.GetText - end if - if fCompareTwoValues(EndeVertikal.GetText, "1"+cDecSep+"00"+sUnit) Then - WarnLog " value not changed" - printlog "EndeHorizontal.GetText = " + EndeHorizontal.GetText - end if + if fCompareTwoValues(sTemp, "1"+cDecSep+"00"+sUnit) Then + WarnLog " value not changed" + printlog "AnfangHorizontal = is '" + sTemp + "' should: '"+"1"+cDecSep+"00"+sUnit+"'" + end if + if fCompareTwoValues(AnfangVertikal.GetText, "1"+cDecSep+"00"+sUnit) Then + WarnLog " value not changed" + printlog "AnfangVertikal.GetText = " + AnfangVertikal.GetText + end if + if fCompareTwoValues(EndeHorizontal.GetText, "1"+cDecSep+"00"+sUnit) Then + WarnLog " value not changed" + printlog "EndeHorizontal.GetText = " + EndeHorizontal.GetText + end if + if fCompareTwoValues(EndeVertikal.GetText, "1"+cDecSep+"00"+sUnit) Then + WarnLog " value not changed" + printlog "EndeHorizontal.GetText = " + EndeHorizontal.GetText + end if - Zaehler = Typ.GetItemCount - for i = 1 to Zaehler - Typ.Select i - SetClipboard Typ.GetSelText - Verbinder.OK - FormatConnector - Kontext "Verbinder" - if GetClipboardText <> Typ.GetSelText Then - WarnLog " Selection not saved. Was: " + Typ.GetSelText + " . But should have been: " +GetClipboardText - end if - next i + Zaehler = Typ.GetItemCount + for i = 1 to Zaehler + Typ.Select i + SetClipboard Typ.GetSelText + Verbinder.OK + FormatConnector + Kontext "Verbinder" + if GetClipboardText <> Typ.GetSelText Then + WarnLog " Selection not saved. Was: " + Typ.GetSelText + " . But should have been: " +GetClipboardText + end if + next i Verbinder.OK Call hCloseDocument @@ -451,7 +451,6 @@ testcase tiFormatPositionAndSize printlog "New impress doc" Call hNewDocument WaitSlot (3000) - printlog "RECTANGLE-----1/2" printlog "create rectangle" Call hRechteckErstellen (20,20,70,30) WaitSlot (1000) @@ -459,119 +458,119 @@ printlog "New impress doc" WaitSlot (1000) printlog "Format-position and size" ContextPositionAndSize - WaitSlot (1000) - Kontext - printlog "TabPositionAndSize" - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - printlog "put x and y position into clipboard" - printlog "x = " & PositionX.GetText - printlog "y = " & PositionY.GetText - SetClipboard (PositionX.GetText + PositionY.GetText) - TabPositionAndSize.OK + WaitSlot (1000) + Kontext + printlog "TabPositionAndSize" + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + printlog "put x and y position into clipboard" + printlog "x = " & PositionX.GetText + printlog "y = " & PositionY.GetText + SetClipboard (PositionX.GetText + PositionY.GetText) + TabPositionAndSize.OK WaitSlot (1000) printlog "move rectangle down and right" hTypeKeys "",10 hTypeKeys "",10 printlog "open PositionAndSize" ContextPositionAndSize - WaitSlot (1000) - Kontext - printlog "TabPositionAndSize" - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - printlog "control position changes with clipboard content" - if (PositionX.GetText + PositionY.GetText) = GetClipboardText Then WarnLog "Der Dialog hat die Positionsaenderung nicht registriert" - printlog "set position of rectange using the edit fields" - PositionX.SetText "2" - x=PositionX.GetText - PositionY.SetText "2" - y=PositionY.GetText - printlog "check protect" - ProtectPosition.Check - TabPositionAndSize.OK + WaitSlot (1000) + Kontext + printlog "TabPositionAndSize" + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + printlog "control position changes with clipboard content" + if (PositionX.GetText + PositionY.GetText) = GetClipboardText Then WarnLog "Der Dialog hat die Positionsaenderung nicht registriert" + printlog "set position of rectange using the edit fields" + PositionX.SetText "2" + x=PositionX.GetText + PositionY.SetText "2" + y=PositionY.GetText + printlog "check protect" + ProtectPosition.Check + TabPositionAndSize.OK WaitSlot (1000) ContextPositionAndSize - WaitSlot (1000) - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - printlog "check if values are correct" - if PositionX.GetText = x And PositionY.GetText = y Then PrintLog " Values could be changed" - printlog "check if protect works" - if PositionX.GetText<> x Then - WarnLog "Protect does not work" - else - PrintLog "Protext works, X axis checked" - end if - if PositionY.GetText<> y Then - WarnLog "Protect does not work" - else - PrintLog " Protext does work, checked y axis" - end if - printlog "uncheck protect" - ProtectPosition.UnCheck - TabPositionAndSize.OK + WaitSlot (1000) + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + printlog "check if values are correct" + if PositionX.GetText = x And PositionY.GetText = y Then PrintLog " Values could be changed" + printlog "check if protect works" + if PositionX.GetText<> x Then + WarnLog "Protect does not work" + else + PrintLog "Protext works, X axis checked" + end if + if PositionY.GetText<> y Then + WarnLog "Protect does not work" + else + PrintLog " Protext does work, checked y axis" + end if + printlog "uncheck protect" + ProtectPosition.UnCheck + TabPositionAndSize.OK WaitSlot (1000) ContextPositionAndSize - WaitSlot (1000) - Kontext - printlog "TabPositionAndSize" - WaitSlot (1000) - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - KeepRatio.UnCheck - printlog "set width to 10" - WaitSlot (1000) - Width.SetText "10" - printlog "put value into a variable" - WaitSlot (1000) - b=Width.GetText - printlog "Width is " & b - SetClipboard Width.GetText - '/// set heigth to 5 ///' - Height.SetText "5" - printlog "put value into variable" - WaitSlot (1000) - h=Height.GetText - printlog "Height is " & h - printlog "check protect" - ProtectPosition.Check - printlog "close dialog" - TabPositionAndSize.OK + WaitSlot (1000) + Kontext + printlog "TabPositionAndSize" + WaitSlot (1000) + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + KeepRatio.UnCheck + printlog "set width to 10" + WaitSlot (1000) + Width.SetText "10" + printlog "put value into a variable" + WaitSlot (1000) + b=Width.GetText + printlog "Width is " & b + SetClipboard Width.GetText + printlog "set heigth to 5" + Height.SetText "5" + printlog "put value into variable" + WaitSlot (1000) + h=Height.GetText + printlog "Height is " & h + printlog "check protect" + ProtectPosition.Check + printlog "close dialog" + TabPositionAndSize.OK WaitSlot (1000) ContextPositionAndSize - WaitSlot (1000) - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - WaitSlot (2000) - printlog "control size changes" - printlog "Width value is: " & Width.GetText - printlog "Value from Clipboard is: " & GetClipboardText - if Width.GetText = GetClipboardText Then - PrintLog " Size of rectangle could be changed. It is = " + Width.GetText + " but it should be = " + b - else - WarnLog " Controls for height and width do not work" - end if - printlog "Uncheck the Position-Protection, so we can work with this window." - if ProtectPosition.isChecked = FALSE then - printlog "Should be checked since it was checked just 16 rows ago" - ErrorLog "ProtectPosition was not checked - why?" - else - ProtectPosition.Uncheck - end if + WaitSlot (1000) + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + WaitSlot (2000) + printlog "control size changes" + printlog "Width value is: " & Width.GetText + printlog "Value from Clipboard is: " & GetClipboardText + if Width.GetText = GetClipboardText Then + PrintLog " Size of rectangle could be changed. It is = " + Width.GetText + " but it should be = " + b + else + WarnLog " Controls for height and width do not work" + end if + printlog "Uncheck the Position-Protection, so we can work with this window." + if ProtectPosition.isChecked = FALSE then + printlog "Should be checked since it was checked just 16 rows ago" + ErrorLog "ProtectPosition was not checked - why?" + else + ProtectPosition.Uncheck + end if - KeepRatio.Check - printlog "raise value for width" - Width.More 5 - if Height.GetText = h Then - WarnLog " Keep ratio does not work properly" - else - PrintLog " Keep ratio does work" - KeepRatio.UnCheck - end if - TabPositionAndSize.OK + KeepRatio.Check + printlog "raise value for width" + Width.More 5 + if Height.GetText = h Then + WarnLog " Keep ratio does not work properly" + else + PrintLog " Keep ratio does work" + KeepRatio.UnCheck + end if + TabPositionAndSize.OK WaitSlot (2000) gMouseClick 90,90 WaitSlot (2000) @@ -581,107 +580,107 @@ printlog "New impress doc" WaitSlot (2000) printlog "Format-Postion and Size" FormatPositionAndSize - WaitSlot (1000) - Kontext - printlog "TabPositionAndSize" - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - printlog "default value ?: width :-----"+Width.IsEnabled - printlog "check fit width to text" - if Width.IsEnabled then FitWidthText.Check - if Width.IsEnabled = True Then - WarnLog " Fit width does not work" - else - PrintLog " Fit width does work" - end if - printlog "fit heigth to text" - FitHeightText.Check - if Height.IsEnabled = True Then - WarnLog " fit heigth doe not work" - else - PrintLog " fit heigth does work" - end if - ' PrintLog " Fit width to text active: " + FitWidthText.IsChecked - ' PrintLog " Fit heigth to text active: " + FitHeightText.IsChecked - printlog "uncheck fit width to text" - FitWidthText.UnCheck - printlog "uncheck fit heigth to text" - FitHeightText.Uncheck - TabPositionAndSize.OK + WaitSlot (1000) + Kontext + printlog "TabPositionAndSize" + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + printlog "default value ?: width :-----"+Width.IsEnabled + printlog "check fit width to text" + if Width.IsEnabled then FitWidthText.Check + if Width.IsEnabled = True Then + WarnLog " Fit width does not work" + else + PrintLog " Fit width does work" + end if + printlog "fit heigth to text" + FitHeightText.Check + if Height.IsEnabled = True Then + WarnLog " fit heigth doe not work" + else + PrintLog " fit heigth does work" + end if + ' PrintLog " Fit width to text active: " + FitWidthText.IsChecked + ' PrintLog " Fit heigth to text active: " + FitHeightText.IsChecked + printlog "uncheck fit width to text" + FitWidthText.UnCheck + printlog "uncheck fit heigth to text" + FitHeightText.Uncheck + TabPositionAndSize.OK WaitSlot (1000) hTypeKeys "",2 hTypeKeys "",2 WaitSlot (1000) ContextPositionAndSize - WaitSlot (1000) - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - printlog "check x-position of textbox" - SetClipboard PositionX.GetText - WaitSlot (1000) - Kontext - printlog "set rotation angle to 50 and position x and y to 1" - Active.SetPage TabDrehung - Kontext "TabDrehung" - PositionX.SetText "1" - PositionY.SetText "1" - Winkel.SetText "50" - w=Winkel.GetText - TabDrehung.OK + WaitSlot (1000) + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + printlog "check x-position of textbox" + SetClipboard PositionX.GetText + WaitSlot (1000) + Kontext + printlog "set rotation angle to 50 and position x and y to 1" + Active.SetPage TabDrehung + Kontext "TabDrehung" + PositionX.SetText "1" + PositionY.SetText "1" + Winkel.SetText "50" + w=Winkel.GetText + TabDrehung.OK WaitSlot (3000) printlog "check position of manipulated textbox" ContextPositionAndSize - WaitSlot (3000) - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - if PositionX = GetClipboardText Then PrintLog " Position changed due to rotation" - Kontext - Active.SetPage TabDrehung - Kontext "TabDrehung" - WaitSlot (1000) - printlog "check rotation angle" - if Winkel.GetText = w Then PrintLog " Object rotated" - TabDrehung.OK + WaitSlot (3000) + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + if PositionX = GetClipboardText Then PrintLog " Position changed due to rotation" + Kontext + Active.SetPage TabDrehung + Kontext "TabDrehung" + WaitSlot (1000) + printlog "check rotation angle" + if Winkel.GetText = w Then PrintLog " Object rotated" + TabDrehung.OK printlog "RECTANGLE-----2/2" printlog "create rectangle" Call hRechteckErstellen (10,60,70,90) WaitSlot (2000) ContextPositionAndSize - WaitSlot (1000) - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - printlog "put x-axis postion of rectangle into clipboard" - SetClipboard PositionX.GetText - Kontext - printlog "set slant angle to 5" - Active.SetPage TabSchraegstellen - Kontext "TabSchraegstellen" - WaitSlot (1000) - printlog "set radius to 5" - Radius.SetText "5" - r=Radius.GetText - Winkel.SetText w - TabSchraegstellen.OK + WaitSlot (1000) + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + printlog "put x-axis postion of rectangle into clipboard" + SetClipboard PositionX.GetText + Kontext + printlog "set slant angle to 5" + Active.SetPage TabSchraegstellen + Kontext "TabSchraegstellen" + WaitSlot (1000) + printlog "set radius to 5" + Radius.SetText "5" + r=Radius.GetText + Winkel.SetText w + TabSchraegstellen.OK WaitSlot (1000) ContextPositionAndSize - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - if PositionX <> GetClipboardText Then PrintLog " Object changed position due to scaling" - printlog "Before we change tab, we set the Position-marker back to checked " - ProtectPosition.Check - Kontext - printlog "check slant angle and radius" - Active.SetPage TabSchraegstellen - Kontext "TabSchraegstellen" - if Radius.GetText = r Then PrintLog " Cornwer radius changed" - if Winkel.GetText =w Then PrintLog " Object rotated over 45°" - TabSchraegstellen.OK + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + if PositionX <> GetClipboardText Then PrintLog " Object changed position due to scaling" + printlog "Before we change tab, we set the Position-marker back to checked " + ProtectPosition.Check + Kontext + printlog "check slant angle and radius" + Active.SetPage TabSchraegstellen + Kontext "TabSchraegstellen" + if Radius.GetText = r Then PrintLog " Cornwer radius changed" + if Winkel.GetText =w Then PrintLog " Object rotated over 45°" + TabSchraegstellen.OK Call hCloseDocument endcase 'tiFormatPositionAndSize @@ -701,64 +700,76 @@ testcase tiFormat3D_Effekte Dim Posi as string Call hNewDocument - Call sSelectEmptyLayout + Call sSelectEmptyLayout printlog "new document" '-----------------------------------RECTANGLE------------------------------------------------------ - Call hRechteckErstellen (20,20,60,70) '/// create rectangle ///' + printlog "create rectangle" + Call hRechteckErstellen (20,20,60,70) WaitSlot (1000) - ContextPositionAndSize '/// get position and size of rectangle ///' - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - PositionX.SetText "5" - X=PositionX.GetText - printlog "--- created RECTANGLE; xPosition @ "+ x - TabPositionAndSize.OK - ContextConvertInto3D '/// convert rectangle into 3d ///' + printlog "get position and size of rectangle" + ContextPositionAndSize + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + PositionX.SetText "5" + X=PositionX.GetText + printlog "--- created RECTANGLE; xPosition @ "+ x + TabPositionAndSize.OK + printlog "convert rectangle into 3d" + ContextConvertInto3D WaitSlot (1000) Kontext "Drei_D_Effekte" if Drei_D_Effekte.exists(3) then qaerrorlog " The 3D-Effects-dialogue was open. Check why." else - Format3D_Effects '/// open 3d flyer///' + printlog "open 3d flyer" + Format3D_Effects end if - try - if Perspektive.isvisible then - Perspektive.Click '/// check perspective ///' - else - warnlog "why not in draw?" - end if - catch - warnlog "something is wrong mit perspective" - endcatch - Zuweisen.Click '/// assign perspective ///' - Kontext "DocumentImpress" - hTypeKeys "" - ContextPositionAndSize '/// check position and size ///' - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - if PositionX.GetText = X Then - printlog "- Perspective acitvated x: "+PositionX.GetText - else - warnlog "- Perspective seems to have a problem, x value has changed!" - end if - TabPositionAndSize.OK - Kontext "Drei_D_Effekte" - Aktualisieren.Click - Drei_D_Effekte.Close - EditSelectAll '/// delete rectangle ///' + try + if Perspektive.isvisible then + printlog "check perspective" + Perspektive.Click + else + warnlog "why not in draw?" + end if + catch + warnlog "something is wrong mit perspective" + endcatch + printlog "assign perspective" + Zuweisen.Click + Kontext "DocumentImpress" + hTypeKeys "" + printlog "check position and size" + ContextPositionAndSize + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + if PositionX.GetText = X Then + printlog "- Perspective acitvated x: "+PositionX.GetText + else + warnlog "- Perspective seems to have a problem, x value has changed!" + end if + TabPositionAndSize.OK + Kontext "Drei_D_Effekte" + Aktualisieren.Click + Drei_D_Effekte.Close + EditSelectAll + printlog "delete rectangle" hTypeKeys "" '-----------------------------------RECTANGLE------------------------------------------------------ - hRechteckErstellen (20,20,60,70) '/// create new rectangle ///' + printlog "create new rectangle" + hRechteckErstellen (20,20,60,70) printlog "--- created RECTANGLE 2" - Format3D_Effects '/// open 3d flyer ///' + printlog "open 3d flyer" + Format3D_Effects Kontext "Drei_D_Effekte" - Rotationskoerper.Click '/// create lathe object ///' + printlog "create lathe object" + Rotationskoerper.Click WaitSlot (1000) Kontext "DocumentImpress" - ContextPositionAndSize '/// check position and size ///' + printlog "check position and size" + ContextPositionAndSize Kontext Active.SetPage TabPositionAndSize Kontext "TabPositionAndSize" @@ -769,14 +780,17 @@ testcase tiFormat3D_Effekte end if TabPositionAndSize.OK EditSelectAll - hTypeKeys "" '/// delete object ///' + printlog "delete object" + hTypeKeys "" Sleep (1) '-----------------------------------RECTANGLE------------------------------------------------------ - hRechteckErstellen (20,20,60,70) '/// create rectangle ///' + printlog "create rectangle" + hRechteckErstellen (20,20,60,70) printlog "--- created RECTANGLE 3" Kontext "Drei_D_Effekte" WaitSlot (1000) - In_3D_Umwandeln.Click '/// convert to 3d in 3d flyer ///' + printlog "convert to 3d in 3d flyer" + In_3D_Umwandeln.Click WaitSlot (2000) gMouseClick 40,40 qaerrorlog "#i92910: automation: crash when executing tiFormat3D_Effekte in test g_format" @@ -798,27 +812,36 @@ testcase tiFormat3D_Effekte 'end select EditSelectAll - hTypeKeys "" '/// delete object ///' + printlog "delete object" + hTypeKeys "" '-----------------------------------ZYLINDER------------------------------------------------------ Sleep (1) - printlog "--- create CYLINDER" - WL_SD_Zylinder '/// create cylinder ///' - gMousemove 30,30,80,80 '/// This affects the Vertical-value down to 15 ///' + printlog "create CYLINDER" + WL_SD_Zylinder + printlog "This affects the Vertical-value down to 15" + gMousemove 30,30,80,80 Sleep (1) hTypeKeys "" Kontext "Drei_D_Effekte" - Geometrie.Click '/// geometry ///' + printlog " geometry" + Geometrie.Click WaitSlot (1000) ' Endwinkel.More - Vert=Vertikale_Segmente.GetText '/// get value for vertical segments (default) ///' - Hor =Horizontale_Segmente.GetText '/// get value for horizontal segments (default) ///' - Rund=Kantenrundung.GetText '/// get value for edge rounding ///' - Skal=Tiefenskalierung.GetText '/// get value for scale ///' - Tief=Tiefe.GetText '/// get value for depth ///' - Winkel=Endwinkel.GetText '/// get value for angle ///' + printlog "get value for vertical segments (default)" + Vert=Vertikale_Segmente.GetText + printlog "get value for horizontal segments (default)" + Hor =Horizontale_Segmente.GetText + printlog "get value for edge rounding" + Rund=Kantenrundung.GetText + printlog "get value for scale" + Skal=Tiefenskalierung.GetText + printlog "get value for depth" + Tief=Tiefe.GetText + printlog "get value for angle" + Winkel=Endwinkel.GetText - '/// Check if every entry has a value <> "" -> an init value is shown. ///' + printlog "Check if every entry has a value <> "" -> an init value is shown." if Vert ="" then warnlog "Vertical Segment has no init value" if Hor ="" then warnlog "Horizontal Segment has no init value" if Rund ="" then warnlog "Rounded edges has no init value" @@ -826,49 +849,54 @@ testcase tiFormat3D_Effekte if Tief ="" then warnlog "Depth has no init value" if Winkel="" then printlog "Rotation angle has no init value" - '/// Go back to the 3d-effects-dialogue and change the value for the cylinder ///' - - hTypeKeys "" '/// Deselect object and check if 3d controller has default values again ///' + printlog "Go back to the 3d-effects-dialogue and change the value for the cylinder" + hTypeKeys "" Kontext "Drei_D_Effekte" - '/// Check if value for vertical segments has changed in 3d controller ///' + printlog "Check if value for vertical segments has changed in 3d controller" if Vertikale_Segmente.GetText = Vert Then Printlog "- Vertical segment value read from object's properties in the 3d flyer" else Warnlog "- 3D flyer could not read vertical segment information from object. It is = '"+ Vertikale_Segmente.GetText + "' but should be = '" + Vert + "'" end if - if Horizontale_Segmente.GetText = Hor Then '/// check if value for horizontal segments has changed ///' + printlog "check if value for horizontal segments has changed" + if Horizontale_Segmente.GetText = Hor Then Printlog "- Horizontal segment value read from object's properties in the 3d flyer" else Warnlog "- 3D flyer not be able to read horizonal segment information from object. It is = '"+ Horizontale_Segmente.GetText + "' but should be = '" + Hor + "'" end if - if Kantenrundung.GetText = Rund Then '/// check if value for edge rounding has changed ///' + printlog "check if value for edge rounding has changed" + if Kantenrundung.GetText = Rund Then Printlog "- Rounded edges works" else Warnlog "- Rounded edges value could not be read by the 3d flyer It is = '" + Kantenrundung.GetText + "' but should be = '" + rund + "'" end if - if Tiefenskalierung.GetText = Skal Then '/// check value for scale ///' + printlog "check value for scale" + if Tiefenskalierung.GetText = Skal Then Printlog "- Scaled depth works" else Warnlog "- Scale depth value could not be read by the 3d flyer It is = '" + Tiefenskalierung.GetText + "' but should be = '" + skal + "'" end if - if Tiefe.GetText = Tief Then '/// check value for depth ///' + printlog "check value for depth" + if Tiefe.GetText = Tief Then Printlog "- Depth value could be read by the 3d flyer" else Warnlog "- Depth value of object could not be read by the flyer It is = '"+ Tiefe.GetText + "' but should be = '" + tief + "'" end if - if Endwinkel.GetText = Winkel Then '/// check value for angle ///' + printlog "check value for angle" + if Endwinkel.GetText = Winkel Then Printlog "- Angle value could be read by the 3d flyer" else Warnlog "- Angle value is not correct" end if - hTypeKeys "" '/// deselect object and check if 3d controller has default values again ///' + printlog "deselect object and check if 3d controller has default values again" + hTypeKeys "" Kontext "Drei_D_Effekte" Sleep (2) Printlog "- check if 3D flyer goes back to default values if object is deselected" @@ -881,16 +909,19 @@ testcase tiFormat3D_Effekte hTypeKeys "" Kontext "Drei_D_Effekte" - Sleep (2) - Horizontale_Segmente.SetText "32" '/// change horizontal and vertical segments ///' - Vertikale_Segmente.SetText "32" - Kantenrundung.SetText "100" - Endwinkel.Settext "300" - Tiefenskalierung.SetText "500" - Tiefe.SetText "100" - Zuweisen.Click '/// assign changes ///' + Sleep (2) + printlog "change horizontal and vertical segments" + Horizontale_Segmente.SetText "32" + Vertikale_Segmente.SetText "32" + Kantenrundung.SetText "100" + Endwinkel.Settext "300" + Tiefenskalierung.SetText "500" + Tiefe.SetText "100" + printlog "assign changes" + Zuweisen.Click - WaitSlot (1000) '/// check value changes ///' + printlog "check value changes" + WaitSlot (1000) if Vertikale_Segmente.GetText = Vert Then Warnlog "- Default value is wrong" if Horizontale_Segmente.GetText = Hor Then Warnlog "- Default value is wrong" if Kantenrundung.GetText = Rund Then Warnlog "- Default value is wrong" @@ -898,87 +929,103 @@ testcase tiFormat3D_Effekte if Endwinkel.GetText = Winkel Then Warnlog "- Default value is wrong" if Tiefe.GetText=Tief Then Warnlog "- Default value is wrong" EditSelectAll - hTypeKeys "" '/// delete cylinder ///' + printlog "delete cylinder" + hTypeKeys "" '-----------------------------------ZYLINDER------------------------------------------------------ - WL_SD_Zylinder '/// create new cylinder ///' + printlog "create new cylinder" + WL_SD_Zylinder gMouseMove (20,20,60,60) WaitSlot (3000) Kontext "Drei_D_Effekte" - Printlog "- Change basic geometric parameters for the object" - Printlog "Segments : Horizontal: 8; Vertical: 8; Rounded edges: 50 %" - Horizontale_Segmente.SetText "8" '/// changing values for cylinder ///' - Vertikale_Segmente.SetText "8" - Kantenrundung.SetText "50 %" - Sleep (1) - Zuweisen.Click + Printlog "- Change basic geometric parameters for the object" + Printlog "Segments : Horizontal: 8; Vertical: 8; Rounded edges: 50 %" + printlog "changing values for cylinder" + Horizontale_Segmente.SetText "8" + Vertikale_Segmente.SetText "8" + Kantenrundung.SetText "50 %" + Sleep (1) + Zuweisen.Click WaitSlot (2000) gMouseClick 90,90 Sleep (2) - EditSelectAll '/// select object ///' + printlog "select object" + EditSelectAll WaitSlot (1000) - Kontext "Drei_D_Effekte" '/// control if changes are done ///' - if Horizontale_Segmente.GetText <> "8" Then Warnlog "- Horizontal segment count is not correct "+Horizontale_Segmente.GetText - if Vertikale_Segmente.GetText <> "8" Then Warnlog "- Vertical segment count is not correct "+Vertikale_Segmente.GetText - if Kantenrundung.GetText <> "50 %" Then Warnlog "- Value for rounded edges is not correct "+Kantenrundung.GetText + printlog "control if changes are done" + Kontext "Drei_D_Effekte" + if Horizontale_Segmente.GetText <> "8" Then Warnlog "- Horizontal segment count is not correct "+Horizontale_Segmente.GetText + if Vertikale_Segmente.GetText <> "8" Then Warnlog "- Vertical segment count is not correct "+Vertikale_Segmente.GetText + if Kantenrundung.GetText <> "50 %" Then Warnlog "- Value for rounded edges is not correct "+Kantenrundung.GetText Darstellung.Click - Zaehler=Modus.GetItemCount '/// get number of pssibole render methods ///' + printlog "get number of pssibole render methods" + Zaehler=Modus.GetItemCount for i =1 to Zaehler Modus.Select i - Zuweisen.Click '/// assign every render method ///' + printlog "assign every render method" + Zuweisen.Click gMouseClick 90,90 Sleep (1) - EditSelectAll '/// select object ///' + printlog "select object" + EditSelectAll Sleep (1) Kontext "Drei_D_Effekte" - if Modus.GetSelIndex <> i Then Warnlog "- Value for render modus did not change" '/// check if render method has changed ///' + printlog "check if render method has changed" + if Modus.GetSelIndex <> i Then Warnlog "- Value for render modus did not change" next i - Printlog "- Check 3d shadow and surface angle" - Drei_DSchatten.Click '/// check 3d shadow ///' - Papierneigung.SetText "90 degree(s)" - vert = Papierneigung.getText - Zuweisen.Click '/// assign shadow ///' - gMouseClick 90,90 '/// deselect object ///' + Printlog "- Check 3d shadow and surface angle" + Drei_DSchatten.Click + Papierneigung.SetText "90 degree(s)" + vert = Papierneigung.getText + printlog "assign shadow" + Zuweisen.Click + printlog "deselect object" + gMouseClick 90,90 WaitSlot (1000) - EditSelectAll '/// select object ///' + printlog "select object" + EditSelectAll + printlog "check value changes" Kontext "Drei_D_Effekte" - if Papierneigung.GetText <> vert Then Warnlog "- Value for surface angle is not correct" '/// check value changes ///' - Entfernung.SetText "10" '/// set distance to 10 ///' - Sleep (1) - hor = Entfernung.getText - Sleep (1) - Zuweisen.Click + if Papierneigung.GetText <> vert Then Warnlog "- Value for surface angle is not correct" + printlog "set distance to 10" + Entfernung.SetText "10" + Sleep (1) + hor = Entfernung.getText + Sleep (1) + Zuweisen.Click if Entfernung.GetText <> hor Then Warnlog "- Value for distance is not correct; should: "+hor+"; is: "+Entfernung.GetText WaitSlot (2000) hTypeKeys "" Sleep (2) ContextPositionAndSize - WaitSlot (2000) - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - PositionX.SetText "5,00cm" - Posi=PositionX.GetText - TabPositionAndSize.OK + WaitSlot (2000) + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + PositionX.SetText "5,00cm" + Posi=PositionX.GetText + TabPositionAndSize.OK WaitSlot (1000) Kontext "Drei_D_Effekte" - Brennweite.SetText "50" '/// set focval length to 50 ///' + printlog "set focval length to 50" + Brennweite.SetText "50" Zuweisen.Click - ContextPositionAndSize '/// check change in position of the object ///' - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - If PositionX.GetText = Posi Then - printlog "- Raising value for focal length has not changed optical appearence of object, ok." - else - warnlog "Problem with focal lenght here!" - endif - TabPositionAndSize.OK + printlog "check change in position of the object" + ContextPositionAndSize + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + If PositionX.GetText = Posi Then + printlog "- Raising value for focal length has not changed optical appearence of object, ok." + else + warnlog "Problem with focal lenght here!" + endif + TabPositionAndSize.OK WaitSlot (1000) Kontext "Drei_D_Effekte" - Brennweite.SetText "5" - Zuweisen.Click + Brennweite.SetText "5" + Zuweisen.Click WaitSlot (1000) EditSelectAll WaitSlot (3000) @@ -1007,71 +1054,78 @@ testcase tdFormatTemplates qaerrorlog "Not yet ready." goto endsub - dim Zaehler as integer - dim i as integer - dim x as integer - dim iWaitIndex as integer - dim sStyleName as string - dim bDouble as boolean - dim sTemp(2) as string - - Call hNewDocument '/// new impress document ///' - - WaitSlot (5000) - FormatStylesCatalog '/// format-Style catalog///' - iWaitIndex = 0 - do while Vorlagenkatalog.NotExists AND iWaitIndex < 10 + dim Zaehler as integer + dim i as integer + dim x as integer + dim iWaitIndex as integer + dim sStyleName as string + dim bDouble as boolean + dim sTemp(2) as string + + printlog "new impress document" + Call hNewDocument + + WaitSlot (5000) + printlog "format-Style catalog!" + FormatStylesCatalog + iWaitIndex = 0 + do while Vorlagenkatalog.NotExists AND iWaitIndex < 10 sleep (1) iWaitIndex = iWaitIndex + 1 - loop + loop - Kontext "Vorlagenkatalog" - Vorlagen.GetItemCount '/// get item count for templates ///' - Vorlagen.Select 2 '/// select template 2 ///' - - if Bereich.GetItemCount = Vorlagen.GetItemCount Then '/// check if area changes when selecting a template ///' - PrintLog " - Area did changed" - else - WarnLog " Number of entrees should be 2, but it is " + Bereich.GetItemCount - end if - - Zaehler = Ansicht.GetItemCount 'Vorlagenliste.GetItemCount + Kontext "Vorlagenkatalog" + printlog "get item count for templates" + Vorlagen.GetItemCount + printlog "select template 2" + Vorlagen.Select 2 + + printlog "check if area changes when selecting a template" + if Bereich.GetItemCount = Vorlagen.GetItemCount Then + PrintLog " - Area did changed" + else + WarnLog " Number of entrees should be 2, but it is " + Bereich.GetItemCount + end if - for i = 1 to Zaehler - Ansicht.TypeKeys "" ,i - SetClipboard Ansicht.GetSelText + Zaehler = Ansicht.GetItemCount 'Vorlagenliste.GetItemCount + + for i = 1 to Zaehler + Ansicht.TypeKeys "" ,i + SetClipboard Ansicht.GetSelText WaitSlot (2000) - Vorlagen.Select 1 - PrintLog " "+i+": Offset: '" + Vorlagen.GetSelText+"'" - if Bereich.GetItemCount=Vorlagen.GetItemCount Then WarnLog " Range has not changed" - Vorlagen.Select 2 + Vorlagen.Select 1 + PrintLog " "+i+": Offset: '" + Vorlagen.GetSelText+"'" + if Bereich.GetItemCount=Vorlagen.GetItemCount Then WarnLog " Range has not changed" + Vorlagen.Select 2 WaitSlot (1000) Ansicht.TypeKeys "" WaitSlot (1000) - Ansicht.Select 1 + Ansicht.Select 1 WaitSlot (1000) - PrintLog " : Offset: '"+Vorlagen.GetSelText + "'; Opinion: '" + Ansicht.GetSelText+"'" - Vorlagenkatalog.OK - FormatStylesCatalog - Kontext "Vorlagenkatalog" - next i + PrintLog " : Offset: '"+Vorlagen.GetSelText + "'; Opinion: '" + Ansicht.GetSelText+"'" + Vorlagenkatalog.OK + FormatStylesCatalog + Kontext "Vorlagenkatalog" + next i - Vorlagen.Select 2 - WaitSlot (2000) - Vorlagen.Select 1 '/// select first template ///' - if Neu.IsEnabled =False Then WarnLog " Button must be choosable, but is not" - Ansicht.Select 1 - WaitSlot (1000) - Neu.Click '/// create new template ///' - Kontext - Active.SetPage TabVerwalten - Kontext "TabVerwalten" - sStyleName = VorlagenName.GetText - printlog " created new style: '"+sStyleName +"'" - TabVerwalten.OK - PrintLog " New template created" - Kontext "Vorlagenkatalog" - WaitSlot (1000) + Vorlagen.Select 2 + WaitSlot (2000) + printlog "select first template" + Vorlagen.Select 1 + if Neu.IsEnabled =False Then WarnLog " Button must be choosable, but is not" + Ansicht.Select 1 + WaitSlot (1000) + printlog "create new template" + Neu.Click + Kontext + Active.SetPage TabVerwalten + Kontext "TabVerwalten" + sStyleName = VorlagenName.GetText + printlog " created new style: '"+sStyleName +"'" + TabVerwalten.OK + PrintLog " New template created" + Kontext "Vorlagenkatalog" + WaitSlot (1000) ' find newly created style, because they are alphabetical ordered :-( i have to check every entry :-((((( Zaehler = Ansicht.GetItemCount i=1 @@ -1121,10 +1175,11 @@ testcase tdFormatTemplates wEnd end if if (i <= Zaehler) then printlog " found created entry for deleting it :-)" - ' Ansicht.TypeKeys "" ,( i + 1 ) '/// control if template list has created template included ///' + ' Ansicht.TypeKeys "" ,( i + 1 ) printlog "control if template list has created template included" WaitSlot (2000) try - Loeschen.Click '/// delete template ///' + printlog "delete template" + Loeschen.Click WaitSlot (1000) Kontext "Active" if active.exists then @@ -1144,7 +1199,8 @@ testcase tdFormatTemplates UseBindings Ansicht.Select 1 WaitSlot (1000) - Aendern.Click '/// modify template ///' + printlog "modify template" + Aendern.Click WaitSlot (2000) Kontext Active.SetPage TabSchatten @@ -1153,8 +1209,9 @@ testcase tdFormatTemplates TabSchatten.Cancel WaitSlot (2000) Kontext "Vorlagenkatalog" - - Verwalten.Click '/// organize templates ///' + + printlog "organize templates" + Verwalten.Click WaitSlot (2000) Kontext "DVVerwalten" DVVerwalten.OK @@ -1165,21 +1222,27 @@ testcase tdFormatTemplates catch Warnlog " - Style Catalog can't close unless the Template Management-dialog is closed" endcatch - PrintLog " FormatStylesCatalog finished" '/// close template catalog ///' + PrintLog " FormatStylesCatalog finished" WaitSlot (2000) - FormatModifyLayout '/// format modify layout ///' + printlog "format modify layout" + FormatModifyLayout WaitSlot (2000) Kontext "Seitenvorlage" - if HintergrundseiteAustauschen.IsChecked=True Then HintergrundseiteAustauschen.UnCheck '/// uncheck switch background page ///' - Laden.Click '/// load ///' + printlog "uncheck switch background page" + if HintergrundseiteAustauschen.IsChecked=True Then HintergrundseiteAustauschen.UnCheck + printlog "load" + Laden.Click WaitSlot (2000) Kontext "Neu" Neu.Cancel - Kontext "Seitenvorlage" '/// choose a page layout ///' + printlog "choose a page layout" + Kontext "Seitenvorlage" 'Waehlen.Click - Seitenvorlage.OK '/// close dialog ///' - - Call hCloseDocument '/// close document ///' + printlog "close dialog" + Seitenvorlage.OK + + printlog "close document" + Call hCloseDocument endcase 'tdFormatTemplates '------------------------------------------------------------------------------- @@ -1194,60 +1257,60 @@ testcase tiFormatAufzaehlungszeichen Kontext "DocumentImpress" hTextrahmenErstellen ("Hello ",20,20,60,60) for i=1 to 8 - Kontext "DocumentImpress" - gMouseClick 30,30 - EditSelectAll - WaitSlot (1000) - FormatNumberingBulletsDraw - WaitSlot (2000) - Kontext - Active.SetPage TabBullet - Kontext "TabBullet" - Auswahl.TypeKeys "", i - TabBullet.OK - Kontext "DocumentImpress" + Kontext "DocumentImpress" + gMouseClick 30,30 + EditSelectAll + WaitSlot (1000) + FormatNumberingBulletsDraw + WaitSlot (2000) + Kontext + Active.SetPage TabBullet + Kontext "TabBullet" + Auswahl.TypeKeys "", i + TabBullet.OK + Kontext "DocumentImpress" next i for i=1 to 8 - Kontext "DocumentImpress" - gMouseClick 30,30 - EditSelectAll - WaitSlot (1000) - FormatNumberingBulletsDraw - Kontext - Active.SetPage TabNumerierungsart - Kontext "TabNumerierungsart" - Auswahl.TypeKeys "", i - TabNumerierungsart.OK - Kontext "DocumentImpress" + Kontext "DocumentImpress" + gMouseClick 30,30 + EditSelectAll + WaitSlot (1000) + FormatNumberingBulletsDraw + Kontext + Active.SetPage TabNumerierungsart + Kontext "TabNumerierungsart" + Auswahl.TypeKeys "", i + TabNumerierungsart.OK + Kontext "DocumentImpress" next i for i=1 to 8 - Kontext "DocumentImpress" - gMouseClick 30,30 - EditSelectAll - FormatNumberingBulletsDraw - Kontext - Active.SetPage TabNumerierungsart - Kontext "TabNumerierungsart" - Auswahl.TypeKeys "", i - TabNumerierungsart.OK - Kontext "DocumentImpress" + Kontext "DocumentImpress" + gMouseClick 30,30 + EditSelectAll + FormatNumberingBulletsDraw + Kontext + Active.SetPage TabNumerierungsart + Kontext "TabNumerierungsart" + Auswahl.TypeKeys "", i + TabNumerierungsart.OK + Kontext "DocumentImpress" next i WaitSlot (3000) for i=1 to 29 - WaitSlot (3000) - FormatNumberingBulletsDraw - WaitSlot (3000) - Kontext - Active.SetPage TabGrafiken - Kontext "TabGrafiken" - sleep 1 - Auswahl.TypeKeys "", i - TabGrafiken.OK - Kontext "DocumentImpress" + WaitSlot (3000) + FormatNumberingBulletsDraw + WaitSlot (3000) + Kontext + Active.SetPage TabGrafiken + Kontext "TabGrafiken" + sleep 1 + Auswahl.TypeKeys "", i + TabGrafiken.OK + Kontext "DocumentImpress" next i gMouseClick 90,90 Call hCloseDocument -endcase 'tiFormatAufzaehlungszeichen +endcase 'tiFormatAufzaehlungszeichen \ No newline at end of file diff --git a/testautomation/graphics/optional/includes/global/g_line.inc b/testautomation/graphics/optional/includes/global/g_line.inc index adc573a16e48..2a6d5b315f89 100644 --- a/testautomation/graphics/optional/includes/global/g_line.inc +++ b/testautomation/graphics/optional/includes/global/g_line.inc @@ -43,35 +43,46 @@ testcase tiFormatLine Dim k 'Variable fuer Transparenz (Anzahl) Dim l Dim ZaehlerStilLinks - - Call hNewDocument '/// New impress document + + printlog "New impress document" + Call hNewDocument sleep 3 - Call hRechteckErstellen (10,10,60,60) '/// create rectangle + printlog "create rectangle" + Call hRechteckErstellen (10,10,60,60) sleep 2 - FormatLine '/// open Format line dialog + printlog "open Format line dialog" + FormatLine Kontext - Active.SetPage TabLinie '///Open TabLine Tabpage + printlog "Open TabLine Tabpage" + Active.SetPage TabLinie Kontext "TabLinie" sleep 2 - Stil.GetItemCount '/// Get item count for style ///' - Farbe.GetItemCount '/// Get item count for color ///' - Breite.More 1 '/// change value for ///' + printlog "Get item count for style" + Stil.GetItemCount + printlog "Get item count for color" + Farbe.GetItemCount + printlog "change value for" + Breite.More 1 ZaehlerStil = Stil.GetItemCount ZaehlerFarbe = Farbe.GetItemCount - - for i=1 to ZaehlerStil '/// Apply every style to the rectangle ///' - wait 10 - Stil.Select i - wait 10 - TabLinie.OK '/// Closing dialog with ok - ' Kontext "DocumentImpress" - FormatLine '///Open TabLine Tabpage - Kontext - Active.SetPage TabLinie - Kontext "TabLinie" + + printlog "Apply every style to the rectangle" + for i=1 to ZaehlerStil + wait 10 + Stil.Select i + wait 10 + printlog "Closing dialog with ok" + TabLinie.OK + ' Kontext "DocumentImpress" + printlog "Open TabLine Tabpage" + FormatLine + Kontext + Active.SetPage TabLinie + Kontext "TabLinie" next i - - for j=1 to ZaehlerFarbe '/// Apply every color to the rectangle///' + + printlog "Apply every color to the rectangle" + for j=1 to ZaehlerFarbe PrintLog "-- " + Farbe.GetSelText wait 10 Farbe.Select j @@ -83,38 +94,46 @@ testcase tiFormatLine Active.SetPage TabLinie Kontext "TabLinie" next j - Breite.More 3 '/// change Breite ///' + printlog "change Breite" + Breite.More 3 Breite.Less 2 for k=1 to 6 - Transparenz.More 1 '/// change tranparence///' + printlog "change tranparence" + Transparenz.More 1 next k TabLinie.OK '--------------------------------------- sleep 2 - EditSelectAll '/// Select all objects in document ///' + printlog "Select all objects in document" + EditSelectAll sleep 2 - hTypeKeys "" '/// Delete objects ///' + printlog "Delete objects" + hTypeKeys "" sleep 2 FormatLine Kontext - Active.SetPage TabLinie '/// TabLine ///' + printlog "TabLine" + Active.SetPage TabLinie Kontext "TabLinie" StilLinks.GetItemCount ZaehlerStilLinks=StilLinks.GetItemCount - for l=1 to ZaehlerStilLinks '/// Apply all line end styles///' - wait 10 - if EndenSynchronisieren.IsChecked=False Then EndenSynchronisieren.Check '/// check synchronize ///' - wait 10 - StilLinks.Select l - if StilLinks.GetSelText<>StilRechts.GetSelText Then - WarnLog " Ends not synchronized. " + StilLinks.GetSelText + " Right: " + StilRechts.GetSelText '/// check if style is automatically applied for both ends ///' - else - PrintLog " Left: " + StilLinks.GetSelText + " Right: " + StilRechts.GetSelText - end if - EndenSynchronisieren.UnCheck + printlog "Apply all line end styles" + for l=1 to ZaehlerStilLinks + wait 10 + printlog "check synchronize" + if EndenSynchronisieren.IsChecked=False Then EndenSynchronisieren.Check + wait 10 + StilLinks.Select l + printlog "check if style is automatically applied for both ends" + if StilLinks.GetSelText<>StilRechts.GetSelText Then + WarnLog " Ends not synchronized. " + StilLinks.GetSelText + " Right: " + StilRechts.GetSelText + else + PrintLog " Left: " + StilLinks.GetSelText + " Right: " + StilRechts.GetSelText + end if + EndenSynchronisieren.UnCheck next l - ZentriertLinks.Check +ZentriertLinks.Check if ZentriertRechts.isChecked = True Then PrintLog " Centered right does work" i = CornerStyle.GetItemCount if i <> 4 then warnlog "CornerStyle should contain four options, but currently has: " + i @@ -130,15 +149,18 @@ testcase tiFormatLine Kontext Active.SetPage TabLinienstile Kontext "TabLinienstile" - Hinzufuegen.Click '/// Add new line style ///' + printlog "Add new line style" + Hinzufuegen.Click Kontext "NameDlg" - Eingabefeld.SetText "Testlinie2" '/// insert name of style (Testlinie2) ///' + printlog "insert name of style (Testlinie2)" + Eingabefeld.SetText "Testlinie2" NameDlg.OK sleep 1 Kontext Active.SetPage TabLinienstile Kontext "TabLinienstile" - Loeschen.Click '/// delete created style ///' + printlog "delete created style" + Loeschen.Click Kontext "Active" Active.Yes Kontext @@ -151,33 +173,41 @@ testcase tiFormatLine LaengeLinks.More 3 LaengeRechts.More 3 Abstand.SetText "0,1" - if AnLinienbreite.IsChecked = True Then AnLinienbreite.Click '/// all fields changed in TabLinienstile ///' + printlog "all fields changed in TabLinienstile" + if AnLinienbreite.IsChecked = True Then AnLinienbreite.Click PrintLog " All controls could be manipulated." TypLinks.Select 1 TypRechts.Select 1 - if LaengeLinks.IsEnabled And LaengeRechts.IsEnabled =True Then '/// check if its possible to apply a length to a point ///' - WarnLog " A point where you can change its length is not a point anymore" + printlog "check if its possible to apply a length to a point" + if LaengeLinks.IsEnabled And LaengeRechts.IsEnabled =True Then + WarnLog " A point where you can change its length is not a point anymore" else - PrintLog " Line style pint tested" '/// All styles for points are changed ///' + printlog "All styles for points are changed " + PrintLog " Line style pint tested" end if sleep 1 try - Linienstil.Select 1 + Linienstil.Select 1 catch - if Linienstil.GetItemCount = 0 then '/// check if style list is filled ///' - Warnlog "- The list for line styles is empty" - Hinzufuegen.Click '/// new style ///' - Kontext "NameDlg" - NameDlg.OK - end if + printlog "check if style list is filled" + if Linienstil.GetItemCount = 0 then + Warnlog "- The list for line styles is empty" + printlog "new style" + Hinzufuegen.Click + Kontext "NameDlg" + NameDlg.OK + end if endcatch Kontext Active.SetPage TabLinienstile Kontext "TabLinienstile" - Aendern.Click '/// change style ///' + printlog "change style" + Aendern.Click Kontext "NameDlg" - Eingabefeld.SetText Eingabefeld.GetText + "1" '/// new name for changed style ///' - SetClipboard Eingabefeld.GetText '/// put name into clipboard ///' + printlog "new name for changed style" + Eingabefeld.SetText Eingabefeld.GetText + "1" + printlog "put name into clipboard" + SetClipboard Eingabefeld.GetText NameDlg.OK Kontext Active.SetPage TabLinienstile @@ -194,7 +224,8 @@ testcase tiFormatLine Hinzufuegen.Click endcatch Kontext "NameDlg" - if Eingabefeld.GetText <> GetClipboardText Then WarnLog "No changes for Line style" '/// check if changed style is in list ///' + printlog "check if changed style is in list" + if Eingabefeld.GetText <> GetClipboardText Then WarnLog "No changes for Line style" NameDlg.Cancel sleep 2 Kontext @@ -202,18 +233,19 @@ testcase tiFormatLine Kontext "TabLinienstile" sleep 1 try - Loeschen.Click '/// delete changed style ///' - Kontext "Active" - Active.Yes - sleep 3 + printlog "delete changed style" + Loeschen.Click + Kontext "Active" + Active.Yes + sleep 3 catch - if Linienstile.GetItemCount = 0 Then - Hinzufuegen.Click - Kontext "NameDlg" - sleep 1 - Eingabefeld.SetText "Delete" - NameDlg.OK - end if + if Linienstile.GetItemCount = 0 Then + Hinzufuegen.Click + Kontext "NameDlg" + sleep 1 + Eingabefeld.SetText "Delete" + NameDlg.OK + end if endcatch Kontext Active.SetPage TabLinienstile @@ -222,7 +254,8 @@ testcase tiFormatLine TabLinienstile.OK '-------------------------------------------- sleep 2 - Call hRechteckErstellen (40,40,80,50) '/// create rectangle ///' + printlog "create rectangle" + Call hRechteckErstellen (40,40,80,50) sleep 2 FormatLine Kontext @@ -230,7 +263,8 @@ testcase tiFormatLine Kontext "TabLinienenden" sleep 2 Kontext "Linienstil" - if Linienstil.Exists then Aendern.Click '/// change style ///' + printlog "change style" + if Linienstil.Exists then Aendern.Click sleep 1 Kontext Active.SetPage TabLinienenden @@ -238,14 +272,16 @@ testcase tiFormatLine sleep 1 Liste.GetItemCount Liste.Select 3 - Hinzufuegen.Click '/// add style ///' + printlog "add style" + Hinzufuegen.Click Kontext "NameDlg" NameDlg.OK Kontext Active.SetPage TabLinienenden Kontext "TabLinienenden" - Aendern.Click '/// change style ///' + printlog "change style" + Aendern.Click Kontext "Active" Printlog Active.GetText Active.OK @@ -256,20 +292,21 @@ testcase tiFormatLine Kontext if active.GetRt=304 then - active.ok - Kontext "NameDlg" - Eingabefeld.SetText Eingabefeld.GetText + "1" - PrintLog " Name inserted" - NameDlg.OK + active.ok + Kontext "NameDlg" + Eingabefeld.SetText Eingabefeld.GetText + "1" + PrintLog " Name inserted" + NameDlg.OK endif if active.GetRt=304 then - active.ok - warnlog "still not a valid name :-(" + active.ok + warnlog "still not a valid name :-(" endif Kontext Active.SetPage TabLinienenden Kontext "TabLinienenden" - Loeschen.Click '/// delete style ///' + printlog "delete style" + Loeschen.Click Kontext "Active" Active.Yes @@ -277,7 +314,8 @@ testcase tiFormatLine Active.SetPage TabLinienenden Kontext "TabLinienenden" sleep 1 - Speichern.Click '/// save style ///' + printlog "save style" + Speichern.Click sleep 1 Kontext "SpeichernDlg" sleep 1 @@ -288,12 +326,12 @@ testcase tiFormatLine sleep 2 '///New part for line - 'EditSelectAll '/// Select all objects in document ///' + 'EditSelectAll printlog "Select all objects in document" 'sleep 2 - 'hTypeKeys "" '/// Delete objects ///' + 'hTypeKeys "" printlog "Delete objects" 'sleep 2 - '/// Create line to test shadow tabpage in line dialog + 'printlog "Create line to test shadow tabpage in line dialog 'kontext "Toolbar" 'Kurven.Click 'sleep 1 @@ -311,7 +349,8 @@ testcase tiFormatLine 'Active.SetPage TabSchatten ' FormatLine.Cancel - Call hCloseDocument '/// close document ///' + printlog "close document" + Call hCloseDocument endcase 'tiFormatLine '-------------------------------------------------------------------------------' @@ -329,8 +368,9 @@ testcase tLineConnect QaErrorLog "tLineConnect ends because Asian languages are not fully supported." goto Endsub end if - - Call hNewDocument '/// New Impress / Draw document ///' + + printlog "New Impress / Draw document" + Call hNewDocument Call sSelectEmptyLayout sleep 3 kontext "GraphicObjectbar" @@ -352,7 +392,7 @@ testcase tLineConnect end if endif - '/// Create 2 lines ///' + printlog "Create 2 lines" kontext "Toolbar" Kurven.Click sleep 1 @@ -376,7 +416,7 @@ testcase tLineConnect printlog "'" + (gApplication) +"'" - '/// Check the amount of objects ///' + printlog "Check the amount of objects" gMouseClick (10, 10) sleep 1 EditSelectAll @@ -400,12 +440,12 @@ testcase tLineConnect end if end if - '/// Connect the two objects selected ///' + printlog "Connect the two objects selected" hOpenContextMenu sleep 1 hMenuSelectNr(13) sleep 1 - '/// Check the amount of objects ///' + printlog "Check the amount of objects" gMouseClick (10, 10) sleep 1 EditSelectAll @@ -419,7 +459,7 @@ testcase tLineConnect value2 = left(StatusBarText,1) printlog "StatusBarText was: " + StatusBarText - '/// if same as the first value = wrong ///' + printlog "if same as the first value = wrong" if value1 = value2 then warnlog "Expected to find one object, but found " + value2 + " instead." endif @@ -427,22 +467,22 @@ testcase tLineConnect warnlog "Connect was not successful. We should have one object, but have " + value2 + " instead." endif - '/// unmark the objects, thereafter mark them again ///' + printlog "unmark the objects, thereafter mark them again" gMouseClick (10, 10) sleep 1 EditSelectAll sleep 1 - '/// Break them from eachother ///' + printlog "Break them from eachother" hOpenContextMenu sleep 1 hMenuSelectNr(11) sleep 1 - '/// unmark the objects, thereafter mark them again ///' + printlog "unmark the objects, thereafter mark them again" gMouseClick (10, 10) sleep 1 EditSelectAll sleep 1 - '/// Check the amount of objects ///' + printlog "Check the amount of objects" if (gApplication = "IMPRESS") then StatusBarText = DocumentImpress.StatusGetText(DocumentImpress.StatusGetItemID(1)) else @@ -453,19 +493,19 @@ testcase tLineConnect printlog "StatusBarText was: " + StatusBarText - '/// if the same as any of the ones before: Wrong ///' + printlog "if the same as any of the ones before: Wrong" if (value3 = value1 OR value3 = value2) then warnlog "Expected to find three objects, but found " + value3 + " instead." endif - '/// if 3 objects, then everything is ok ///' + printlog "if 3 objects, then everything is ok" if value3 = 3 then printlog "Found three objects. Means the test was successful." else warnlog "Wrong value, expected three objects, but found " + value3 + "." endif - '/// Go through the different Corner-styles ///' + printlog "Go through the different Corner-styles" hOpenContextMenu sleep 1 @@ -496,7 +536,7 @@ testcase tLineConnect CornerStyle.Select cfirst TabLinie.Ok - '/// And a nice finish to make life a bit happier for anyone who looks at the test ///' + printlog "And a nice finish to make life a bit happier for anyone who looks at the test" kontext "Toolbar" Ellipsen.Click if (gApplication = "DRAW") then @@ -525,9 +565,9 @@ testcase tLineConnect gMouseMove (48,43, 53,50) endif gMouseClick (10, 10) - '/// Close the document ///' + printlog "Close the document" hCloseDocument - '/// Endcase ///' + printlog "Endcase" endcase 'tiLineConnect '-------------------------------------------------------------------------------' diff --git a/testautomation/graphics/optional/includes/global/g_spellcheck.inc b/testautomation/graphics/optional/includes/global/g_spellcheck.inc index e1f02de039cc..755a22170e20 100644 --- a/testautomation/graphics/optional/includes/global/g_spellcheck.inc +++ b/testautomation/graphics/optional/includes/global/g_spellcheck.inc @@ -221,7 +221,7 @@ endcase 'tiToolsSpellcheckCheck_ChangeAll function delete_all_added_words(aWords) - '/// this function delete the words in sWords in all user dictionaries + 'this function delete the words in sWords in all user dictionaries Dim iBookCounter as integer Dim iWordCounter as integer @@ -269,7 +269,7 @@ end function 'delete_all_added_words function delete_word_from_dictionary(sWord as String, sDictionary as String) - '/// this function delete the words in sWords in all user dictionaries + 'this function delete the words in sWords in all user dictionaries Dim iBookCounter as integer Dim iWordCounter as integer diff --git a/testautomation/graphics/optional/includes/impress/i_headerfooter.inc b/testautomation/graphics/optional/includes/impress/i_headerfooter.inc index 3e4c54551525..d69a6762f886 100644 --- a/testautomation/graphics/optional/includes/impress/i_headerfooter.inc +++ b/testautomation/graphics/optional/includes/impress/i_headerfooter.inc @@ -30,35 +30,31 @@ '* short description : Tests the header-footer-function in Impress '* '******************************************************************* -'* -' #1 tiHeaderFooterSlide -' #1 tiHeaderFooterNotesHandout -'* -'\******************************************************************* -dim numbervalue1 as integer -dim value2 as String -dim value3 as String +testcase tiHeaderFooterSlide -'------------------------------------------------------------------------------ + dim numbervalue1 as integer + dim value2 as String + dim value3 as String -testcase tiHeaderFooterSlide - '/// This part checks the first Tabpage of the Header and Footer Dialog - - Call hNewDocument '/// Open New document + printlog "This part checks the first Tabpage of the Header and Footer Dialog" + + printlog "Open New document" + Call hNewDocument kontext "drawimpress" try - ViewHeaderAndFooter '/// View - Header And Footer + printlog "View - Header And Footer" + ViewHeaderAndFooter sleep(1) catch - warnlog " Could'nt open ViewHeaderAndFooter!" '/// Warnlog for not opening dialog + warnlog " Could'nt open ViewHeaderAndFooter!" endcatch printlog " Testing TabHeaderFooterSlide." kontext "TabHeaderFooterSlide" - '/// Check Date And Time on first tab - if DateTime.Exists = TRUE AND DateTimeFixed.isVisible = TRUE then '/// Testing date and time checkbox + printlog "Testing date and time checkbox" + if DateTime.Exists = TRUE AND DateTimeFixed.isVisible = TRUE then DateTime.UnCheck sleep(1) DateTime.Check @@ -74,7 +70,7 @@ testcase tiHeaderFooterSlide warnlog "DateTime does not exist or is not visible." endif - '/// Checking if DateTime checkbox setting is remembered... + printlog "Checking if DateTime checkbox setting is remembered..." DateTime.Uncheck printlog " Date Time is unchecked now." Apply.Click @@ -87,7 +83,7 @@ testcase tiHeaderFooterSlide endif DateTime.Check - '/// Check DateTimeFixed can be checked/unchecked + printlog "Check DateTimeFixed can be checked/unchecked" if DateTimeFixed.Exists = TRUE AND DateTimeFixed.isVisible = TRUE then DateTimeFixed.Check sleep(1) @@ -102,7 +98,7 @@ testcase tiHeaderFooterSlide warnlog " DateTimeFixed doesnt exist or is not visible!" endif - '/// Can text be inserted in the "fixed"-field? + printlog "Can text be inserted in the fixed-field?" if DateTimeFixedText.exists = TRUE AND DateTimeFixedText.isVisible = TRUE then DateTimeFixedText.settext "lalala" @@ -116,7 +112,7 @@ testcase tiHeaderFooterSlide warnlog " DateTimeFixedText doesnt exist or is not visible!" endif - '/// Checking if DateTimeFixed and Text setting is remembered... + printlog "Checking if DateTimeFixed and Text setting is remembered..." DateTime.Check DateTimeFixed.Check DateTimeFixedText.settext "lalala" @@ -130,7 +126,7 @@ testcase tiHeaderFooterSlide endif DateTimeFixedText.settext "" - '/// Can I change to "Variable" and check it? + printlog "Can I change to Variable and check it?" if DateTimeVariable.exists = TRUE AND DateTimeVariable.isVisible = TRUE then DateTimeVariable.Check sleep(1) @@ -145,7 +141,7 @@ testcase tiHeaderFooterSlide warnlog " DateTimeVariable doesnt exist or is not visible!" endif - '/// Is the Variable setting saved? + printlog "Is the Variable setting saved?" Apply.Click ViewHeaderAndFooter if DateTimeVariable.isChecked then @@ -154,24 +150,30 @@ testcase tiHeaderFooterSlide warnlog " Variable setting does not get saved!" endif - '/// Checking DateTimeFormat box + printlog "Checking DateTimeFormat box" if DateTimeFormat.exists = TRUE AND DateTimeFormat.isVisible = TRUE then - numbervalue1 = DateTimeFormat.getitemcount '/// Get the number of choices + printlog "Get the number of choices" + numbervalue1 = DateTimeFormat.getitemcount printlog " DateTimeFormat equals: " + numbervalue1 - value2 = DateTimeFormat.getseltext '/// Get the text for the choosen entry + printlog "Get the text for the choosen entry" + value2 = DateTimeFormat.getseltext printlog " Tries to get ", numbervalue1 & "." - DateTimeFormat.select ( numbervalue1 - 1 ) '/// Select the last entry - value3 = DateTimeFormat.getseltext '/// Get the text for the last entry + printlog "Select the last entry" + DateTimeFormat.select ( numbervalue1 - 1 ) + printlog "Get the text for the last entry" + value3 = DateTimeFormat.getseltext printlog " DateTimeFormat is: " + value3 - if value2 = value3 then - errorlog " More options for Date should exist!" '/// Check if the first and last are the same. - DateTimeFormat.select value2 '/// Choose the original state + if value2 = value3 then + printlog "Check if the first and last are the same." + errorlog " More options for Date should exist!" + printlog "Choose the original state" + DateTimeFormat.select value2 else printlog " DateTimeFormat box works." endif - '/// Checking if settings of DateTimeFormat box get saved + printlog "Checking if settings of DateTimeFormat box get saved" Apply. Click ViewHeaderAndFooter if DateTimeFormat.GetSelText = value3 then @@ -184,23 +186,30 @@ testcase tiHeaderFooterSlide warnlog " DateTimeFormat doesnt exist or is not visible." endif - '/// Checking DateTimeLanguage box + printlog "Checking DateTimeLanguage box" if DateTimeLanguage.exists = TRUE AND DateTimeLanguage.isVisible = TRUE then - numbervalue1 = DateTimeLanguage.GetItemCount '/// Get the number of choices - DateTimeFormat.select 1 '/// Choose the first entry - value2 = DateTimeLanguage.GetSelText '/// Get the text for the choosen entry - DateTimeLanguage.select ( numbervalue1 - 1 ) '/// Select the last entry - value3 = DateTimeLanguage.GetSelText '/// Get the text for the last entry + printlog "Get the number of choices " + numbervalue1 = DateTimeLanguage.GetItemCount + printlog "Choose the first entry " + DateTimeFormat.select 1 + printlog "Get the text for the choosen entry " + value2 = DateTimeLanguage.GetSelText + printlog "Select the last entry " + DateTimeLanguage.select ( numbervalue1 - 1 ) + printlog "Get the text for the last entry " + value3 = DateTimeLanguage.GetSelText if value2 = value3 then - errorlog " More options for Date should exist!" '/// Check if the first and last aare the same. - DateTimeLanguage.select value2 '/// Choose the original state + errorlog " More options for Date should exist!" + printlog "Check if the first and last are the same. " + printlog "Choose the original state " + DateTimeLanguage.select value2 value3 = DateTimeLanguage.GetSelText else printlog " DateTimeLanguage box works." endif - '/// Checking if language settings get saved + printlog "Checking if language settings get saved" Apply.Click ViewHeaderAndFooter if DateTimeLanguage.GetSelText = value3 then @@ -213,7 +222,7 @@ testcase tiHeaderFooterSlide warnlog " DateTime doesnt exist or is not visible!" endif - '/// Checking Footer checkbox + printlog "Checking Footer checkbox " if Footer.exists = TRUE AND Footer.isVisible = TRUE then Footer.Check sleep(1) @@ -228,7 +237,7 @@ testcase tiHeaderFooterSlide warnlog " Footer checkbox doesnt exist or is not visible!" endif - '/// Checking if Footer setting gest saved + printlog "Checking if Footer setting gest saved" Footer.Uncheck Apply.Click ViewHeaderAndFooter @@ -239,7 +248,7 @@ testcase tiHeaderFooterSlide endif Footer.Check - '/// Checking if text can be inserted in FooterFixedText + printlog "Checking if text can be inserted in FooterFixedText " if FooterFixedText.exists = TRUE AND FooterFixedText.isVisible = TRUE then FooterFixedText.SetText "lalala" @@ -253,7 +262,7 @@ testcase tiHeaderFooterSlide warnlog " Footer doesnt exist or is not visible!" endif - '/// Checking if Footer text gets saved. + printlog "Checking if Footer text gets saved." Apply.Click ViewHeaderAndFooter @@ -265,7 +274,7 @@ testcase tiHeaderFooterSlide endif FooterFixedText.SetText "" - '/// Checking Slidenumber checkbox + printlog "Checking Slidenumber checkbox" if Donotshowonfirstslide.exists = TRUE AND Donotshowonfirstslide.isVisible = TRUE then Slidenumber.Check sleep(1) @@ -279,7 +288,7 @@ testcase tiHeaderFooterSlide warnlog " Do not show on first slide doesnt exist or is not visible!" endif - '/// Checking if Slidenumber gets saved. + printlog "Checking if Slidenumber gets saved." Apply.Click ViewHeaderAndFooter @@ -289,7 +298,7 @@ testcase tiHeaderFooterSlide warnlog " Slidenumber setting is not remembered!" endif - '/// Checking "Do not show on first slide" checkbox + printlog "Checking Do not show on first slide checkbox" if Donotshowonfirstslide.exists = TRUE AND Donotshowonfirstslide.isVisible = TRUE then Donotshowonfirstslide.UnCheck sleep(1) @@ -303,7 +312,7 @@ testcase tiHeaderFooterSlide warnlog " Do not show on first slide doesnt exist or is not visible!" endif - '/// Checking if Do not show on first slide is saved. + printlog "Checking if Do not show on first slide is saved." Apply.Click ViewHeaderAndFooter @@ -313,34 +322,41 @@ testcase tiHeaderFooterSlide warnlog " Do not show on first slide setting is not saved!" endif - '/// Closing dialog with cancel + printlog "Closing dialog with cancel" sleep 1 TabHeaderFooterSlide.Cancel sleep 1 kontext "drawimpress" sleep 1 - '/// Close document + printlog "Close document" Call hCloseDocument -endcase +endcase 'tiHeaderFooterSlide '---------------------------------------------------------------------------- testcase tiHeaderFooterNotesHandout - '/// This part checks the second Tabpage of the Header and Footer Dialog for notes and handout - Call hNewDocument '/// Open New document + dim numbervalue1 as integer + dim value2 as String + dim value3 as String + + printlog "This part checks the second Tabpage of the Header and Footer Dialog for notes and handout" + + printlog "Open New document " + Call hNewDocument kontext "drawimpress" try - ViewHeaderAndFooter '/// View - Header And Footer + printlog "View - Header And Footer " + ViewHeaderAndFooter sleep(1) catch - warnlog " Could'nt open ViewHeaderAndFooter!" '/// Warnlog for not opening dialog + printlog "Warnlog for not opening dialog" + warnlog " Could'nt open ViewHeaderAndFooter!" endcatch 'goto endcase kontext " TabHeaderFooterSlide" - '/// Change tabpage to HeaderFooterNotesHandout printlog " Testing TabHeaderFooterNotesHandout." sleep 2 kontext @@ -348,7 +364,7 @@ testcase tiHeaderFooterNotesHandout sleep 2 kontext "TabHeaderFooterNotesHandout" - '/// Checking Header checkbox + printlog "Checking Header checkbox " if Header.exists = TRUE AND Header.isVisible = TRUE then Header.UnCheck sleep(1) @@ -365,7 +381,7 @@ testcase tiHeaderFooterNotesHandout warnlog " Header doesnt exist or is not visible!" endif - '/// Checking if Header setting is saved. + printlog "Checking if Header setting is saved." Header.Uncheck ApplyToAll.Click ViewHeaderAndFooter @@ -380,7 +396,7 @@ testcase tiHeaderFooterNotesHandout Header.Check endif - '/// Checking if header text can be inserted + printlog "Checking if header text can be inserted" if HeaderFixedText.exists = TRUE AND HeaderFixedText.isVisible = TRUE then HeaderFixedText.settext "lalala" sleep(1) @@ -394,7 +410,7 @@ testcase tiHeaderFooterNotesHandout warnlog " HeaderFixedText doesnt exist or is not visible!" endif - '/// Checking if text is saved. + printlog "Checking if text is saved." ApplyToAll.Click ViewHeaderAndFooter kontext @@ -407,7 +423,7 @@ testcase tiHeaderFooterNotesHandout endif HeaderFixedText.SetText "" - '/// Checking Date And Time checkbox + printlog "Checking Date And Time checkbox" if DateTime.exists = TRUE AND DateTime.isVisible = TRUE then DateTime.UnCheck sleep(1) @@ -424,7 +440,7 @@ testcase tiHeaderFooterNotesHandout warnlog " DateTime doesnt exist or is not visible!" endif - '/// Checking if Date and Time setting is saved. + printlog "Checking if Date and Time setting is saved." DateTime.Uncheck ApplyToAll.Click ViewHeaderAndFooter @@ -439,7 +455,7 @@ testcase tiHeaderFooterNotesHandout endif DateTime.Check - '/// Check DateTimeFixed can be checked/unchecked + printlog "Check DateTimeFixed can be checked/unchecked " if DateTimeFixed.exists = TRUE AND DateTimeFixed.isVisible = TRUE then if DateTimeFixed.isChecked then @@ -464,7 +480,7 @@ testcase tiHeaderFooterNotesHandout warnlog " DateTimeFixed doesnt exist or is not visible!" endif - '/// Can text be inserted in the "fixed"-field? + printlog "Can text be inserted in the fixed-field? " if DateTimeFixedText.exists = TRUE AND DateTimeFixedText.isVisible = TRUE then DateTimeFixedText.settext "lalala" @@ -474,7 +490,7 @@ testcase tiHeaderFooterNotesHandout printlog " DateTimeFixedText works." endif - '/// Checking if DateTimeFixedText gets saved. + printlog "Checking if DateTimeFixedText gets saved." ApplyToAll.Click ViewHeaderAndFooter kontext @@ -491,7 +507,7 @@ testcase tiHeaderFooterNotesHandout warnlog "DateTimeFixedText doesnt exist or is not visible" endif - '/// Can it be changed to "Variable" and checked? + printlog "Can it be changed to Variable and checked? " if DateTimeVariable.exists = TRUE AND DateTimeVariable.isVisible = TRUE then DateTimeVariable.Check sleep(1) @@ -502,7 +518,7 @@ testcase tiHeaderFooterNotesHandout warnlog " Something wrong with the DateTimeVariable-checkbox or DateTimeFormat is checked!" endif - '/// Checking if DateTimeVariable setting gets saved. + printlog "Checking if DateTimeVariable setting gets saved." ApplyToAll.Click ViewHeaderAndFooter kontext @@ -519,25 +535,31 @@ testcase tiHeaderFooterNotesHandout warnlog " DateTimeVariable doesnt exist or is not visible" endif - '/// Checking format dropdown box - numbervalue1 = DateTimeFormat.getitemcount '/// Get the number of choices + printlog "Checking format dropdown box" + printlog "Get the number of choices " + numbervalue1 = DateTimeFormat.getitemcount printlog " DateTimeFormat equals: " + numbervalue1 - value2 = DateTimeFormat.getseltext '/// Get the text for the choosen entry + printlog "Get the text for the choosen entry " + value2 = DateTimeFormat.getseltext printlog " Tries to get ", numbervalue1 if DateTimeFormat.exists = TRUE AND DateTimeFormat.isVisible = TRUE then - DateTimeFormat.select ( numbervalue1 - 1 ) '/// Select the last entry - value3 = DateTimeFormat.getseltext '/// Get the text for the last entry + printlog "Select the last entry " + DateTimeFormat.select ( numbervalue1 - 1 ) + printlog "Get the text for the last entry " + value3 = DateTimeFormat.getseltext printlog " DateTimeFormat is: " + value3 - if value2 = value3 then - errorlog " More options for Date should exist." '/// Check if the first and last are the same. - DateTimeFormat.select value2 '/// Choose the original state + if value2 = value3 then + printlog "Check if the first and last are the same. " + errorlog " More options for Date should exist." + printlog "Choose the original state " + DateTimeFormat.select value2 else printlog " DateTimeFormat works." endif - '/// Checking if DateTimeFormat setting gets saved. + printlog "Checking if DateTimeFormat setting gets saved." ApplyToAll.Click ViewHeaderAndFooter kontext @@ -555,19 +577,25 @@ testcase tiHeaderFooterNotesHandout endif if DateTimeLanguage.exists = TRUE AND DateTimeLanguage.isVisible = TRUE then - numbervalue1 = DateTimeLanguage.getitemcount '/// Get the number of choices - DateTimeFormat.select 1 '/// Choose the first entry - value2 = DateTimeLanguage.getseltext '/// Get the text for the choosen entry - DateTimeLanguage.select ( numbervalue1 - 1 ) '/// Select the last entry - value3 = DateTimeLanguage.getseltext '/// Get the text for the last entry + printlog "Get the number of choices " + numbervalue1 = DateTimeLanguage.getitemcount + printlog "Choose the first entry " + DateTimeFormat.select 1 + printlog "Get the text for the choosen entry " + value2 = DateTimeLanguage.getseltext + printlog "Select the last entry " + DateTimeLanguage.select ( numbervalue1 - 1 ) + printlog "Get the text for the last entry" + value3 = DateTimeLanguage.getseltext - if value2 = value3 then - errorlog " More options for Date should exist!" '/// Check if the first and last are the same. + if value2 = value3 then + printlog "Check if the first and last are the same. " + errorlog " More options for Date should exist!" else printlog " Footer works." endif - '/// Checking if DateTimeLanguage setting gets saved. + printlog "Checking if DateTimeLanguage setting gets saved." ApplyToAll.Click ViewHeaderAndFooter kontext @@ -583,7 +611,7 @@ testcase tiHeaderFooterNotesHandout warnlog " DateTimeLanguage does not exist!" endif - '/// Checking Footer checkbox. + printlog "Checking Footer checkbox. " if Footer.exists = TRUE AND Footer.isVisible = TRUE then Footer.UnCheck sleep(1) @@ -597,7 +625,7 @@ testcase tiHeaderFooterNotesHandout Footer.Check endif - '///Check if Footer setting is saved. + printlog "Check if Footer setting is saved." Footer.Uncheck ApplyToAll.Click ViewHeaderAndFooter @@ -611,10 +639,8 @@ testcase tiHeaderFooterNotesHandout printlog " Footer is not checked." endif Footer.Check - - - '/// Checking if Footer text can be inserted + printlog "Checking if Footer text can be inserted" if FooterFixedText.exists = TRUE AND FooterFixedText.isVisible = TRUE then FooterFixedText.SetText "lalala" sleep(1) @@ -629,7 +655,7 @@ testcase tiHeaderFooterNotesHandout warnlog " FooterFixedText does not exists!" endif - '///Checking if Footer text is saved. + printlog "Checking if Footer text is saved." ApplyToAll.Click ViewHeaderAndFooter kontext @@ -642,7 +668,7 @@ testcase tiHeaderFooterNotesHandout printlog " FooterFixedText gets saved." endif - '/// Checking Slidenumber checkbox + printlog "Checking Slidenumber checkbox" if Slidenumber.exists = TRUE AND Slidenumber.isVisible = TRUE then Slidenumber.UnCheck sleep(1) @@ -653,7 +679,7 @@ testcase tiHeaderFooterNotesHandout Slidenumber.Check endif - '/// Checking if Slidenumber setting is saved. + printlog "Checking if Slidenumber setting is saved." ApplyToAll.Click ViewHeaderAndFooter kontext @@ -670,16 +696,16 @@ testcase tiHeaderFooterNotesHandout warnlog " Slidenumber does'nt exist or is not visible!" endif - '/// Close dialog with cancel + printlog "Close dialog with cancel" sleep 1 TabHeaderFooterNotesHandout.Cancel sleep 1 kontext "drawimpress" sleep 1 - '/// Close document + printlog "Close document " Call hCloseDocument -endcase +endcase 'tiHeaderFooterNotesHandout -'------------------------------------------------------------------------------- +'------------------------------------------------------------------------------- \ No newline at end of file diff --git a/testautomation/graphics/optional/includes/impress/i_pengine1.inc b/testautomation/graphics/optional/includes/impress/i_pengine1.inc index 44f531c47fcd..ff4d2a035ef0 100644 --- a/testautomation/graphics/optional/includes/impress/i_pengine1.inc +++ b/testautomation/graphics/optional/includes/impress/i_pengine1.inc @@ -30,20 +30,9 @@ '* short description : Tests the Engine for Presentation '* '******************************************************************* -'* -' #1 tiPengineTabEntrance -' #1 tiPengineTabEmphasis -' #1 tiPengineTabExit -' #1 tiPengineTabMotionPaths -' #1 tiPengineSlideTransition -' #1 tiPengineTabpageEntrance2 -' #1 tiPengineTabPageEmphasis2 -' #1 tiPengineTabPageExit2 -' #1 tiPengineTabPageMotionPaths2 -'* -'\******************************************************************* testcase tiPengineTabEntrance + dim bError as boolean dim e as integer dim d as integer @@ -62,19 +51,19 @@ testcase tiPengineTabEntrance dim UsedEffect as string dim NewEffect as string -'/// open application ///' -Call hNewDocument -'/// create textbox with text ///' -Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) -'/// Slide Show->Custom Animation... ///' -SlideShowCustomAnimation - Kontext "Tasks" - '/// click button 'Add...' ///' - EffectAdd.click - '/// Dialog 'Custom Animation' comes up ///' - kontext + printlog "open application" + Call hNewDocument + printlog "create textbox with text" + Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) + printlog "Slide Show->Custom Animation..." + SlideShowCustomAnimation + Kontext "Tasks" + printlog "click button 'Add...'" + EffectAdd.click + printlog "Dialog 'Custom Animation' comes up" + kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if TabEntrance.exists(5) then @@ -183,7 +172,8 @@ SlideShowCustomAnimation Printlog "Presentation didn't end. Error?" endif kontext "TabEntrance" - Effects.TypeKeys "", e '/// Select the next entry ///' + printlog "Select the next entry" + Effects.TypeKeys "", e p = Effects.GetSelIndex If p = d Then e = i Next e @@ -206,12 +196,12 @@ SlideShowCustomAnimation Next o kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if TabEntrance.exists(5) then Effects.Select 4 - '/// Close dialog 'Custom Animation' with 'OK' ///' + printlog "Close dialog 'Custom Animation' with 'OK'" TabEntrance.OK else warnlog "Error when switching Tab" @@ -223,15 +213,16 @@ SlideShowCustomAnimation endif kontext "Tasks" EffectAutomaticPreview.Check - '/// click button 'Remove' ///' + printlog "click button 'Remove'" EffectRemove.Click - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tiPengineTabEntrance -'------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +'------------------------------------------------------------------------------- testcase tiPengineTabEmphasis + dim bError as boolean dim e as integer dim d as integer @@ -250,19 +241,19 @@ testcase tiPengineTabEmphasis dim UsedEffect as string dim NewEffect as string - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create textbox with text ///' + printlog "create textbox with text" Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) - '/// Slide Show->Custom Animation... ///' + printlog "Slide Show->Custom Animation..." SlideShowCustomAnimation Kontext "Tasks" - '/// click button 'Add...' ///' + printlog "click button 'Add...'" EffectAdd.click - '/// Dialog 'Custom Animation' comes up ///' + printlog "Dialog 'Custom Animation' comes up" kontext - '/// Switch to TabPage: Emphasis ///' + printlog "Switch to TabPage: Emphasis" kontext active.setPage(TabEmphasis) kontext "TabEmphasis" @@ -347,11 +338,12 @@ testcase tiPengineTabEmphasis else Printlog "Presentation didn't end. Error?" endif - '/// Switch to TabPage: Emphasis ///' + printlog "Switch to TabPage: Emphasis" kontext active.setPage(TabEmphasis) kontext "TabEmphasis" - Effects.TypeKeys "", e + 1 '/// Select the next entry ///' + printlog "Select the next entry" + Effects.TypeKeys "", e + 1 p = Effects.GetSelIndex If p = d Then e = i Next e @@ -375,12 +367,12 @@ testcase tiPengineTabEmphasis endif kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if TabEntrance.exists(5) then Effects.Select 4 - '/// Close dialog 'Custom Animation' with 'OK' ///' + printlog "Close dialog 'Custom Animation' with 'OK'" TabEntrance.OK else warnlog "Error when switching Tab" @@ -388,15 +380,16 @@ testcase tiPengineTabEmphasis bError = false kontext "Tasks" EffectAutomaticPreview.Check - '/// click button 'Remove' ///' + printlog "click button 'Remove'" EffectRemove.Click - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tiPengineTabEmphasis -'------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +'------------------------------------------------------------------------------- testcase tiPengineTabExit + dim bError as boolean dim e as integer dim d as integer @@ -415,19 +408,19 @@ testcase tiPengineTabExit dim UsedEffect as string dim NewEffect as string - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create textbox with text ///' + printlog "create textbox with text" Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) - '/// Slide Show->Custom Animation... ///' + printlog "Slide Show->Custom Animation..." SlideShowCustomAnimation Kontext "Tasks" - '/// click button 'Add...' ///' + printlog "click button 'Add...'" EffectAdd.click - '/// Dialog 'Custom Animation' comes up ///' + printlog "Dialog 'Custom Animation' comes up" kontext - '/// Switch to TabPage: Exit ///' + printlog "Switch to TabPage: Exit" active.setPage(TabExit) kontext "TabExit" if TabExit.exists(5) then @@ -509,10 +502,11 @@ testcase tiPengineTabExit Printlog "Presentation didn't end. Error?" endif kontext - '/// Switch to TabPage: Exit ///' + printlog "Switch to TabPage: Exit" active.setPage(TabExit) kontext "TabExit" - Effects.TypeKeys "", e + 1 '/// Select the next entry ///' + printlog "Select the next entry" + Effects.TypeKeys "", e + 1 p = Effects.GetSelIndex If p = d Then e = i 'p > 2 AND Next e @@ -529,12 +523,12 @@ testcase tiPengineTabExit endif kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if TabEntrance.exists(5) then Effects.Select 4 - '/// Close dialog 'Custom Animation' with 'OK' ///' + printlog "Close dialog 'Custom Animation' with 'OK'" TabEntrance.OK else warnlog "Error when switching Tab" @@ -542,15 +536,17 @@ testcase tiPengineTabExit bError = false kontext "Tasks" EffectAutomaticPreview.Check - '/// click button 'Remove' ///' + printlog "click button 'Remove'" EffectRemove.Click - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase -'------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +endcase 'tiPengineTabExit + +'------------------------------------------------------------------------------- testcase tiPengineTabMotionPaths + dim bError as boolean dim e as integer dim d as integer @@ -569,19 +565,19 @@ testcase tiPengineTabMotionPaths dim UsedEffect as string dim NewEffect as string - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create textbox with text ///' + printlog "create textbox with text" Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) - '/// Slide Show->Custom Animation... ///' + printlog "Slide Show->Custom Animation..." SlideShowCustomAnimation Kontext "Tasks" - '/// click button 'Add...' ///' + printlog "click button 'Add...'" EffectAdd.click - '/// Dialog 'Custom Animation' comes up ///' + printlog "Dialog 'Custom Animation' comes up" kontext - '/// Switch to TabPage: Motion Paths ///' + printlog "Switch to TabPage: Motion Paths" active.setPage(TabMotionPaths) kontext "TabMotionPaths" if TabMotionPaths.exists(5) then @@ -671,10 +667,11 @@ testcase tiPengineTabMotionPaths Printlog "Presentation didn't end. Error?" endif kontext - '/// Switch to TabPage: Motion Paths ///' + printlog "Switch to TabPage: Motion Paths" active.setPage(TabMotionPaths) kontext "TabMotionPaths" - Effects.TypeKeys "", e + 1 '/// Select the next entry ///' + Effects.TypeKeys "", e + 1 + printlog "Select the next entry" ' if p = 2 then Effects.TypeKeys "" p = Effects.GetSelIndex If p = d Then e = i 'p > 2 AND @@ -691,12 +688,12 @@ testcase tiPengineTabMotionPaths endif kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if TabEntrance.exists(5) then Effects.Select 4 - '/// Close dialog 'Custom Animation' with 'OK' ///' + printlog "Close dialog 'Custom Animation' with 'OK'" TabEntrance.OK else warnlog "Error when switching Tab" @@ -704,15 +701,16 @@ testcase tiPengineTabMotionPaths bError = false kontext "Tasks" EffectAutomaticPreview.Check - '/// click button 'Remove' ///' + printlog "click button 'Remove'" EffectRemove.Click - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tiPengineTabMotionPaths '-------------------------------------------------------------------------------------------------------------------------------------------------- testcase tiPengineSlideTransition + dim a as integer dim b as integer dim i as integer @@ -720,31 +718,31 @@ testcase tiPengineSlideTransition dim iCount as integer dim Soundposition as integer - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create rectangle ///' + printlog "create rectangle" Call hRechteckErstellen ( 10, 10, 20, 40 ) sleep 1 - '/// Insert a second slide ///' + printlog "Insert a second slide" InsertSlide sleep 2 - hTypekeys "" + hTypeKeys "" sleep 2 - '/// create textframe with quotes; Simple: 39; Double: 34; ///' + printlog "create textframe with quotes; Simple: 39; Double: 34;" hTextrahmenErstellen ( "Hallo",20,20,60,30) - '/// Insert a third slide ///' + printlog "Insert a third slide" InsertSlide sleep 2 hTypekeys "" sleep 2 - '/// Slide Show->Slide Transition ///' + printlog "Slide Show->Slide Transition" SlideShowSlideTransition sleep 2 - '/// The 'Slide Transition' in the right 'Tasks' Pane has to come up ///' + printlog "The 'Slide Transition' in the right 'Tasks' Pane has to come up" Kontext "Tasks" - '/// Select every entry in the Listbox 'Apply to Selected Slides' ///' - '/// Then select the next Speed for Transition and retest all the effects ///' - '/// Redo until all effects has been tested with all speeds ///' + printlog "Select every entry in the Listbox 'Apply to Selected Slides'" + printlog "Then select the next Speed for Transition and retest all the effects" + printlog "Redo until all effects has been tested with all speeds" lala = TransitionApplyToSelectedSlide.GetItemCount Printlog "Count of effects : " + TransitionApplyToSelectedSlide.GetItemCount Printlog "Count of Speeds : " + TransitionSpeed.GetItemCount @@ -759,7 +757,7 @@ testcase tiPengineSlideTransition Next iCount Next b Printlog "Count of Sounds : " + TransitionSound.GetItemCount - '/// One Entry of the Listbox 'Sound' is 'Other sound...', select it ///' + printlog "One Entry of the Listbox 'Sound' is 'Other sound...', select it" ' iCount = TransitionSound.GetItemCount TransitionSound.TypeKeys "" i = 0 @@ -770,11 +768,11 @@ testcase tiPengineSlideTransition Soundposition = TransitionSound.GetSelIndex kontext "OeffnenDlg" if (OeffnenDlg.Exists (5)) then - '/// Read all entries in Listbox 'File type' ///' + printlog "Read all entries in Listbox 'File type'" for i = 1 to Dateityp.getItemCount printlog "" + i + ":" + Dateityp.getItemText(i) next i - '/// cancel dialog 'Open' ///' + printlog "cancel dialog 'Open'" sleep 1 OeffnenDlg.cancel kontext "Tasks" @@ -792,21 +790,21 @@ testcase tiPengineSlideTransition sleep 5 kontext "Tasks" - '/// check checkbox 'Automatically after' ///' + printlog "check checkbox 'Automatically after'" TransitionAutomaticallyAfter.Check sleep 5 - '/// press key 'Page Up' in box ///' + printlog "press key 'Page Up' in box" TransitionAutomaticallyAfterTime.TypeKeys "" sleep 5 - '/// check the standard checkbox 'On mouse click' ///' + printlog "check the standard checkbox 'On mouse click'" TransitionOnMouseClick.Check sleep 5 - '/// press button 'Apply to All Slides' ///' + printlog "press button 'Apply to All Slides'" TransitionApplyToAllSlides.Click sleep 5 - '/// press button 'Play' ///' + printlog "press button 'Play'" TransitionPlay.Click - '/// press button 'Slide Show' ///' + printlog "press button 'Slide Show'" sleep (10) TransitionSlideShow.Click sleep (3) @@ -827,17 +825,17 @@ testcase tiPengineSlideTransition endif kontext "Tasks" - '/// uncheck and check Checkbox 'Automatic Preview' ///' - '/// default is checked ///' + printlog "uncheck and check Checkbox 'Automatic Preview'" + printlog "default is checked" if (NOT TransitionAutomaticPreview.IsChecked) then warnlog "Impress:Tasks Pane:Slide Transition: Automatic preview has to be checked by default, wasn't!" endif TransitionAutomaticPreview.UnCheck sleep 1 TransitionAutomaticPreview.Check - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tiPengineSlideTransition 'testcase ' Two different objects for two different effects. Does it work? @@ -849,9 +847,10 @@ endcase ' Save file, close, open again and see if everything is as it were. (Random effects) 'Endcase -'######################################################################## +'------------------------------------------------------------------------------- testcase tiPengineTabpageEntrance2 + dim bError as boolean dim e as integer dim d as integer @@ -868,21 +867,21 @@ testcase tiPengineTabpageEntrance2 dim StartName1 as string dim PropertyName1 as string -'/// open application ///' -Call hNewDocument -'/// create textbox with text ///' -Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) -'/// Slide Show->Custom Animation... ///' -SlideShowCustomAnimation - Kontext "Tasks" - '/// Uncheck AutomaticPreview ///' - EffectAutomaticPreview.UnCheck - '/// click button 'Add...' ///' - EffectAdd.click - '/// Dialog 'Custom Animation' comes up ///' - kontext + printlog "open application" + Call hNewDocument + printlog "create textbox with text" + Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) + printlog "Slide Show->Custom Animation..." + SlideShowCustomAnimation + Kontext "Tasks" + printlog "Uncheck AutomaticPreview" + EffectAutomaticPreview.UnCheck + printlog "click button 'Add...'" + EffectAdd.click + printlog "Dialog 'Custom Animation' comes up" + kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if TabEntrance.exists(5) then @@ -927,7 +926,8 @@ SlideShowCustomAnimation Printlog "Presentation didn't end. Error?" endif kontext "TabEntrance" - Effects.TypeKeys "", e '/// Select the next entry ///' + printlog "Select the next entry" + Effects.TypeKeys "", e p = Effects.GetSelIndex If p = d Then e = i Next e @@ -945,12 +945,12 @@ SlideShowCustomAnimation Next o kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if TabEntrance.exists(5) then Effects.Select 4 - '/// Close dialog 'Custom Animation' with 'OK' ///' + printlog "Close dialog 'Custom Animation' with 'OK'" TabEntrance.OK else warnlog "Error when switching Tab" @@ -962,15 +962,16 @@ SlideShowCustomAnimation endif kontext "Tasks" EffectAutomaticPreview.Check - '/// click button 'Remove' ///' + printlog "click button 'Remove'" EffectRemove.Click - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tiPengineTabpageEntrance2 '------------------------------------------------------------------------------------------------------------------------------------------------------ testcase tiPengineTabPageEmphasis2 + dim bError as boolean dim e as integer dim d as integer @@ -987,21 +988,21 @@ testcase tiPengineTabPageEmphasis2 dim StartName1 as string dim PropertyName1 as string -'/// open application ///' -Call hNewDocument -'/// create textbox with text ///' -Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) -'/// Slide Show->Custom Animation... ///' -SlideShowCustomAnimation + printlog "open application" + Call hNewDocument + printlog "create textbox with text" + Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) + printlog "Slide Show->Custom Animation..." + SlideShowCustomAnimation Kontext "Tasks" - '/// Uncheck AutomaticPreview ///' + printlog "Uncheck AutomaticPreview" EffectAutomaticPreview.UnCheck - '/// click button 'Add...' ///' + printlog "click button 'Add...'" EffectAdd.click - '/// Dialog 'Custom Animation' comes up ///' + printlog "Dialog 'Custom Animation' comes up" kontext - '/// Switch to TabPage: Emphasis ///' + printlog "Switch to TabPage: Emphasis" kontext active.setPage(TabEmphasis) kontext "TabEmphasis" @@ -1049,7 +1050,8 @@ SlideShowCustomAnimation active.setPage(TabEmphasis) Printlog "Testing effects in - TabEmphasis" kontext "TabEmphasis" - Effects.TypeKeys "", e + 1 '/// Select the next entry ///' + printlog "Select the next entry" + Effects.TypeKeys "", e + 1 p = Effects.GetSelIndex If p = d Then e = i 'p > 2 AND Next e @@ -1074,12 +1076,12 @@ SlideShowCustomAnimation endif kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if TabEntrance.exists(5) then Effects.Select 4 - '/// Close dialog 'Custom Animation' with 'OK' ///' + printlog "Close dialog 'Custom Animation' with 'OK'" TabEntrance.OK else warnlog "Error when switching Tab" @@ -1087,15 +1089,16 @@ SlideShowCustomAnimation bError = false kontext "Tasks" EffectAutomaticPreview.Check - '/// click button 'Remove' ///' + printlog "click button 'Remove'" EffectRemove.Click - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tiPengineTabPageEmphasis2 '------------------------------------------------------------------------------------ testcase tiPengineTabPageExit2 + dim bError as boolean dim e as integer dim d as integer @@ -1112,21 +1115,21 @@ testcase tiPengineTabPageExit2 dim StartName1 as string dim PropertyName1 as string -'/// open application ///' +printlog "open application" Call hNewDocument -'/// create textbox with text ///' +printlog "create textbox with text" Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) -'/// Slide Show->Custom Animation... ///' +printlog "Slide Show->Custom Animation..." SlideShowCustomAnimation Kontext "Tasks" - '/// Uncheck AutomaticPreview ///' + printlog "Uncheck AutomaticPreview" EffectAutomaticPreview.UnCheck - '/// click button 'Add...' ///' + printlog "click button 'Add...'" EffectAdd.click - '/// Dialog 'Custom Animation' comes up ///' + printlog "Dialog 'Custom Animation' comes up" kontext - '/// Switch to TabPage: Exit ///' + printlog "Switch to TabPage: Exit" active.setPage(TabExit) kontext "TabExit" if TabExit.exists(5) then @@ -1178,15 +1181,16 @@ SlideShowCustomAnimation Printlog "Presentation didn't end. Error?" endif kontext - '/// Switch to TabPage: Exit ///' + printlog "Switch to TabPage: Exit" active.setPage(TabExit) kontext "TabExit" - Effects.TypeKeys "", e + 1 '/// Select the next entry ///' + printlog "Select the next entry" + Effects.TypeKeys "", e + 1 p = Effects.GetSelIndex If p = d Then e = i 'p > 2 AND Next e kontext - '/// Switch to TabPage: Exit ///' + printlog "Switch to TabPage: Exit" active.setPage(TabExit) kontext "TabExit" e = 0 @@ -1208,12 +1212,12 @@ SlideShowCustomAnimation endif kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if TabEntrance.exists(5) then Effects.Select 4 - '/// Close dialog 'Custom Animation' with 'OK' ///' + printlog "Close dialog 'Custom Animation' with 'OK'" TabEntrance.OK else warnlog "Error when switching Tab" @@ -1221,15 +1225,16 @@ SlideShowCustomAnimation bError = false kontext "Tasks" EffectAutomaticPreview.Check - '/// click button 'Remove' ///' + printlog "click button 'Remove'" EffectRemove.Click - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tiPengineTabPageExit2 '-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- testcase tiPengineTabPageMotionPaths2 + dim bError as boolean dim e as integer dim d as integer @@ -1246,21 +1251,21 @@ testcase tiPengineTabPageMotionPaths2 dim StartName1 as string dim PropertyName1 as string - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create textbox with text ///' + printlog "create textbox with text" Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) - '/// Slide Show->Custom Animation... ///' + printlog "Slide Show->Custom Animation..." SlideShowCustomAnimation Kontext "Tasks" - '/// Uncheck AutomaticPreview ///' + printlog "Uncheck AutomaticPreview" EffectAutomaticPreview.UnCheck - '/// click button 'Add...' ///' + printlog "click button 'Add...'" EffectAdd.click - '/// Dialog 'Custom Animation' comes up ///' + printlog "Dialog 'Custom Animation' comes up" kontext - '/// Switch to TabPage: Motion Paths ///' + printlog "Switch to TabPage: Motion Paths" active.setPage(TabMotionPaths) kontext "TabMotionPaths" if TabMotionPaths.exists(5) then @@ -1302,15 +1307,16 @@ testcase tiPengineTabPageMotionPaths2 Printlog "Presentation didn't end. Error?" endif kontext - '/// Switch to TabPage: Motion Paths ///' + printlog "Switch to TabPage: Motion Paths" active.setPage(TabMotionPaths) kontext "TabMotionPaths" - Effects.TypeKeys "", e + 1 '/// Select the next entry ///' + printlog "Select the next entry" + Effects.TypeKeys "", e + 1 p = Effects.GetSelIndex If p = d Then e = i 'p > 2 AND Next e kontext - '/// Switch to TabPage: Motion Paths ///' + printlog "Switch to TabPage: Motion Paths" active.setPage(TabMotionPaths) kontext "TabMotionPaths" @@ -1332,12 +1338,12 @@ testcase tiPengineTabPageMotionPaths2 warnlog "Impress:Tasks Pane:Custom Animation:TabMotionPaths tabPage doesn't work." endif kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if TabEntrance.exists(5) then Effects.Select 4 - '/// Close dialog 'Custom Animation' with 'OK' ///' + printlog "Close dialog 'Custom Animation' with 'OK'" TabEntrance.OK else warnlog "Error when switching Tab" @@ -1345,12 +1351,10 @@ testcase tiPengineTabPageMotionPaths2 bError = false kontext "Tasks" EffectAutomaticPreview.Check - '/// click button 'Remove' ///' + printlog "click button 'Remove'" EffectRemove.Click - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase - -'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - +endcase 'tiPengineTabPageMotionPaths2 +'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/testautomation/graphics/optional/includes/impress/i_pengine2.inc b/testautomation/graphics/optional/includes/impress/i_pengine2.inc index f1fa908cf7b7..56d15f6eee37 100644 --- a/testautomation/graphics/optional/includes/impress/i_pengine2.inc +++ b/testautomation/graphics/optional/includes/impress/i_pengine2.inc @@ -30,48 +30,41 @@ '* short description : Tests the Presentation-Engines effects '* '******************************************************************* -'* -' #1 tiPengineAnimationEffectsPreview -' #1 tiPengineAnimationEffectsOptions -' #1 tiPengineAllShapesAndEffects -' #1 tiPengine2ObjectsGetsEffects -'* -'\******************************************************************* testcase tiPengineAnimationEffectsPreview dim bError as boolean - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create textbox with text ///' + printlog "create textbox with text" Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) - '/// Slide Show->Custom Animation... ///' + printlog "Slide Show->Custom Animation..." SlideShowCustomAnimation - Kontext "Tasks" - '/// click button 'Add...' ///' - EffectAdd.click - '/// Dialog 'Custom Animation' comes up ///' - kontext - '/// Switch to TabPage: Entrance ///' - active.setPage(TabEntrance) - kontext "TabEntrance" - if TabEntrance.exists(5) then - DialogTest(TabEntrance) - TestAnimations - '/// Switch to TabPage: Emphasis ///' - kontext - active.setPage(TabEmphasis) - kontext "TabEmphasis" - if TabEmphasis.exists(5) then - DialogTest(TabEmphasis) - TestAnimations - else - bError = true - warnlog "Impress:Tasks Pane:Custom Animation:TabEmphasis tabPage doesn't work." - endif - kontext - - '/// Switch to TabPage: Exit ///' + Kontext "Tasks" + printlog "click button 'Add...'" + EffectAdd.click + printlog "Dialog 'Custom Animation' comes up" + kontext + printlog "Switch to TabPage: Entrance" + active.setPage(TabEntrance) + kontext "TabEntrance" + if TabEntrance.exists(5) then + DialogTest(TabEntrance) + TestAnimations + printlog "Switch to TabPage: Emphasis" + kontext + active.setPage(TabEmphasis) + kontext "TabEmphasis" + if TabEmphasis.exists(5) then + DialogTest(TabEmphasis) + TestAnimations + else + bError = true + warnlog "Impress:Tasks Pane:Custom Animation:TabEmphasis tabPage doesn't work." + endif + kontext + + printlog "Switch to TabPage: Exit" active.setPage(TabExit) kontext "TabExit" if TabExit.exists(5) then @@ -83,7 +76,7 @@ testcase tiPengineAnimationEffectsPreview endif kontext - '/// Switch to TabPage: Motion Paths ///' + printlog "Switch to TabPage: Motion Paths" active.setPage(TabMotionPaths) kontext "TabMotionPaths" if TabMotionPaths.exists(5) then @@ -95,12 +88,12 @@ testcase tiPengineAnimationEffectsPreview endif kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if TabEntrance.exists(5) then Effects.Select 4 - '/// Close dialog 'Custom Animation' with 'OK' ///' + printlog "Close dialog 'Custom Animation' with 'OK'" TabEntrance.OK else warnlog "Error when switching Tab" @@ -112,12 +105,12 @@ testcase tiPengineAnimationEffectsPreview endif Kontext "Tasks" if (NOT bError) then - '/// click button 'Change...' ///' + printlog "click button 'Change...'" EffectChange.click - '/// Dialog 'Custom Animation' comes up ///' + printlog "Dialog 'Custom Animation' comes up" kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if (NOT TabEntrance.exists(5)) then @@ -129,7 +122,7 @@ testcase tiPengineAnimationEffectsPreview if EffectProperty.IsVisible then EffectProperty.GetItemCount endif - '/// CLick on button '...' (Options) ///' + printlog "CLick on button '...' (Options)" EffectOptions.Click kontext "TabEffect" if TabEffect.Exists(5) then @@ -137,7 +130,7 @@ testcase tiPengineAnimationEffectsPreview Sound.GetItemCount AfterAnimation.GetItemCount - '/// switch to TabPage 'Timing' ///' + printlog "switch to TabPage 'Timing'" Kontext Active.SetPage TabTiming kontext "TabTiming" @@ -155,7 +148,7 @@ testcase tiPengineAnimationEffectsPreview warnlog "Impress:Tasks Pane:Custom Animation:Effect Options: Timing TabPage didn't work." endif - '/// switch to TabPage 'Timing' ///' + printlog "switch to TabPage 'Timing'" Kontext active.setPage TabTextAnimation kontext "TabTextAnimation" @@ -193,17 +186,18 @@ testcase tiPengineAnimationEffectsPreview sleep (2) kontext "Tasks" EffectAutomaticPreview.Check - '/// click button 'Remove' ///' + printlog "click button 'Remove'" EffectRemove.Click endif sleep (2) - '/// close application ///' + printlog "close application" Call hCloseDocument endcase 'tiPengineAnimationEffectsPreview '------------------------------------------------------------------------------ testcase tiPengineAnimationEffectsOptions + dim bError as boolean dim e as integer dim d as integer @@ -222,28 +216,28 @@ testcase tiPengineAnimationEffectsOptions dim StartName1 as string dim PropertyName1 as string -'/// open application ///' -Call hNewDocument -'/// create textbox with text ///' -Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) -'/// Slide Show->Custom Animation... ///' -SlideShowCustomAnimation - '/// Dialog 'Custom Animation' comes up ///' - Kontext "Tasks" - '/// Click button 'Add...' to add an effect to the text ///' - EffectAdd.click - kontext - '/// Switch to TabPage: Entrance ///' - active.setPage(TabEntrance) - kontext "TabEntrance" - if TabEntrance.exists(5) then + printlog "open application" + Call hNewDocument + printlog "create textbox with text" + Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 ) + printlog "Slide Show->Custom Animation..." + SlideShowCustomAnimation + printlog "Dialog 'Custom Animation' comes up" + Kontext "Tasks" + printlog "Click button 'Add...' to add an effect to the text" + EffectAdd.click + kontext + printlog "Switch to TabPage: Entrance" + active.setPage(TabEntrance) + kontext "TabEntrance" + if TabEntrance.exists(5) then AutomaticPreview.UnCheck Printlog "Testing effects in - TabEntrance" i = Effects.GetItemCount p = 7555 Effects.TypeKeys "" Randomize - '/// Choose ten random effects, and test them. ///' + printlog "Choose ten random effects, and test them." For e = 1 to 10 randomize for y = 1 to 1 @@ -270,7 +264,7 @@ SlideShowCustomAnimation Warnlog "Something wrong when exiting Impress:Tasks Pane:Custom Animation: ... (options)" endif kontext "TabEntrance" - '/// Select the next entry ///' + printlog "Select the next entry" Effects.TypeKeys "", e p = Effects.GetSelIndex If p = d Then e = i @@ -300,27 +294,28 @@ SlideShowCustomAnimation endif kontext "Tasks" EffectAutomaticPreview.Check - '/// click button 'Remove' ///' + printlog "click button 'Remove'" EffectRemove.Click - '/// close application ///' + printlog "close application" Call hCloseDocument endcase 'tiPengineAnimationEffectsOptions -'------------------------------------------------------------------------------------------------------------------------------------------------------ +'------------------------------------------------------------------------------- testcase tiPengineAllShapesAndEffects - dim sFileName as string -'/// the Presentation-Engine consists of showing the presentation, with all it's effects. ///' + dim sFileName as string - '/// Create a new presentation. ///' + printlog "the Presentation-Engine consists of showing the presentation, with all it's effects." + + printlog "Create a new presentation." Call hNewDocument Sleep (1) - '/// Open the test-file. ///' + printlog "Open the test-file." Call hFileOpen (gTesttoolpath + "graphics\required\input\allshapes2.odp") 'effects.odp") - '/// Start the slideshow. ///' + printlog "Start the slideshow." Call hTypeKeys "" sleep (10) kontext "DocumentPresentation" @@ -339,14 +334,14 @@ testcase tiPengineAllShapesAndEffects Call hCloseDocument sleep (1) - '/// Open the test-file. ///' + printlog "Open the test-file." Call hFileOpen (gTesttoolpath + "graphics\required\input\effects.odp") Sleep (10) - '/// Start the slideshow. ///' + printlog "Start the slideshow." CALL hTypeKeys "" Sleep (10) - '/// Press "Space" again, to continue with slide two. ///' + printlog "Press Space again, to continue with slide two." kontext "DocumentPresentation" while DocumentPresentation.exists() DocumentPresentation.TypeKeys "" @@ -362,14 +357,15 @@ testcase tiPengineAllShapesAndEffects kontext "DocumentImpress" end if -'/// Close Application ///' +printlog "Close Application" Call hCloseDocument Printlog "Finished Optional-test for Presentation-Engine" endcase 'tiPengineAllShapesAndEffects -'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +'------------------------------------------------------------------------------- testcase tiPengine2ObjectsGetsEffects + dim i as integer dim t as integer dim q as integer @@ -385,7 +381,6 @@ testcase tiPengine2ObjectsGetsEffects kontext "Toolbar" sleep (1) - printlog "insert a Smiley." printlog "From the toolbar: Insert three objects:" printlog "insert a Smiley." kontext "Toolbar" @@ -469,9 +464,7 @@ testcase tiPengine2ObjectsGetsEffects warnlog "Error when switching Tab" end if Kontext "Tasks" - printlog "Effect no 3" - printlog "Insert new slide" InsertSlide Printlog "Inserted new Slide" @@ -507,7 +500,6 @@ testcase tiPengine2ObjectsGetsEffects Kontext "Tasks" printlog "Effect no 4" - printlog "Click button 'Add...'" EffectAdd.click printlog "Dialog 'Custom Animation' comes up" @@ -570,16 +562,19 @@ testcase tiPengine2ObjectsGetsEffects Printlog "Finished Optional-test for Presentation-Engine" endcase 'tiPengine2ObjectsGetsEffects -'------------------------------------------------------------------------------------------------------------------------------------------------------ +'------------------------------------------------------------------------------- Function TestAnimations - '/// select in the listbox 'Effects' the second entry///' + + printlog "Function: TestAnimations: select in the listbox 'Effects' the second entry" + Dim i as Integer Dim s as Integer Dim q as Integer Dim e as Integer Dim o as Integer Dim p as Integer + i = Effects.GetItemCount s = Speed.GetItemCount AutomaticPreview.Check @@ -588,7 +583,7 @@ Function TestAnimations If e <> p Then if AutomaticPreview.isChecked = TRUE then sleep 1 Printlog "Effect has position Nr: " + Effects.GetSelIndex + ". Name of effect: " + Effects.GetSelText - '/// Select the next entry ///' + printlog "Select the next entry" Effects.TypeKeys "" p = Effects.GetSelIndex Else @@ -606,4 +601,4 @@ Function TestAnimations sleep 1 AutomaticPreview.Check Kontext -end Function +end Function \ No newline at end of file diff --git a/testautomation/graphics/optional/includes/impress/i_slidelayer.inc b/testautomation/graphics/optional/includes/impress/i_slidelayer.inc index 441e0a323099..724aaa8b70a4 100644 --- a/testautomation/graphics/optional/includes/impress/i_slidelayer.inc +++ b/testautomation/graphics/optional/includes/impress/i_slidelayer.inc @@ -30,75 +30,69 @@ '* short description : '* '********************************************************************* -' #1 tiInsertExpandSlide -' #1 tiInsertSummarySlide -' #1 tiFormatSeitenlayout -' #1 t114174 -' #1 t111862 -'\******************************************************************** ' Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp") -' Inhalt.SetText ConvertPath (gTesttoolPath + "graphics\required\input\leer.sxd") '/// auto.sdd choosen ///' +' Inhalt.SetText ConvertPath (gTesttoolPath + "graphics\required\input\leer.sxd") '------------------------------------------------------------------------------- testcase tiInsertExpandSlide - - dim i,x as integer - dim sTemp as string - dim b116350 as boolean - - '/// open application ///' - Call hNewDocument - Call sSelectEmptyLayout - '/// create presupposition /// - '///+ View->Master View->Outline View ///' - ViewWorkspaceOutlineView - Sleep 1 - Kontext "DocumentImpressOutlineView" - '///+ create a slide with some levels...and some more slides with just one level... ///' - '///+ it should look like this: ///' - '///+-------------------------------------------------- ///' - '///+ Slide 1///' - '///+ - A ///' - '///+ - - B///' - '///+ - - - C///' - '///+ - - - - D///' - '///+ - - - - - - F///' - '///+ - B///' - '///+ - C///' - '///+ - D///' - '///+ Slide 2 ///' - '///+ Slide 3 ///' - '///+ Slide 4 ///' - '///+ Slide 5 ///' - '///+-------------------------------------------------- ///' - DocumentImpressOutlineView.TypeKeys "Slide 1" - for i = 1 to 6 - DocumentImpressOutlineView.TypeKeys "" - DocumentImpressOutlineView.TypeKeys chr(64+i) - next i - DocumentImpressOutlineView.TypeKeys "" - DocumentImpressOutlineView.TypeKeys ("",5) - for i = 1 to 3 - DocumentImpressOutlineView.TypeKeys chr(65+i) - DocumentImpressOutlineView.TypeKeys "" - next i - DocumentImpressOutlineView.TypeKeys ("") - for i = 2 to 5 - DocumentImpressOutlineView.TypeKeys "Slide " + i - DocumentImpressOutlineView.TypeKeys "" - next i - DocumentImpressOutlineView.TypeKeys "" - '///+ View->Master View->Drawing View ///' - ViewWorkspaceDrawingView - Sleep 1 - '///+ there have to be 5 slides now ///' - fGetSlideCount (5) - '/// goto the first slide ///' - hTypeKeys "" - '/// Insert->Expand Slide ///' - InsertExpandSlide + dim i,x as integer + dim sTemp as string + dim b116350 as boolean + + printlog "open application " + Call hNewDocument + Call sSelectEmptyLayout + printlog "create presupposition" + printlog "View->Master View->Outline View " + ViewWorkspaceOutlineView + Sleep 1 + Kontext "DocumentImpressOutlineView" + '///+ create a slide with some levels...and some more slides with just one level... " + '///+ it should look like this: " + '///+-------------------------------------------------- " + '///+ Slide 1" + '///+ - A " + '///+ - - B" + '///+ - - - C" + '///+ - - - - D" + '///+ - - - - - - F" + '///+ - B" + '///+ - C" + '///+ - D" + '///+ Slide 2 " + '///+ Slide 3 " + '///+ Slide 4 " + '///+ Slide 5 " + '///+-------------------------------------------------- " + DocumentImpressOutlineView.TypeKeys "Slide 1" + for i = 1 to 6 + DocumentImpressOutlineView.TypeKeys "" + DocumentImpressOutlineView.TypeKeys chr(64+i) + next i + DocumentImpressOutlineView.TypeKeys "" + DocumentImpressOutlineView.TypeKeys ("",5) + for i = 1 to 3 + DocumentImpressOutlineView.TypeKeys chr(65+i) + DocumentImpressOutlineView.TypeKeys "" + next i + DocumentImpressOutlineView.TypeKeys ("") + for i = 2 to 5 + DocumentImpressOutlineView.TypeKeys "Slide " + i + DocumentImpressOutlineView.TypeKeys "" + next i + DocumentImpressOutlineView.TypeKeys "" + printlog " View->Master View->Drawing View " + ViewWorkspaceDrawingView + Sleep 1 + printlog "there have to be 5 slides now " + fGetSlideCount (5) + + printlog "goto the first slide " + hTypeKeys "" + printlog "Insert->Expand Slide" + InsertExpandSlide ' usually the content of the new pages is the same as the curren, there is a slide created for every part in the first outline level (gliederungsebene) Sleep 1 if (8 = fGetSlideCount (8)) then @@ -106,7 +100,7 @@ testcase tiInsertExpandSlide else warnLog "Bug with Insert Expand Slide" endif - '///+ check slide content ///' + printlog " check slide content " hTypeKeys ("" EditSelectAll EditCopy @@ -142,9 +136,9 @@ testcase tiInsertExpandSlide next i hTypeKeys "" - '/// Insert->Expand Slide ///' + printlog "Insert->Expand Slide" InsertExpandSlide - '/// And since the Second slide now should be named "B", we check that first ///' + printlog "And since the Second slide now should be named B, we check that first " hTypeKeys ("") EditSelectAll try @@ -190,7 +184,7 @@ testcase tiInsertExpandSlide EditSelectAll next i - '/// close application ///' + printlog "close application " Call hCloseDocument endcase 'tiInsertExpandSlide @@ -285,23 +279,29 @@ testcase tiFormatSeitenlayout qaerrorlog "outcommented due to bug" goto endsub - Printlog "Format/Page Layout" - Call hNewDocument '/// new impress document ///' - - FormatPage '/// format page ///' + Printlog "Format/Page Layout" + printlog "new impress document " + Call hNewDocument + + printlog "format page " + FormatPage Kontext "Tasks" sleep 5 - SetClipboard LayoutsPreview.GetText '/// get page name ///' - SeitenName.SetText "Test" '/// change page name ///' + printlog "get page name " + SetClipboard LayoutsPreview.GetText + printlog "change page name " + SeitenName.SetText "Test" sleep 1 - if Hintergrund.IsChecked=False Then '/// check background ///' + printlog "check background " + if Hintergrund.IsChecked=False Then Hintergrund.Check else Hintergrund.UnCheck if Hintergrund.IsChecked=False Then PrintLog " Background is deactivated" end if - - if ObjekteAufDemHintergrund.IsChecked = True Then '/// change status of objects on background ///' + + printlog "change status of objects on background " + if ObjekteAufDemHintergrund.IsChecked = True Then PrintLog " Object on background is activated" ObjekteAufDemHintergrund.UnCheck if ObjekteAufDemHintergrund.IsChecked = False Then PrintLog " Objects on background are deactivated" @@ -309,9 +309,11 @@ testcase tiFormatSeitenlayout ObjekteAufDemHintegrund.Check PrintLog " Object on background is activated" end if - Seitenlayout.OK '/// close dialog ///' + printlog "close dialog " + Seitenlayout.OK sleep 1 - FormatPage '/// reopen dialog ///' + printlog "reopen dialog " + FormatPage Kontext "LayoutsPreview" sleep 2 if GetClipboardText <> SeitenName.GetText Then @@ -320,7 +322,8 @@ testcase tiFormatSeitenlayout WarnLog " Page name is not correct" end if sleep 2 - LayoutsPreview.TypeKeys "" '/// assign different page layout ///' + printlog "assign different page layout " + LayoutsPreview.TypeKeys "" LayoutsPreview.TypeKeys "" ,2 LayoutsPreview.TypeKeys "" sleep 2 @@ -338,7 +341,8 @@ testcase tiFormatSeitenlayout sleep 3 DocumentImpress.MouseDoubleClick 25,60 sleep 3 - Kontext "GrafikEinfuegenDlg" '/// check in document if layout has changed ///' + printlog "check in document if layout has changed " + Kontext "GrafikEinfuegenDlg" sleep 2 if GrafikEinfuegenDlg.exists (5) then try @@ -361,13 +365,14 @@ testcase tiFormatSeitenlayout endif sleep 3 Kontext "DocumentImpress" - Call hCloseDocument '/// close document ///' + printlog "close document " + Call hCloseDocument endcase 'tiFormatSeitenlayout '------------------------------------------------------------------------------ testcase t114174 - '/// resulting from regression in #111862# ///' + printlog "resulting from regression in #111862# " dim sReference(2) as string dim sText(2) as string dim i as integer @@ -385,10 +390,10 @@ testcase t114174 sReference(1) = "Koelle" sReference(2) = "Alaaf!" - '/// open application ///' + printlog "open application " Call hNewDocument - '/// Format->Modify Layout ///' + printlog "Format->Modify Layout " FormatPage Kontext "Tasks" LayoutsPreview.TypeKeys "" @@ -414,7 +419,7 @@ testcase t114174 endif next i - '/// deselect all by typing key 'ESCAPE' again ///' + printlog "deselect all by typing key 'ESCAPE' again " hTypeKeys("") hFileSaveAsKill(sFile) @@ -477,10 +482,10 @@ testcase t111862 sReference(1) = "Koelle" sReference(2) = "Alaaf!" - '/// open application ///' + printlog "open application " Call hNewDocument - '/// Format->Modify Layout ///' + printlog "Format->Modify Layout " Formatpage Kontext "Tasks" LayoutsPreview.TypeKeys "" @@ -519,4 +524,4 @@ testcase t111862 hCloseDocument() endcase 't111862 -'------------------------------------------------------------------------------ +'------------------------------------------------------------------------------ \ No newline at end of file diff --git a/testautomation/graphics/optional/includes/impress/i_slideshow.inc b/testautomation/graphics/optional/includes/impress/i_slideshow.inc index cfcc0fbd2e2f..2c51a83a509a 100644 --- a/testautomation/graphics/optional/includes/impress/i_slideshow.inc +++ b/testautomation/graphics/optional/includes/impress/i_slideshow.inc @@ -38,7 +38,7 @@ testcase tSlideShowSlideShow dim testfile as string dim localtestfile as string - '/// open file 'graphics\\input\\diashow.odp' ///' + printlog "open file 'graphics\input\diashow.odp' " testfile = ( gTesttoolPath + "graphics\required\input\diashow.odp" ) hFileOpenLocally( testfile ) sleep 30 @@ -48,11 +48,11 @@ testcase tSlideShowSlideShow Kontext "Navigator" if Navigator.Exists then Navigator.Close - '/// Deactivate "Start with current page" in ToolsOptions ///' + printlog "Deactivate Start with current page in ToolsOptions " setStartCurrentPage(FALSE) try - '/// SlideShow->Slide Show Settings... ///' + printlog "SlideShow->Slide Show Settings... " SlideShowPresentationSettings bLoaded = true catch @@ -61,17 +61,17 @@ testcase tSlideShowSlideShow if bLoaded then Kontext "Bildschirmpraesentation" - '/// check Radio button 'Type': 'Window' ///' + printlog "check Radio button 'Type': 'Window' " Fenster.Check - '/// close dialog 'Slide Show' with OK ///' + printlog "close dialog 'Slide Show' with OK " Bildschirmpraesentation.OK sleep 3 - '/// start the slideshow with 'Slide Show->Slide Show' ///' + printlog "start the slideshow with 'Slide Show->Slide Show' " SlideShowSlideshow sleep 3 Kontext "DocumentPresentation" sleep 5 - '/// end the presentation by typing [ESCAPE] ///' + printlog "end the presentation by typing [ESCAPE] " DocumentPresentation.TypeKeys "" sleep 3 try @@ -83,7 +83,7 @@ testcase tSlideShowSlideShow sleep 3 endcatch - '/// start the slideshow with 'Slide Show->Slide Show' ///' + printlog "start the slideshow with 'Slide Show->Slide Show' " SlideShowSlideshow Kontext "DocumentPresentation" Printlog "- Check if slideshow runs" @@ -94,14 +94,14 @@ testcase tSlideShowSlideShow Warnlog "Presentation is not running !" endcatch sleep 5 - '/// type the key [SHIFT + F5] to open the navigator ///' + printlog "type the key [SHIFT + F5] to open the navigator " DocumentPresentation.TypeKeys "" Kontext "NavigatorDraw" sleep 1 - '/// check in list, if the page changed ///' + printlog "check in list, if the page changed " if Liste.GetSelIndex <> 2 Then Warnlog "- pagedown not working: '" + Liste.GetSelText+"'" Kontext "DocumentPresentation" - '/// press key [cursor right] 3 times ///' + printlog "press key [cursor right] 3 times " for i = 1 to 3 sleep 3 DocumentPresentation.TypeKeys "" @@ -124,11 +124,11 @@ testcase tSlideShowSlideShow warnlog "Document didn't get loaded" endif Kontext "DocumentImpress" - '/// Close the Navigator ///' + printlog " Close the Navigator " DocumentImpress.TypeKeys "" - '/// Set "Start with current page" back to default = on, in ToolsOptions ///' + printlog "Set Start with current page back to default = on, in ToolsOptions " setStartCurrentPage(TRUE) - '/// close the application ///' + printlog "close the application " Call hCloseDocument localtestfile = hFileGetLocalPath( gTesttoolPath + "diashow.odp" ) printlog localtestfile @@ -143,17 +143,19 @@ endcase 'tSlideShowSlideShow '------------------------------------------------------------------------------- testcase tSlideShowRehearseTimings + qaerrorlog "#i64783# - tSlideShowRehearseTimings outcommented due to bug" goto endsub + dim bLoaded as boolean dim i as integer - '/// open file 'graphics\\input\\diashow.odp' ///' + printlog "open file 'graphics\input\diashow.odp' " hFileOpen ConvertPath (gTesttoolPath + "graphics\required\input\diashow.odp") sleep 10 - ' check if the document is writable + printlog "check if the document is writable" if fIsDocumentWritable = false then - ' make the document writable and check if it's succesfull + printlog "make the document writable and check if it's succesfull" if fMakeDocumentWritable = false then warnlog "The document can't be make writeable. Test stopped." goto endsub @@ -163,7 +165,7 @@ testcase tSlideShowRehearseTimings if Navigator.Exists then Navigator.Close bLoaded = false try - '/// SlideShow->Slide Show Settings... ///' + printlog "SlideShow->Slide Show Settings... " SlideShowPresentationSettings bLoaded = true catch @@ -171,12 +173,12 @@ testcase tSlideShowRehearseTimings endcatch if bLoaded then Kontext "Bildschirmpraesentation" - '/// check Radio button 'Type': 'Window' ///' + printlog "check Radio button 'Type': 'Window' " Fenster.Check - '/// close dialog 'Slide Show' with OK ///' + printlog "close dialog 'Slide Show' with OK " Bildschirmpraesentation.OK sleep 3 - '/// start the slideshow with 'Slide Show->Rehearse Timings' ///' + printlog "start the slideshow with 'Slide Show->Rehearse Timings' " SlideShowRehearseTimings Kontext "DocumentPresentation" if DocumentPresentation.Exists then @@ -184,7 +186,7 @@ testcase tSlideShowRehearseTimings else warnlog "bah" endif - '/// press key [return] 5 times ///' + printlog "press key [return] 5 times " for i = 1 to 5 sleep 5 DocumentPresentation.TypeKeys "" @@ -204,15 +206,15 @@ testcase tSlideShowRehearseTimings warnlog "Documnet didn't get loaded" endif - '/// check state of navigator ! expected: closed ///' + printlog " check state of navigator ! expected: closed " Kontext "Navigator" if Navigator.exists then - '///+ close navigator ! ///' + printlog " close navigator ! " Navigator.Close else printlog "Navigator: NOT available" endif - '/// close the application ///' + printlog "close the application " Call hCloseDocument endcase 'tSlideShowRehearseTimings @@ -242,64 +244,64 @@ testcase tSlideShowSlideShowSettings ' the state of the navigator in the normal view is not affected ' the navigator that is open in normal view, is not visible in windows presenattions - '/// open application ///' + printlog "open application " Call hNewDocument -'/// check state of navigator ! expected: closed ///' + printlog " check state of navigator ! expected: closed " Kontext "Navigator" if Navigator.exists then - '///+ close navigator ! ///' + printlog "close navigator ! " Navigator.Close QaErrorLog "Navigator was open. Check earlier tests. Now closed." else printlog "Navigator: NOT available. Good." endif - '/// Slide Show -> Slide Show Settings ///' + printlog "Slide Show -> Slide Show Settings " SlideShowPresentationSettings Kontext "Bildschirmpraesentation" - '/// check checkbox in section 'Range' - 'From: ///' + printlog "check checkbox in section 'Range' - 'From: " AbDia.Check - '/// get count of slides from listbox 'From:' ///' + printlog "get count of slides from listbox 'From:' " x = AbDiaName.GetItemCount - '/// check if count in listbox 'from' is '0' ///' + printlog "check if count in listbox 'from' is '0' " if (x = 1) Then Printlog " - Slide count in the list: '" + x + "'" else Warnlog " - unexpected slide count; should be '1'; is '" + x + "'" end if - '/// close dialog 'Slide Show' with OK ///' + printlog "close dialog 'Slide Show' with OK " Bildschirmpraesentation.OK - '/// Insert->Slide... ///' + printlog "Insert->Slide... " InsertSlide sleep 2 hTypekeys "" sleep 2 - '/// Slide Show -> Slide Show Settings ///' + printlog "Slide Show -> Slide Show Settings " SlideShowPresentationSettings Kontext "Bildschirmpraesentation" - Printlog "'/// check if count in listbox 'from' increased ///'" + Printlog "check if count in listbox 'from' increased" i = AbDiaName.GetItemCount if ((i -1) = x) Then Printlog " - Slide appears in the list; count : '" + i + "'" else Warnlog " - Slide not added; is '" + i + "' should: '" + x + "'" end if - '/// close dialog 'Slide Show' with CANCEL ///' + printlog "close dialog 'Slide Show' with CANCEL " Bildschirmpraesentation.Cancel - '/// close application ///' + printlog "close application " Call hCloseDocument sleep 5 bLoaded = false - '/// open file 'graphics\\input\\diashow.odp' (Slide Show with 4 Slides) ///' + printlog "open file 'graphics\input\diashow.odp' (Slide Show with 4 Slides) " sTestfile = ( gTesttoolPath + "graphics\required\input\diashow.odp" ) hFileOpenLocally( sTestfile ) sleep 10 try Kontext "DocumentImpress" - '/// Slide Show -> Slide Show Settings ///' + printlog "Slide Show -> Slide Show Settings " Printlog "'--------------------------------------------------------------------------" SlideShowPresentationSettings bLoaded = true @@ -317,19 +319,19 @@ testcase tSlideShowSlideShowSettings if (NavigatorSichtbar.IsChecked) then Warnlog "'Navigator visible' is checked :-(" endif - '/// check checkbox 'All Slides' ///' + printlog "check checkbox 'All Slides'" AlleDias.Check - '/// check checkbox 'Window' ///' + printlog "check checkbox 'Window" Fenster.Check - '/// check checkbox 'Navigator visible' ///' - NavigatorSichtbar.Check '-------------------------------------------------------------------------- - '/// close dialog 'Slide Show' with OK ///' + printlog "check checkbox 'Navigator visible" + NavigatorSichtbar.Check + printlog "close dialog 'Slide Show' with OK " Bildschirmpraesentation.OK - '/// start the slideshow with 'Slide Show->Slide Show' ///' + printlog "start the slideshow with 'Slide Show->Slide Show' " SlideShowSlideshow Printlog "'---------------------------- START P -- All -- Window -- Navigator -------------------------" sleep 5 - '/// check state of navigator ! expected: open ///' + printlog " check state of navigator ! expected: open " Kontext "Navigator" if Navigator.exists then Printlog "Navigator: open :-)" @@ -341,7 +343,7 @@ testcase tSlideShowSlideShowSettings sleep 1 Kontext "DocumentPresentation" try - '/// press pagedown ///' + printlog "press pagedown " DocumentPresentation.TypeKeys "" catch Warnlog "presentation is not running !" @@ -351,8 +353,8 @@ testcase tSlideShowSlideShowSettings if Liste.GetSelIndex <> 2 Then warnlog "Wrong slide." endif - '/// press the key [Page Down] 3 times ///' - '///+ check in Navigator list, if the slide is number: (times key pressed) ///' + printlog "press the key [Page Down] 3 times " + printlog "check in Navigator list, if the slide is number: (times key pressed) " for i = 2 to 4 Kontext "Navigator" if Navigator.exists then @@ -367,7 +369,7 @@ testcase tSlideShowSlideShowSettings DocumentPresentation.TypeKeys "" next i sleep (2) - '/// press the key [Page Down] to exit presentation ///' + printlog "press the key [Page Down] to exit presentation " DocumentPresentation.TypeKeys "" sleep (5) try @@ -378,20 +380,20 @@ testcase tSlideShowSlideShowSettings DocumentPresentation.TypeKeys "" endcatch sleep 2 - '/// check state of navigator ! expected: open ///' + printlog " check state of navigator ! expected: open " Kontext "Navigator" if Navigator.exists then - '///+ close navigator ! ///' + printlog "close navigator ! " Navigator.Close else printlog "Navigator: NOT available" endif - Printlog "'--------------------------------------------------------------------------" + Printlog "'---------------------------------------------------------------" Kontext "DocumentPresentation" - '/// type the key [MOD1 SHIFT F5] to open the navigator ///' '-------------------------------------------------------------------------- + printlog "type the key [MOD1 SHIFT F5] to open the navigator " hTypeKeys "" - '/// Slide Show -> Slide Show Settings ///' + printlog "Slide Show -> Slide Show Settings " SlideShowPresentationSettings Kontext "Bildschirmpraesentation" if (AlleDias.IsChecked = FALSE) then @@ -406,59 +408,59 @@ testcase tSlideShowSlideShowSettings if (DiawechselAufHintergrund.IsChecked = FALSE) then Warnlog "'Change slides by clicking on background' is not checked :-(" endif - '/// check checkbox in section 'Range' - 'From: ///' + printlog "check checkbox in section 'Range' - 'From:" AbDia.Check - '/// select the 3rd item from the top from listbox 'From:' -> 2 slides to go ///' + printlog "select the 3rd item from the top from listbox 'From:' -> 2 slides to go " AbDiaName.Select 3 sTemp = AbDiaName.GetSelText Printlog " - From '" + sTemp + "' will be shown" - '/// check checkbox 'Default' ///' + printlog "check checkbox 'Default'" Standard.Check - '/// UNcheck checkbox 'Navigator visible'///' + printlog "UNcheck checkbox 'Navigator visible'" NavigatorSichtbar.UnCheck - '/// UNcheck checkbox 'Change slides by clicking on background'///' + printlog "UNcheck checkbox 'Change slides by clicking on background'" DiawechselAufHintergrund.UnCheck - '/// close dialog 'Slide Show' with OK ///' + printlog "close dialog 'Slide Show' with OK " Bildschirmpraesentation.OK sleep 3 Kontext "DocumentPresentation" - '/// start the slideshow with 'Slide Show->Slide Show' ///' + printlog "start the slideshow with 'Slide Show->Slide Show' " SlideShowSlideshow Printlog "'---------------------------- START P -- From -- Default -- Click on Bg -----------------------" sleep 5 - '/// check state of navigator ! expected: closed ///' + printlog " check state of navigator ! expected: closed " Kontext "Navigator" if Navigator.exists then - '///+ close navigator ! ///' + printlog "close navigator ! " Navigator.Close Warnlog "Navigator: closed" else Printlog "Navigator: NOT available. Good." endif sleep 1 - '/// type the key [MOD1 SHIFT F5] to open the navigator ///' '-------------------------------------------------------------------------- + printlog "type the key [MOD1 SHIFT F5] to open the navigator " Kontext "DocumentPresentation" DocumentPresentation.TypeKeys "" sleep 3 - '/// check in Navigator list, if the page is THREE! ///' + printlog "check in Navigator list, if the page is THREE! " fGetSlideName(S3) - '/// click right mouse button ///' + printlog "click right mouse button " sleep 5 DocumentPresentation.MouseDown 50,50 DocumentPresentation.MouseUp 50,50 - '/// check in Navigator list, if the page is still THREE. If so, change slide with PageDown ///' + printlog "check in Navigator list, if the page is still THREE. If so, change slide with PageDown " if (fGetSlideName(S3) <> S3) then Warnlog "'Change slides by clicking on background' disable did not work :-(" else DocumentPresentation.TypeKeys "" endif - '/// check in Navigator list, if the page is FOUR ///' + printlog "check in Navigator list, if the page is FOUR " fGetSlideName(S4) sleep 5 - '/// press the key [Page Down] ///' + printlog "press the key [Page Down] " DocumentPresentation.TypeKeys "" sleep 5 - '/// press the key [Space] to exit presentation ///' + printlog "press the key [Space] to exit presentation " DocumentPresentation.TypeKeys "" sleep 10 try @@ -470,10 +472,10 @@ testcase tSlideShowSlideShowSettings DocumentPresentation.TypeKeys "" Warnlog " - Program was still in slideshow mode - ended now ?" endcatch - '/// check state of navigator ! expected: open ///' + printlog " check state of navigator ! expected: open " Kontext "Navigator" if Navigator.exists then - '///+ close navigator ! ///' + printlog "close navigator ! " Navigator.Close printlog "Navigator: closed" else @@ -481,7 +483,7 @@ testcase tSlideShowSlideShowSettings endif Printlog "'--------------------------------------------------------------------------" - '/// Slide Show -> Slide Show Settings ///' + printlog "Slide Show -> Slide Show Settings " SlideShowPresentationSettings Kontext "Bildschirmpraesentation" if (AbDia.IsChecked = FALSE) then @@ -496,33 +498,33 @@ testcase tSlideShowSlideShowSettings if (DiawechselAufHintergrund.IsChecked) then Warnlog "'Change slides by clicking in background' is checked :-(" endif - '/// check checkbox 'All Slides' ///' + printlog "check checkbox 'All Slides' " AlleDias.Check - '/// check check box 'Auto' -> implies looping of slideshow in fullscreen mode ///' + printlog "check check box 'Auto' -> implies looping of slideshow in fullscreen mode" Auto.Check - '/// set duration of pause to '00:00:05' ///' + printlog "set duration of pause to '00:00:05' " Zeit.SetText "00:00:05" - '/// check check box 'Show logo' ///' + printlog "check check box 'Show logo' " LogoAnzeigen.Check - '/// check checkbox 'Change slides by clicking on background'///' + printlog "check checkbox 'Change slides by clicking on background'" DiawechselAufHintergrund.Check - '/// close dialog 'Slide Show' with OK ///' + printlog "close dialog 'Slide Show' with OK " Bildschirmpraesentation.OK - '/// start the slideshow with 'Slide Show->Slide Show' ///' + printlog "start the slideshow with 'Slide Show->Slide Show' " SlideShowSlideshow Printlog "'---------------------------- START P -- All -- Auto -- :05 -- Logo -----------------------------" sleep 3 Kontext "DocumentPresentation" - '/// type the key [MOD1 SHIFT F5] to open the navigator ///' '-------------------------------------------------------------------------- + printlog "type the key [MOD1 SHIFT F5] to open the navigator " DocumentPresentation.TypeKeys "" - '/// press the key [Space] 4 times ///' - '///+ check in Navigator list, if the slide is number: [(times key pressed) -1 ] ///' + printlog "press the key [Space] 4 times " + printlog "check in Navigator list, if the slide is number: [(times key pressed) -1 ] " for i = 1 to 4 fGetSlideName(saSlideNames(i)) DocumentPresentation.TypeKeys "" sleep 5 next i - '/// wait until autopause ended (5 secs) ///' + printlog "wait until autopause ended (5 secs) " sleep 10 if (fGetSlideName(saSlideNames(1)) = saSlideNames(1)) then Printlog " - Enless loop works" @@ -530,7 +532,7 @@ testcase tSlideShowSlideShowSettings Warnlog " Enless loop does NOT work" end if sleep 2 - '/// type key [excape] to exit presentation ///' + printlog "type key [excape] to exit presentation " Kontext "DocumentPresentation" DocumentPresentation.TypeKeys "" sleep 5 @@ -544,7 +546,7 @@ testcase tSlideShowSlideShowSettings DocumentImpress.TypeKeys "" sleep 5 endcatch - '/// check state of navigator ! expected: closed ///' + printlog " check state of navigator ! expected: closed " Kontext "Navigator" if Navigator.exists then Navigator.Close @@ -555,56 +557,56 @@ testcase tSlideShowSlideShowSettings Printlog "'--------------------------------------------------------------------------" Kontext "DocumentImpress" - '/// Slide Show -> Slide Show Settings ///' + printlog "Slide Show -> Slide Show Settings " SlideShowPresentationSettings Kontext "BildschirmPraesentation" - '/// check checkbox 'default' ///' + printlog "check checkbox 'default' " Standard.Check - '/// check checkbox 'Change slides maually' ///' - ' to check this i need an automatic transition somewhere in the presentation !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + printlog "check checkbox 'Change slides maually'" + ' to check this i need an automatic transition somewhere in the presentation ! DiawechselManuel.Check - '/// check checkbox 'Mouse pointer as pen' ///' + printlog "check checkbox 'Mouse pointer as pen'" MauszeigerAlsStift.Check - '/// close dialog 'Slide Show' with OK ///' + printlog "close dialog 'Slide Show' with OK " BildschirmPraesentation.Ok sleep 1 - '/// goto the first slide by typing [strg home] ///' + printlog "goto the first slide by typing [strg home] " hTypeKeys "" - '///+ - SlideShow->SlideTransition ///' + printlog "SlideShow->SlideTransition " SlideShowSlideTransition Kontext "Tasks" - '///+ - click button 'Extras' ///' + printlog "click button 'Extras' " sleep 1 - '///+ - + click button 'Automatic Transition' ///' + printlog "click button 'Automatic Transition' " TransitionAutomaticallyAfter.Check 'click - '///+ - + + Set Time to '00:00:01' ///' + printlog " Set Time to '00:00:01' " TransitionAutomaticallyAfterTime.SetText "2" - '///+ - click button 'Assign' ///' + printlog " click button 'Assign' " TransitionApplyToAllSlides.Click - '///+ - close dialog 'Slide Transition' ///' + printlog "close dialog 'Slide Transition' " sleep 3 - '/// start the slideshow with keys [STRG F2] ///' + printlog "start the slideshow with keys [STRG F2] " Kontext "DocumentImpress" DocumentImpress.TypeKeys "" Printlog "'---------------------------- START P -- Default -- Manuel ------------------------------" - '/// wait 10 seconds (to get the dia changed automatical has not to happen !) ///' + printlog "wait 10 seconds (to get the dia changed automatical has not to happen !) " sleep 10 Kontext "DocumentPresentation" - '/// type the key [MOD1 SHIFT F5] to open the navigator ///' '-------------------------------------------------------------------------- + printlog "type the key [MOD1 SHIFT F5] to open the navigator " DocumentPresentation.TypeKeys "" - '/// press key [cursor right] 3 times ///' + printlog "press key [cursor right] 3 times " for i = 1 to 4 sleep 5 fGetSlideName(saSlideNames(i)) - '///+ use the left mouse button, to use the pen drawing function ///' + printlog "use the left mouse button, to use the pen drawing function " DocumentPresentation.MouseDown (10, 10) DocumentPresentation.MouseMove (10, 90) DocumentPresentation.MouseUp (10, 90) DocumentPresentation.TypeKeys "" next i - '/// press the key [Page Down] to exit presentation ///' + printlog "press the key [Page Down] to exit presentation " sleep (2) DocumentPresentation.TypeKeys "" sleep (2) @@ -615,10 +617,10 @@ testcase tSlideShowSlideShowSettings Printlog "- Slideshow ended at the right time" endif sleep 2 - '/// check state of navigator ! expected: closed ///' + printlog " check state of navigator ! expected: closed " Kontext "Navigator" if Navigator.exists then - '///+ close navigator ! ///' + printlog "close navigator ! " Navigator.Close warnlog "Navigator: closed" else @@ -627,50 +629,50 @@ testcase tSlideShowSlideShowSettings Printlog "'--------------------------------------------------------------------------" Kontext "DocumentImpress" - '/// Slide Show -> Slide Show Settings ///' + printlog "Slide Show -> Slide Show Settings " SlideShowPresentationSettings Kontext "BildschirmPraesentation" - '/// check checkbox 'default' ///' + printlog "check checkbox 'default' " Standard.Check - '/// UNcheck checkbox 'Change slides manually' ///' + printlog "UNcheck checkbox 'Change slides manually'" DiawechselManuel.UNCheck - '/// UNcheck checkbox 'Mouse pointer as pen' ///' + printlog "UNcheck checkbox 'Mouse pointer as pen' " MauszeigerAlsStift.UNCheck - '/// close dialog 'Slide Show' with OK ///' + printlog "close dialog 'Slide Show' with OK " BildschirmPraesentation.Ok sleep 1 - '/// goto the first slide by typing [strg home] ///' + printlog "goto the first slide by typing [strg home] " hTypeKeys "" - '/// Set all slides to 'wait 10 seconds' to get the slide changed automatically ///' - '///+ - SlideShow->SlideTransition ///' + printlog "Set all slides to 'wait 10 seconds' to get the slide changed automatically " + printlog "SlideShow->SlideTransition " SlideShowSlideTransition Kontext "Tasks" - '///+ - click button 'Extras' ///' + printlog "click button 'Extras' " sleep 1 - '///+ - + click button 'Automatic Transition' ///' + printlog "click button 'Automatic Transition' " TransitionAutomaticallyAfter.Check 'click - '///+ - + + Set Time to '10sec' ///' + printlog "Set Time to '10sec' " TransitionAutomaticallyAfterTime.SetText "10" - '///+ - click button 'Apply to all Slides' ///' + printlog "click button 'Apply to all Slides' " TransitionApplyToAllSlides.Click - '///+ - close dialog 'Slide Transition' ///' + printlog "close dialog 'Slide Transition' " sleep (1) - '/// start the slideshow with keys [STRG F2] ///' + printlog "start the slideshow with keys [STRG F2] " Kontext "DocumentImpress" DocumentImpress.TypeKeys "" Printlog "'---------------------------- START P -- Default -- Automatic -----------------------------" - '/// Wait 6 seconds to see if the Automatic Transition changes the slide. ///' + printlog "Wait 6 seconds to see if the Automatic Transition changes the slide. " sleep 6 Kontext "DocumentPresentation" - '/// type the key [MOD1 SHIFT F5] to open the navigator ///' '-------------------------------------------------------------------------- + printlog "type the key [MOD1 SHIFT F5] to open the navigator " DocumentPresentation.TypeKeys "" - '/// press key [cursor right] 3 times ///' + printlog "press key [cursor right] 3 times " for i = 2 to 4 sleep (5) fGetSlideName(saSlideNames(i)) DocumentPresentation.TypeKeys "" next i - '/// press the key [Page Down] to exit presentation ///' + printlog "press the key [Page Down] to exit presentation " sleep (2) DocumentPresentation.TypeKeys "" sleep (2) @@ -681,18 +683,18 @@ testcase tSlideShowSlideShowSettings Printlog "- Slideshow ended at the right time" endif sleep 2 - '/// check state of navigator ! expected: closed ///' + printlog " check state of navigator ! expected: closed " Kontext "Navigator" if Navigator.exists then - '///+ close navigator ! ///' + printlog "close navigator ! " Navigator.Close endif else warnlog "document didn't get loaded" endif - '/// Set "Start with current page" back to default = on, in ToolsOptions ///' + printlog "Set Start with current page back to default = on, in ToolsOptions " setStartCurrentPage(TRUE) - '/// Close the document ///' + printlog "Close the document " call hCloseDocument sLocaltestfile = hFileGetLocalPath( gTesttoolPath + "diashow.odp" ) printlog sLocaltestfile @@ -714,110 +716,110 @@ testcase tSlideShowCustomSlideShow dim sTemp as string Seite = s1 - '/// open application ///' + printlog "open application " Call hNewDocument Kontext "Navigator" if Navigator.Exists then Navigator.Close - '/// Deactivate "Start with current page" in ToolsOptions ///' + printlog "Deactivate Start with current page in ToolsOptions " setStartCurrentPage(FALSE) - '/// create a rectangle ///' + printlog "create a rectangle " hRechteckErstellen 30,30,60,60 - '/// do 2 times : ///' + printlog "do 2 times : " for i = 1 to 2 - '///+ Insert->Slide... ///' + printlog "Insert->Slide... " InsertSlide sleep 2 hTypekeys "" sleep 2 - '///+ create a rectangle ///' + printlog "create a rectangle " hRechteckErstellen 30,30,70,70 next i - '/// Slide Show -> Slide Show Settings ///' + printlog "Slide Show -> Slide Show Settings " SlideShowPresentationSettings Kontext "Bildschirmpraesentation" if (Fenster.IsChecked = False) Then Fenster.Check - '/// close dialog 'Slide Show' with OK ///' + printlog "close dialog 'Slide Show' with OK " Bildschirmpraesentation.OK - '/// Slide Show -> Custom Slide Show... ///' + printlog "Slide Show -> Custom Slide Show... " SlideShowCustomSlideshow Kontext "IndividuellePraesentation" - '/// click button 'New...' ///' + printlog "click button 'New...' " Neu.Click Kontext "IndividuellePraesentationDefinieren" - '/// type something in 'Name' ///' + printlog "type something in 'Name' " PraesentationName.SetText "Individually 1" - '/// select the first entry in the list 'Existing Slides' ///' + printlog "select the first entry in the list 'Existing Slides' " SeitenPraesentation.Select 1 - '/// click button '>>' ///' + printlog "click button '>>' " Hinzufuegen.Click i = SelectedSlides.GetItemCount if (i <> 1) Then Warnlog "- Number of slides 'Selected Slides' is not correct. It should be = '1', but it is = '" + i + "'" endif - '/// close dialog 'Define Custom Slide Show' with OK ///' + printlog "close dialog 'Define Custom Slide Show' with OK " IndividuellePraesentationDefinieren.OK Kontext "IndividuellePraesentation" - '/// click button 'Edit...' ///' + printlog "click button 'Edit...'" Bearbeiten.Click Kontext "IndividuellePraesentationDefinieren" - '/// select an entry in the list 'Selected Slides' ///' + printlog "select an entry in the list 'Selected Slides' " SelectedSlides.TypeKeys "" - '/// click button '<<' ///' + printlog "click button '<<' " Entfernen.Click i = SelectedSlides.GetItemCount if (i <> 0) Then Warnlog " Removing slides from list 'Selected Slides' does not work It should be = '1', but it is = '" + i + "'" endif - '/// select the first entry in the list 'Existing Slides' ///' + printlog "select the first entry in the list 'Existing Slides' " SeitenPraesentation.Select 1 - '/// click button '>>' ///' + printlog "click button '>>' " Hinzufuegen.Click - '/// close dialog 'Define Custom Slide Show' with OK ///' + printlog "close dialog 'Define Custom Slide Show' with OK " IndividuellePraesentationDefinieren.OK Kontext "IndividuellePraesentation" - '/// check checkbox 'Use Custom Slide Show' ///' '------------------------------------------------------- + printlog "check checkbox 'Use Custom Slide Show'" IndividuellePraesentationBenutzen.Check - '/// click button 'Start...' ///' + printlog "click button 'Start..." Starten.Click sleep 2 Kontext "DocumentPresentation" - '/// press key [space] 2 times ///' + printlog "press key [space] 2 times " DocumentPresentation.TypeKeys "" sleep 2 DocumentPresentation.TypeKeys "" sleep 5 try Kontext "IndividuellePraesentation" - '/// close dialog 'Custom Slide Shows' with button 'Close' ///' + printlog "close dialog 'Custom Slide Shows' with button 'Close' " IndividuellePraesentation.Close catch Warnlog "- Slideshow did not end after slide 1" DocumentPresentation.TypeKeys "" sleep 2 endcatch - '/// Slide Show -> Custom Slide Show... ///' + printlog "Slide Show -> Custom Slide Show... " SlideShowCustomSlideshow Kontext "IndividuellePraesentation" - '/// click button 'Edit...' ///' + printlog "click button 'Edit...' " Bearbeiten.Click Kontext "IndividuellePraesentationDefinieren" - '/// select 1st entry in the list 'Selected Slides' ///' + printlog "select 1st entry in the list 'Selected Slides' " SelectedSlides.Select 1 - '/// click button '<<' ///' + printlog "click button '<<' " Entfernen.Click i = SelectedSlides.GetItemCount if (i <> 0) Then Warnlog "- Add and remove slides does not work properly. It should be '0', but it is = '"+i+"'" endif - '/// select the first entry in the list 'Existing Slides' ///' + printlog "select the first entry in the list 'Existing Slides' " SeitenPraesentation.Select 1 - '/// click button '>>' 4 times ///' + printlog "click button '>>' 4 times " for i =1 to 4 Hinzufuegen.Click next i @@ -828,16 +830,16 @@ testcase tSlideShowCustomSlideShow Warnlog "- Wrong slide added to individual slideshow. Instead of '" + Seite + "', '" + sTemp + "' was added" endif next i - '/// close dialog 'Define Custom Slide Show' with OK ///' + printlog "close dialog 'Define Custom Slide Show' with OK " IndividuellePraesentationDefinieren.OK sleep 1 Kontext "IndividuellePraesentation" - '/// UNcheck checkbox 'Use Custom Slide Show' ///' + printlog "UNcheck checkbox 'Use Custom Slide Show'" IndividuellePraesentationBenutzen.UnCheck - '/// click button 'Start...' ///' - Starten.Click '---------------------------- START P ---------------------------------------------- - '/// press key [space] 4 times ///' + printlog "click button 'Start...' " + Starten.Click + printlog "press key [space] 4 times " kontext "DocumentPresentation" for i = 1 to 4 sleep 3 @@ -845,19 +847,19 @@ testcase tSlideShowCustomSlideShow next i sleep 10 kontext "IndividuellePraesentation" - '/// close dialog 'Custom Slide Shows' with button 'Close' ///' + printlog "close dialog 'Custom Slide Shows' with button 'Close' " if IndividuellePraesentation.exists then IndividuellePraesentation.Close else Warnlog "'IndividuellePraesentation' was closed :-(" end if - '/// Set "Start with current page" back to default = on, in ToolsOptions ///' + printlog "Set Start with current page back to default = on, in ToolsOptions " setStartCurrentPage(TRUE) - '/// close the application ///' + printlog "close the application " Kontext "Navigator" if Navigator.exists then - '///+ close navigator ! ///' + printlog "close navigator ! " Navigator.Close else printlog "Navigator: NOT available" @@ -879,33 +881,33 @@ testcase tSlideShowSlideTransition sFile = ConvertPath (gOfficePath + "user\work\diashow") -' '/// open application ///' + printlog "open application " call hNewDocument - '/// close the navigator///' + printlog "close the navigator" Kontext "Navigator" if Navigator.Exists then Navigator.Close WaitSlot (3000) - '/// create 3 slides with a rectangle ///' + printlog "create 3 slides with a rectangle " hRechteckErstellen (30,30,60,60) for i = 1 to 2 - '///+ - Insert->Slide ///' + printlog " Insert->Slide " WaitSlot (1000) InsertSlide WaitSlot (2000) hTypekeys "" WaitSlot (2000) - '///+ - insert rectangle///' + printlog " insert rectangle" hRechteckErstellen (30,30,60,60) next i Printlog "created 3 slides" - '/// for all 3 slides do: ///' + printlog "for all 3 slides do: " for i = 1 to 3 - '///+ - open navigator with shortcutkey [MOD1 SHIFT F5] ///' + printlog "open navigator with shortcutkey [MOD1 SHIFT F5] " hTypeKeys "" Sleep (3) Kontext "NavigatorDraw" - '///+ - select the next slide in the list ///' + printlog "select the next slide in the list " if Liste.GetItemCount < 3 then warnlog "We have " + Liste.GetItemCount + " entries in the Navigator." hTypeKeys "" @@ -913,21 +915,21 @@ testcase tSlideShowSlideTransition Kontext "NavigatorDraw" end if Liste.Select i - '///+ - press key [return] ///' + printlog "press key [return] " Liste.TypeKeys "" Kontext "Navigator" - '///+ - close Navigator ///' + printlog "close Navigator " Navigator.Close - '///+ - SlideShow->SlideTransition ///' + printlog " SlideShow->SlideTransition " SlideShowSlideTransition Kontext "Tasks" '"SlideTransition"' "OL_DIA_Diawechsel" 'OL_DIA_Diawechsel TransitionAutomaticPreview.UnCheck - '///+ - click button 'Effects' ///' + printlog "click button 'Effects' " TransitionApplyToSelectedSlide.typekeys "" Sleep (1) - '///+ - in the listbox 'speed' select the i. one from the top ///' + printlog "in the listbox 'speed' select the i. one from the top " TransitionSpeed.Select i - '///+ - Select an effect-group from the listbox ///' + printlog "Select an effect-group from the listbox " TransitionApplyToSelectedSlide.typekeys "" for q= 1 to (i+2) Sleep (2) @@ -935,12 +937,13 @@ testcase tSlideShowSlideTransition Sleep (2) next q sEffect(i) = TransitionApplyToSelectedSlide.GetSelText - '///+ - click button 'Extras' ///' + printlog "click button 'Extras' " Sleep (2) + printlog "click button 'Automatic Transition' " select case i - case 1: '///+ - + click button 'Automatic Transition' ///' + case 1: TransitionAutomaticallyAfter.Check - '///+ - + + Set Time to '00:00:01' OR ///' + printlog " Set Time to '00:00:01' OR " TransitionAutomaticallyAfterTime.ToMin 'SetText "1" '"00:00:01" TransitionAutomaticallyAfterTime.More TransitionApplyToSelectedSlide.typekeys "" @@ -948,8 +951,8 @@ testcase tSlideShowSlideTransition TransitionAutomaticallyAfter.Check Tasks.TypeKeys "" TimerValue = TransitionAutomaticallyAfterTime.GetText - printlog " TimerValue is now: " + TimerValue - case else: '///+ - + click button 'SemiAutomatic Transition' OR ///' + printlog "TimerValue is now: " + TimerValue + case else: printlog "click button 'SemiAutomatic Transition' OR " TransitionOnMouseClick.Check end select Sleep (3) @@ -958,26 +961,26 @@ testcase tSlideShowSlideTransition Kontext "DocumentImpress" Sleep (3) - '/// SlideShow->Slide Show Settings... ///' + printlog "SlideShow->Slide Show Settings... " SlideShowPresentationSettings Kontext "Bildschirmpraesentation" WaitSlot (2000) - '/// check Radio button 'Type': 'Window' ///' + printlog "check Radio button 'Type': 'Window' " Fenster.Check - '/// close dialog 'Slide Show' ///' + printlog "close dialog 'Slide Show' " Bildschirmpraesentation.OK WaitSlot (5000) Kontext "DocumentImpress" - Printlog "'/// SlideShow->Slide Show ///'" + Printlog "printlog SlideShow->Slide Show" SlideShowSlideshow - '/// wait 10 sec ///' - sleep (10) 'WaitSlot (10000) + printlog "wait 10 sec " + sleep (10) Kontext "DocumentPresentation" - '/// type key [ESCAPE] ///' + printlog "type key [ESCAPE] " DocumentPresentation.TypeKeys "" WaitSlot (3000) try - '/// type key [F11] to open the stylist (to check ending of presenation) ///' + printlog "type key [F11] to open the stylist (to check ending of presenation) " if lcase(gPlatform) = "osx" then hTypekeys "" else @@ -986,7 +989,7 @@ testcase tSlideShowSlideTransition Sleep (3) Kontext "Gestalter" Sleep (3) - '/// close Stylist ///' + printlog "close Stylist " Gestalter.Close Printlog "- Slideshow worked" catch @@ -996,34 +999,33 @@ testcase tSlideShowSlideTransition Sleep (2) endcatch - '/// close the navigator///' + printlog "close the navigator" Kontext "Navigator" if Navigator.Exists then Navigator.Close - Printlog "'///+ check the settings in SlideView in the Dia object bar ///'" + Printlog "check the settings in SlideView in the Dia object bar " for i = 1 to 3 Printlog " --------------------- " + i + " ---------------------------" - '///+ - open navigator with shortcutkey [MOD1 SHIFT F5] ///' + printlog " open navigator with shortcutkey [MOD1 SHIFT F5] " hTypeKeys "" sleep (3) Kontext "NavigatorDraw" - '///+ - select the next slide in the list ///' + printlog " select the next slide in the list " Liste.Select i - '///+ - press key [return] ///' + printlog " press key [return] " Liste.TypeKeys "" Kontext "Navigator" - '///+ - close Navigator ///' + printlog " close Navigator " Navigator.Close - '///+ - View->Master View->Slides View ///' -' ViewWorkspaceSlidesView + printlog " View->Master View->Slides View " Sleep (2) - Kontext "Tasks" 'SlideViewObjectbar" - '///+ - check 'speed' ///' + Kontext "Tasks" + printlog " check 'speed' " if Tasks.Exists = TRUE AND Tasks.IsVisible = TRUE then x = TransitionSpeed.GetSelIndex 'TransitionSpeed if (x <> i) then Warnlog "Speed changed :-( is: '" + x + "' should be: '" + i + "'" end if - '///+ - check 'Transition' ///' + printlog " check 'Transition' " x = TransitionApplyToSelectedSlide.GetSelIndex 'Diawechsel.GetSelIndex if (x <> (i+3)) then Warnlog "Transition changed :-( is: '" + x + "' should be: '" + (i+3) + "'" @@ -1033,65 +1035,64 @@ testcase tSlideShowSlideTransition end if end if - '///+ - check 'effect group' ///' + printlog " check 'effect group' " sTemp = TransitionApplyToSelectedSlide.GetSelText x = inStr (sTemp,sEffect(i)) Printlog " Effect tried :-) '" + x + "'" if (x < 1) then printlog "the string '" + sTemp + "' should contain the words(s): '" + sEffect(i) + "'" end if -' ViewWorkspaceDrawingView else warnlog " SlideViewObjectbar doesnt exists or isnt visible" end if next i - '/// save file as presentation with name '"user\\work\\diashow")' ///' + printlog "save file as presentation with name 'user\work\diashow)' " hFileSaveAsWithFilterKill ((sFile + ".odp") , "impress8" ) Printlog " saved presentation: '" + sFile + "'" '." + gImpressFilter + " - '/// close application///' + printlog "close application" hCloseDocument () WaitSlot (10000) - '/// load file again ///' + printlog "load file again " hFileOpen (sFile + ".odp") WaitSlot (5000) - Printlog " '/// check setings for every slide in the transition dialog ///'" - '///+ for all 3 slides do: ///' + Printlog "check setings for every slide in the transition dialog " + printlog " for all 3 slides do: " for i = 1 to 3 - Printlog " --------------------- " + i + " ---------------------------" - '///+ - open navigator with shortcutkey [MOD1 SHIFT F5] ///' - hTypeKeys "" - Sleep (3) - Kontext "NavigatorDraw" - '///+ - select the next slide in the list ///' - Liste.Select i - '///+ - press key [return] ///' - Liste.TypeKeys "" - Kontext "Navigator" - '///+ - close Navigator ///' - Navigator.Close - '///+ - select the grafik with the key [TAB] ///' - hTypeKeys ("") - '///+ - SlideShow->SlideTransition ///' - SlideShowSlideTransition + Printlog " --------------------- " + i + " ---------------------------" + printlog " open navigator with shortcutkey [MOD1 SHIFT F5] " + hTypeKeys "" + Sleep (3) + Kontext "NavigatorDraw" + printlog " select the next slide in the list " + Liste.Select i + printlog " press key [return] " + Liste.TypeKeys "" + Kontext "Navigator" + printlog " close Navigator " + Navigator.Close + printlog " select the grafik with the key [TAB] " + hTypeKeys ("") + printlog " SlideShow->SlideTransition " + SlideShowSlideTransition Kontext "Tasks" Sleep (1) - '///+ - check 'speed' ///' + printlog " check 'speed' " x = TransitionSpeed.GetSelIndex if (x <> i) then Warnlog " Speed changed :-( is: '" + x + "' should: '" + i + "'" end if - '///+ - check 'effect group' ///' + printlog " check 'effect group' " x = TransitionApplyToSelectedSlide.GetSelIndex if (x <> (i+3)) then Warnlog " Effect changed :-( is: '" + x + "' should: '" + (i+3) + "'" end if sleep (1) select case i - case 1: '///+ - click button 'Automatic Transition' ///' + case 1: printlog " click button 'Automatic Transition' " if (TransitionAutomaticallyAfter.IsEnabled) then - '///+ - + + Check Time '1' OR ///' + '///+ - + + Check Time '1' OR " sTemp = TransitionAutomaticallyAfterTime.GetText if (sTemp <> TimerValue) then Warnlog " Time is different :-( is: '" + sTemp + "' should be: '" + TimerValue + "'" '"00:00:01" @@ -1100,27 +1101,27 @@ testcase tSlideShowSlideTransition Warnlog " button 'Automatic Transition' not pressed ?" end if case 2: if (TransitionAutomaticallyAfter.IsChecked <> FALSE) then - '///+ - + check button 'SemiAutomatic Transition' OR ///' + '///+ - + check button 'SemiAutomatic Transition' OR " Warnlog " button 'Automatic Transition' is pressed ?" end if case 3: if (TransitionAutomaticallyAfter.IsChecked <> FALSE) then - '///+ - + click button 'Manual Transition' ///' + '///+ - + click button 'Manual Transition' " Warnlog " button 'Automatic Transition' is pressed ?" end if end select Sleep (3) next i TransitionAutomaticPreview.Check - '/// Set "Start with current page" back to default = on, in ToolsOptions ///' + printlog "Set Start with current page back to default = on, in ToolsOptions " setStartCurrentPage(TRUE) Kontext "Navigator" if Navigator.exists then - '///+ close navigator ! ///' + printlog " close navigator ! " Navigator.Close else printlog "Navigator: NOT available" end if - '/// Close the document ///' + printlog "Close the document " call hCloseDocument endcase 'tSlideShowSlideTransition @@ -1140,7 +1141,7 @@ testcase tSlideShowShowHideSlide saSlideNames(3) = S3 saSlideNames(4) = S4 - printlog "Open file 'graphics\\input\\diashow.odp' (Slide Show with 4 Slides)" + printlog "Open file 'graphics\input\diashow.odp' (Slide Show with 4 Slides)" hFileOpen ConvertPath (gTesttoolPath + "graphics\required\input\diashow.odp") sleep (10) printlog "check if the document is writable" @@ -1190,7 +1191,7 @@ testcase tSlideShowShowHideSlide SlideShowSlideshow sleep (1) kontext "DocumentPresentation" - printlog "type the key [MOD1 SHIFT F5] to open the navigator" '-------------------------------------------------------------------------- + printlog "type the key [MOD1 SHIFT F5] to open the navigator" DocumentPresentation.TypeKeys "" sleep (1) kontext "NavigatorDraw" @@ -1241,4 +1242,4 @@ testcase tSlideShowShowHideSlide endcase 'tSlideShowShowHideSlide -'------------------------------------------------------------------------------ +'------------------------------------------------------------------------------ \ No newline at end of file diff --git a/testautomation/graphics/optional/includes/impress/i_slideshow2.inc b/testautomation/graphics/optional/includes/impress/i_slideshow2.inc index b15beb28932d..2df33261c6f2 100644 --- a/testautomation/graphics/optional/includes/impress/i_slideshow2.inc +++ b/testautomation/graphics/optional/includes/impress/i_slideshow2.inc @@ -30,33 +30,29 @@ '* short description : '* '******************************************************************* -'* -' #1 tPraesentationAnimation -' #1 tPraesentationEffekt -' #1 tSlideShowInteraction -' #1 tAendernObjektBenennen -' #1 tSlideshowBackgroundAllSlides -' #1 tSlideshowBackgroundSelectedSlide -'* -'\****************************************************************** testcase tPraesentationAnimation + Dim i - Printlog "- Slideshow/Animation" + Printlog "- Slideshow/Animation" + printlog "new document " Call hNewDocument - Call sSelectEmptyLayout '/// new document ///' - sleep 2 - InsertGraphicsFromFile '/// insert graphic ///' - Kontext "OeffnenDlg" - Dateiname.SetText ConvertPath (gTesttoolPath + "global/input/graf_inp/desp.bmp") - sleep 2 - Oeffnen.Click - sleep 2 + Call sSelectEmptyLayout + sleep 2 + printlog "insert graphic" + InsertGraphicsFromFile + Kontext "OeffnenDlg" + Dateiname.SetText ConvertPath (gTesttoolPath + "global/input/graf_inp/desp.bmp") + sleep 2 + Oeffnen.Click + sleep 2 - gMouseClick 90,90 '/// deselect graphic ///' + printlog "deselect graphic" + gMouseClick 90,90 - InsertGraphicsFromFile '/// insert 2nd graphic ///' + printlog "insert 2nd graphic" + InsertGraphicsFromFile Kontext "OeffnenDlg" Dateiname.SetText ConvertPath (gTesttoolPath + "global/input/graf_inp/borabora.jpg") sleep 2 @@ -65,15 +61,18 @@ testcase tPraesentationAnimation Call hTypekeys "" - Opl_SD_EffekteZulassen '/// open animation dialogue ///' + printlog "open animation dialogue" + Opl_SD_EffekteZulassen Kontext "Animation" for i=1 to 10 - BildAufnehmen.Click '/// add graphic 10 times ///' + printlog "add graphic 10 times" + BildAufnehmen.Click next i sleep 1 - if AnzahlBilder.GetText <> "10" Then '/// get number of frames (should be 10) ///' + printlog "get number of frames (should be 10) " + if AnzahlBilder.GetText <> "10" Then WarnLog " - Adding pictures did not work" else PrintLog " Pictures added" @@ -81,52 +80,63 @@ testcase tPraesentationAnimation if AlleAufnehmen.IsEnabled Then WarnLog " - Add all should not be enabled because only 1 object is selected" - Kontext "DocumentImpress" - EditSelectAll '/// select both graphics in document ///' + Kontext "DocumentImpress" + printlog "select both graphics in document " + EditSelectAll - Kontext "Animation" + Kontext "Animation" + printlog "add them 5 times (10 frames)" for i=1 to 5 - printlog i - AlleAufnehmen.Click '/// add them 5 times (10 frames) ///' + printlog i + AlleAufnehmen.Click next i sleep 1 - if AnzahlBilder.GetText <> "20" Then '/// compare total numbers of frame ///' + printlog "compare total numbers of frame" + if AnzahlBilder.GetText <> "20" Then WarnLog " - Adding pics does not work" else PrintLog " all pics added" end if - ErstesBild.Click '/// jump to 1st frame ///' + printlog "jump to 1st frame" + ErstesBild.Click - if AnzahlBilder.GetText <> "1" Then '/// get number index of selected frame ///' + printlog "get number index of selected frame" + if AnzahlBilder.GetText <> "1" Then WarnLog " - Jump back to beginning does not work" else PrintLog " Jump back to beginning works" end if - LetztesBild.Click '/// jump to last frame ///' + printlog "jump to last frame" + LetztesBild.Click - if AnzahlBilder.GetText <> "20" Then '/// control number index of selected frame ///' + printlog "control number index of selected frame" + if AnzahlBilder.GetText <> "20" Then WarnLog " - Jump to end does not work" else PrintLog " Jumped to end" end if sleep 1 - Abspielen.Click '/// play animation ///' + printlog "play animation" + Abspielen.Click sleep 10 Kontext "DocumentImpress" - EditSelectAll '/// delete graphics in document ///' + printlog "delete graphics in document " + EditSelectAll DocumentImpress.TypeKeys "" sleep 2 Kontext "Animation" - Erstellen.Click '/// create animation ///' + printlog "create animation" + Erstellen.Click sleep 10 Kontext "DocumentImpress" try - EditCopy '/// try to copy created animation to make sure it is created ///' + printlog "try to copy created animation to make sure it is created" + EditCopy PrintLog " Animation created" catch WarnLog " - Animation not created" @@ -134,7 +144,8 @@ testcase tPraesentationAnimation Kontext "Animation" - if AnimationsgruppeGruppenobjekt.IsChecked = True Then '/// set duration time of frames ///' + printlog "set duration time of frames" + if AnimationsgruppeGruppenobjekt.IsChecked = True Then try AnzeigedauerProBild.SetText "1" WarnLog " - Control should be disabled" @@ -143,11 +154,14 @@ testcase tPraesentationAnimation endcatch end if - AnimationsgruppeBitmapobjekt.Check '/// check group object ///' + printlog "check group object" + AnimationsgruppeBitmapobjekt.Check - AnzeigedauerProBild.SetText "3" '/// set frame visibility time to 3 ///' + printlog "set frame visibility time to 3" + AnzeigedauerProBild.SetText "3" SetClipboard AnzeigedauerProBild.GetText - AnzeigedauerProBild.More '/// raise value for frame time ///' + printlog "raise value for frame time" + AnzeigedauerProBild.More if AnzeigedauerProBild.GetText<> GetClipboardText Then PrintLog " Duration per frame works" else @@ -155,7 +169,8 @@ testcase tPraesentationAnimation end if Dim Zaehler - Zaehler = AnzahlDurchlaeufe.GetItemCount '/// test different settings for pass amount ///' + printlog "test different settings for pass amount" + Zaehler = AnzahlDurchlaeufe.GetItemCount for i=1 to Zaehler AnzahlDurchlaeufe.Select i next i @@ -167,36 +182,43 @@ testcase tPraesentationAnimation Anpassung.Select i next i - BildLoeschen.Click '/// delete 1 frame ///' + printlog "delete 1 frame" + BildLoeschen.Click if AnzahlBilder = "20" Then WarnLog " - Deleting pictures does not work" else PrintLog " Picture No.20 deleted" end if - AlleLoeschen.Click '/// delete all frames ///' + printlog "delete all frames" + AlleLoeschen.Click Kontext "Active" Active.Yes sleep 3 Kontext "Animation" - if Abspielen.IsEnabled = true Then '/// check if play button is still active ///' + printlog "check if play button is still active" + if Abspielen.IsEnabled = true Then WarnLog " - Not all pics are deleted" else PrintLog " All pics deleted" end if sleep 2 - Animation.Close '/// close animation flyer ///' + printlog "close animation flyer" + Animation.Close sleep 2 - Call hCloseDocument '/// close document ///' -endcase + printlog "close document " + Call hCloseDocument +endcase 'tPraesentationAnimation '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- testcase tPraesentationEffekt + qaerrorlog "Test not yet ready." goto endsub - Printlog "- Slideshow/Effect" + + Dim i Dim j Dim k @@ -208,11 +230,14 @@ testcase tPraesentationEffekt Dim ZaehlerText Dim ZaehlerTon Dim Zufall - Call hNewDocument '/// new document ///' - '/// check state of navigator ! expected: closed ///' + + Printlog "- Slideshow/Effect" + printlog "new document " + Call hNewDocument + printlog " check state of navigator ! expected: closed" Kontext "Navigator" if Navigator.exists then - '///+ close navigator ! ///' + printlog " close navigator !" Navigator.Close Warnlog "Navigator was open. Check earlier tests. Now closed." else @@ -221,17 +246,22 @@ testcase tPraesentationEffekt sleep 2 kontext "DocumentImpress" gMouseClick 50,50 - hRechteckErstellen (20,20,50,50) '/// create rectangle ///' + printlog "create rectangle" + hRechteckErstellen (20,20,50,50) sleep 3 Kontext "Effekt" Printlog " - Test effects" - gMouseClick 90,90 '/// deselect rectangle ///' + printlog "deselect rectangle" + gMouseClick 90,90 sleep 1 - DocumentImpress.TypeKeys "" '/// select rectangle ///' + printlog "select rectangle " + DocumentImpress.TypeKeys "" sleep 1 - DocumentImpress.TypeKeys "" '/// go into text edit mode (F2) ///' + printlog "go into text edit mode (F2)" + DocumentImpress.TypeKeys "" sleep 1 - DocumentImpress.TypeKeys "test text to test text effects" '/// type text into the rectangle ///' + printlog "type text into the rectangle" + DocumentImpress.TypeKeys "test text to test text effects" sleep 1 DocumentImpress.TypeKeys "" sleep 2 @@ -242,7 +272,8 @@ testcase tPraesentationEffekt sleep 3 Effekte.Click Zaehler=Effekteliste.GetItemCount - for i=2 to Zaehler '/// Start from the second entry since the first one is "No effect" ///' + printlog "Start from the second entry since the first one is No effect" + for i=2 to Zaehler Effekteliste.Select i SetClipboard Effekteliste.GetSelText Effekt.TypeKeys "" @@ -398,7 +429,7 @@ testcase tPraesentationEffekt Effekt.Close sleep 1 Call hCloseDocument -endcase +endcase 'tPraesentationEffekt '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -410,14 +441,15 @@ testcase tSlideShowInteraction Datei$ = ConvertPath (gOfficePath + "user\work\interac.odp") - '/// open application ///' + printlog "open application" Call hNewDocument Call sSelectEmptyLayout sleep 5 - setStartCurrentPage(TRUE) '/// Set "start with current page to ON ///' + printlog "Set start with current page to ON" + setStartCurrentPage(TRUE) - '/// call 'Insert->Slide' three times and name the slides 2, 3, 4 and create a rectangl� on it ///' - '///+ we now have 4 slides ?! :-) ///' + printlog "call 'Insert->Slide' three times and name the slides 2, 3, 4 and create a rectangle on it " + printlog "we now have 4 slides" Kontext "DocumentImpress" for i = 2 to 4 InsertSlide @@ -430,7 +462,7 @@ testcase tSlideShowInteraction sleep 2 next i - '/// check state of navigator ! expected: closed -> open navigator ///' + printlog " check state of navigator ! expected: closed -> open navigator" Kontext "Navigator" if Navigator.exists then qaerrorlog "Navigator: already open :-(" @@ -442,7 +474,7 @@ testcase tSlideShowInteraction endif sleep 3 - '/// Slide Show->Interaction ///' + printlog "Slide Show->Interaction" SlideShowInteraction Kontext "TabInteraktion" sleep 1 @@ -658,7 +690,7 @@ testcase tSlideShowInteraction endif sleep 6 - '/// Do Page down + Page up due to focusing-problems ///' + printlog "Do Page down + Page up due to focusing-problems" kontext "Slides" hTypeKeys "" hTypeKeys "" @@ -828,20 +860,21 @@ testcase tSlideShowInteraction endcatch Kontext "DocumentImpress" - '/// Close the Navigator ///' + printlog "Close the Navigator" DocumentImpress.TypeKeys "" sleep 3 - '/// Set "start with current page to ON = Default ///' + printlog "Set start with current page to ON = Default" setStartCurrentPage(TRUE) Call hCloseDocument -endcase +endcase 'tSlideShowInteraction '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- testcase tAendernObjektBenennen Printlog "- Context/Name object" + printlog "new document " Call hNewDocument - Call sSelectEmptyLayout '/// new document ///' + Call sSelectEmptyLayout sleep 1 Kontext "DocumentImpress" @@ -900,7 +933,7 @@ testcase tAendernObjektBenennen sleep 2 Call hCloseDocument sleep 2 -endcase +endcase 'tAendernObjektBenennen '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -912,23 +945,23 @@ testcase tSlideshowBackgroundAllSlides Background$ = ConvertPath(gOfficeBasisPath + "share\gallery\emoticons\grin.gif") Datei$ = ConvertPath (gOfficePath + "user\work\background.odp") - '/// Create a new document ///' + printlog "Create a new document" Printlog "- SlideshowBackground" Call hNewDocument - '/// Insert a new Slide ///' + printlog "Insert a new Slide" Kontext "DocumentImpress" InsertSlide - '/// Open the Contextmenu ///' + printlog "Open the Contextmenu" DocumentImpress.OpenContextMenu - '/// Select the entry "Slide" ///' + printlog "Select the entry Slide" hMenuFindSelect (".uno:PageMenu", true, 1, true) - '/// Select the entry "Background" ///' + printlog "Select the entry Background" hMenuSelectNr (4) - '/// In the open-file dialogue, choose and open a graphic-file you wish to have as a background ///' + printlog "In the open-file dialogue, choose and open a graphic-file you wish to have as a background" kontext "GrafikEinfuegenDlg" If GrafikEinfuegenDlg.Exists Then DateiName.SetText (Background$) @@ -937,7 +970,7 @@ testcase tSlideshowBackgroundAllSlides warnlog "GrafikEinfuegenDlg not existent... check why." End if - '/// If an "active"-message shows up, press "yes" to apply this background to all slides. ///' + printlog "If an active-message shows up, press yes to apply this background to all slides." kontext "Active" if Active.Exists then Active.Yes @@ -945,43 +978,45 @@ testcase tSlideshowBackgroundAllSlides QaErrorLog "No dialogue considering if we wish to apply the background to all slides." end if - '/// Save the document ///' + printlog "Save the document" Call hFileSaveAsKill (Datei$) - '/// Close the document ///' + printlog "Close the document" Call hCloseDocument - '/// Open the document ///' + printlog "Open the document" Call hFileOpen (Datei$) - '/// Close the document ///' + printlog "Close the document" Call hCloseDocument -endcase +endcase 'tSlideshowBackgroundAllSlides '--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- testcase tSlideshowBackgroundSelectedSlide + Dim Datei$ as string Dim Background$ as string Dim i as integer Dim Zaehler as integer + Background$ = ConvertPath(gOfficeBasisPath + "share\gallery\emoticons\grin.gif") Datei$ = ConvertPath (gOfficePath + "user\work\background.odp") - '/// Create a new document ///' + printlog "Create a new document" Printlog "- SlideshowBackground" Call hNewDocument - '/// Insert a new Slide ///' + printlog "Insert a new Slide" Kontext "DocumentImpress" InsertSlide - '/// Open the Contextmenu ///' + printlog "Open the Contextmenu" DocumentImpress.OpenContextMenu - '/// Select the entry "Slide" ///' + printlog "Select the entry Slide" hMenuFindSelect (".uno:PageMenu", true, 1, true) - '/// Select the entry "Background" ///' + printlog "Select the entry Background" hMenuSelectNr (4) - '/// In the open-file dialogue, choose and open a graphic-file you wish to have as a background ///' + printlog "In the open-file dialogue, choose and open a graphic-file you wish to have as a background" kontext "GrafikEinfuegenDlg" If GrafikEinfuegenDlg.Exists Then DateiName.SetText (Background$) @@ -990,7 +1025,7 @@ testcase tSlideshowBackgroundSelectedSlide warnlog "GrafikEinfuegenDlg not existent... check why." End if - '/// If an "active"-message shows up, press "No" to only apply this background to the selected slide. ///' + printlog "If an active-message shows up, press No to only apply this background to the selected slide." kontext "Active" if Active.Exists then Active.No @@ -998,14 +1033,14 @@ testcase tSlideshowBackgroundSelectedSlide QaErrorLog "No dialogue considering if we wish to apply the background to all slides." end if - '/// Save the document ///' + printlog "Save the document" Call hFileSaveAsKill (Datei$) - '/// Close the document ///' + printlog "Close the document" Call hCloseDocument - '/// Open the document ///' + printlog "Open the document" Call hFileOpen (Datei$) - '/// Close the document ///' + printlog "Close the document" Call hCloseDocument -endcase +endcase 'tSlideshowBackgroundSelectedSlide -'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +'--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/testautomation/graphics/optional/includes/impress/i_slideshow3.inc b/testautomation/graphics/optional/includes/impress/i_slideshow3.inc index bc138fef445d..07ac2f0d9def 100644 --- a/testautomation/graphics/optional/includes/impress/i_slideshow3.inc +++ b/testautomation/graphics/optional/includes/impress/i_slideshow3.inc @@ -30,125 +30,140 @@ '* short description : '* '******************************************************************* -' #1 tExtrasInteraktion -' #1 tExtrasEffekt -' #1 tExtrasPraesentationseinstellungen -' #1 tExtrasIndividuellePraesentation -' #1 tExtrasInteraktion -' #1 tSlideshowContextMenuOneSlide -' #1 tSlideshowContextMenuMoreSlides -' #1 tiMousePointerHides -'\****************************************************************** testcase tExtrasInteraktion + + Dim i + Dim Zaehler + + Printlog " - SlideShow/Interaction" - Call hNewDocument - Call sSelectEmptyLayout - sleep 1 - Call hTextrahmenErstellen ("Seite 1",10,10,40,40) '/// create textbox ///' - SlideShowPresentationSettings '/// Set slide show settings ///' - Kontext "Bildschirmpraesentation" - NavigatorSichtbar.Check '/// Navigator visible ///' - Bildschirmpraesentation.OK - SlideShowInteraction '/// open Interaction ///' - Kontext "Interaktion" - if Interaktion.exists(5)then - AktionBeiMausklick.Select 1 '/// Select "Go to previous slide" ///' - else - Print "Interaction doesnt exist, something is wrong here." - endif - Interaktion.OK - Kontext "DocumentImpress" - SlideShowSlideshow '/// Run slideshow ///' - Sleep (2) - Kontext "DokumentPraesentation" - DokumentPraesentation.TypeKeys "" - Sleep 2 - Kontext "DocumentImpress" - gMouseClick 20,20 - EditSelectAll - try - EditCopy - Printlog " Interaction ->No action works" - Kontext "DocumentImpress" - catch - Warnlog " - Interaction->does not work properly: Should be: Page 2 but it is: " + GetClipboardText - DocumentImpress.TypeKeys "" - Kontext "DocumentImpress" - endcatch - hCloseDocument - Call hNewDocument - Call sSelectEmptyLayout - Call hRechteckErstellen (50,50,80,80) '/// create rectangle ///' - SlideShowInteraction - Kontext "Interaktion" - Dim i - Dim Zaehler - Zaehler=AktionBeiMausklick.GetItemCount - For i=2 to Zaehler - AktionBeiMausklick.Select i '/// select actions ///' - SetClipboard AktionBeiMausklick.GetSelText - Interaktion.OK - Kontext "DocumentImpress" - EditSelectAll - SlideShowInteraction - Kontext "Interaktion" + Call hNewDocument + Call sSelectEmptyLayout + sleep 1 + printlog "create textbox" + Call hTextrahmenErstellen ("Seite 1",10,10,40,40) + printlog "Set slide show settings" + SlideShowPresentationSettings + Kontext "Bildschirmpraesentation" + printlog "Navigator visible" + NavigatorSichtbar.Check + Bildschirmpraesentation.OK + printlog "open Interaction" + SlideShowInteraction + Kontext "Interaktion" + if Interaktion.exists(5)then + printlog "Select Go to previous slide" + AktionBeiMausklick.Select 1 + else + Print "Interaction doesnt exist, something is wrong here." + endif + Interaktion.OK + Kontext "DocumentImpress" + printlog "Run slideshow" + SlideShowSlideshow + Sleep (2) + Kontext "DokumentPraesentation" + DokumentPraesentation.TypeKeys "" + Sleep 2 + Kontext "DocumentImpress" + gMouseClick 20,20 + EditSelectAll + try + EditCopy + Printlog " Interaction ->No action works" + Kontext "DocumentImpress" + catch + Warnlog " - Interaction->does not work properly: Should be: Page 2 but it is: " + GetClipboardText + DocumentImpress.TypeKeys "" + Kontext "DocumentImpress" + endcatch + hCloseDocument + + Call hNewDocument + Call sSelectEmptyLayout + printlog "create rectangle" + Call hRechteckErstellen (50,50,80,80) + SlideShowInteraction + Kontext "Interaktion" + Zaehler=AktionBeiMausklick.GetItemCount + For i=2 to Zaehler + printlog "select actions" + AktionBeiMausklick.Select i + SetClipboard AktionBeiMausklick.GetSelText + Interaktion.OK + Kontext "DocumentImpress" + EditSelectAll + SlideShowInteraction + Kontext "Interaktion" + printlog "control if action is saved (closing reopening dialog)" if GetClipboardText<>AktionBeiMausklick.GetSelText Then - Warnlog " Action at mouseclick - " + GetClipboardText + " - not taken" '/// control if action is saved (closing reopening dialog) ///' + Warnlog " Action at mouseclick - " + GetClipboardText + " - not taken" else - Printlog " Action at mouseclick - " + GetClipboardText + " - runs" + Printlog " Action at mouseclick - " + GetClipboardText + " - runs" end if - next i - Interaktion.OK - sleep 1 - Call hCloseDocument '/// close document ///' -endcase + next i + Interaktion.OK + sleep 1 + printlog "close document" + Call hCloseDocument +endcase 'tExtrasInteraktion + +'------------------------------------------------------------------------------- testcase tExtrasEffekt qaerrorlog "Test not yet ready." - goto endsub - Dim i - Dim j - Dim k - Dim l - Dim m - Dim n - Dim Zaehler - Dim ZaehlerKmh - Dim ZaehlerText - Dim ZaehlerTon - Dim Zufall - Call hNewDocument '/// New impress document ///' - - '/// check state of navigator ! expected: closed ///' - Kontext "Navigator" - if Navigator.exists then - '///+ close navigator ! ///' - Navigator.Close - Warnlog "Navigator was open. Check earlier tests. Now closed." - else - printlog "Navigator: NOT available. Good." - endif - - gMouseClick 50,50 - hRechteckErstellen (20,20,50,50) '/// create rectangle ///' - sleep 2 - DocumentImpress.TypeKeys "" - DocumentImpress.TypeKeys "- This is text to test the text effects of the Effects flyer" - sleep 1 - gMouseClick 90,90 '/// deselect rectangle ///' - DocumentImpress.TypeKeys "" '/// reselect rectangle ///' - - sleep 1 - Kontext "Effekt" + goto endsub + Dim i + Dim j + Dim k + Dim l + Dim m + Dim n + Dim Zaehler + Dim ZaehlerKmh + Dim ZaehlerText + Dim ZaehlerTon + Dim Zufall + + printlog "New impress document" + Call hNewDocument + + printlog " check state of navigator ! expected: closed" + Kontext "Navigator" + if Navigator.exists then + printlog " close navigator !" + Navigator.Close + Warnlog "Navigator was open. Check earlier tests. Now closed." + else + printlog "Navigator: NOT available. Good." + endif + + gMouseClick 50,50 + printlog "create rectangle" + hRechteckErstellen (20,20,50,50) + sleep 2 + DocumentImpress.TypeKeys "" + DocumentImpress.TypeKeys "- This is text to test the text effects of the Effects flyer" + sleep 1 + printlog "deselect rectangle" + gMouseClick 90,90 + printlog "reselect rectangle" + DocumentImpress.TypeKeys "" + + sleep 1 + Kontext "Effekt" Printlog " - Test effect flyer" - SlideShowEffects '/// Open effect flyer ///' - Kontext "ExtrasEffekt" - sleep 1 - Effekte.Click - Zaehler=Effekteliste.GetItemCount '/// select each effect 1 time, assign effect and close dialog ///' - for i=1 to Zaehler '/// reopen dialog and check if the effect is still there ///' + printlog "Open effect flyer" + SlideShowEffects + Kontext "ExtrasEffekt" + sleep 1 + Effekte.Click + printlog "select each effect 1 time, assign effect and close dialog" + Zaehler=Effekteliste.GetItemCount + printlog "reopen dialog and check if the effect is still there" + for i=1 to Zaehler Effekteliste.Select i SetClipboard Effekteliste.GetSelText Effekt.TypeKeys "" @@ -159,15 +174,16 @@ testcase tExtrasEffekt SlideShowEffects Kontext "Effekt" sleep 1 - if GetClipboardText<>Effekteliste.GetSelText Then Warnlog " - Invisible color not chosen" - printlog GetClipboardText + " should be " + Effekteliste.GetSelText + if GetClipboardText<>Effekteliste.GetSelText Then Warnlog " - Invisible color not chosen" + printlog GetClipboardText + " should be " + Effekteliste.GetSelText - sleep 1 + sleep 1 next i sleep 2 - Texteffekte.Click '/// test text effects ///' - sleep 1 - ZaehlerKmh=Geschwindigkeit.GetItemCount + printlog "test text effects" + Texteffekte.Click + sleep 1 + ZaehlerKmh=Geschwindigkeit.GetItemCount for j=1 to ZaehlerKmh Geschwindigkeit.Select j SetClipboard Geschwindigkeit.GetSelText @@ -176,14 +192,14 @@ testcase tExtrasEffekt SlideShowEffects Kontext "Effekt" sleep 1 - if GetClipboardText<>Geschwindigkeit.GetSelText Then Warnlog " - Speed not taken over" + if GetClipboardText<>Geschwindigkeit.GetSelText Then Warnlog " - Speed not taken over" next j - Printlog " - Speed test ok" + Printlog " - Speed test ok" - Printlog " - Test text effects" - Texteffekte.Click - sleep 1 - ZaehlerText=TexteffekteListe.GetItemCount + Printlog " - Test text effects" + Texteffekte.Click + sleep 1 + ZaehlerText=TexteffekteListe.GetItemCount for k=1 to ZaehlerText TexteffekteListe.Select k printlog TexteffekteListe.GetSelText + "-effect choosen" @@ -199,19 +215,19 @@ testcase tExtrasEffekt Texteffekte.Click printlog "and when we closed the window and opened again... " + TexteffekteListe.GetSelText + " was choosen" sleep 1 - if GetClipboardText<>TexteffekteListe.GetSelText Then Warnlog " - Texteffect did not changed" - sleep 1 + if GetClipboardText<>TexteffekteListe.GetSelText Then Warnlog " - Texteffect did not changed" + sleep 1 next k Printlog " - Test invisible color" - Effekte.Click - Effekteliste.Select 1 - Effekteauswahl.TypeKeys "",2 - Zuweisen.Click - sleep 1 - Extras.Click - sleep 1 - randomize - Zufall=((2*Rnd)+1) + Effekte.Click + Effekteliste.Select 1 + Effekteauswahl.TypeKeys "",2 + Zuweisen.Click + sleep 1 + Extras.Click + sleep 1 + randomize + Zufall=((2*Rnd)+1) for l=1 to 4 UnsichtbarMachen.Click sleep 1 @@ -222,14 +238,15 @@ testcase tExtrasEffekt Kontext "Effekt" sleep 1 Effekteauswahl.TypeKeys "",2 - Extras.Click '/// test extras ///' + printlog "test extras" + Extras.Click sleep 1 UnsichtbarMachen.Click sleep 1 Zuweisen.Click sleep 1 next l - Printlog " - Blend with color" + Printlog " - Blend with color" sleep 2 for m=1 to 5 MitFarbeAbblenden.Click @@ -251,243 +268,271 @@ testcase tExtrasEffekt sleep 1 ' if GetClipboardText<>Abblendfarbe.GetSelText Then Warnlog " - Blendingcolor did not take over" next m - Printlog " - Test order" - Effekte.Click - sleep 1 - Effekteliste.Select 2 - Zuweisen.Click - Reihenfolge.Click - sleep 1 - sleep 1 - Printlog " - test preview window" - Vorschaufenster.Click '/// open preview window ///' - sleep 1 - Kontext "Vorschau" - if Vorschau.Exists = False Then Warnlog " - Preview window not opened" - Vorschau.Close - Kontext "Effekt" - Extras.Click - if not Klangliste.IsEnabled Then Klang.Click '/// insert sound ///' - sleep 1 -' ZaehlerTon=Klangliste.GetItemCount - for n=1 to 5 - SetClipboard Klangliste.GetSelText - Klangliste.Select n - VollstaendigAbspielen.Click - Effekt.Close - SlideShowEffects - Kontext "Effekt" - sleep 1 - Extras.Click - sleep 1 + Printlog " - Test order" + Effekte.Click + sleep 1 + Effekteliste.Select 2 + Zuweisen.Click + Reihenfolge.Click + sleep 1 + sleep 1 + Printlog " - test preview window" + printlog "open preview window" + Vorschaufenster.Click + sleep 1 + Kontext "Vorschau" + if Vorschau.Exists = False Then Warnlog " - Preview window not opened" + Vorschau.Close + Kontext "Effekt" + Extras.Click + printlog "insert sound" + if not Klangliste.IsEnabled Then Klang.Click + sleep 1 + ' ZaehlerTon=Klangliste.GetItemCount + for n=1 to 5 + SetClipboard Klangliste.GetSelText + Klangliste.Select n + VollstaendigAbspielen.Click + Effekt.Close + SlideShowEffects + Kontext "Effekt" + sleep 1 + Extras.Click + sleep 1 if GetClipboardText<>Klangliste.GetSelText Then Warnlog " - sound did not change" next n - Effekt.Close - sleep 1 - Call hCloseDocument '/// close document ///' -endcase + Effekt.Close + sleep 1 + printlog "close document" + Call hCloseDocument +endcase 'tExtrasEffekt + +'------------------------------------------------------------------------------- testcase tExtrasPraesentationseinstellungen -dim waschecked as boolean - Printlog " - SlideShow/Slideshow settings" - Call hNewDocument '/// New impress document ///' - setStartCurrentPage(FALSE) '/// Set ToolsOptions - Presentation - StartCurrentPage = off ///' - '/// check state of navigator ! expected: closed ///' - Kontext "Navigator" - if Navigator.exists then - '///+ close navigator ! ///' - Navigator.Close - Warnlog "Navigator was open. Check earlier tests. Now closed." - else - printlog "Navigator: NOT available. Good." - endif - Kontext "DocumentImpress" - ExtrasPraesentationseinstellung - Kontext "Bildschirmpraesentation" - AbDia.Check - SetClipboard AbDiaName.GetItemCount - Bildschirmpraesentation.OK - InsertSlide '/// insert slide ///' - sleep 2 - hTypekeys "" - sleep 2 - SlideShowPresentationSettings '/// slideshow settings ///' - Kontext "Bildschirmpraesentation" - if AbDiaName.GetItemCount <> GetClipboardText Then - Printlog " - Added page appears in list" - else - Warnlog " - Page not added to the list" - end if - AlleDias.Check '/// check all dias///' - Printlog " - Test all slides" - Bildschirmpraesentation.OK - hCloseDocument '/// close document ///' - DateiOeffnen '/// open document (diashow.odp) ///' - Kontext "OeffnenDlg" - if OeffnenDlg.Exists(10) then - Dateiname.SetText ConvertPath (gTesttoolPath + "graphics\required\input\diashow.odp") - else - Warnlog "Took more then 10 seconds to get the file-open -dialogue open. Ending Test." - goto endsub - endif - Oeffnen.Click - sleep (60) - ' check if the document is writable - if fIsDocumentWritable = false then - ' make the document writable and check if it's succesfull - if fMakeDocumentWritable = false then - warnlog "The document can't be make writeable. Test stopped." + + dim waschecked as boolean + + Printlog " - SlideShow/Slideshow settings" + printlog "New impress document" + Call hNewDocument + printlog "Set ToolsOptions - Presentation - StartCurrentPage = off" + setStartCurrentPage(FALSE) + printlog " check state of navigator ! expected: closed" + Kontext "Navigator" + if Navigator.exists then + printlog " close navigator !" + Navigator.Close + Warnlog "Navigator was open. Check earlier tests. Now closed." + else + printlog "Navigator: NOT available. Good." + endif + Kontext "DocumentImpress" + ExtrasPraesentationseinstellung + Kontext "Bildschirmpraesentation" + AbDia.Check + SetClipboard AbDiaName.GetItemCount + Bildschirmpraesentation.OK + printlog "insert slide" + InsertSlide + sleep 2 + hTypekeys "" + sleep 2 + printlog "slideshow settings" + SlideShowPresentationSettings + Kontext "Bildschirmpraesentation" + if AbDiaName.GetItemCount <> GetClipboardText Then + Printlog " - Added page appears in list" + else + Warnlog " - Page not added to the list" + end if + printlog "check all dias" + AlleDias.Check + Printlog " - Test all slides" + Bildschirmpraesentation.OK + printlog "close document" + hCloseDocument + printlog "open document (diashow.odp)" + DateiOeffnen + Kontext "OeffnenDlg" + if OeffnenDlg.Exists(10) then + Dateiname.SetText ConvertPath (gTesttoolPath + "graphics\required\input\diashow.odp") + else + Warnlog "Took more then 10 seconds to get the file-open -dialogue open. Ending Test." goto endsub - endif - endif - Kontext "DocumentImpress" - sleep 1 - SlideShowPresentationSettings - Kontext "Bildschirmpraesentation" - if Fenster.IsChecked = False Then '/// slideshow runs in window mode checked ///' - Fenster.Check - Printlog " - Slideshow in window mode" - else - Printlog " - Slideshow in window mode checked" - end if - Bildschirmpraesentation.OK + endif + Oeffnen.Click + sleep (60) + printlog "check if the document is writable" + if fIsDocumentWritable = false then + printlog "make the document writable and check if it's succesfull" + if fMakeDocumentWritable = false then + warnlog "The document can't be make writeable. Test stopped." + goto endsub + endif + endif + Kontext "DocumentImpress" + sleep 1 + SlideShowPresentationSettings + Kontext "Bildschirmpraesentation" + printlog "slideshow runs in window mode checked" + if Fenster.IsChecked = False Then + Fenster.Check + Printlog " - Slideshow in window mode" + else + Printlog " - Slideshow in window mode checked" + end if + Bildschirmpraesentation.OK Printlog " - Testing slide show" - SlideShowSlideshow '/// run slideshow ///' - sleep (3) - Kontext "DocumentPresentation" - DocumentPresentation.TypeKeys "" - try - Kontext "DocumentImpress" - ViewZoom '/// try using menue entrees (should be disabled while slideshow is running) ///' - Warnlog " - In slide show mode controls shouldn't be enabled" - Kontext "Massstab" - Massstab.OK - catch - Kontext "DocumentPresentation" - Printlog " - Slideshow runs" - endcatch - sleep 2 - DocumentPresentation.TypeKeys "" - sleep 2 - DocumentPresentation.TypeKeys "" - sleep 2 - DocumentPresentation.TypeKeys "" - sleep 2 - DocumentPresentation.TypeKeys "" - sleep (5) - - kontext "DocumentPresentation" - if DocumentPresentation.Exists(3) then '/// test if application is still in slideshow mode ///' - warnlog " - We are still in slideshow mode" - DocumentPresentation.TypeKeys "" - else - Printlog " - Test Abdia page 3 ended" - endif - - Printlog " - From slides test" - SlideShowPresentationSettings '/// open slideshow settings ///' - Kontext "Bildschirmpraesentation" - Fenster.Check '/// check slideshow in window mode ///' - AbDia.Check - AbDiaName.Select 3 '/// slideshow begins at dia 3///' - Printlog " - From " + AbDiaName.GetSelText + " was the slides shown" - Bildschirmpraesentation.OK - SlideShowSlideshow '/// run slideshow ///' - sleep (3) - Kontext "DocumentPresentation" - DocumentPresentation.TypeKeys "" 'to get to 4 - sleep 2 - DocumentPresentation.TypeKeys "" ' to get to the end - sleep 2 - '/// Click once more to get out of presentation-mode ///' - DocumentPresentation.TypeKeys "" 'out - sleep (3) - kontext "DocumentPresentation" - if DocumentPresentation.Exists(3) then - warnlog " - We are still in slideshow mode" - DocumentPresentation.TypeKeys "" + printlog "run slideshow" + SlideShowSlideshow + sleep (3) + Kontext "DocumentPresentation" + DocumentPresentation.TypeKeys "" + try + Kontext "DocumentImpress" + printlog "try using menue entrees (should be disabled while slideshow is running)" + ViewZoom + Warnlog " - In slide show mode controls shouldn't be enabled" + Kontext "Massstab" + Massstab.OK + catch + Kontext "DocumentPresentation" + Printlog " - Slideshow runs" + endcatch + sleep 2 + DocumentPresentation.TypeKeys "" + sleep 2 + DocumentPresentation.TypeKeys "" + sleep 2 + DocumentPresentation.TypeKeys "" + sleep 2 + DocumentPresentation.TypeKeys "" + sleep (5) + + kontext "DocumentPresentation" + printlog "test if application is still in slideshow mode" + if DocumentPresentation.Exists(3) then + warnlog " - We are still in slideshow mode" + DocumentPresentation.TypeKeys "" + else + Printlog " - Test Abdia page 3 ended" + endif + + Printlog " - From slides test" + printlog "open slideshow settings" + SlideShowPresentationSettings + Kontext "Bildschirmpraesentation" + printlog "check slideshow in window mode" + Fenster.Check + AbDia.Check + printlog "slideshow begins at dia 3" + AbDiaName.Select 3 + Printlog " - From " + AbDiaName.GetSelText + " was the slides shown" + Bildschirmpraesentation.OK + printlog "run slideshow" + SlideShowSlideshow + sleep (3) + Kontext "DocumentPresentation" + DocumentPresentation.TypeKeys "" 'to get to 4 + sleep 2 + DocumentPresentation.TypeKeys "" ' to get to the end + sleep 2 + printlog "Click once more to get out of presentation-mode" + DocumentPresentation.TypeKeys "" 'out + sleep (3) + kontext "DocumentPresentation" + if DocumentPresentation.Exists(3) then + warnlog " - We are still in slideshow mode" + DocumentPresentation.TypeKeys "" else - Printlog " - Test Abdia page 3 ended" - endif - Printlog " - Repeat endless" - - Kontext "DocumentImpress" - SlideShowPresentationSettings '/// open slideshow settings ///' - Kontext "Bildschirmpraesentation" - if AbDia.IsChecked=True Then AlleDias.Check - if Auto.IsChecked=False Then Auto.Check - Bildschirmpraesentation.OK - sleep (1) - SlideShowSlideshow 'start from 1 - sleep (3) - Kontext "DocumentPresentation" - DocumentPresentation.TypeKeys "" 'to 2 - sleep 2 - DocumentPresentation.TypeKeys "" 'to 3 - sleep 2 - DocumentPresentation.TypeKeys "" 'to 4 - sleep 2 - DocumentPresentation.TypeKeys "" 'to pause - sleep 2 - DocumentPresentation.TypeKeys "" 'to 1 - sleep 2 - DocumentPresentation.TypeKeys "" 'to 2 - sleep 2 - DocumentPresentation.TypeKeys "" 'to 3 - sleep 2 - DocumentPresentation.TypeKeys "" '/// Open the navigator ///' - sleep 2 - DocumentPresentation.TypeKeys "" 'to 4 - sleep 2 - DocumentPresentation.TypeKeys "" 'to pause - sleep 2 - DocumentPresentation.TypeKeys "" 'to 1 - sleep 3 - DocumentPresentation.TypeKeys "" 'to 2 - sleep 3 - DocumentPresentation.TypeKeys "" 'to 3 - sleep 3 - Kontext "NavigatorDraw" - if NavigatorDraw.Exists then - Printlog " The navigator is open. good." - else - Warnlog " The navigator should be accessable. Opening now." - Kontext "DocumentImpress" - DocumentImpress.TypeKeys "" - Kontext "NavigatorDraw" - end if - sleep 2 - if Liste.GetSelIndex <> 3 then - Warnlog " - Diashow not repeated: We should be at page no 3, but we are at page no: " + Liste.GetSelIndex - Kontext "DocumentPresentation" - DocumentPresentation.TypeKeys "" '/// Close the Navigator-window ///' - else - Printlog " - Repeat endless does work" - Kontext "DocumentPresentation" - DocumentPresentation.TypeKeys "" '/// Close the Navigator-window ///' - sleep 2 - endif - Kontext "DocumentPresentation" - DocumentPresentation.TypeKeys "" - sleep 2 - Kontext "DocumentImpress" - gMouseClick 80,80 - try - SlideShowPresentationSettings '/// test endless repeating setting ///' - Kontext "Bildschirmpraesentation" - Bildschirmpraesentation.OK - Printlog " - Repeat endless" - catch - Warnlog " - We are still in slideshow mode" - DocumentPresentation.TypeKeys "" - sleep 5 + Printlog " - Test Abdia page 3 ended" + endif + Printlog " - Repeat endless" + + Kontext "DocumentImpress" + printlog "open slideshow settings" + SlideShowPresentationSettings + Kontext "Bildschirmpraesentation" + if AbDia.IsChecked=True Then AlleDias.Check + if Auto.IsChecked=False Then Auto.Check + Bildschirmpraesentation.OK + sleep (1) + SlideShowSlideshow 'start from 1 + sleep (3) + Kontext "DocumentPresentation" + DocumentPresentation.TypeKeys "" 'to 2 + sleep 2 + DocumentPresentation.TypeKeys "" 'to 3 + sleep 2 + DocumentPresentation.TypeKeys "" 'to 4 + sleep 2 + DocumentPresentation.TypeKeys "" 'to pause + sleep 2 + DocumentPresentation.TypeKeys "" 'to 1 + sleep 2 + DocumentPresentation.TypeKeys "" 'to 2 + sleep 2 + DocumentPresentation.TypeKeys "" 'to 3 + sleep 2 + printlog "Open the navigator" + DocumentPresentation.TypeKeys "" + sleep 2 + DocumentPresentation.TypeKeys "" 'to 4 + sleep 2 + DocumentPresentation.TypeKeys "" 'to pause + sleep 2 + DocumentPresentation.TypeKeys "" 'to 1 + sleep 3 + DocumentPresentation.TypeKeys "" 'to 2 + sleep 3 + DocumentPresentation.TypeKeys "" 'to 3 + sleep 3 + Kontext "NavigatorDraw" + if NavigatorDraw.Exists then + Printlog " The navigator is open. good." + else + Warnlog " The navigator should be accessable. Opening now." + Kontext "DocumentImpress" + DocumentImpress.TypeKeys "" + Kontext "NavigatorDraw" + end if + sleep 2 + if Liste.GetSelIndex <> 3 then + Warnlog " - Diashow not repeated: We should be at page no 3, but we are at page no: " + Liste.GetSelIndex + Kontext "DocumentPresentation" + printlog "Close the Navigator-window" + DocumentPresentation.TypeKeys "" + else + Printlog " - Repeat endless does work" + Kontext "DocumentPresentation" + printlog "Close the Navigator-window" + DocumentPresentation.TypeKeys "" + sleep 2 + endif + Kontext "DocumentPresentation" + DocumentPresentation.TypeKeys "" + sleep 2 + Kontext "DocumentImpress" + gMouseClick 80,80 + try + printlog "test endless repeating setting" + SlideShowPresentationSettings + Kontext "Bildschirmpraesentation" + Bildschirmpraesentation.OK + Printlog " - Repeat endless" + catch + Warnlog " - We are still in slideshow mode" + DocumentPresentation.TypeKeys "" + sleep 5 endcatch - Kontext "DocumentImpress" + Kontext "DocumentImpress" SlideShowPresentationSettings Kontext "BildschirmPraesentation" Fenster.Check - Printlog " - Test slide switching manually" '/// test dia switch manual ///' + printlog "test dia switch manual" + Printlog " - Test slide switching manually" if DiawechselManuel.IsChecked = False Then DiawechselManuel.Check BildschirmPraesentation.Ok sleep 1 @@ -512,42 +557,49 @@ dim waschecked as boolean Kontext "Navigator" sleep 5 - '/// Check state of navigator ! Expected: closed ///' - Kontext "Navigator" - if Navigator.exists then - '///+ Close Navigator ! ///' - Navigator.Close - Warnlog "Navigator: Should have been closed. Closing now." - else - printlog "Navigator: not available - Good" - endif - Kontext "DokumentPraesentation" - DokumentPraesentation.TypeKeys "" '/// Exit presentation-mode ///' - Kontext "DocumentImpress" - Call hCloseDocument '/// close document ///' -endcase + printlog " Check state of navigator ! Expected: closed" + Kontext "Navigator" + if Navigator.exists then + '///+ Close Navigator !" + Navigator.Close + Warnlog "Navigator: Should have been closed. Closing now." + else + printlog "Navigator: not available - Good" + endif + Kontext "DokumentPraesentation" + printlog "Exit presentation-mode" + DokumentPraesentation.TypeKeys "" + Kontext "DocumentImpress" + printlog "close document" + Call hCloseDocument +endcase 'tExtrasPraesentationseinstellungen + +'------------------------------------------------------------------------------- testcase tExtrasIndividuellePraesentation Printlog "- Slideshow/Individual slideshow" Call hNewDocument - Call sSelectEmptyLayout '/// new impress document ///' - '/// Deactivate "Start with current page" in ToolsOptions ///' - setStartCurrentPage(FALSE) - '/// check state of navigator ! expected: closed ///' - Kontext "Navigator" - if Navigator.exists then - '///+ close navigator ! ///' - Navigator.Close - Warnlog "Navigator was open. Check earlier tests. Now closed." - else - printlog "Navigator: NOT available. Good." - endif - Printlog " - insert 3 slides for the individual slide show" - SlideShowPresentationSettings '/// open slide show settings ///' - Kontext "Bildschirmpraesentation" - Fenster.Check - Bildschirmpraesentation.OK - InsertSlide '/// insert slide ///' + printlog "new impress document" + Call sSelectEmptyLayout + printlog "Deactivate Start with current page in ToolsOptions" + setStartCurrentPage(FALSE) + printlog " check state of navigator ! expected: closed" + Kontext "Navigator" + if Navigator.exists then + printlog " close navigator !" + Navigator.Close + Warnlog "Navigator was open. Check earlier tests. Now closed." + else + printlog "Navigator: NOT available. Good." + endif + Printlog " - insert 3 slides for the individual slide show" + printlog "open slide show settings" + SlideShowPresentationSettings + Kontext "Bildschirmpraesentation" + Fenster.Check + Bildschirmpraesentation.OK + printlog "insert slide" + InsertSlide sleep 2 Call sSelectEmptyLayout hTypekeys "" @@ -557,7 +609,8 @@ testcase tExtrasIndividuellePraesentation Call sSelectEmptyLayout hTypekeys "" sleep 2 - InsertSlide '/// insert another slide ///' + printlog "insert another slide" + InsertSlide sleep 2 Call sSelectEmptyLayout hTypekeys "" @@ -565,543 +618,575 @@ testcase tExtrasIndividuellePraesentation Printlog " - Slides added" sleep 1 Kontext "DocumentImpress" - DocumentImpress.TypeKeys "" '/// open navigator ///' + printlog "open navigator" + DocumentImpress.TypeKeys "" sleep 1 Kontext "NavigatorDraw" if NavigatorDraw.Exists Then - Printlog " - Navigator exists" - Erste.Click '/// switch to 1st slide ///' - Kontext "DocumentImpress" - DocumentImpress.MouseDown ( 50, 50 ) '/// Make a click onto the slide to focus onto that ///' - DocumentImpress.MouseUp ( 50, 50 ) - hRechteckErstellen (10,10,20,20) '/// create rectangle ///' - Kontext "NavigatorDraw" - Naechste.Click '/// switch to 2nd slide ///' - Kontext "DocumentImpress" - hRechteckErstellen (30,30,40,40) '/// create another rectangle ///' - Kontext "NavigatorDraw" - Naechste.Click '/// switch to 3rd slide ///' - Kontext "DocumentImpress" - hRechteckErstellen (40,40,50,50) '/// create rectangle ///' - Kontext "NavigatorDraw" - Naechste.Click '/// switch to next slide ///' - Kontext "DocumentImpress" - hRechteckErstellen (50,50,60,60) '/// create rectangle ///' - Printlog " - Created rectangles on all slides" - else - Warnlog " No Navigator" - end if - sleep 1 - SlideShowCustomSlideshow '/// open custom slideshow ///' - Kontext "IndividuellePraesentation" - Printlog " - Create new slideshow" - Neu.Click '/// create new individual slideshow ///' - Kontext "IndividuellePraesentationDefinieren" - PraesentationName.SetText "Test 1" '/// set name of individiual slideshow to Test 1 ///' - Dim i - Dim Zaehler - Zaehler=SeitenPraesentation.GetItemCount '/// add slides to presentation ///' - For i=1 to Zaehler - SeitenPraesentation.SetNoSelection - SeitenPraesentation.Select i - Hinzufuegen.Click - if SelectedSlides.GetItemCount=i Then - Printlog " - slide added to slideshow" - else - Warnlog " Count does not match selection. Should be: "+ i + " but is: "+ IndividuellePraesentation.GetItemCount - end if - next i - Printlog " - Add slides using multiple selections" - SeitenPraesentation.Select 1 - Hinzufuegen.Click - SeitenPraesentation.Select 2 - Hinzufuegen.Click - SeitenPraesentation.Select 3 - Hinzufuegen.Click - SeitenPraesentation.Select 4 - Hinzufuegen.Click - - if SelectedSlides.GetItemCount=8 Then '/// control number of added slides ///' - Printlog " - slides has been added, multiple selection is working" - else - Warnlog " Multiple selection does not work" - end if - - IndividuellePraesentationDefinieren.OK - sleep 2 - Kontext "IndividuellePraesentation" - if IndividuellePraesentationBenutzen.IsChecked=False Then IndividuellePraesentationBenutzen.Check - sleep 2 - Starten.Click '/// run presentation ///' - Printlog " - Individual slideshow started" - sleep 5 - Kontext "Navigator" '/// Check if the navigator exists, if so - close it ///' - if Navigator.Exists Then - Printlog " - Navigator exists, we close it" - Navigator.Close '/// close navigator ///' - sleep 2 - end if - Kontext "DocumentPresentation" - sleep 3 - DocumentPresentation.TypeKeys "" - sleep 2 - DocumentPresentation.TypeKeys "" - sleep 2 - DocumentPresentation.TypeKeys "" - sleep 2 - DocumentPresentation.TypeKeys "" - sleep 2 - DocumentPresentation.TypeKeys "" - sleep 2 - DocumentPresentation.TypeKeys "" - sleep 2 - DocumentPresentation.TypeKeys "" - sleep 2 - DocumentPresentation.TypeKeys "" - sleep 2 - DocumentPresentation.TypeKeys "" - sleep 5 + Printlog " - Navigator exists" + printlog "switch to 1st slide" + Erste.Click + Kontext "DocumentImpress" + printlog "Make a click onto the slide to focus onto that" + DocumentImpress.MouseDown ( 50, 50 ) + DocumentImpress.MouseUp ( 50, 50 ) + printlog "create rectangle" + hRechteckErstellen (10,10,20,20) + Kontext "NavigatorDraw" + printlog "switch to 2nd slide" + Naechste.Click + Kontext "DocumentImpress" + printlog "create another rectangle" + hRechteckErstellen (30,30,40,40) + Kontext "NavigatorDraw" + printlog "switch to 3rd slide" + Naechste.Click + Kontext "DocumentImpress" + printlog "create rectangle" + hRechteckErstellen (40,40,50,50) + Kontext "NavigatorDraw" + printlog "switch to next slide" + Naechste.Click + Kontext "DocumentImpress" + printlog "create rectangle" + hRechteckErstellen (50,50,60,60) + Printlog " - Created rectangles on all slides" + else + Warnlog " No Navigator" + end if + sleep 1 + printlog "open custom slideshow" + SlideShowCustomSlideshow + Kontext "IndividuellePraesentation" + printlog "create new individual slideshow" + Neu.Click + Kontext "IndividuellePraesentationDefinieren" + printlog "set name of individiual slideshow to Test 1" + PraesentationName.SetText "Test 1" + Dim i + Dim Zaehler + printlog "add slides to presentation" + Zaehler=SeitenPraesentation.GetItemCount + For i=1 to Zaehler + SeitenPraesentation.SetNoSelection + SeitenPraesentation.Select i + Hinzufuegen.Click + if SelectedSlides.GetItemCount=i Then + Printlog " - slide added to slideshow" + else + Warnlog " Count does not match selection. Should be: "+ i + " but is: "+ IndividuellePraesentation.GetItemCount + end if + next i + Printlog " - Add slides using multiple selections" + SeitenPraesentation.Select 1 + Hinzufuegen.Click + SeitenPraesentation.Select 2 + Hinzufuegen.Click + SeitenPraesentation.Select 3 + Hinzufuegen.Click + SeitenPraesentation.Select 4 + Hinzufuegen.Click + + printlog "control number of added slides" + if SelectedSlides.GetItemCount=8 Then + Printlog " - slides has been added, multiple selection is working" + else + Warnlog " Multiple selection does not work" + end if + + IndividuellePraesentationDefinieren.OK + sleep 2 Kontext "IndividuellePraesentation" - if IndividuellePraesentation.IsVisible=False Then - Warnlog " Slideshow should have ended" - Kontext "DocumentPresentation" - DocumentPresentation.TypeKeys "" - else - printlog " Presentation seems to have ended successfully" - end if + if IndividuellePraesentationBenutzen.IsChecked=False Then IndividuellePraesentationBenutzen.Check + sleep 2 + printlog "run presentation" + Starten.Click + Printlog " - Individual slideshow started" + sleep 5 + printlog "Check if the navigator exists, if so - close it" + Kontext "Navigator" + if Navigator.Exists Then + Printlog " - Navigator exists, we close it" + printlog "close navigator" + Navigator.Close + sleep 2 + end if + Kontext "DocumentPresentation" + sleep 3 + DocumentPresentation.TypeKeys "" + sleep 2 + DocumentPresentation.TypeKeys "" + sleep 2 + DocumentPresentation.TypeKeys "" + sleep 2 + DocumentPresentation.TypeKeys "" + sleep 2 + DocumentPresentation.TypeKeys "" + sleep 2 + DocumentPresentation.TypeKeys "" + sleep 2 + DocumentPresentation.TypeKeys "" + sleep 2 + DocumentPresentation.TypeKeys "" + sleep 2 + DocumentPresentation.TypeKeys "" + sleep 5 + Kontext "IndividuellePraesentation" + if IndividuellePraesentation.IsVisible=False Then + Warnlog " Slideshow should have ended" + Kontext "DocumentPresentation" + DocumentPresentation.TypeKeys "" + else + printlog " Presentation seems to have ended successfully" + end if - sleep 2 + sleep 2 - Kontext "IndividuellePraesentation" - IndividuellePraesentation.Close '/// Close custom slideshow ///' - - Kontext "NavigatorDraw" '/// Navigator: Control if right slide is displayed ///' - printlog " Now we switch to the navigator again" - if Liste.GetSelIndex <> 4 then '/// Unless -Start on first slide- is activated? Default = No ///' - Warnlog " This is not the right slide, it should be 4 but is: " + Liste.GetSelIndex - else - Printlog " - Individual slideshow seems to work" - end if - SlideShowCustomSlideshow '/// open custom slideshow ///' - '/// Set "Start with current page" back to default = on, in ToolsOptions ///' - Kontext "IndividuellePraesentation" - if IndividuellePraesentationBenutzen.IsChecked=False Then IndividuellePraesentationBenutzen.Check - IndividuellePraesentation.Close - sleep 2 - Kontext "Navigator" 'Draw - if Navigator.exists then - Navigator.Close '/// Close the Navigator ///' - Kontext "NavigatorDraw" - if NavigatorDraw.exists then - NavigatorDraw.Close - endif - else - printlog "Navigator: NOT available. Good." - endif - Kontext "DocumentImpress" - setStartCurrentPage(TRUE) - Call hCloseDocument '/// close document ///' -endcase - -'**************************************************************************************************** + Kontext "IndividuellePraesentation" + printlog "Close custom slideshow" + IndividuellePraesentation.Close + + printlog "Navigator: Control if right slide is displayed" + Kontext "NavigatorDraw" + printlog " Now we switch to the navigator again" + printlog "Unless -Start on first slide- is activated? Default = No" + if Liste.GetSelIndex <> 4 then + Warnlog " This is not the right slide, it should be 4 but is: " + Liste.GetSelIndex + else + Printlog " - Individual slideshow seems to work" + end if + printlog "open custom slideshow" + SlideShowCustomSlideshow + printlog "Set Start with current page back to default = on, in ToolsOptions" + Kontext "IndividuellePraesentation" + if IndividuellePraesentationBenutzen.IsChecked=False Then IndividuellePraesentationBenutzen.Check + IndividuellePraesentation.Close + sleep 2 + Kontext "Navigator" 'Draw + if Navigator.exists then + printlog "Close the Navigator" + Navigator.Close + Kontext "NavigatorDraw" + if NavigatorDraw.exists then + NavigatorDraw.Close + endif + else + printlog "Navigator: NOT available. Good." + endif + Kontext "DocumentImpress" + setStartCurrentPage(TRUE) + printlog "close document" + Call hCloseDocument +endcase 'tExtrasIndividuellePraesentation + +'------------------------------------------------------------------------------- testcase tSlideshowContextMenuOneSlide + qaerrorlog "Test not yet ready." - goto endsub - dim NumberOfEntries as Integer - Printlog "- ContextMenu in Slideshow" - '/// New Impress Document ///' - Call hNewDocument - - '/// Start the Slideshow. ///' - hTypeKeys "" - '/// Check that the right mousebutton brings up the Context-Menu. ///' - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - '/// Check that the right-click brought up a Context-Menu. ///' - '/// And check the number of Menu-Positions (there should be XXX of them ) ///' - NumberOfEntries = 0 - sleep 2 - try - NumberOfEntries = MenuGetItemCount - catch - warnlog " No ContextMenu found? Please inform the Automatic Tester" - kontext "DocumentImpress" - hOpenContextMenu - NumberOfEntries = MenuGetItemCount - endcatch - if (NumberOfEntries = 0) then - Warnlog " the Context-Menu doesnt contain any entries, or were not up. Test ends." - Goto Endsub - endif - if NumberOfEntries <> 3 then - warnlog " Expected three entries in this Menu, but found " + NumberOfEntries -' if NumberOfEntries <> 6 then -' warnlog " Expected six entries in this Menu, but found " + NumberOfEntries - else - printlog " Number of Entries was: " + NumberOfEntries - endif - '/// Check that every position contains the expected Undermenu. ("Screen": Black/White. and "End Slideshow") ///' - '/// And check that Menu-Item one opens an undermenu. ///' - Printlog " We open number one: " + MenuGetItemText(MenuGetItemID(1)) - hMenuSelectNr (1) - sleep 2 - NumberOfEntries = MenuGetItemCount - printlog " Menu-entries: " + MenuGetItemCount - if (NumberOfEntries <> 2) then - Warnlog " the third Context-Menu-entry was NOT 'Screen'." - else - Printlog " We open the next number one: " + MenuGetItemText(MenuGetItemID(1)) - hMenuSelectNr (1) - endif - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - hMenuSelectNr (1) 'Open the Screen -menu. - sleep 2 - Printlog " We open number two: " + MenuGetItemText(MenuGetItemID(MenuGetItemCount)) - hMenuSelectNr (2) 'Choose "White" - sleep 2 - - 'TODO - Due to existing bug, function not yet available. - '/// Change to slideshow-ending. Check that the Context-Menu also comes up here. ///' - 'DocumentPresentation. - hTypeKeys "" - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - NumberOfEntries = 0 - NumberOfEntries = MenuGetItemCount - if NumberOfEntries <> 0 then - printlog " Menu-entries: " + MenuGetItemCount - else - warnlog " No context-menu at Slideshow-endpage." - DocumentPresentation.TypeKeys "" - endif - - '/// And that one can go back. ///' - hMenuSelectNr (1) 'Open the Goto Slide -menu. - sleep 2 - Printlog " We open number one (should be 'Goto First Slide'): " + MenuGetItemText(MenuGetItemID(1)) - hMenuSelectNr (2) 'Choose "Back" 'TODO ;: but now we just end the slideshow - sleep 2 - - Kontext "DocumentPresentation" - DocumentPresentation.TypeKeys "" - DocumentPresentation.TypeKeys "" - Kontext "DocumentImpress" - InsertSlide - - '/// Start the Slideshow. ///' - hTypeKeys "" - '/// Check that the right mousebutton brings up the Context-Menu. ///' - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - - '/// Check that Menu-Item (three) really finishes the presentation. ///' - Printlog " We open the last entry (End Show): " + MenuGetItemText(MenuGetItemID(MenuGetItemCount)) - hMenuSelectNr (4) 'MenuGetItemCount) 'End Slideshow - if DocumentPresentation.Exists then - Warnlog "either wrong position for 'End Slideshow', or the command didnt work." - else - printlog "The presentation was closed, good." - endif - - '/// Check that one can step one step forward, even if there is no more than one slide. ///' - '/// Start the Slideshow. ///' - hTypeKeys "" - '/// Check that the right mousebutton brings up the Context-Menu. ///' - sleep (2) - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - - hMenuSelectNr (2) 'Open the Goto Slide -menu. - - '/// Select the 'one step forward' -entry ///' - hMenuSelectNr (1) - - '/// Check that we're on the last slide ///' - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - - hMenuSelectNr (2) 'Open the Goto Slide -menu. - if MenuIsItemEnabled (MenugetItemID(4)) then - printlog "Jumped to the right slide" - else - warnlog "possibly the 'jump to slide' -menu didnt quite work" - endif - - '/// Close the Context-Menu ///' - hMenuSelectNr (0) - Kontext "DocumentPresentation" - - '/// Check if the context-menu also comes up at the very last page (slideshow-ending) ///' - DocumentPresentation.TypeKeys "" -' DocumentPresentation.TypeKeys "" - sleep 1 - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - - if MenuGetItemText (MenuGetItemID(1)) <> "" then - Printlog "Context-menu came up at the last page: correct." - else - Warnlog "Context-menu did NOT come up correctly at the last page: false." - endif - - '/// Check if we from here, via the context menu, can go back to the first page ///' - hMenuSelectNr (2) 'Open the Goto Slide -menu. - sleep 1 - hMenuSelectNr (1) 'First Slide - - '/// Check that we're on the first slide ///' - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - - hMenuSelectNr (2) 'Open the Goto Slide -menu. - if MenuIsItemEnabled (MenugetItemID(3)) then - printlog "Jumped to the right slide" - else - warnlog "possibly the 'jump to slide' -menu didnt quite work from the last slide" - endif - - '/// Close the Context-Menu ///' - MenuSelect (0) - '/// Close the Presentation ///' - hTypeKeys "" - '/// Close Document ///' - Call hCloseDocument + goto endsub + + dim NumberOfEntries as Integer + + Printlog "- ContextMenu in Slideshow" + printlog "New Impress Document" + Call hNewDocument + + printlog "Start the Slideshow." + hTypeKeys "" + printlog "Check that the right mousebutton brings up the Context-Menu." + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + printlog "Check that the right-click brought up a Context-Menu." + printlog "And check the number of Menu-Positions (there should be XXX of them )" + NumberOfEntries = 0 + sleep 2 + try + NumberOfEntries = MenuGetItemCount + catch + warnlog " No ContextMenu found? Please inform the Automatic Tester" + kontext "DocumentImpress" + hOpenContextMenu + NumberOfEntries = MenuGetItemCount + endcatch + if (NumberOfEntries = 0) then + Warnlog " the Context-Menu doesnt contain any entries, or were not up. Test ends." + Goto Endsub + endif + if NumberOfEntries <> 3 then + warnlog " Expected three entries in this Menu, but found " + NumberOfEntries + ' if NumberOfEntries <> 6 then + ' warnlog " Expected six entries in this Menu, but found " + NumberOfEntries + else + printlog " Number of Entries was: " + NumberOfEntries + endif + printlog "Check that every position contains the expected Undermenu. (Screen: Black/White. and End Slideshow)" + printlog "And check that Menu-Item one opens an undermenu." + Printlog " We open number one: " + MenuGetItemText(MenuGetItemID(1)) + hMenuSelectNr (1) + sleep 2 + NumberOfEntries = MenuGetItemCount + printlog " Menu-entries: " + MenuGetItemCount + if (NumberOfEntries <> 2) then + Warnlog " the third Context-Menu-entry was NOT 'Screen'." + else + Printlog " We open the next number one: " + MenuGetItemText(MenuGetItemID(1)) + hMenuSelectNr (1) + endif + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + printlog "Open the Screen -menu." + hMenuSelectNr (1) + sleep 2 + Printlog " We open number two: " + MenuGetItemText(MenuGetItemID(MenuGetItemCount)) + printlog "Choose White" + hMenuSelectNr (2) + sleep 2 + + 'TODO - Due to existing bug, function not yet available. + printlog "Change to slideshow-ending. Check that the Context-Menu also comes up here." + 'DocumentPresentation. + hTypeKeys "" + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + NumberOfEntries = 0 + NumberOfEntries = MenuGetItemCount + if NumberOfEntries <> 0 then + printlog " Menu-entries: " + MenuGetItemCount + else + warnlog " No context-menu at Slideshow-endpage." + DocumentPresentation.TypeKeys "" + endif + + printlog "And that one can go back." + hMenuSelectNr (1) 'Open the Goto Slide -menu. + sleep 2 + Printlog " We open number one (should be 'Goto First Slide'): " + MenuGetItemText(MenuGetItemID(1)) + hMenuSelectNr (2) 'Choose "Back" 'TODO ;: but now we just end the slideshow + sleep 2 + + Kontext "DocumentPresentation" + DocumentPresentation.TypeKeys "" + DocumentPresentation.TypeKeys "" + Kontext "DocumentImpress" + InsertSlide + + printlog "Start the Slideshow." + hTypeKeys "" + printlog "Check that the right mousebutton brings up the Context-Menu." + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + + printlog "Check that Menu-Item (three) really finishes the presentation." + Printlog " We open the last entry (End Show): " + MenuGetItemText(MenuGetItemID(MenuGetItemCount)) + hMenuSelectNr (4) 'MenuGetItemCount) 'End Slideshow + if DocumentPresentation.Exists then + Warnlog "either wrong position for 'End Slideshow', or the command didnt work." + else + printlog "The presentation was closed, good." + endif + + printlog "Check that one can step one step forward, even if there is no more than one slide." + printlog "Start the Slideshow." + hTypeKeys "" + printlog "Check that the right mousebutton brings up the Context-Menu." + sleep (2) + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + + printlog "Open the Goto Slide -menu" + hMenuSelectNr (2) + printlog "Select the 'one step forward' -entry" + hMenuSelectNr (1) + + printlog "Check that we're on the last slide" + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + + hMenuSelectNr (2) + if MenuIsItemEnabled (MenugetItemID(4)) then + printlog "Jumped to the right slide" + else + warnlog "possibly the 'jump to slide' -menu didnt quite work" + endif + + printlog "Close the Context-Menu" + hMenuSelectNr (0) + Kontext "DocumentPresentation" + + printlog "Check if the context-menu also comes up at the very last page (slideshow-ending)" + DocumentPresentation.TypeKeys "" + sleep 1 + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + + if MenuGetItemText (MenuGetItemID(1)) <> "" then + Printlog "Context-menu came up at the last page: correct." + else + Warnlog "Context-menu did NOT come up correctly at the last page: false." + endif + + printlog "Check if we from here, via the context menu, can go back to the first page" + hMenuSelectNr (2) 'Open the Goto Slide -menu. + sleep 1 + hMenuSelectNr (1) 'First Slide + + printlog "Check that we're on the first slide" + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + + hMenuSelectNr (2) 'Open the Goto Slide -menu. + if MenuIsItemEnabled (MenugetItemID(3)) then + printlog "Jumped to the right slide" + else + warnlog "possibly the 'jump to slide' -menu didnt quite work from the last slide" + endif + + printlog "Close the Context-Menu" + MenuSelect (0) + printlog "Close the Presentation" + hTypeKeys "" + printlog "Close Document" + Call hCloseDocument endcase 'tSlideshowContextMenuOneSlide -'**************************************************************************************************** +'------------------------------------------------------------------------------- testcase tSlideshowContextMenuMoreSlides + qaerrorlog "Test not yet ready." - goto endsub - dim NumberOfEntries as Integer - Printlog "- ContextMenu in Slideshow" - '/// New Impress Document ///' - Call hNewDocument - '/// Insert three new Slides ///' - InsertSlide - InsertSlide - InsertSlide - '/// Start the Slideshow. ///' - hTypeKeys "" - sleep (3) - '/// Check that the right mousebutton brings up the Context-Menu. ///' - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - '/// Check that the right-click brought up a Context-Menu. ///' - '/// And check the number of Menu-Positions (there should be XXX of them ) ///' - NumberOfEntries = 0 - sleep 2 - try - NumberOfEntries = MenuGetItemCount - catch - warnlog " No ContextMenu found? Please inform the Automatic Tester" - kontext "DocumentImpress" - hOpenContextMenu - NumberOfEntries = MenuGetItemCount - endcatch - if (NumberOfEntries = 0) then - Warnlog " the Context-Menu doesnt contain any entries, or were not up. Test ends." - Goto Endsub - endif - if NumberOfEntries <> 6 then - warnlog " Expected six entries in this Menu, but found " + NumberOfEntries - else - printlog " Number of Entries was: " + NumberOfEntries - endif - '/// Check that every position contains the expected Undermenu. ("Screen": Black/White. and "End Slideshow") ///' - '/// And check that Menu-Item one opens an undermenu. ///' - Printlog " We open number four: " + MenuGetItemText(MenuGetItemID(4)) - hMenuSelectNr (3) - sleep 2 - NumberOfEntries = MenuGetItemCount - printlog " Menu-entries: " + MenuGetItemCount - if (NumberOfEntries <> 2) then - Warnlog " the first Context-Menu-entry was NOT 'Screen'." - else - Printlog " We open the next number one: " + MenuGetItemText(MenuGetItemID(1)) - hMenuSelectNr (1) - endif - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - hMenuSelectNr (3) 'Open the Screen -menu. - sleep 2 - Printlog " We open number two: " + MenuGetItemText(MenuGetItemID(MenuGetItemCount)) - hMenuSelectNr (2) 'Choose "White" - sleep 2 - - 'TODO - Due to existing bug, function not yet available. - '/// Change to slideshow-ending. Check that the Context-Menu also comes up here. ///' - 'DocumentPresentation. - hTypeKeys "" - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - NumberOfEntries = 0 - NumberOfEntries = MenuGetItemCount - if NumberOfEntries <> 0 then - printlog " Menu-entries: " + MenuGetItemCount - else - warnlog " No context-menu at Slideshow-endpage." - DocumentPresentation.TypeKeys "" - endif - - '/// And that one can go back. ///' - hMenuSelectNr (2) 'Open the Goto Slide -menu. - sleep 2 - Printlog " We open number one (should be 'Goto First Slide'): " + MenuGetItemText(MenuGetItemID(1)) - hMenuSelectNr (2) 'Choose "Back" 'TODO ;: but now we just end the slideshow - sleep 2 - - Kontext "DocumentPresentation" - DocumentPresentation.TypeKeys "" - DocumentPresentation.TypeKeys "" - Kontext "DocumentImpress" - - '/// Start the Slideshow. ///' - hTypeKeys "" - '/// Check that the right mousebutton brings up the Context-Menu. ///' - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - - '/// Check that Menu-Item (three) really finishes the presentation. ///' - Printlog " We open the last entry (End Show): " + MenuGetItemText(MenuGetItemID(MenuGetItemCount)) - hMenuSelectNr (4)'MenuGetItemCount) 'End Slideshow - sleep 4 - if DocumentPresentation.Exists then - Warnlog "either wrong position for 'End Slideshow', or the command didnt work." - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - Printlog " We open the last entry (End Show): " + MenuGetItemText(MenuGetItemID(MenuGetItemCount)) - hMenuSelectNr (4)'MenuGetItemCount) 'End Slideshow - else - printlog "The presentation was closed, good." - endif - - '/// Check that one can step one step forward, even if there is no more than one slide. ///' - '/// Start the Slideshow. ///' - hTypeKeys "" - sleep (3) - '/// Check that the right mousebutton brings up the Context-Menu. ///' - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - - hMenuSelectNr (2) 'Open the Goto Slide -menu. - - '/// Select the 'one step forward' -entry ///' - hMenuSelectNr (1) - - '/// Check that we're on the last slide ///' - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - - hMenuSelectNr (2) 'Open the Goto Slide -menu. - if MenuIsItemEnabled (MenugetItemID(4)) then - printlog "Jumped to the right slide" - else - warnlog "possibly the 'jump to slide' -menu didnt quite work" - endif - - '/// Close the Context-Menu ///' - hMenuSelectNr (0) - Kontext "DocumentPresentation" - - '/// Check if the context-menu also comes up at the very last page (slideshow-ending) ///' - DocumentPresentation.TypeKeys "" - sleep 1 - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - - if MenuGetItemText (MenuGetItemID(1)) <> "" then - Printlog "Context-menu came up at the last page: correct." - else - Warnlog "Context-menu did NOT come up correctly at the last page: false." - endif - - '/// Check if we from here, via the context menu, can go back to the first page ///' - hMenuSelectNr (2) 'Open the Goto Slide -menu. - sleep 1 - hMenuSelectNr (1) 'First Slide - - '/// Check that we're on the first slide ///' - Kontext "DocumentPresentation" - DocumentPresentation.MouseDown 50, 50, 3 - DocumentPresentation.MouseUp 50, 50, 3 - sleep 2 - - hMenuSelectNr (2) 'Open the Goto Slide -menu. - if MenuIsItemEnabled (MenugetItemID(3)) then - printlog "Jumped to the right slide" - else - warnlog "possibly the 'jump to slide' -menu didnt quite work from the last slide" - endif - - '/// Close the Context-Menu ///' - MenuSelect (0) - '/// Close the Presentation ///' - hTypeKeys "" - '/// Close Document ///' - Call hCloseDocument + goto endsub + + dim NumberOfEntries as Integer + + Printlog "- ContextMenu in Slideshow" + printlog "New Impress Document" + Call hNewDocument + printlog "Insert three new Slides" + InsertSlide + InsertSlide + InsertSlide + printlog "Start the Slideshow." + hTypeKeys "" + sleep (3) + printlog "Check that the right mousebutton brings up the Context-Menu." + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + printlog "Check that the right-click brought up a Context-Menu." + printlog "And check the number of Menu-Positions (there should be XXX of them )" + NumberOfEntries = 0 + sleep 2 + try + NumberOfEntries = MenuGetItemCount + catch + warnlog " No ContextMenu found? Please inform the Automatic Tester" + kontext "DocumentImpress" + hOpenContextMenu + NumberOfEntries = MenuGetItemCount + endcatch + if (NumberOfEntries = 0) then + Warnlog " the Context-Menu doesnt contain any entries, or were not up. Test ends." + Goto Endsub + endif + if NumberOfEntries <> 6 then + warnlog " Expected six entries in this Menu, but found " + NumberOfEntries + else + printlog " Number of Entries was: " + NumberOfEntries + endif + printlog "Check that every position contains the expected Undermenu. (Screen: Black/White. and End Slideshow)" + printlog "And check that Menu-Item one opens an undermenu." + Printlog " We open number four: " + MenuGetItemText(MenuGetItemID(4)) + hMenuSelectNr (3) + sleep 2 + NumberOfEntries = MenuGetItemCount + printlog " Menu-entries: " + MenuGetItemCount + if (NumberOfEntries <> 2) then + Warnlog " the first Context-Menu-entry was NOT 'Screen'." + else + Printlog " We open the next number one: " + MenuGetItemText(MenuGetItemID(1)) + hMenuSelectNr (1) + endif + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + hMenuSelectNr (3) 'Open the Screen -menu. + sleep 2 + Printlog " We open number two: " + MenuGetItemText(MenuGetItemID(MenuGetItemCount)) + hMenuSelectNr (2) 'Choose "White" + sleep 2 + + 'TODO - Due to existing bug, function not yet available. + printlog "Change to slideshow-ending. Check that the Context-Menu also comes up here." + 'DocumentPresentation. + hTypeKeys "" + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + NumberOfEntries = 0 + NumberOfEntries = MenuGetItemCount + if NumberOfEntries <> 0 then + printlog " Menu-entries: " + MenuGetItemCount + else + warnlog " No context-menu at Slideshow-endpage." + DocumentPresentation.TypeKeys "" + endif + + printlog "And that one can go back." + hMenuSelectNr (2) 'Open the Goto Slide -menu. + sleep 2 + Printlog " We open number one (should be 'Goto First Slide'): " + MenuGetItemText(MenuGetItemID(1)) + hMenuSelectNr (2) 'Choose "Back" 'TODO ;: but now we just end the slideshow + sleep 2 + + Kontext "DocumentPresentation" + DocumentPresentation.TypeKeys "" + DocumentPresentation.TypeKeys "" + Kontext "DocumentImpress" + + printlog "Start the Slideshow." + hTypeKeys "" + printlog "Check that the right mousebutton brings up the Context-Menu." + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + + printlog "Check that Menu-Item (three) really finishes the presentation." + Printlog " We open the last entry (End Show): " + MenuGetItemText(MenuGetItemID(MenuGetItemCount)) + hMenuSelectNr (4)'MenuGetItemCount) 'End Slideshow + sleep 4 + if DocumentPresentation.Exists then + Warnlog "either wrong position for 'End Slideshow', or the command didnt work." + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + Printlog " We open the last entry (End Show): " + MenuGetItemText(MenuGetItemID(MenuGetItemCount)) + hMenuSelectNr (4)'MenuGetItemCount) 'End Slideshow + else + printlog "The presentation was closed, good." + endif + + printlog "Check that one can step one step forward, even if there is no more than one slide." + printlog "Start the Slideshow." + hTypeKeys "" + sleep (3) + printlog "Check that the right mousebutton brings up the Context-Menu." + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + + hMenuSelectNr (2) 'Open the Goto Slide -menu. + + printlog "Select the 'one step forward' -entry" + hMenuSelectNr (1) + + printlog "Check that we're on the last slide" + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + + hMenuSelectNr (2) 'Open the Goto Slide -menu. + if MenuIsItemEnabled (MenugetItemID(4)) then + printlog "Jumped to the right slide" + else + warnlog "possibly the 'jump to slide' -menu didnt quite work" + endif + + printlog "Close the Context-Menu" + hMenuSelectNr (0) + Kontext "DocumentPresentation" + + printlog "Check if the context-menu also comes up at the very last page (slideshow-ending)" + DocumentPresentation.TypeKeys "" + sleep 1 + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + + if MenuGetItemText (MenuGetItemID(1)) <> "" then + Printlog "Context-menu came up at the last page: correct." + else + Warnlog "Context-menu did NOT come up correctly at the last page: false." + endif + + printlog "Check if we from here, via the context menu, can go back to the first page" + hMenuSelectNr (2) 'Open the Goto Slide -menu. + sleep 1 + hMenuSelectNr (1) 'First Slide + + printlog "Check that we're on the first slide" + Kontext "DocumentPresentation" + DocumentPresentation.MouseDown 50, 50, 3 + DocumentPresentation.MouseUp 50, 50, 3 + sleep 2 + + hMenuSelectNr (2) 'Open the Goto Slide -menu. + if MenuIsItemEnabled (MenugetItemID(3)) then + printlog "Jumped to the right slide" + else + warnlog "possibly the 'jump to slide' -menu didnt quite work from the last slide" + endif + + printlog "Close the Context-Menu" + MenuSelect (0) + printlog "Close the Presentation" + hTypeKeys "" + printlog "Close Document" + Call hCloseDocument endcase 'tSlideshowContextMenuMoreSlides -'**************************************************************************************************** +'------------------------------------------------------------------------------- testcase tiMousePointerHides + qaerrorlog "Test not yet ready." - goto endsub - dim i as Integer - Printlog "- ContextMenu in Slideshow" - '/// New Impress Document ///' - Call hNewDocument - - '/// Start the Slideshow. ///' - hTypeKeys "" - sleep 1 - i = 0 - while ((getMouseStyle = 0) AND (i<20)) - sleep 1 - inc (i) - printlog getMouseStyle - if (getMouseStyle <> 0) then i = 20 - wend - if (getMouseStyle <> 0) then - printlog "Mousepointer disappeared like it should have" - else - warnlog "the mousepointer was still visible, after 20 seconds." - endif - - hTypeKeys "" - hTypeKeys "" - - '/// Close Document ///' - Call hCloseDocument -endcase 'tSlideshowContextMenuMoreSlides + goto endsub -'**************************************************************************************************** + dim i as Integer + Printlog "- ContextMenu in Slideshow" + printlog "New Impress Document" + Call hNewDocument + + printlog "Start the Slideshow." + hTypeKeys "" + sleep 1 + i = 0 + while ((getMouseStyle = 0) AND (i<20)) + sleep 1 + inc (i) + printlog getMouseStyle + if (getMouseStyle <> 0) then i = 20 + wend + if (getMouseStyle <> 0) then + printlog "Mousepointer disappeared like it should have" + else + warnlog "the mousepointer was still visible, after 20 seconds." + endif + + hTypeKeys "" + hTypeKeys "" + + printlog "Close Document" + Call hCloseDocument +endcase 'tiMousePointerHides + +'------------------------------------------------------------------------------- \ No newline at end of file -- cgit From 19f6193043144ba340ff73f73c1308a8d31defec Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 19 Nov 2010 14:04:37 +0100 Subject: l10nnewlangs: #i115677# Write error to stderr, single / multi process error msg fix --- solenv/bin/build.pl | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/solenv/bin/build.pl b/solenv/bin/build.pl index 0ba604d55cec..239b15c65d38 100755 --- a/solenv/bin/build.pl +++ b/solenv/bin/build.pl @@ -786,6 +786,7 @@ sub dmake_dir { $error_code = run_job($dmake, $job_name); html_store_job_info(\%local_deps_hash, $job_name, $error_code) if (!$child); }; + if ($error_code && $ignore) { push(@ignored_errors, $job_name); $error_code = 0; @@ -802,6 +803,7 @@ sub dmake_dir { }; _exit(0); } elsif ($error_code && ($error_code != -1)) { + $broken_build{$job_name} = $error_code if (!$processes_to_run && $error_code); return $error_code; }; }; @@ -1681,23 +1683,23 @@ sub cancel_build { }; if ($broken_modules_number && $build_all_parents) { - print "\n"; - print $broken_modules_number; - print " module(s): "; + print STDERR "\n"; + print STDERR $broken_modules_number; + print STDERR " module(s): "; foreach (@broken_module_names) { - print "\n\t$_"; + print STDERR "\n\t$_"; }; - print "\nneed(s) to be rebuilt\n\nReason(s):\n\n"; + print STDERR "\nneed(s) to be rebuilt\n\nReason(s):\n\n"; foreach (keys %broken_build) { - print "ERROR: error " . $broken_build{$_} . " occurred while making $_\n"; + print STDERR "ERROR: error " . $broken_build{$_} . " occurred while making $_\n"; }; - print "\nAttention: if you fix the errors in above module(s) you may prolongue your the build issuing command:\n\n\t" . $message_part; + print STDERR "\nAttention: if you fix the errors in above module(s) you may prolongue your the build issuing command:\n\n\t" . $message_part; } else { while (children_number()) { handle_dead_children(1); } foreach (keys %broken_build) { - print "ERROR: error " . $broken_build{$_} . " occurred while making $_\n"; + print STDERR "ERROR: error " . $broken_build{$_} . " occurred while making $_\n"; }; }; print "\n"; @@ -2031,7 +2033,7 @@ sub do_custom_job { }; if ($error_code) { $modules_with_errors{$dependencies_hash}++; - $broken_build{$module} = $error_code; +# $broken_build{$module_job} = $error_code; } else { remove_from_dependencies($module_job, $dependencies_hash); }; -- cgit From 6ad930a9e6a25ec36f4672bf833cffa7371d6f9a Mon Sep 17 00:00:00 2001 From: os Date: Fri, 19 Nov 2010 14:24:51 +0100 Subject: #i112395# rtf import fixed --- sw/source/filter/rtf/swparrtf.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index a4f3063ea05a..0c23218092d5 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -3641,7 +3641,7 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc ) // wurde an der Position ein Escapement aufgespannt, so entferne // das jetzt. Fussnoten sind bei uns immer hochgestellt. - SvxRTFItemStackTypePtr pTmp = aSaveStack.back(); + SvxRTFItemStackTypePtr pTmp = aSaveStack.empty() ? 0 : aSaveStack.back(); if( pTmp && pTmp->GetSttNodeIdx() == pPam->GetPoint()->nNode.GetIndex() && pTmp->GetSttCnt() == nPos ) -- cgit From 688cfc2ff1c3a5d56efe1add12f8e0edb0be56bb Mon Sep 17 00:00:00 2001 From: os Date: Fri, 19 Nov 2010 14:24:51 +0100 Subject: #i112395# rtf import fixed --- editeng/inc/editeng/svxrtf.hxx | 2 +- editeng/source/rtf/rtfitem.cxx | 12 ++++++------ editeng/source/rtf/svxrtf.cxx | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/editeng/inc/editeng/svxrtf.hxx b/editeng/inc/editeng/svxrtf.hxx index 10864b1850f1..62bc6efcd4bf 100644 --- a/editeng/inc/editeng/svxrtf.hxx +++ b/editeng/inc/editeng/svxrtf.hxx @@ -470,7 +470,7 @@ inline const Color& SvxRTFParser::GetColor( size_t nId ) const inline SfxItemSet& SvxRTFParser::GetAttrSet() { SvxRTFItemStackTypePtr pTmp; - if( bNewGroup || 0 == ( pTmp = aAttrStack.back()) ) + if( bNewGroup || 0 == ( pTmp = aAttrStack.empty() ? 0 : aAttrStack.back()) ) pTmp = _GetAttrSet(); return pTmp->aAttrSet; } diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index 3141ab20afcd..58789fab2106 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -228,7 +228,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) RTF_CharTypeDef eCharType = NOTDEF_CHARTYPE; USHORT nFontAlign; - int bChkStkPos = !bNewGroup && aAttrStack.back(); + int bChkStkPos = !bNewGroup && !aAttrStack.empty(); while( bWeiter && IsParserWorking() ) // solange bekannte Attribute erkannt werden { @@ -250,7 +250,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if( !bChkStkPos ) break; - SvxRTFItemStackType* pAkt = aAttrStack.back(); + SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); if( !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() && pAkt->nSttCnt == pInsPos->GetCntIdx() )) break; @@ -269,7 +269,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) // alle bis hierher gueltigen Attribute "setzen" AttrGroupEnd(); - pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); aAttrStack.push_back( pNew ); @@ -305,7 +305,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) nStyleNo = -1 == nTokenValue ? 0 : USHORT(nTokenValue); // setze am akt. auf dem AttrStack stehenden Style die // StyleNummer - SvxRTFItemStackType* pAkt = aAttrStack.back(); + SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); if( !pAkt ) break; @@ -1869,7 +1869,7 @@ void SvxRTFParser::ReadBackgroundAttr( int nToken, SfxItemSet& rSet, // pard / plain abarbeiten void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) { - if( !bNewGroup && aAttrStack.back() ) // not at the beginning of a new group + if( !bNewGroup && !aAttrStack.empty() ) // not at the beginning of a new group { SvxRTFItemStackType* pAkt = aAttrStack.back(); @@ -1887,7 +1887,7 @@ void SvxRTFParser::RTFPardPlain( int bPard, SfxItemSet** ppSet ) // alle bis hierher gueltigen Attribute "setzen" AttrGroupEnd(); - pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); aAttrStack.push_back( pNew ); pAkt = pNew; diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index 14b17807a0ea..2788d2fd4b10 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -875,7 +875,7 @@ const Font& SvxRTFParser::GetFont( USHORT nId ) SvxRTFItemStackType* SvxRTFParser::_GetAttrSet( int bCopyAttr ) { - SvxRTFItemStackType* pAkt = aAttrStack.back(); + SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); SvxRTFItemStackType* pNew; if( pAkt ) pNew = new SvxRTFItemStackType( *pAkt, *pInsPos, bCopyAttr ); @@ -941,9 +941,9 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen { if( !aAttrStack.empty() ) { - SvxRTFItemStackType *pOld = aAttrStack.back(); + SvxRTFItemStackType *pOld = aAttrStack.empty() ? 0 : aAttrStack.back(); aAttrStack.pop_back(); - SvxRTFItemStackType *pAkt = aAttrStack.back(); + SvxRTFItemStackType *pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); do { // middle check loop ULONG nOldSttNdIdx = pOld->pSttNd->GetIdx(); @@ -1118,7 +1118,7 @@ void SvxRTFParser::AttrGroupEnd() // den akt. Bearbeiten, vom Stack loeschen // alle bis hierher gueltigen Attribute "setzen" AttrGroupEnd(); - pAkt = aAttrStack.back(); // can be changed after AttrGroupEnd! + pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); // can be changed after AttrGroupEnd! pNew->aAttrSet.SetParent( pAkt ? &pAkt->aAttrSet : 0 ); aAttrStack.push_back( pNew ); pAkt = pNew; @@ -1181,7 +1181,7 @@ void SvxRTFParser::SetAttrSet( SvxRTFItemStackType &rSet ) // Is text wasn't inserted? (Get SttPos from the top of stack!) int SvxRTFParser::IsAttrSttPos() { - SvxRTFItemStackType* pAkt = aAttrStack.back(); + SvxRTFItemStackType* pAkt = aAttrStack.empty() ? 0 : aAttrStack.back(); return !pAkt || (pAkt->pSttNd->GetIdx() == pInsPos->GetNodeIdx() && pAkt->nSttCnt == pInsPos->GetCntIdx()); } -- cgit From 7a4ec865eafbb8c0a6fb703d843a8f023c5a6a9c Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Fri, 19 Nov 2010 14:37:26 +0100 Subject: #i115618# fix bad PDF export regression for simple RTL cases --- vcl/source/gdi/pdfwriter_impl.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 580161da8a4e..aa9f642f9fee 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -7398,7 +7398,14 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT // try to handle ligatures and such if( i < nGlyphs-1 ) { - pUnicodesPerGlyph[i] = nChars = pCharPosAry[i+1] - pCharPosAry[i]; + nChars = pCharPosAry[i+1] - pCharPosAry[i]; + // #i115618# fix for simple RTL+CTL cases + // TODO: sanitize for RTL ligatures, more complex CTL, etc. + if( nChars < 0 ) + nChars = -nChars; + else if( nChars == 0 ) + nChars = 1; + pUnicodesPerGlyph[i] = nChars; for( int n = 1; n < nChars; n++ ) aUnicodes.push_back( rText.GetChar( sal::static_int_cast(pCharPosAry[i]+n) ) ); } -- cgit From a7efcc63895bb32164a9077a3e46b7cab33c3454 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Mon, 22 Nov 2010 10:18:47 +0100 Subject: #i108584# workaround unexpected ATSUBreakLine error result --- vcl/aqua/source/gdi/salatslayout.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 335505de85ac..0261ab3b56fa 100755 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -753,10 +753,11 @@ int ATSLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) cons // initial measurement of text break position UniCharArrayOffset nBreakPos = mnMinCharPos; - const ATSUTextMeasurement nATSUMaxWidth = Vcl2Fixed( nPixelWidth ); + ATSUTextMeasurement nATSUMaxWidth = Vcl2Fixed( nPixelWidth ); + if( nATSUMaxWidth <= 0xFFFF ) // #i108584# avoid ATSU rejecting the parameter + return mnMinCharPos; // or do ATSUMaxWidth=0x10000; OSStatus eStatus = ATSUBreakLine( maATSULayout, mnMinCharPos, nATSUMaxWidth, false, &nBreakPos ); - if( (eStatus != noErr) && (eStatus != kATSULineBreakInWord) ) return STRING_LEN; -- cgit From a26b166697b3486eebe005e33184b713689c3382 Mon Sep 17 00:00:00 2001 From: "Herbert Duerr [hdu]" Date: Mon, 22 Nov 2010 10:29:58 +0100 Subject: #i108584# workaround unexpected ATSUBreakLine error result --- vcl/aqua/source/gdi/salatslayout.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 0261ab3b56fa..a355ff86d00e 100755 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -753,7 +753,7 @@ int ATSLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) cons // initial measurement of text break position UniCharArrayOffset nBreakPos = mnMinCharPos; - ATSUTextMeasurement nATSUMaxWidth = Vcl2Fixed( nPixelWidth ); + const ATSUTextMeasurement nATSUMaxWidth = Vcl2Fixed( nPixelWidth ); if( nATSUMaxWidth <= 0xFFFF ) // #i108584# avoid ATSU rejecting the parameter return mnMinCharPos; // or do ATSUMaxWidth=0x10000; OSStatus eStatus = ATSUBreakLine( maATSULayout, mnMinCharPos, @@ -782,7 +782,7 @@ int ATSLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) cons if( eStatus != noErr ) return nBreakPos; const ATSUTextMeasurement nATSURemWidth = nATSUMaxWidth - (nRight - nLeft); - if( nATSURemWidth <= 0 ) + if( nATSURemWidth <= 0xFFFF ) // #i108584# avoid ATSU rejecting the parameter return nBreakPos; UniCharArrayOffset nBreakPosInWord = nBreakPos; eStatus = ATSUBreakLine( maATSULayout, nBreakPos, nATSURemWidth, false, &nBreakPosInWord ); -- cgit From 1a5c9a9fc0b76f921a05883056bf4decabe65c3c Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Mon, 22 Nov 2010 15:19:49 +0100 Subject: l10nnewlangs: #i115677# removed unneeded condition --- solenv/bin/build.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solenv/bin/build.pl b/solenv/bin/build.pl index 239b15c65d38..3b325b62ad98 100755 --- a/solenv/bin/build.pl +++ b/solenv/bin/build.pl @@ -803,7 +803,7 @@ sub dmake_dir { }; _exit(0); } elsif ($error_code && ($error_code != -1)) { - $broken_build{$job_name} = $error_code if (!$processes_to_run && $error_code); + $broken_build{$job_name} = $error_code; return $error_code; }; }; -- cgit From 2eb40fcdb2f3e4e9768fa18ad662c11d52c44ad2 Mon Sep 17 00:00:00 2001 From: os Date: Mon, 22 Nov 2010 16:46:59 +0100 Subject: #b7001883# exit if sprm array is invalid --- sw/source/filter/ww8/ww8par.cxx | 9 ++++++++- sw/source/filter/ww8/ww8scan.cxx | 17 +++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 24f36b047a4e..cd11631a0181 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4919,7 +4919,14 @@ ULONG WW8Reader::Read(SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const St } SwWW8ImplReader* pRdr = new SwWW8ImplReader(nVersion, pStg, pIn, rDoc, rBaseURL, bNew); - nRet = pRdr->LoadDoc( rPam ); + try + { + nRet = pRdr->LoadDoc( rPam ); + } + catch( const std::exception& ) + { + nRet = ERR_WW8_NO_WW8_FILE_ERR; + } delete pRdr; if( refStrm.Is() ) diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index d64e207313d8..171e45260818 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -892,11 +892,18 @@ void WW8SprmIter::SetSprms(const BYTE* pSprms_, long nLen_) const BYTE* WW8SprmIter::operator ++( int ) { - if (nRemLen > 0) + if (nRemLen > 0 ) { - pSprms += nAktSize; - nRemLen -= nAktSize; - UpdateMyMembers(); + if( nRemLen >= nAktSize ) + { + pSprms += nAktSize; + nRemLen -= nAktSize; + UpdateMyMembers(); + } + else + { + throw( ::std::exception() ); + } } return pSprms; } @@ -3247,6 +3254,8 @@ void WW8PLCFx_Cp_FKP::GetSprms(WW8PLCFxDesc* p) Otherwise our cool fastsave algorithm can be brought to bear on the problem. */ + if( !pPieceIter ) + return; ULONG nOldPos = pPieceIter->GetIdx(); bool bOk = pPieceIter->SeekPos(nOrigCp); pPieceIter->SetIdx( nOldPos ); -- cgit From 13881ca76ecbbbef8ede8df923aaf2504a16c5f4 Mon Sep 17 00:00:00 2001 From: sj Date: Mon, 22 Nov 2010 18:54:49 +0100 Subject: os145: #b7001888# fixing small svm problem --- vcl/source/gdi/metaact.cxx | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 8c1545758c3b..79d875542509 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -1441,19 +1441,35 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData ) rIStm >> mnLen; rIStm >> nAryLen; + if ( mnIndex > mnLen ) + { + mnIndex = 0; + mpDXAry = 0; + return; + } + if( nAryLen ) { // #i9762#, #106172# Ensure that DX array is at least mnLen entries long - const ULONG nIntAryLen( Max(nAryLen, static_cast(mnLen)) ); - mpDXAry = new sal_Int32[ nIntAryLen ]; - - ULONG i; - for( i = 0UL; i < nAryLen; i++ ) - rIStm >> mpDXAry[ i ]; + if ( mnLen >= nAryLen ) + { + mpDXAry = new (std::nothrow)sal_Int32[ mnLen ]; + if ( mpDXAry ) + { + ULONG i; + for( i = 0UL; i < nAryLen; i++ ) + rIStm >> mpDXAry[ i ]; - // #106172# setup remainder - for( ; i < nIntAryLen; i++ ) - mpDXAry[ i ] = 0; + // #106172# setup remainder + for( ; i < mnLen; i++ ) + mpDXAry[ i ] = 0; + } + } + else + { + mpDXAry = NULL; + return; + } } else mpDXAry = NULL; -- cgit From 1d93737ff8a4ad7ddee057cb6a30286bf4e6ff6b Mon Sep 17 00:00:00 2001 From: sj Date: Mon, 22 Nov 2010 18:56:17 +0100 Subject: os145: #b7001888# fixing small svm problem --- drawinglayer/source/primitive2d/metafileprimitive2d.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 0d57e566ef8a..73683884e2bd 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -248,9 +248,12 @@ namespace if(nPushFlags) { OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: PUSH with no property holders (!)"); - PropertyHolder* pNew = new PropertyHolder(*maPropertyHolders.back()); - pNew->setPushFlags(nPushFlags); - maPropertyHolders.push_back(pNew); + if ( !maPropertyHolders.empty() ) + { + PropertyHolder* pNew = new PropertyHolder(*maPropertyHolders.back()); + pNew->setPushFlags(nPushFlags); + maPropertyHolders.push_back(pNew); + } } } @@ -354,8 +357,9 @@ namespace PropertyHolder& Current() { + static PropertyHolder aDummy; OSL_ENSURE(maPropertyHolders.size(), "PropertyHolders: CURRENT with no property holders (!)"); - return *maPropertyHolders.back(); + return maPropertyHolders.empty() ? aDummy : *maPropertyHolders.back(); } ~PropertyHolders() -- cgit From fe4993ecf57e530d7adf63524ebfaac881eef3f9 Mon Sep 17 00:00:00 2001 From: sj Date: Mon, 22 Nov 2010 19:00:24 +0100 Subject: os145: #b7001886# fixing small ppt import problem, improving png reader --- filter/source/msfilter/svdfppt.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index f334c86bbc5f..e6a7c9821bde 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -1468,10 +1468,14 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const S if ( bOk ) { - // PersistPtrs lesen (alle) - nPersistPtrAnz = aUserEditAtom.nMaxPersistWritten + 1; // 1 mehr, damit ich immer direkt indizieren kann - pPersistPtr = new UINT32[ nPersistPtrAnz ]; // (die fangen naemlich eigentlich bei 1 an) - if ( !pPersistPtr ) + nPersistPtrAnz = aUserEditAtom.nMaxPersistWritten + 1; + if ( ( nPersistPtrAnz >> 2 ) > nStreamLen ) // sj: at least nPersistPtrAnz is not allowed to be greater than filesize + bOk = FALSE; // (it should not be greater than the PPT_PST_PersistPtrIncrementalBlock, but + // we are reading this block later, so we do not have access yet) + + if ( bOk && ( nPersistPtrAnz < ( SAL_MAX_UINT32 / sizeof( UINT32 ) ) ) ) + pPersistPtr = new (std::nothrow) UINT32[ nPersistPtrAnz ]; + if ( bOk && !pPersistPtr ) bOk = FALSE; else { @@ -5087,8 +5091,8 @@ void PPTStyleTextPropReader::ReadParaProps( SvStream& rIn, SdrPowerPointImport& rIn >> nCharCount >> aParaPropSet.pParaSet->mnDepth; // Einruecktiefe - aParaPropSet.pParaSet->mnDepth = - std::min(sal_uInt16(9), + aParaPropSet.pParaSet->mnDepth = // taking care of about using not more than 9 outliner levels + std::min(sal_uInt16(8), aParaPropSet.pParaSet->mnDepth); nCharCount--; -- cgit From b9113ba2a8a4fca7d21b1268a250f4cdc70ba64d Mon Sep 17 00:00:00 2001 From: sj Date: Mon, 22 Nov 2010 19:00:24 +0100 Subject: os145: #b7001886# fixing small ppt import problem, improving png reader --- vcl/source/gdi/pngread.cxx | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index 11971db34378..df67c4974d47 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -411,7 +411,9 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint ) case PNGCHUNK_IDAT : { - if ( !mbIDAT ) // the gfx is finished, but there may be left a zlibCRC of about 4Bytes + if ( !mpInflateInBuf ) // taking care that the header has properly been read + mbStatus = FALSE; + else if ( !mbIDAT ) // the gfx is finished, but there may be left a zlibCRC of about 4Bytes ImplReadIDAT(); } break; @@ -527,7 +529,7 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) mbIDAT = mbAlphaChannel = mbTransparent = FALSE; mbGrayScale = mbRGBTriple = FALSE; mnTargetDepth = mnPngDepth; - mnScansize = ( ( maOrigSize.Width() * mnPngDepth ) + 7 ) >> 3; + sal_uInt64 nScansize64 = ( ( static_cast< sal_uInt64 >( maOrigSize.Width() ) * mnPngDepth ) + 7 ) >> 3; // valid color types are 0,2,3,4 & 6 switch ( mnColorType ) @@ -557,7 +559,7 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) case 2 : // each pixel is an RGB triple { mbRGBTriple = TRUE; - mnScansize *= 3; + nScansize64 *= 3; switch ( mnPngDepth ) { case 16 : // we have to reduce the bitmap @@ -590,7 +592,7 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) case 4 : // each pixel is a grayscale sample followed by an alpha sample { - mnScansize *= 2; + nScansize64 *= 2; mbAlphaChannel = TRUE; switch ( mnPngDepth ) { @@ -608,7 +610,7 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) case 6 : // each pixel is an RGB triple followed by an alpha sample { mbRGBTriple = TRUE; - mnScansize *= 4; + nScansize64 *= 4; mbAlphaChannel = TRUE; switch (mnPngDepth ) { @@ -626,16 +628,24 @@ BOOL PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint ) return FALSE; } - mnBPP = mnScansize / maOrigSize.Width(); + mnBPP = static_cast< sal_uInt32 >( nScansize64 / maOrigSize.Width() ); if ( !mnBPP ) mnBPP = 1; - mnScansize++; // each scanline includes one filterbyte + nScansize64++; // each scanline includes one filterbyte + + if ( nScansize64 > SAL_MAX_UINT32 ) + return FALSE; + + mnScansize = static_cast< sal_uInt32 >( nScansize64 ); // TODO: switch between both scanlines instead of copying - mpInflateInBuf = new BYTE[ mnScansize ]; + mpInflateInBuf = new (std::nothrow) BYTE[ mnScansize ]; mpScanCurrent = mpInflateInBuf; - mpScanPrior = new BYTE[ mnScansize ]; + mpScanPrior = new (std::nothrow) BYTE[ mnScansize ]; + + if ( !mpInflateInBuf || !mpScanPrior ) + return FALSE; // calculate target size from original size and the preview hint if( rPreviewSizeHint.Width() || rPreviewSizeHint.Height() ) -- cgit From 49ee642b36a41f00a7e035179544944705e49c23 Mon Sep 17 00:00:00 2001 From: sj Date: Tue, 23 Nov 2010 10:41:33 +0100 Subject: os145: #b7001886# improved ppt import filter --- filter/source/msfilter/svdfppt.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index e6a7c9821bde..05f99aa36813 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -1475,9 +1475,9 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const S if ( bOk && ( nPersistPtrAnz < ( SAL_MAX_UINT32 / sizeof( UINT32 ) ) ) ) pPersistPtr = new (std::nothrow) UINT32[ nPersistPtrAnz ]; - if ( bOk && !pPersistPtr ) + if ( !pPersistPtr ) bOk = FALSE; - else + if ( bOk ) { memset( pPersistPtr, 0x00, nPersistPtrAnz * 4 ); -- cgit From 0988817cfd6399d04b7fbcf48603662e599276a1 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Tue, 23 Nov 2010 17:46:25 +0100 Subject: OOO330 --- solenv/inc/minor.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index 6b224831e369..98281accfb44 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -1,5 +1,5 @@ RSCVERSION=330 -RSCREVISION=330m16(Build:9549) -BUILD=9549 -LAST_MINOR=m16 +RSCREVISION=330m17(Build:9551) +BUILD=9551 +LAST_MINOR=m17 SOURCEVERSION=OOO330 -- cgit From 45729f083e7f06a672dbb7bee0627c4d6edfd46b Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 24 Nov 2010 13:45:55 +0100 Subject: pl08: #i115742# fix excel export and import functionality --- filter/source/msfilter/mscodec.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/filter/source/msfilter/mscodec.cxx b/filter/source/msfilter/mscodec.cxx index 7387e566f24e..c6feb4fb57dd 100644 --- a/filter/source/msfilter/mscodec.cxx +++ b/filter/source/msfilter/mscodec.cxx @@ -312,6 +312,9 @@ static void lcl_PrintDigest(const sal_uInt8* /*pDigest*/, const char* /*msg*/) sal_Bool MSCodec_Std97::InitCodec( const uno::Sequence< beans::NamedValue >& aData ) { +#if DEBUG_MSO_ENCRYPTION_STD97 + fprintf(stdout, "MSCodec_Std97::InitCodec: --begin\n");fflush(stdout); +#endif sal_Bool bResult = sal_False; ::comphelper::SequenceAsHashMap aHashData( aData ); @@ -325,6 +328,8 @@ sal_Bool MSCodec_Std97::InitCodec( const uno::Sequence< beans::NamedValue >& aDa { (void)memcpy( m_pDocId, aUniqueID.getConstArray(), 16 ); bResult = sal_True; + lcl_PrintDigest(m_pDigestValue, "digest value"); + lcl_PrintDigest(m_pDocId, "DocId value"); } else OSL_ENSURE( sal_False, "Unexpected document ID!\n" ); @@ -362,6 +367,8 @@ void MSCodec_Std97::InitKey ( lcl_PrintDigest(m_pDigestValue, "digest value"); (void)memcpy (m_pDocId, pDocId, 16); + + lcl_PrintDigest(m_pDocId, "DocId value"); } bool MSCodec_Std97::VerifyKey ( @@ -438,7 +445,7 @@ bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter) bool MSCodec_Std97::CreateSaltDigest( const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] ) { #if DEBUG_MSO_ENCRYPTION_STD97 - lcl_PrintDigest(pSaltData, "salt data"); + lcl_PrintDigest(nSaltData, "salt data"); #endif bool result = false; -- cgit From a3816d55a7bb3273046dccbb200a9637a539e001 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 24 Nov 2010 13:45:55 +0100 Subject: pl08: #i115742# fix excel export and import functionality --- sc/source/filter/excel/xestream.cxx | 2 +- sc/source/filter/excel/xistream.cxx | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index b15568e8ce9a..356b0d8bab42 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -600,7 +600,7 @@ void XclExpBiff8Encrypter::Init( const uno::Sequence< beans::NamedValue >& aEncr // generate salt hash. ::msfilter::MSCodec_Std97 aCodec; aCodec.InitCodec( aEncryptionData ); - aCodec.GetDigestFromSalt( mpnSalt, mpnSaltDigest ); + aCodec.CreateSaltDigest( mpnSalt, mpnSaltDigest ); // verify to make sure it's in good shape. mbValid = maCodec.VerifyKey( mpnSalt, mpnSaltDigest ); diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index 6b4851292e11..534d40fa5cd5 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -28,6 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" +#include +#include + #include "xistream.hxx" #include "xlstring.hxx" #include "xiroot.hxx" @@ -153,7 +156,26 @@ uno::Sequence< beans::NamedValue > XclImpBiff5Decrypter::OnVerifyPassword( const maCodec.InitKey( (sal_uInt8*)aBytePassword.getStr() ); if ( maCodec.VerifyKey( mnKey, mnHash ) ) + { maEncryptionData = maCodec.GetEncryptionData(); + + // since the export uses Std97 encryption always we have to request it here + ::std::vector< sal_uInt16 > aPassVect( 16 ); + ::std::vector< sal_uInt16 >::iterator aIt = aPassVect.begin(); + for( sal_Int32 nInd = 0; nInd < nLen; ++nInd, ++aIt ) + *aIt = static_cast< sal_uInt16 >( rPassword.getStr()[nInd] ); + + uno::Sequence< sal_Int8 > aDocId = ::comphelper::DocPasswordHelper::GenerateRandomByteSequence( 16 ); + OSL_ENSURE( aDocId.getLength() == 16, "Unexpected length of the senquence!" ); + + ::msfilter::MSCodec_Std97 aCodec97; + aCodec97.InitKey( &aPassVect.front(), (sal_uInt8*)aDocId.getConstArray() ); + + // merge the EncryptionData, there should be no conflicts + ::comphelper::SequenceAsHashMap aEncryptionHash( maEncryptionData ); + aEncryptionHash.update( ::comphelper::SequenceAsHashMap( aCodec97.GetEncryptionData() ) ); + aEncryptionHash >> maEncryptionData; + } } return maEncryptionData; -- cgit From baa3cdb1a532bb79ec3fbfbc23cbb4ee4b566308 Mon Sep 17 00:00:00 2001 From: obo Date: Wed, 24 Nov 2010 16:52:49 +0100 Subject: #i115761# Impress freezes opening the attached odp file(s) --- basegfx/source/polygon/b2dtrapezoid.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index c1e0f7f6c7c1..d89ec7c6cf73 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -798,6 +798,7 @@ namespace basegfx if(splitEdgeAtGivenPoint(aLeft, *pNewLeft, aCurrent)) { maNewPoints.push_back(pNewLeft); + bDone = true; } else { @@ -809,13 +810,12 @@ namespace basegfx if(splitEdgeAtGivenPoint(aRight, *pNewRight, aCurrent)) { maNewPoints.push_back(pNewRight); + bDone = true; } else { delete pNewRight; } - - bDone = true; } } -- cgit From 406dec43952fa9a7afa55738c6e7df317ad26275 Mon Sep 17 00:00:00 2001 From: obo Date: Thu, 25 Nov 2010 11:51:51 +0100 Subject: masterfix OOO330: #i115774# crash in FR version when typing / as first character --- editeng/source/misc/svxacorr.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index f969a8033f08..b7124881c90e 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -701,7 +701,7 @@ BOOL SvxAutoCorrect::FnAddNonBrkSpace( bRunNext = true; } } - else if ( cChar == '/' ) + else if ( cChar == '/' && nEndPos > 1 && rTxt.Len() > (nEndPos - 1) ) { // Remove the hardspace right before to avoid formatting URLs sal_Unicode cPrevChar = rTxt.GetChar( nEndPos - 1 ); -- cgit From 8cbc2d0363811781f5de45b3a11b3614feec4a9a Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Thu, 25 Nov 2010 17:50:45 +0100 Subject: pl08: #163778# fix buildbot - use rtl functions --- comphelper/source/misc/docpasswordhelper.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 697f221d9c80..3c8d66bd57e4 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -294,10 +294,10 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( if ( aPassword.getLength() && aDocId.getLength() == 16 ) { sal_uInt16 pPassData[16]; - memset( pPassData, 0, sizeof(pPassData) ); + rtl_zeroMemory( pPassData, sizeof(pPassData) ); sal_Int32 nPassLen = ::std::min< sal_Int32 >( aPassword.getLength(), 15 ); - (void)memcpy( pPassData, aPassword.getStr(), nPassLen * sizeof(pPassData[0]) ); + rtl_copyMemory( pPassData, aPassword.getStr(), nPassLen * sizeof(pPassData[0]) ); aResultKey = GenerateStd97Key( pPassData, aDocId ); } @@ -312,7 +312,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( if ( pPassData[0] && aDocId.getLength() == 16 ) { sal_uInt8 pKeyData[64]; - (void)memset( pKeyData, 0, sizeof(pKeyData) ); + rtl_zeroMemory( pKeyData, sizeof(pKeyData) ); sal_Int32 nInd = 0; @@ -342,7 +342,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( // Update digest with padding. pKeyData[16] = 0x80; - (void)memset (pKeyData + 17, 0, sizeof(pKeyData) - 17); + rtl_zeroMemory( pKeyData + 17, sizeof(pKeyData) - 17 ); pKeyData[56] = 0x80; pKeyData[57] = 0x0a; @@ -353,7 +353,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( rtl_digest_rawMD5 ( hDigest, (sal_uInt8*)aResultKey.getArray(), aResultKey.getLength() ); // Erase KeyData array and leave. - (void)memset (pKeyData, 0, sizeof(pKeyData)); + rtl_zeroMemory( pKeyData, sizeof(pKeyData) ); } return aResultKey; -- cgit From e5b7e737d483bd39e45f859066b33ddfe4c3c91e Mon Sep 17 00:00:00 2001 From: Release Engineering Date: Fri, 3 Dec 2010 15:30:54 +0100 Subject: DEV300 --- solenv/inc/minor.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index 2716c19b5268..9f23c05cc53f 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -1,5 +1,5 @@ RSCVERSION=300 -RSCREVISION=300m94(Build:9547) -BUILD=9547 -LAST_MINOR=m94 +RSCREVISION=300m95(Build:9553) +BUILD=9553 +LAST_MINOR=m95 SOURCEVERSION=DEV300 -- cgit From 0f68b1957428d467ac071c4e54b31bf31ed5d9b2 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 6 Dec 2010 12:20:22 +0100 Subject: masterfix DEV300: #i10000# fix for cws srb1 --- ooo.lst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ooo.lst b/ooo.lst index 09937897d3b9..e61ad60f48a9 100755 --- a/ooo.lst +++ b/ooo.lst @@ -27,18 +27,13 @@ ca4870d899fd7e943ffc310a5421ad4d-liberation-fonts-ttf-1.06.0.20100721.tar.gz 4a660ce8466c9df01f19036435425c3a-glibc-2.1.3-stub.tar.gz 4ea70ea87b47e92d318d4e7f5b940f47-cairo-1.8.0.tar.gz 599dc4cc65a07ee868cf92a667a913d2-xpdf-3.02.tar.gz -5aba06ede2daa9f2c11892fbd7bc3057-libserializer.zip b92261a5679276c400555004937af965-nss-3.12.6-with-nspr-4.8.4.tar.gz -67b42915c8432abf0a922438f00860a2-libxml.zip 7740a8ec23878a2f50120e1faa2730f2-libxml2-2.7.6.tar.gz 7376930b0d3f3d77a685d94c4a3acda8-STLport-4.5-0119.tar.gz -79600e696a98ff95c2eba976f7a8dfbb-liblayout.zip 798b2ffdc8bcfe7bca2cf92b62caf685-rhino1_5R5.zip ecb2e37e45c9933e2a963cabe03670ab-curl-7.19.7.tar.gz 8294d6c42e3553229af9934c5c0ed997-stax-api-1.0-2-sources.jar -8ea307d71d11140574bfb9fcc2487e33-libbase.zip bd30e9cf5523cdfc019b94f5e1d7fd19-cppunit-1.12.1.tar.gz -a06a496d7a43cbdc35e69dbe678efadb-libloader.zip a169ab152209200a7bad29a275cb0333-seamonkey-1.1.14.source.tar.gz a4d9b30810a434a3ed39fc0003bbd637-LICENSE_stax-api-1.0-2-sources.html a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2.zip @@ -55,7 +50,6 @@ d1a3205871c3c52e8a50c9f18510ae12-libformula.zip d35724900f6a4105550293686688bbb3-silgraphite-2.3.1.tar.gz d4c4d91ab3a8e52a2e69d48d34ef4df4-core.zip d70951c80dabecc2892c919ff5d07172-db-4.7.25.NC-custom.tar.gz -dbb3757275dc5cc80820c0b4dd24ed95-librepository.zip dbd5f3b47ed13132f04c685d608a7547-jpeg-6b.tar.gz e0707ff896045731ff99e99799606441-README_db-4.7.25.NC-custom.txt e81c2f0953aa60f8062c05a4673f2be0-Python-2.6.1.tar.bz2 @@ -63,8 +57,6 @@ e61d0364a30146aaa3001296f853b2b9-libxslt-1.1.26.tar.gz ea570af93c284aa9e5621cd563f54f4d-bsh-2.0b1-src.tar.gz ea91f2fb4212a21d708aced277e6e85a-vigra1.4.0.tar.gz ee8b492592568805593f81f8cdf2a04c-expat-2.0.1.tar.gz -f3e2febd267c8e4b13df00dac211dd6d-flute.zip -f7925ba8491fe570e5164d2c72791358-libfonts.zip fb7ba5c2182be4e73748859967455455-README_stax-api-1.0-2-sources.txt fca8706f2c4619e2fa3f8f42f8fc1e9d-rasqal-0.9.16.tar.gz fcc6df1160753d0b8c835d17fdeeb0a7-boost_1_39_0.tar.gz @@ -82,3 +74,4 @@ d8bd5eed178db6e2b18eeed243f85aa8-flute-1.1.6.zip db60e4fde8dd6d6807523deb71ee34dc-liblayout-0.2.10.zip eeb2c7ddf0d302fba4bfc6e97eac9624-libbase-1.1.6.zip f94d9870737518e3b597f9265f4e9803-libserializer-1.1.6.zip +ba2930200c9f019c2d93a8c88c651a0f-flow-engine-0.9.4.zip -- cgit From 8ad779467d54c07000b0e4cf75bf16a34ee01345 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 6 Dec 2010 14:04:50 +0100 Subject: masterfix DEV300: #i10000# changed ULONG_MAX to SAL_MAX_UINT32 --- sw/source/filter/html/htmltabw.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index 91b026ca6770..7171f4ec28b1 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -70,6 +70,7 @@ #endif #include #endif +#include //#define MAX_DEPTH (USHRT_MAX) #define MAX_DEPTH (3) @@ -337,7 +338,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, #ifndef PURE_HTML long nWidth = 0; - sal_uInt32 nPrcWidth = ULONG_MAX; + sal_uInt32 nPrcWidth = SAL_MAX_UINT32; if( bOutWidth ) { if( bLayoutExport ) -- cgit