diff options
227 files changed, 3377 insertions, 6735 deletions
diff --git a/filter/inc/filter.hrc b/filter/inc/filter.hrc index 4bea3330f617..2bbf94ed50c7 100644 --- a/filter/inc/filter.hrc +++ b/filter/inc/filter.hrc @@ -55,12 +55,11 @@ // warning, next range is RID_FILTER_START + 100 ! -#define HID_FILTER_XSLT_START (HID_FILTER_START + 0) // see source/xsltdialog/xmlfilterhelpids.hrc for range -#define HID_FILTER_XSLT_END (HID_FILTER_START + 99) -#define HID_FILTER_PDF_OPTIONS (HID_FILTER_START + 100) -#define HID_FILTER_PDF_INITIAL_VIEW (HID_FILTER_START + 101) -#define HID_FILTER_PDF_USER_INTERFACE (HID_FILTER_START + 102) -#define HID_FILTER_PDF_SECURITY (HID_FILTER_START + 103) -#define HID_FILTER_PDF_LINKS (HID_FILTER_START + 104) +#define HID_FILTER_PDF_OPTIONS "HID_FILTER_PDF_OPTIONS" +#define HID_FILTER_PDF_INITIAL_VIEW "HID_FILTER_PDF_INITIAL_VIEW" +#define HID_FILTER_PDF_USER_INTERFACE "HID_FILTER_PDF_USER_INTERFACE" +#define HID_FILTER_PDF_SECURITY "HID_FILTER_PDF_SECURITY" +#define HID_FILTER_PDF_LINKS "HID_FILTER_PDF_LINKS" + #endif 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 <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/NamedValue.hpp> + +#include <rtl/cipher.h> +#include <rtl/digest.h> #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,16 +347,26 @@ 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& ); rtlCipher m_hCipher; rtlDigest m_hDigest; sal_uInt8 m_pDigestValue[ RTL_DIGEST_LENGTH_MD5 ]; + sal_uInt8 m_pDocId[16]; }; // ============================================================================ diff --git a/filter/prj/build.lst b/filter/prj/build.lst index bed99e401b7f..065b4313c57b 100644 --- a/filter/prj/build.lst +++ b/filter/prj/build.lst @@ -42,3 +42,6 @@ fl filter\source\config\cache nmake - all fl_config fl filter\source\config\fragments\types nmake - all fl_fcfg_fragments_types fl_inc NULL fl filter\source\config\fragments\filters nmake - all fl_fcfg_fragments_filters fl_inc NULL fl filter\source\config\fragments nmake - all fl_fcfg_fragments fl_fcfg_fragments_filters fl_inc NULL + +# took very long +# fl filter\qa\complex\filter\misc nmake - all fl_qa_complex NULL diff --git a/filter/prj/d.lst b/filter/prj/d.lst index e8fdae8a1c58..037bef1a3765 100644 --- a/filter/prj/d.lst +++ b/filter/prj/d.lst @@ -49,9 +49,21 @@ mkdir: %_DEST%\bin%_EXT%\pdfimport ..\%__SRC%\bin\pdfunzip.* %_DEST%\bin%_EXT%\pdfunzip.* ..\%__SRC%\misc\filters\modulepacks\fcfg_*.xcu %_DEST%\xml%_EXT%\registry\spool\fcfg_*.xcu ..\%COMMON_OUTDIR%\bin\fcfg_langpack_*.zip %_DEST%\pck%_EXT%\fcfg_langpack_*.zip +..\%__SRC%\misc\t602filter.component %_DEST%\xml%_EXT%\t602filter.component mkdir: %_DEST%\inc%_EXT%\filter mkdir: %_DEST%\inc%_EXT%\filter\msfilter ..\inc\filter\msfilter\*.hxx %_DEST%\inc%_EXT%\filter\msfilter\*.hxx ..\inc\filter\msfilter\*.h %_DEST%\inc%_EXT%\filter\msfilter\*.h +..\%__SRC%\misc\XSLTFilter.jar.component %_DEST%\xml%_EXT%\XSLTFilter.jar.component +..\%__SRC%\misc\XSLTValidate.component %_DEST%\xml%_EXT%\XSLTValidate.component +..\%__SRC%\misc\filterconfig1.component %_DEST%\xml%_EXT%\filterconfig1.component +..\%__SRC%\misc\flash.component %_DEST%\xml%_EXT%\flash.component +..\%__SRC%\misc\pdffilter.component %_DEST%\xml%_EXT%\pdffilter.component +..\%__SRC%\misc\placeware.component %_DEST%\xml%_EXT%\placeware.component +..\%__SRC%\misc\svgfilter.component %_DEST%\xml%_EXT%\svgfilter.component +..\%__SRC%\misc\xmlfa.component %_DEST%\xml%_EXT%\xmlfa.component +..\%__SRC%\misc\xmlfd.component %_DEST%\xml%_EXT%\xmlfd.component +..\%__SRC%\misc\xsltdlg.component %_DEST%\xml%_EXT%\xsltdlg.component +..\%__SRC%\misc\xsltfilter.component %_DEST%\xml%_EXT%\xsltfilter.component diff --git a/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java b/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java index e32b81caa85b..a269afec836d 100644 --- a/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java +++ b/filter/qa/complex/filter/misc/FinalizedMandatoryTest.java @@ -24,7 +24,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - package complex.filter.misc; import com.sun.star.beans.PropertyValue; @@ -39,10 +38,18 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; import com.sun.star.util.XFlushable; -import complexlib.ComplexTestCase; -import util.utils; - - +// import complexlib.ComplexTestCase; +// import util.utils; + +// ---------- junit imports ----------------- +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; +// ------------------------------------------ /** * This complex test checks the functionality of the properties "Finalized" and "Mandatory" of @@ -74,7 +81,8 @@ import util.utils; * <CODE>Mandatory=true</CODE> * <CODE>Mandatory=false</CODE> */ -public class FinalizedMandatoryTest extends ComplexTestCase { +public class FinalizedMandatoryTest +{ static XMultiServiceFactory xMSF; @@ -82,21 +90,21 @@ public class FinalizedMandatoryTest extends ComplexTestCase { * A function to tell the framework, which test functions are available. * @return All test methods. */ - public String[] getTestMethodNames() { - return new String[]{"checkReadonlySupportFilterFactory", - "checkReadonlySupportTypeDetection"}; - } - +// public String[] getTestMethodNames() { +// return new String[]{"checkReadonlySupportFilterFactory", +// "checkReadonlySupportTypeDetection"}; +// } /** Create the environment for following tests. * Use either a component loader from desktop or * from frame * @throws Exception Exception */ - public void before() throws Exception { + @Before public void before() throws Exception + { // create TypeDetection - xMSF = (XMultiServiceFactory)param.getMSF(); - assure("Could not get XMultiServiceFactory", xMSF != null); + xMSF = getMSF(); + assertNotNull("Could not get XMultiServiceFactory", xMSF); } @@ -106,14 +114,16 @@ public class FinalizedMandatoryTest extends ComplexTestCase { * @throws Exception was thrown if creataion failes * @return <CODE>XInterface</CODE> of service */ - public XInterface getTestObject(String serviceName) throws Exception{ + private XInterface getTestObject(String serviceName) throws Exception + { Object oInterface = xMSF.createInstance(serviceName); - if (oInterface == null) { - failed("Service wasn't created") ; - throw new Exception("could not create service '"+serviceName+"'"); - } + assertNotNull("Service wan't created", oInterface); +// if (oInterface == null) { +// failed("Service wasn't created") ; +// throw new Exception("could not create service '"+serviceName+"'"); +// } return (XInterface) oInterface; } @@ -121,7 +131,8 @@ public class FinalizedMandatoryTest extends ComplexTestCase { * call the function <CODE>checkReadonlySupport</CODE> to test <CODE>com.sun.star.document.FilterFactory</CODE> * @see com.sun.star.document.FilterFactory */ - public void checkReadonlySupportFilterFactory(){ + @Test public void checkReadonlySupportFilterFactory() + { checkReadonlySupport("com.sun.star.document.FilterFactory"); } @@ -129,26 +140,30 @@ public class FinalizedMandatoryTest extends ComplexTestCase { * call the function <CODE>checkReadonlySupport</CODE> to test <CODE>com.sun.star.document.TypeDetection</CODE> * @see com.sun.star.document.TypeDetection */ - public void checkReadonlySupportTypeDetection(){ + @Test public void checkReadonlySupportTypeDetection() + { checkReadonlySupport("com.sun.star.document.TypeDetection"); } - /** * test the given service <CODE>serviceName</CODE>. * For every filter a new instace was created and the tests started. * @param serviceName the name of the service to test */ - private void checkReadonlySupport(String serviceName){ - log.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); - log.println("testing service '" + serviceName + "'"); + private void checkReadonlySupport(String serviceName) + { + System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + System.out.println("testing service '" + serviceName + "'"); XInterface oObj = null; - try{ + try + { oObj = getTestObject(serviceName); - log.println("ImplName: "+utils.getImplName(oObj)); - } catch (java.lang.Exception e){ - failed("could not get test object"); + System.out.println("ImplName: " + util.utils.getImplName(oObj)); + } + catch (java.lang.Exception e) + { + fail("could not get test object"); } boolean mandantoryTrue = false; @@ -157,19 +172,21 @@ public class FinalizedMandatoryTest extends ComplexTestCase { boolean finalizedFalse = false; - XNameAccess xNA = (XNameAccess) UnoRuntime.queryInterface - (XNameAccess.class, oObj); + XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, oObj); String[] filterNames = xNA.getElementNames(); // XNameContainer; XNameReplace String filterName = filterNames[0]; - Object[] instance = null;; - for (int i = 0; i < filterNames.length; i++) { - log.println("------------------------------------------------"); - try{ + Object[] instance = null; + + for (int i = 0; i < filterNames.length; i++) + { + System.out.println("------------------------------------------------"); + try + { PropertyValue instanceProp = new PropertyValue(); filterName = filterNames[i]; - log.println(filterName); + System.out.println(filterName); // testobject must new created for every test. // We change in a loop the container and try to flush this changes. @@ -177,16 +194,19 @@ public class FinalizedMandatoryTest extends ComplexTestCase { // similar to a document which could not be saved beacuse of invalid // contend. While you don't remove the invalid conted you will never // be able to save the document. Same here. - try{ + try + { oObj = getTestObject(serviceName); - } catch (java.lang.Exception e){ - failed("could not get test object", CONTINUE); + } + catch (java.lang.Exception e) + { + fail("could not get test object"); } - xNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oObj); - XNameContainer xNC = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oObj); - XNameReplace xNR = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, oObj); - XFlushable xFlush = (XFlushable) UnoRuntime.queryInterface(XFlushable.class, oObj); + xNA = UnoRuntime.queryInterface(XNameAccess.class, oObj); + XNameContainer xNC = UnoRuntime.queryInterface(XNameContainer.class, oObj); + XNameReplace xNR = UnoRuntime.queryInterface(XNameReplace.class, oObj); + XFlushable xFlush = UnoRuntime.queryInterface(XFlushable.class, oObj); instance = (Object[]) xNA.getByName(filterName); PropertyValue[] props = (PropertyValue[]) instance; @@ -204,59 +224,75 @@ public class FinalizedMandatoryTest extends ComplexTestCase { finalizedFalse |= !isFinalized; //change the filter - setPropertyValueValue((PropertyValue[])instance, "UIName", "dummy"); + setPropertyValueValue((PropertyValue[]) instance, "UIName", "dummy"); // 1a.) try to change the filter in the container - try{ + try + { xNR.replaceByName(filterName, instance); - }catch (IllegalArgumentException e){ - failed("could not replace filter properties ('" + filterName + "')", CONTINUE); + } + catch (IllegalArgumentException e) + { + fail("could not replace filter properties ('" + filterName + "')"); } // 1b.) try to wirte the changed filter to the configuration. // This must result in a exception if the filter is finalized. boolean flushError = false; - try{ + try + { xFlush.flush(); - } catch (WrappedTargetRuntimeException e){ + } + catch (WrappedTargetRuntimeException e) + { flushError = true; - assure("Unexpected exception wihle flushing changed filter '"+ filterName + "'", isFinalized,CONTINUE); + assertTrue("Unexpected exception wihle flushing changed filter '" + filterName + "'", isFinalized); } - assure("Expected exception was not thorwn while flushing changed filter '"+ filterName + "' Finalized:" + isFinalized, - !(flushError ^ isFinalized), CONTINUE); + assertTrue("Expected exception was not thorwn while flushing changed filter '" + filterName + "' Finalized:" + isFinalized, + !(flushError ^ isFinalized)); // 2a.) try to remove the filter from the container - try{ + try + { xNC.removeByName(filterName); - }catch (NoSuchElementException e){ - failed("could not remove filter from container ('" + filterName + "')", CONTINUE); + } + catch (NoSuchElementException e) + { + fail("could not remove filter from container ('" + filterName + "')"); } // 1b.) try to wirte the changed filter to the configuration. // This must result in a exception if the filter is mandatory flushError = false; - try{ + try + { xFlush.flush(); - } catch (WrappedTargetRuntimeException e){ + } + catch (WrappedTargetRuntimeException e) + { flushError = true; - assure("Unexpected exception wihle flushing removed filter '"+ filterName + "'", isMandatory,CONTINUE); + assertTrue("Unexpected exception wihle flushing removed filter '" + filterName + "'", isMandatory); } - assure("Expected exception was not thorwn while flushing removed filter '"+ filterName + "' Mandatory:" + isMandatory, - !(flushError ^ isMandatory), CONTINUE); + assertTrue("Expected exception was not thorwn while flushing removed filter '" + filterName + "' Mandatory:" + isMandatory, + !(flushError ^ isMandatory)); - } catch (NoSuchElementException e){ - failed("Couldn't get elements from object", true); - } catch (WrappedTargetException e){ - failed("Couldn't get elements from object", true); + } + catch (NoSuchElementException e) + { + fail("Couldn't get elements from object"); + } + catch (WrappedTargetException e) + { + fail("Couldn't get elements from object"); } } String preMsg = "Could not find filter with state "; String postMsg = " Please check if such filter is installed!"; - assure(preMsg + "'Mandatory=true'" + postMsg ,mandantoryTrue, CONTINUE); - assure(preMsg + "'Mandatory=false'" + postMsg ,mandantoryFalse, CONTINUE); - assure(preMsg + "'Finalized=true'" + postMsg ,finalizedTrue, CONTINUE); - assure(preMsg + "'Finalized=false'" + postMsg ,finalizedFalse, CONTINUE); + assertTrue(preMsg + "'Mandatory=true'" + postMsg, mandantoryTrue); + assertTrue(preMsg + "'Mandatory=false'" + postMsg, mandantoryFalse); + assertTrue(preMsg + "'Finalized=true'" + postMsg, finalizedTrue); + assertTrue(preMsg + "'Finalized=false'" + postMsg, finalizedFalse); } /** @@ -265,13 +301,18 @@ public class FinalizedMandatoryTest extends ComplexTestCase { * @see com.sun.star.beans.PropertyValue * @param props Sequenze of PropertyValue */ - protected void printPropertyValues(PropertyValue[] props) { + protected void printPropertyValues(PropertyValue[] props) + { int i = 0; - while (i < props.length ) { - log.println(props[i].Name + ":" + props[i].Value.toString()); + while (i < props.length) + { + System.out.println(props[i].Name + ":" + props[i].Value.toString()); i++; } - if (i < props.length) log.println(props[i].Name + ":" + props[i].Value.toString()); + if (i < props.length) + { + System.out.println(props[i].Name + ":" + props[i].Value.toString()); + } } /** @@ -280,9 +321,11 @@ public class FinalizedMandatoryTest extends ComplexTestCase { * @param pName the name of the property the value shoud be returned * @return the value of the property */ - protected Object getPropertyValueValue(PropertyValue[] props, String pName) { + protected Object getPropertyValueValue(PropertyValue[] props, String pName) + { int i = 0; - while (i < props.length && !props[i].Name.equals(pName)) { + while (i < props.length && !props[i].Name.equals(pName)) + { i++; } return i < props.length ? props[i].Value : null; @@ -294,14 +337,36 @@ public class FinalizedMandatoryTest extends ComplexTestCase { * @param pName name of the property which should be changed * @param pValue the value the property should be assigned */ - protected void setPropertyValueValue(PropertyValue[] props, String pName, Object pValue) { + protected void setPropertyValueValue(PropertyValue[] props, String pName, Object pValue) + { int i = 0; - while (i < props.length && !props[i].Name.equals(pName)) { + while (i < props.length && !props[i].Name.equals(pName)) + { i++; } props[i].Value = pValue; } + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + // setup and close connections + @BeforeClass + public static void setUpConnection() throws Exception + { + System.out.println("setUpConnection()"); + connection.setUp(); + } + @AfterClass + public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + private static final OfficeConnection connection = new OfficeConnection(); } diff --git a/filter/qa/complex/filter/misc/TypeDetection6FileFormat.java b/filter/qa/complex/filter/misc/TypeDetection6FileFormat.java index 842a365d4714..6fda574ae8f5 100644 --- a/filter/qa/complex/filter/misc/TypeDetection6FileFormat.java +++ b/filter/qa/complex/filter/misc/TypeDetection6FileFormat.java @@ -3,21 +3,31 @@ * * Created on 26. April 2004, 10:37 */ - package complex.filter.misc; import com.sun.star.container.XNameAccess; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; -import complexlib.ComplexTestCase; + import util.utils; +// ---------- junit imports ----------------- +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; +// ------------------------------------------ + /** * * @author cn93815 */ -public class TypeDetection6FileFormat extends ComplexTestCase { +public class TypeDetection6FileFormat +{ static XMultiServiceFactory xMSF; @@ -25,20 +35,20 @@ public class TypeDetection6FileFormat extends ComplexTestCase { * A function to tell the framework, which test functions are available. * @return All test methods. */ - public String[] getTestMethodNames() { - return new String[]{"checkFilterFactory", - "checkTypeDetection"}; - } - +// public String[] getTestMethodNames() { +// return new String[]{"checkFilterFactory", +// "checkTypeDetection"}; +// } /** Create the environment for following tests. * Use either a component loader from desktop or * from frame * @throws Exception Exception */ - public void before() throws Exception { + @Before public void before() throws Exception + { - xMSF = (XMultiServiceFactory)param.getMSF(); - assure("Could not get XMultiServiceFactory", xMSF != null); + xMSF = getMSF(); + assertNotNull("Could not get XMultiServiceFactory", xMSF); } @@ -46,7 +56,8 @@ public class TypeDetection6FileFormat extends ComplexTestCase { * call the function <CODE>checkFileFormatSupport</CODE> to test <CODE>com.sun.star.document.FilterFactory</CODE> * @see com.sun.star.document.FilterFactory */ - public void checkFilterFactory(){ + @Test public void checkFilterFactory() + { checkFileFormatSupport("com.sun.star.document.FilterFactory"); } @@ -54,7 +65,8 @@ public class TypeDetection6FileFormat extends ComplexTestCase { * call the function <CODE>checkFileFormatSupport</CODE> to test <CODE>com.sun.star.document.TypeDetection</CODE> * @see com.sun.star.document.TypeDetection */ - public void checkTypeDetection(){ + @Test public void checkTypeDetection() + { checkFileFormatSupport("com.sun.star.document.TypeDetection"); } @@ -64,42 +76,67 @@ public class TypeDetection6FileFormat extends ComplexTestCase { * The serve was created and the filter 'TypeDetection6FileFormat' was searched * @param serviceName the name of the service to test */ - private void checkFileFormatSupport(String serviceName){ - log.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); - log.println("testing service '" + serviceName + "'"); + private void checkFileFormatSupport(String serviceName) + { + System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); + System.out.println("testing service '" + serviceName + "'"); XInterface oObj = null; - try{ + try + { oObj = getTestObject(serviceName); - log.println("ImplName: "+utils.getImplName(oObj)); - } catch (java.lang.Exception e){ - failed("could not get test object"); + System.out.println("ImplName: " + utils.getImplName(oObj)); + } + catch (java.lang.Exception e) + { + fail("could not get test object"); } - XNameAccess xNA = (XNameAccess) UnoRuntime.queryInterface - (XNameAccess.class, oObj); + XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, oObj); String msg = "Could not find filter 'TypeDetection6FileFormat'!"; msg += "\nMaybe 'TypeDetection6FileFormat.xcu' is not registered."; - assure(msg, xNA.hasByName("TypeDetection6FileFormat"),CONTINUE); + assertTrue(msg, xNA.hasByName("TypeDetection6FileFormat")); } - /** + /** * Creates an instance for the given <CODE>serviceName</CODE> * @param serviceName the name of the service which should be created * @throws Exception was thrown if creataion failes * @return <CODE>XInterface</CODE> of service */ - public XInterface getTestObject(String serviceName) throws Exception{ + public XInterface getTestObject(String serviceName) throws Exception + { Object oInterface = xMSF.createInstance(serviceName); - if (oInterface == null) { - failed("Service wasn't created") ; - throw new Exception("could not create service '"+serviceName+"'"); + if (oInterface == null) + { + fail("Service wasn't created"); + throw new Exception("could not create service '" + serviceName + "'"); } return (XInterface) oInterface; } + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + + // setup and close connections + @BeforeClass public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); } diff --git a/filter/qa/complex/filter/misc/makefile.mk b/filter/qa/complex/filter/misc/makefile.mk index 2792b2438b6e..5ac072a2e071 100755 --- a/filter/qa/complex/filter/misc/makefile.mk +++ b/filter/qa/complex/filter/misc/makefile.mk @@ -25,73 +25,35 @@ # #************************************************************************* -PRJ = ..$/..$/..$/.. -PRJNAME = filter -TARGET = Filter -PACKAGE = complex$/filter$/misc - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = FinalizedMandatoryTest.java TypeDetection6FileFormat.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -#----- make a jar from compiled files ------------------------------ - -MAXLINELENGTH = 100000 - -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE - -# --- Parameters for the test -------------------------------------- - -# start an office if the parameter is set for the makefile -.IF "$(OFFICE)" == "" -CT_APPEXECCOMMAND = +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: .ELSE -CT_APPEXECCOMMAND = -AppExecutionCommand \ - "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" -.ENDIF - -# test base is java complex -CT_TESTBASE = -TestBase java_complex - -# replace $/ with . in package name -CT_PACKAGE = -o $(PACKAGE:s\$/\.\) - -# start the runner application -CT_APP = org.openoffice.Runner +PRJ = ../../../.. +PRJNAME = filter +TARGET = qa_complex_filter_misc -# --- Targets ------------------------------------------------------ +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/filter/misc +JAVATESTFILES = \ + TypeDetection6FileFormat.java \ + FinalizedMandatoryTest.java -.IF "$(depend)" == "" -DisplayHint : ALLTAR -.ELSE -DisplayHint : ALLDEP -.ENDIF +JAVAFILES = $(JAVATESTFILES) -.INCLUDE : target.mk +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END -DisplayHint: - @echo "\ntype 'dmake FinalizedMandatoryTest'" - @echo "\ntype 'dmake TypeDetection6FileFormat'" - @echo "! BE SHURE YOU HAVE 'TypeDetection6FileFormat.xcu' SUCCESSFUL REGISTERED IN YOU OFFICE !" +# Sample how to debug +# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y -RUN: run +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -run: \ - DisplayHint +ALLTAR : javatest +.END -FinalizedMandatoryTest: - java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_PACKAGE).FinalizedMandatoryTest - -TypeDetection6FileFormat: - java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_PACKAGE).TypeDetection6FileFormat diff --git a/filter/source/config/cache/filterconfig1.component b/filter/source/config/cache/filterconfig1.component new file mode 100644 index 000000000000..9d3c7c90fb31 --- /dev/null +++ b/filter/source/config/cache/filterconfig1.component @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.filter.config.ConfigFlush"> + <service name="com.sun.star.document.FilterConfigRefresh"/> + </implementation> + <implementation name="com.sun.star.comp.filter.config.ContentHandlerFactory"> + <service name="com.sun.star.frame.ContentHandlerFactory"/> + </implementation> + <implementation name="com.sun.star.comp.filter.config.FilterFactory"> + <service name="com.sun.star.document.FilterFactory"/> + </implementation> + <implementation name="com.sun.star.comp.filter.config.FrameLoaderFactory"> + <service name="com.sun.star.frame.FrameLoaderFactory"/> + </implementation> + <implementation name="com.sun.star.comp.filter.config.TypeDetection"> + <service name="com.sun.star.document.TypeDetection"/> + </implementation> +</component> diff --git a/filter/source/config/cache/makefile.mk b/filter/source/config/cache/makefile.mk index fbc4806b0a32..d94c81e35010 100644 --- a/filter/source/config/cache/makefile.mk +++ b/filter/source/config/cache/makefile.mk @@ -77,3 +77,11 @@ SHL1VERSIONMAP= $(SOLARENV)/src/component.map # --- Targets ---------------------------------- .INCLUDE : target.mk + +ALLTAR : $(MISC)/filterconfig1.component + +$(MISC)/filterconfig1.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt filterconfig1.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt filterconfig1.component diff --git a/filter/source/config/cache/registration.cxx b/filter/source/config/cache/registration.cxx index a65f5c42fea8..2be110871ee1 100644 --- a/filter/source/config/cache/registration.cxx +++ b/filter/source/config/cache/registration.cxx @@ -94,30 +94,6 @@ static void InitConstants() // extern "C" component_getImplementationEnvironment() _COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT -// extern "C" component_writeInfo() -_COMPHELPER_COMPONENT_WRITEINFO -( - _COMPHELPER_COMPONENTINFO( TypeDetection , - TypeDetection::impl_getImplementationName() , - TypeDetection::impl_getSupportedServiceNames()) - - _COMPHELPER_COMPONENTINFO( FilterFactory , - FilterFactory::impl_getImplementationName() , - FilterFactory::impl_getSupportedServiceNames()) - - _COMPHELPER_COMPONENTINFO( ContentHandlerFactory , - ContentHandlerFactory::impl_getImplementationName() , - ContentHandlerFactory::impl_getSupportedServiceNames()) - - _COMPHELPER_COMPONENTINFO( FrameLoaderFactory , - FrameLoaderFactory::impl_getImplementationName() , - FrameLoaderFactory::impl_getSupportedServiceNames()) - - _COMPHELPER_COMPONENTINFO( ConfigFlush , - ConfigFlush::impl_getImplementationName() , - ConfigFlush::impl_getSupportedServiceNames()) -) - // extern "C" component_getFactory() _COMPHELPER_COMPONENT_GETFACTORY ( diff --git a/filter/source/config/cache/registration.hxx b/filter/source/config/cache/registration.hxx index 38e5980c967a..d664cc365abb 100644 --- a/filter/source/config/cache/registration.hxx +++ b/filter/source/config/cache/registration.hxx @@ -31,10 +31,8 @@ //_______________________________________________ // includes -#include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/registry/InvalidRegistryException.hpp> #include <rtl/ustrbuf.hxx> #include <cppuhelper/factory.hxx> @@ -59,97 +57,6 @@ namespace comphelper{ //_______________________________________________ -/** @short creates a new key inside component registry. - - @descr using: a) _COMPHELPER_COMPONENTINFO( MyClass, - MyClass::st_getImplName(), - MyClass::st_getServNames()) - - b) _COMPHELPER_COMPONENTINFO( MyClass, - ::rtl::OUString::createFromAscii("css.MyClass"), - lServiceNames) - - @param CLASS - must be the class name of the implementation - of an uno service, which should be registered here. - - @param IMPLEMENTATIONNAME - can be an uno implementation name from type [::rtl::OUString] - directly or any possible method call, which returns such - name. - - @param SERVICENAME - a list of supported uno service names from type - [css::uno::Sequence< ::rtl::OUString >] - or any possible method call, which returns such - list. - */ -#define _COMPHELPER_COMPONENTINFO(CLASS, IMPLEMENTATIONNAME, SERVICENAMES) \ - /*define new scope to prevent multiple using of the same variables ... */ \ - { \ - /* build new key name */ \ - ::rtl::OUStringBuffer sKeyBuf(256); \ - sKeyBuf.appendAscii("/" ); \ - sKeyBuf.append (IMPLEMENTATIONNAME); \ - sKeyBuf.appendAscii("/UNO/SERVICES" ); \ - ::rtl::OUString sKey = sKeyBuf.makeStringAndClear(); \ - \ - /* try to register this service ... thrown exception will be catched by COMPONENT_WRITEINFO! */ \ - css::uno::Reference< css::registry::XRegistryKey > xKey = xRoot->createKey(sKey); \ - if (!xKey.is()) \ - throw css::registry::InvalidRegistryException(sKey, css::uno::Reference< css::uno::XInterface >()); \ - \ - /* dont optimize it! it must work for simple types and function calls! */ \ - const css::uno::Sequence< ::rtl::OUString > lServiceNames = SERVICENAMES; \ - const ::rtl::OUString* pServiceNames = lServiceNames.getConstArray(); \ - sal_Int32 nCount = lServiceNames.getLength(); \ - \ - for (sal_Int32 i=0; i<nCount; ++i) \ - xKey->createKey(pServiceNames[i]); \ - } - -//_______________________________________________ - -/** @short implments extern C function component_writeInfo - - @descr using: _COMPHELPER_COMPONENT_WRITEINFO - ( - _COMPHELPER_COMPONENTINFO(...) - .. - _COMPHELPER_COMPONENTINFO(...) - ) - - @param INFOLIST - list of macros of type COMPONENTINFO without(!) any - seperator signs between two elements. - */ -#define _COMPHELPER_COMPONENT_WRITEINFO(INFOLIST) \ - extern "C" sal_Bool SAL_CALL component_writeInfo(void* pServiceManager, \ - void* pRegistryKey ) \ - { \ - if (!pServiceManager || !pRegistryKey) \ - return sal_False; \ - \ - css::uno::Reference< css::registry::XRegistryKey > xRoot = reinterpret_cast< css::registry::XRegistryKey* >(pRegistryKey); \ - \ - /*if one of following registration will fail ... an exception is thrown! */ \ - try \ - { \ - /* This parameter will expand to: */ \ - /* _COMPHELPER_COMPONENTINFO(1) */ \ - /* ... */ \ - /* _COMPHELPER_COMPONENTINFO(n) */ \ - INFOLIST \ - } \ - catch(const css::registry::InvalidRegistryException&) \ - { \ - return sal_False; \ - } \ - return sal_True; \ - } - -//_______________________________________________ - /** TODO doc */ #define _COMPHELPER_MULTIINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD) \ diff --git a/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu b/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu index 7c61f7c14084..20c55429e465 100644 --- a/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu +++ b/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu @@ -1,5 +1,5 @@ <node oor:name="MS PowerPoint 97" oor:op="replace"> - <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN ENCRYPTION PASSWORDTOMODIFY</value></prop> + <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN</value></prop> <prop oor:name="UIComponent"/> <prop oor:name="FilterService"/> <prop oor:name="UserData"><value>sdfilt</value></prop> diff --git a/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu b/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu index 505084d4d39f..b0776fda9500 100644 --- a/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu +++ b/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu @@ -1,5 +1,5 @@ <node oor:name="MS PowerPoint 97 Vorlage" oor:op="replace"> - <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH ALIEN ENCRYPTION PASSWORDTOMODIFY</value></prop> + <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH ALIEN</value></prop> <prop oor:name="UIComponent"/> <prop oor:name="FilterService"/> <prop oor:name="UserData"><value>sdfilt</value></prop> diff --git a/filter/source/config/fragments/filters/Rich_Text_Format.xcu b/filter/source/config/fragments/filters/Rich_Text_Format.xcu index dc8b07e45536..d8fb18c96d06 100644 --- a/filter/source/config/fragments/filters/Rich_Text_Format.xcu +++ b/filter/source/config/fragments/filters/Rich_Text_Format.xcu @@ -1,7 +1,7 @@ <node oor:name="Rich Text Format" oor:op="replace"> - <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN PREFERRED</value></prop> + <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop> <prop oor:name="UIComponent"/> - <prop oor:name="FilterService"/> + <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.RtfFilter</value></prop> <prop oor:name="UserData"><value>RTF</value></prop> <prop oor:name="UIName"> <value xml:lang="x-default">Rich Text Format</value> diff --git a/filter/source/config/fragments/internalgraphicfilters/ras_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/ras_Export.xcu index aabae28a10c4..69aa0147ea36 100644 --- a/filter/source/config/fragments/internalgraphicfilters/ras_Export.xcu +++ b/filter/source/config/fragments/internalgraphicfilters/ras_Export.xcu @@ -2,7 +2,7 @@ <prop oor:name="Type"><value>ras_Sun_Rasterfile</value></prop> <prop oor:name="FormatName"><value>era</value></prop> <prop oor:name="RealFilterName"/> - <prop oor:name="UIComponent"/> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> <prop oor:name="UIName"> <value xml:lang="en-US">RAS - Sun Raster Image</value> </prop> diff --git a/filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu index 72653869a68d..30b7122a654d 100644 --- a/filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu +++ b/filter/source/config/fragments/internalgraphicfilters/svg_Export.xcu @@ -2,7 +2,7 @@ <prop oor:name="Type"><value>svg_Scalable_Vector_Graphics</value></prop> <prop oor:name="FormatName"><value>SVESVG</value></prop> <prop oor:name="RealFilterName"/> - <prop oor:name="UIComponent"/> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> <prop oor:name="UIName"> <value xml:lang="en-US">SVG - Scalable Vector Graphics</value> </prop> diff --git a/filter/source/config/fragments/internalgraphicfilters/tif_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/tif_Export.xcu index a7d39ebdc8a4..791335acce1f 100644 --- a/filter/source/config/fragments/internalgraphicfilters/tif_Export.xcu +++ b/filter/source/config/fragments/internalgraphicfilters/tif_Export.xcu @@ -2,7 +2,7 @@ <prop oor:name="Type"><value>tif_Tag_Image_File</value></prop> <prop oor:name="FormatName"><value>eti</value></prop> <prop oor:name="RealFilterName"/> - <prop oor:name="UIComponent"/> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> <prop oor:name="UIName"> <value xml:lang="en-US">TIFF - Tagged Image File Format</value> </prop> diff --git a/filter/source/config/fragments/internalgraphicfilters/xpm_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/xpm_Export.xcu index ee1effb786e9..660a240a6678 100644 --- a/filter/source/config/fragments/internalgraphicfilters/xpm_Export.xcu +++ b/filter/source/config/fragments/internalgraphicfilters/xpm_Export.xcu @@ -2,7 +2,7 @@ <prop oor:name="Type"><value>xpm_XPM</value></prop> <prop oor:name="FormatName"><value>exp</value></prop> <prop oor:name="RealFilterName"/> - <prop oor:name="UIComponent"/> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> <prop oor:name="UIName"> <value xml:lang="en-US">XPM - X PixMap</value> </prop> diff --git a/filter/source/docbook/sofftodocbookheadings.xsl b/filter/source/docbook/sofftodocbookheadings.xsl index bc9b67a9a340..cfddf901b2d4 100644 --- a/filter/source/docbook/sofftodocbookheadings.xsl +++ b/filter/source/docbook/sofftodocbookheadings.xsl @@ -69,11 +69,6 @@ match="text:h" use="generate-id(preceding::text:h[@text:level < current()/@text:level][1])"/> - <!-- All those headings have not the lowest outline level (mapped to section1), but come before the first heading mapped to section1 --> - <xsl:key name="preludingHeadings" - match="text:h" - use="generate-id(following::text:h[@text:level = $section1_OutlineLevel][1])"/> - <!-- The key function "getHeadingsByOutline" returns all headings of a certain outline level --> <xsl:key name="getHeadingsByOutline" match="text:h" @@ -171,7 +166,7 @@ <xsl:text disable-output-escaping="yes"><sect1></xsl:text> <title></title> <!-- create sections for all the first section1 preluding headings --> - <xsl:for-each select="key('preludingHeadings', generate-id())"> + <xsl:for-each select="key('getHeadingsByOutline', $section1_OutlineLevel)[1]/preceding::text:h"> <xsl:call-template name="make-section"> <xsl:with-param name="previousSectionLevel" select="$section1_OutlineLevel"/> <xsl:with-param name="currentSectionLevel"> @@ -1182,4 +1177,4 @@ <xsl:with-param name="whitespaces" select="8"/> </xsl:call-template> </xsl:template> -</xsl:stylesheet>
\ No newline at end of file +</xsl:stylesheet> diff --git a/filter/source/filtertracer/exports.dxp b/filter/source/filtertracer/exports.dxp index 0c2e3e7cddd7..0cb5620a1603 100644 --- a/filter/source/filtertracer/exports.dxp +++ b/filter/source/filtertracer/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory
\ No newline at end of file diff --git a/filter/source/filtertracer/filtertraceruno.cxx b/filter/source/filtertracer/filtertraceruno.cxx index f2254c8256f9..0e3097de3ff6 100644 --- a/filter/source/filtertracer/filtertraceruno.cxx +++ b/filter/source/filtertracer/filtertraceruno.cxx @@ -51,37 +51,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -// ----------------------- -// - component_writeInfo - -// ----------------------- - -extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey ) -{ - sal_Bool bRet = sal_False; - - if( pRegistryKey ) - { - try - { - NMSP_UNO::Reference< com::sun::star::registry::XRegistryKey > xNewKey( - reinterpret_cast< com::sun::star::registry::XRegistryKey * >( pRegistryKey )->createKey( - FilterTracer_getImplementationName() ) ); - xNewKey = xNewKey->createKey( B2UCONST( "/UNO/SERVICES" ) ); - const SEQ( rtl::OUString )& rSNL = FilterTracer_getSupportedServiceNames(); - const rtl::OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - bRet = sal_True; - } - catch( com::sun::star::registry::InvalidRegistryException& ) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - - return bRet; -} - // ------------------------ // - component_getFactory - // ------------------------ diff --git a/filter/source/flash/flash.component b/filter/source/flash/flash.component new file mode 100644 index 000000000000..1ce69b3549bc --- /dev/null +++ b/filter/source/flash/flash.component @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.Impress.FlashExportDialog"> + <service name="com.sun.star.Impress.FlashExportDialog"/> + </implementation> + <implementation name="com.sun.star.comp.Impress.FlashExportFilter"> + <service name="com.sun.star.document.ExportFilter"/> + </implementation> +</component> diff --git a/filter/source/flash/impswfdialog.src b/filter/source/flash/impswfdialog.src index 3e38dde68441..83015a3adfeb 100644 --- a/filter/source/flash/impswfdialog.src +++ b/filter/source/flash/impswfdialog.src @@ -29,6 +29,7 @@ ModalDialog DLG_OPTIONS { + HelpID = "filter:ModalDialog:DLG_OPTIONS"; Size = MAP_APPFONT ( 200 , 200 ) ; OutputSize = TRUE ; SVLook = TRUE ; @@ -44,6 +45,7 @@ ModalDialog DLG_OPTIONS }; NumericField NUM_FLD_QUALITY { + HelpID = "filter:NumericField:DLG_OPTIONS:NUM_FLD_QUALITY"; Border = TRUE ; Pos = MAP_APPFONT ( 12 , 33 ) ; Size = MAP_APPFONT ( 50 , 12 ) ; @@ -57,6 +59,7 @@ ModalDialog DLG_OPTIONS }; CheckBox BOOL_EXPORT_ALL { + HelpID = "filter:CheckBox:DLG_OPTIONS:BOOL_EXPORT_ALL"; Pos = MAP_APPFONT ( 12 , 65 ) ; Size = MAP_APPFONT ( 10 , 14 ) ; TabStop = TRUE ; @@ -69,6 +72,7 @@ ModalDialog DLG_OPTIONS }; CheckBox BOOL_EXPORT_MULTIPLE_FILES { + HelpID = "filter:CheckBox:DLG_OPTIONS:BOOL_EXPORT_MULTIPLE_FILES"; Pos = MAP_APPFONT ( 12 , 80 ) ; Size = MAP_APPFONT ( 10 , 14 ) ; TabStop = TRUE ; @@ -81,6 +85,7 @@ ModalDialog DLG_OPTIONS }; CheckBox BOOL_EXPORT_BACKGROUNDS { + HelpID = "filter:CheckBox:DLG_OPTIONS:BOOL_EXPORT_BACKGROUNDS"; Pos = MAP_APPFONT ( 22 , 95 ) ; Size = MAP_APPFONT ( 10 , 14 ) ; TabStop = TRUE ; @@ -93,6 +98,7 @@ ModalDialog DLG_OPTIONS }; CheckBox BOOL_EXPORT_BACKGROUND_OBJECTS { + HelpID = "filter:CheckBox:DLG_OPTIONS:BOOL_EXPORT_BACKGROUND_OBJECTS"; Pos = MAP_APPFONT ( 22 , 107) ; Size = MAP_APPFONT ( 10 , 14 ) ; TabStop = TRUE ; @@ -105,6 +111,7 @@ ModalDialog DLG_OPTIONS }; CheckBox BOOL_EXPORT_SLIDE_CONTENTS { + HelpID = "filter:CheckBox:DLG_OPTIONS:BOOL_EXPORT_SLIDE_CONTENTS"; Pos = MAP_APPFONT ( 22 , 119 ) ; Size = MAP_APPFONT ( 10 , 14 ) ; TabStop = TRUE ; @@ -117,6 +124,7 @@ ModalDialog DLG_OPTIONS }; CheckBox BOOL_EXPORT_SOUND { + HelpID = "filter:CheckBox:DLG_OPTIONS:BOOL_EXPORT_SOUND"; Pos = MAP_APPFONT ( 12 , 134 ) ; Size = MAP_APPFONT ( 10 , 14 ) ; TabStop = TRUE ; @@ -129,6 +137,7 @@ ModalDialog DLG_OPTIONS }; CheckBox BOOL_EXPORT_OLE_AS_JPEG { + HelpID = "filter:CheckBox:DLG_OPTIONS:BOOL_EXPORT_OLE_AS_JPEG"; Pos = MAP_APPFONT ( 12 , 146 ) ; Size = MAP_APPFONT ( 10 , 14 ) ; TabStop = TRUE ; diff --git a/filter/source/flash/makefile.mk b/filter/source/flash/makefile.mk index e5ff1bf21c5e..69da217234d8 100644 --- a/filter/source/flash/makefile.mk +++ b/filter/source/flash/makefile.mk @@ -96,3 +96,11 @@ DEF1NAME=$(SHL1TARGET) .INCLUDE : target.mk + +ALLTAR : $(MISC)/flash.component + +$(MISC)/flash.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + flash.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt flash.component diff --git a/filter/source/flash/swfuno.cxx b/filter/source/flash/swfuno.cxx index d4a11ebb921b..5ab572014ace 100644 --- a/filter/source/flash/swfuno.cxx +++ b/filter/source/flash/swfuno.cxx @@ -61,42 +61,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//================================================================================================== - -void singlecomponent_writeInfo( Reference< XRegistryKey >& xNewKey, const Sequence< OUString > & rSNL ) -{ - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); -} - -SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void * /* pServiceManager */, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( FlashExportFilter_getImplementationName() ) ); - xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - singlecomponent_writeInfo( xNewKey, FlashExportFilter_getSupportedServiceNames() ); - - xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( SWFDialog_getImplementationName() ); - xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - - singlecomponent_writeInfo( xNewKey, SWFDialog_getSupportedServiceNames() ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; -} //================================================================================================== SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) diff --git a/filter/source/graphicfilter/egif/dlgegif.cxx b/filter/source/graphicfilter/egif/dlgegif.cxx deleted file mode 100644 index a9f1e60708b2..000000000000 --- a/filter/source/graphicfilter/egif/dlgegif.cxx +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_filter.hxx" -#ifndef GCC -#endif -#include <tools/ref.hxx> -#include <svtools/FilterConfigItem.hxx> -#include <vcl/msgbox.hxx> -#include "dlgegif.hxx" -#include "dlgegif.hrc" -#include "strings.hrc" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEGIF::DlgExportEGIF( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_GIF, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aCbxInterlaced ( this, ResId( CBX_INTERLACED, *rPara.pResMgr ) ), - aCbxTranslucent ( this, ResId( CBX_TRANSLUCENT, *rPara.pResMgr ) ), - aGrpMode ( this, ResId( GRP_MODE, *rPara.pResMgr ) ), - aGrpDraw ( this, ResId( GRP_DRAW, *rPara.pResMgr ) ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ) -{ - FreeResource(); - - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/GIF" ) ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - String aInterlaceStr( ResId( KEY_INTER, *pMgr ) ); - String aTranslucentStr( ResId( KEY_TRANS, *pMgr ) ); - // Config-Parameter lesen - sal_Bool bInterlaced = pConfigItem->ReadInt32( aInterlaceStr, 1 ) != 0; - sal_Bool bTranslucent = pConfigItem->ReadInt32( aTranslucentStr, 1 ) != 0; - - aCbxInterlaced.Check( bInterlaced ); - aCbxTranslucent.Check( bTranslucent ); - - aBtnOK.SetClickHdl( LINK( this, DlgExportEGIF, OK ) ); -} - -DlgExportEGIF::~DlgExportEGIF() -{ - delete pConfigItem; -} - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEGIF, OK, void *, EMPTYARG ) -{ - - // Config-Parameter schreiben - String aInterlaceStr( ResId( KEY_INTER, *pMgr ) ); - String aTranslucentStr( ResId( KEY_TRANS, *pMgr ) ); - - sal_Int32 nValue = 0; - if ( aCbxInterlaced.IsChecked() ) - nValue++; - pConfigItem->WriteInt32( aInterlaceStr, nValue ); - - nValue = 0; - if ( aCbxTranslucent.IsChecked() ) - nValue++; - pConfigItem->WriteInt32( aTranslucentStr, nValue ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} - - - diff --git a/filter/source/graphicfilter/egif/dlgegif.hrc b/filter/source/graphicfilter/egif/dlgegif.hrc deleted file mode 100644 index a2f9f4feb488..000000000000 --- a/filter/source/graphicfilter/egif/dlgegif.hrc +++ /dev/null @@ -1,36 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "filter.hrc" - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define FI_DESCR 1 -#define GRP_MODE 1 -#define GRP_DRAW 2 -#define CBX_INTERLACED 1 -#define CBX_TRANSLUCENT 2 diff --git a/filter/source/graphicfilter/egif/dlgegif.hxx b/filter/source/graphicfilter/egif/dlgegif.hxx deleted file mode 100644 index 0dbe48a065a3..000000000000 --- a/filter/source/graphicfilter/egif/dlgegif.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEGIF_HXX_ -#define _DLGEGIF_HXX_ - -#include <svtools/fltcall.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen -|* -\************************************************************************/ - -class FilterConfigItem; -class ResMgr; - -class DlgExportEGIF : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - CheckBox aCbxInterlaced; - CheckBox aCbxTranslucent; - FixedLine aGrpMode; - FixedLine aGrpDraw; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - DECL_LINK( OK, void * ); - -public: - DlgExportEGIF( FltCallDialogParameter& rPara ); - ~DlgExportEGIF(); -}; - -#endif // _DLGEGIF_HXX_ - diff --git a/filter/source/graphicfilter/egif/dlgegif.src b/filter/source/graphicfilter/egif/dlgegif.src deleted file mode 100644 index 39f96bb7ac7a..000000000000 --- a/filter/source/graphicfilter/egif/dlgegif.src +++ /dev/null @@ -1,118 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgegif.hrc" -ModalDialog DLG_EXPORT_GIF -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 169 , 70 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "GIF Options" ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 113 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 113 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 113 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine GRP_MODE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "Mode" ; - }; - CheckBox CBX_INTERLACED - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 86 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Interlaced" ; - }; - FixedLine GRP_DRAW - { - Pos = MAP_APPFONT ( 6 , 32 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text [ en-US ] = "Drawing objects" ; - }; - CheckBox CBX_TRANSLUCENT - { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 86 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Save ~transparency" ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/filter/source/graphicfilter/egif/egif.cxx b/filter/source/graphicfilter/egif/egif.cxx index 93f9f5ec0b15..56715487148b 100644 --- a/filter/source/graphicfilter/egif/egif.cxx +++ b/filter/source/graphicfilter/egif/egif.cxx @@ -36,9 +36,6 @@ #include <svtools/fltcall.hxx> #include <svtools/FilterConfigItem.hxx> #include "giflzwc.hxx" -#include "strings.hrc" -#include "dlgegif.hrc" -#include "dlgegif.hxx" // ------------- // - GIFWriter - @@ -574,56 +571,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGrap } // ------------------------------------------------------------------------ - -extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara ) -{ - BOOL bRet = FALSE; - - if ( rPara.pWindow ) - { - ByteString aResMgrName( "egi" ); - ResMgr* pResMgr; - - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - - if( pResMgr ) - { - rPara.pResMgr = pResMgr; - bRet = ( DlgExportEGIF( rPara ).Execute() == RET_OK ); - delete pResMgr; - } - else - bRet = TRUE; - } - - return bRet; -} - -// ------------------------------------------------------------------------ -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -// ------------------------------------------------------------------------ - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif diff --git a/filter/source/graphicfilter/egif/egifstr.src b/filter/source/graphicfilter/egif/egifstr.src deleted file mode 100644 index ea258019d543..000000000000 --- a/filter/source/graphicfilter/egif/egifstr.src +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "strings.hrc" - -// Key fuer den Dialog -String KEY_INTER -{ - Text = "Interlaced"; -}; -String KEY_TRANS -{ - Text = "Translucent"; -}; diff --git a/filter/source/graphicfilter/egif/exports.map b/filter/source/graphicfilter/egif/exports.map index 61e4682c6551..d4e28c44700c 100644 --- a/filter/source/graphicfilter/egif/exports.map +++ b/filter/source/graphicfilter/egif/exports.map @@ -1,7 +1,6 @@ UDK_3_0_0 { global: GraphicExport; - DoExportDialog; local: *; diff --git a/filter/source/graphicfilter/egif/makefile.mk b/filter/source/graphicfilter/egif/makefile.mk index 27dae4906046..5579a301e020 100644 --- a/filter/source/graphicfilter/egif/makefile.mk +++ b/filter/source/graphicfilter/egif/makefile.mk @@ -42,20 +42,13 @@ DEPTARGET=vegif CDEFS+= -DEDITDEBUG .ENDIF -SRS1NAME=$(TARGET) -SRC1FILES = dlgegif.src \ - egifstr.src .IF "$(L10N_framework)"=="" SLOFILES= $(SLO)$/egif.obj \ - $(SLO)$/dlgegif.obj \ - $(SLO)$/giflzwc.obj + $(SLO)$/giflzwc.obj .ENDIF # ========================================================================== -RESLIB1NAME=$(TARGET2) -RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs - .IF "$(L10N_framework)"=="" SHL1TARGET= egi$(DLLPOSTFIX) SHL1IMPLIB= egif diff --git a/filter/source/graphicfilter/egif/strings.hrc b/filter/source/graphicfilter/egif/strings.hrc deleted file mode 100644 index 1566c0dfee81..000000000000 --- a/filter/source/graphicfilter/egif/strings.hrc +++ /dev/null @@ -1,28 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define KEY_INTER 256 -#define KEY_TRANS 257 diff --git a/filter/source/graphicfilter/eos2met/dlgeos2.cxx b/filter/source/graphicfilter/eos2met/dlgeos2.cxx deleted file mode 100644 index 4c5bf1b0a429..000000000000 --- a/filter/source/graphicfilter/eos2met/dlgeos2.cxx +++ /dev/null @@ -1,179 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_filter.hxx" -#ifndef GCC -#endif -#include <com/sun/star/awt/Size.hpp> -#include <vcl/msgbox.hxx> -#include <svtools/FilterConfigItem.hxx> -#include "dlgeos2.hxx" -#include "dlgeos2.hrc" -#include "strings.hrc" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEMET::DlgExportEMET( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EMET, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), - aRbOriginal ( this, ResId( RB_ORIGINAL, *rPara.pResMgr ) ), - aRbSize ( this, ResId( RB_SIZE, *rPara.pResMgr ) ), - aGrpMode ( this, ResId( GRP_MODE, *rPara.pResMgr ) ), - aFtSizeX ( this, ResId( FT_SIZEX, *rPara.pResMgr ) ), - aMtfSizeX ( this, ResId( MTF_SIZEX, *rPara.pResMgr ) ), - aFtSizeY ( this, ResId( FT_SIZEY, *rPara.pResMgr ) ), - aMtfSizeY ( this, ResId( MTF_SIZEY, *rPara.pResMgr ) ), - aGrpSize ( this, ResId( GRP_SIZE, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ) -{ - FreeResource(); - - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/MET" ) ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - aBtnOK.SetClickHdl( LINK( this, DlgExportEMET, OK ) ); - aRbOriginal.SetClickHdl( LINK( this, DlgExportEMET, ClickRbOriginal ) ); - aRbSize.SetClickHdl( LINK( this, DlgExportEMET, ClickRbSize ) ); - - // Config-Parameter lesen - sal_Int32 nMode = pConfigItem->ReadInt32( String( ResId( KEY_MODE, *pMgr ) ), 0 ); - ::com::sun::star::awt::Size aDefault( 10000, 10000 ); - ::com::sun::star::awt::Size aSize; - aSize = pConfigItem->ReadSize( String( ResId( KEY_SIZE, *pMgr ) ), aDefault ); - - aMtfSizeX.SetDefaultUnit( FUNIT_MM ); - aMtfSizeY.SetDefaultUnit( FUNIT_MM ); - - aMtfSizeX.SetValue( aSize.Width ); - aMtfSizeY.SetValue( aSize.Height ); - - switch ( rPara.eFieldUnit ) - { -// case FUNIT_NONE : -// case FUNIT_KM : -// case FUNIT_PERCENT : -// case FUNIT_CUSTOM : -// case FUNIT_MILE : -// case FUNIT_FOOT : -// case FUNIT_M : - case FUNIT_MM : - case FUNIT_CM : - case FUNIT_TWIP : - case FUNIT_POINT : - case FUNIT_PICA : - case FUNIT_INCH : - case FUNIT_100TH_MM : - { - aMtfSizeX.SetUnit( rPara.eFieldUnit ); - aMtfSizeY.SetUnit( rPara.eFieldUnit ); - } - break; - default: - break; // multiple other value not handled -Wall - } - if ( nMode == 1 ) - { - aRbSize.Check( TRUE ); - ClickRbSize( NULL ); - } - else - { - aRbOriginal.Check( TRUE ); - ClickRbOriginal( NULL ); - } -} - -DlgExportEMET::~DlgExportEMET() -{ - delete pConfigItem; -} - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEMET, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - ::com::sun::star::awt::Size aSize( - (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeX.GetValue(), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM ), - (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeY.GetValue(), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM ) ); - sal_Int32 nStrMode = ( aRbSize.IsChecked() ) ? 1 : 0; - - pConfigItem->WriteInt32( String( ResId( KEY_MODE, *pMgr ) ), nStrMode ); - pConfigItem->WriteSize( String( ResId( KEY_SIZE, *pMgr ) ), aSize ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEMET, ClickRbOriginal, void*, EMPTYARG ) -{ - aGrpSize.Disable(); - aFtSizeX.Disable(); - aMtfSizeX.Disable(); - aFtSizeY.Disable(); - aMtfSizeY.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEMET, ClickRbSize, void*, EMPTYARG ) -{ - aGrpSize.Enable(); - aFtSizeX.Enable(); - aMtfSizeX.Enable(); - aFtSizeY.Enable(); - aMtfSizeY.Enable(); - - return 0; -} - diff --git a/filter/source/graphicfilter/eos2met/dlgeos2.hrc b/filter/source/graphicfilter/eos2met/dlgeos2.hrc deleted file mode 100644 index 5e4ec5b160fc..000000000000 --- a/filter/source/graphicfilter/eos2met/dlgeos2.hrc +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "filter.hrc" - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define CBX_SIZE 2 -#define MTF_SIZEX 1 -#define MTF_SIZEY 2 -#define FT_SIZEX 1 -#define FT_SIZEY 2 -#define GRP_SIZE 1 -#define GRP_MODE 2 -#define RB_ORIGINAL 1 -#define RB_SIZE 2 - diff --git a/filter/source/graphicfilter/eos2met/dlgeos2.hxx b/filter/source/graphicfilter/eos2met/dlgeos2.hxx deleted file mode 100644 index 6387be453494..000000000000 --- a/filter/source/graphicfilter/eos2met/dlgeos2.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEOS2_HXX_ -#define _DLGEOS2_HXX_ -#include <svtools/fltcall.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen bei Vektorformaten -|* -\************************************************************************/ - -class FilterConfigItem; -class ResMgr; - -class DlgExportEMET : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - RadioButton aRbOriginal; - RadioButton aRbSize; - FixedLine aGrpMode; - - FixedText aFtSizeX; - MetricField aMtfSizeX; - FixedText aFtSizeY; - MetricField aMtfSizeY; - FixedLine aGrpSize; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - DECL_LINK( OK, void* p ); - DECL_LINK( ClickRbOriginal,void* p ); - DECL_LINK( ClickRbSize,void* p ); - -public: - DlgExportEMET( FltCallDialogParameter& rPara ); - ~DlgExportEMET(); -}; - - -#endif // _DLGEMET_HXX_ - diff --git a/filter/source/graphicfilter/eos2met/dlgeos2.src b/filter/source/graphicfilter/eos2met/dlgeos2.src deleted file mode 100644 index 6c9e474e25db..000000000000 --- a/filter/source/graphicfilter/eos2met/dlgeos2.src +++ /dev/null @@ -1,162 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "dlgeos2.hrc" - -ModalDialog DLG_EXPORT_EMET -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 178 , 89 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "MET Options" ; - MetricField MTF_SIZEX - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 55 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - MetricField MTF_SIZEY - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 71 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - FixedLine GRP_SIZE - { - Pos = MAP_APPFONT ( 6 , 44 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Size" ; - }; - FixedText FT_SIZEX - { - Pos = MAP_APPFONT ( 12 , 56 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "Width" ; - }; - FixedText FT_SIZEY - { - Pos = MAP_APPFONT ( 12 , 72 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "Height" ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 122 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 122 , 24 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 122 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - RadioButton RB_ORIGINAL - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Original" ; - }; - RadioButton RB_SIZE - { - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Size" ; - }; - FixedLine GRP_MODE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Mode" ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/filter/source/graphicfilter/eos2met/eos2met.cxx b/filter/source/graphicfilter/eos2met/eos2met.cxx index 5ef86b9c1b98..4fce357a91e8 100644 --- a/filter/source/graphicfilter/eos2met/eos2met.cxx +++ b/filter/source/graphicfilter/eos2met/eos2met.cxx @@ -45,8 +45,6 @@ #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> #include <svl/solar.hrc> -#include "strings.hrc" -#include "dlgeos2.hxx" // -----------------------------Feld-Typen------------------------------- @@ -2594,55 +2592,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream & rStream, Graphic & rGr } } -//================== GraphicDialog - die exportierte Funktion ================ - -extern "C" BOOL SAL_CALL DoExportDialog( FltCallDialogParameter& rPara ) -{ - BOOL bRet = FALSE; - - if ( rPara.pWindow ) - { - ByteString aResMgrName( "eme" ); - ResMgr* pResMgr; - - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - - if( pResMgr ) - { - rPara.pResMgr = pResMgr; - bRet = ( DlgExportEMET( rPara ).Execute() == RET_OK ); - delete pResMgr; - } - else - bRet = TRUE; - } - - return bRet; -} - -//================== ein bischen Muell fuer Windows ========================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif diff --git a/filter/source/graphicfilter/eos2met/eos2mstr.src b/filter/source/graphicfilter/eos2met/eos2mstr.src deleted file mode 100644 index 8afebcb7564c..000000000000 --- a/filter/source/graphicfilter/eos2met/eos2mstr.src +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "strings.hrc" - -String KEY_MODE -{ - Text = "ExportMode"; -}; - -String KEY_SIZE -{ - Text = "Size"; -}; diff --git a/filter/source/graphicfilter/eos2met/exports.map b/filter/source/graphicfilter/eos2met/exports.map index 61e4682c6551..d4e28c44700c 100644 --- a/filter/source/graphicfilter/eos2met/exports.map +++ b/filter/source/graphicfilter/eos2met/exports.map @@ -1,7 +1,6 @@ UDK_3_0_0 { global: GraphicExport; - DoExportDialog; local: *; diff --git a/filter/source/graphicfilter/eos2met/makefile.mk b/filter/source/graphicfilter/eos2met/makefile.mk index 9f8deb74c7ca..da9ac4b53e15 100644 --- a/filter/source/graphicfilter/eos2met/makefile.mk +++ b/filter/source/graphicfilter/eos2met/makefile.mk @@ -42,17 +42,12 @@ DEPTARGET=veos2met CDEFS+= -DEDITDEBUG .ENDIF -SRS1NAME=$(TARGET) -SRC1FILES= dlgeos2.src \ - eos2mstr.src .IF "$(L10N_framework)"=="" -SLOFILES = $(SLO)$/eos2met.obj \ - $(SLO)$/dlgeos2.obj +SLOFILES = $(SLO)$/eos2met.obj + .ENDIF # ========================================================================== -RESLIB1NAME=$(TARGET2) -RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs .IF "$(L10N_framework)"=="" SHL1TARGET= eme$(DLLPOSTFIX) SHL1IMPLIB= eos2met diff --git a/filter/source/graphicfilter/eos2met/strings.hrc b/filter/source/graphicfilter/eos2met/strings.hrc deleted file mode 100644 index 7834e3ea2bc0..000000000000 --- a/filter/source/graphicfilter/eos2met/strings.hrc +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define KEY_MODE 260 -#define KEY_SIZE 261 - diff --git a/filter/source/graphicfilter/epbm/dlgepbm.cxx b/filter/source/graphicfilter/epbm/dlgepbm.cxx deleted file mode 100644 index 932fb7ff5bb9..000000000000 --- a/filter/source/graphicfilter/epbm/dlgepbm.cxx +++ /dev/null @@ -1,99 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_filter.hxx" -#ifndef GCC -#endif - -#include <tools/ref.hxx> -#include <svtools/FilterConfigItem.hxx> -#include <vcl/msgbox.hxx> -#include "dlgepbm.hxx" -#include "dlgepbm.hrc" -#include "strings.hrc" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEPBM::DlgExportEPBM( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPBM, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aGrpFormat ( this, ResId( GRP_FORMAT, *rPara.pResMgr ) ), - aRBRaw ( this, ResId( RB_RAW, *rPara.pResMgr ) ), - aRBASCII ( this, ResId( RB_ASCII, *rPara.pResMgr ) ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ) -{ - FreeResource(); - - // Config-Parameter lesen - - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PBM" ) ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - sal_Int32 nFormat = pConfigItem->ReadInt32( String( ResId( KEY_FORMAT, *pMgr ) ), 1 ); - - BOOL bCheck = FALSE; - if ( !nFormat ) - bCheck ^= TRUE; - - aRBRaw.Check( bCheck ); - bCheck ^= TRUE; - aRBASCII.Check( bCheck ); - - aBtnOK.SetClickHdl( LINK( this, DlgExportEPBM, OK ) ); -} - -DlgExportEPBM::~DlgExportEPBM() -{ - delete pConfigItem; -} - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEPBM, OK, void *, EMPTYARG ) -{ - - // Config-Parameter schreiben - sal_Int32 nFormat = 0; - if ( aRBASCII.IsChecked() ) - nFormat++; - pConfigItem->WriteInt32( String( ResId( KEY_FORMAT, *pMgr ) ), nFormat ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} diff --git a/filter/source/graphicfilter/epbm/dlgepbm.hrc b/filter/source/graphicfilter/epbm/dlgepbm.hrc deleted file mode 100644 index 876dfa840997..000000000000 --- a/filter/source/graphicfilter/epbm/dlgepbm.hrc +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "filter.hrc" - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define GRP_FORMAT 1 -#define RB_RAW 1 -#define RB_ASCII 2 diff --git a/filter/source/graphicfilter/epbm/dlgepbm.hxx b/filter/source/graphicfilter/epbm/dlgepbm.hxx deleted file mode 100644 index 780eac366020..000000000000 --- a/filter/source/graphicfilter/epbm/dlgepbm.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEPBM_HXX_ -#define _DLGEPBM_HXX_ -#include <svtools/fltcall.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <svtools/stdctrl.hxx> - - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen -|* -\************************************************************************/ - -class ResMgr; - -class FilterConfigItem; -class DlgExportEPBM : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - FixedLine aGrpFormat; - RadioButton aRBRaw; - RadioButton aRBASCII; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - DECL_LINK( OK, void * ); - -public: - DlgExportEPBM( FltCallDialogParameter& rPara ); - ~DlgExportEPBM(); -}; - -#endif // _DLGEPBM_HXX_ diff --git a/filter/source/graphicfilter/epbm/dlgepbm.src b/filter/source/graphicfilter/epbm/dlgepbm.src deleted file mode 100644 index b4e6eb2decf2..000000000000 --- a/filter/source/graphicfilter/epbm/dlgepbm.src +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgepbm.hrc" -ModalDialog DLG_EXPORT_EPBM -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 133 , 63 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "PBM Options" ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 73 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 73 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 73 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine GRP_FORMAT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "File format"; - }; - RadioButton RB_RAW - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Binary"; - }; - RadioButton RB_ASCII - { - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Text"; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/filter/source/graphicfilter/epbm/epbm.cxx b/filter/source/graphicfilter/epbm/epbm.cxx index fe8dc77fc704..b4f5b9b680ce 100644 --- a/filter/source/graphicfilter/epbm/epbm.cxx +++ b/filter/source/graphicfilter/epbm/epbm.cxx @@ -35,9 +35,6 @@ #include <svl/solar.hrc> #include <svtools/fltcall.hxx> #include <svtools/FilterConfigItem.hxx> -#include "strings.hrc" -#include "dlgepbm.hrc" -#include "dlgepbm.hxx" //============================ PBMWriter ================================== @@ -215,58 +212,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGrap } // ------------------------------------------------------------------------ - -extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara ) -{ - BOOL bRet = FALSE; - - if ( rPara.pWindow ) - { - ByteString aResMgrName( "epb" ); - ResMgr* pResMgr; - - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - - if( pResMgr ) - { - rPara.pResMgr = pResMgr; - bRet = ( DlgExportEPBM( rPara ).Execute() == RET_OK ); - delete pResMgr; - } - else - bRet = TRUE; - } - - return bRet; -} - -// ------------------------------------------------------------------------ -#ifndef GCC -#endif - -// --------------- -// - Win16 trash - -// --------------- - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ - if ( nHeap ) - UnlockData( 0 ); - - hDLLInst = hDLL; - - return TRUE; -} - -// ------------------------------------------------------------------------ - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif diff --git a/filter/source/graphicfilter/epbm/epbmstr.src b/filter/source/graphicfilter/epbm/epbmstr.src deleted file mode 100644 index 8424505dbcd1..000000000000 --- a/filter/source/graphicfilter/epbm/epbmstr.src +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "strings.hrc" - -// Key fuer den Dialog -String KEY_FORMAT -{ - Text = "FileFormat"; -}; diff --git a/filter/source/graphicfilter/epbm/exports.map b/filter/source/graphicfilter/epbm/exports.map index 61e4682c6551..d4e28c44700c 100644 --- a/filter/source/graphicfilter/epbm/exports.map +++ b/filter/source/graphicfilter/epbm/exports.map @@ -1,7 +1,6 @@ UDK_3_0_0 { global: GraphicExport; - DoExportDialog; local: *; diff --git a/filter/source/graphicfilter/epbm/makefile.mk b/filter/source/graphicfilter/epbm/makefile.mk index 3b248222cda1..609eae204aa4 100644 --- a/filter/source/graphicfilter/epbm/makefile.mk +++ b/filter/source/graphicfilter/epbm/makefile.mk @@ -42,17 +42,11 @@ DEPTARGET=vepbm CDEFS+= -DEDITDEBUG .ENDIF -SRS1NAME=$(TARGET) -SRC1FILES= dlgepbm.src \ - epbmstr.src .IF "$(L10N_framework)"=="" -SLOFILES = $(SLO)$/epbm.obj \ - $(SLO)$/dlgepbm.obj +SLOFILES = $(SLO)$/epbm.obj .ENDIF # ========================================================================== -RESLIB1NAME=$(TARGET2) -RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs .IF "$(L10N_framework)"=="" SHL1TARGET= epb$(DLLPOSTFIX) SHL1IMPLIB= epbm diff --git a/filter/source/graphicfilter/epbm/strings.hrc b/filter/source/graphicfilter/epbm/strings.hrc deleted file mode 100644 index 122719e87d4b..000000000000 --- a/filter/source/graphicfilter/epbm/strings.hrc +++ /dev/null @@ -1,27 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define KEY_FORMAT 256 diff --git a/filter/source/graphicfilter/epgm/dlgepgm.cxx b/filter/source/graphicfilter/epgm/dlgepgm.cxx deleted file mode 100644 index 3aa960b25a26..000000000000 --- a/filter/source/graphicfilter/epgm/dlgepgm.cxx +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_filter.hxx" -#ifndef GCC -#endif - -#include <tools/ref.hxx> -#include <svtools/FilterConfigItem.hxx> -#include <vcl/msgbox.hxx> -#include "dlgepgm.hxx" -#include "dlgepgm.hrc" -#include "strings.hrc" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEPGM::DlgExportEPGM( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPGM, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aGrpFormat ( this, ResId( GRP_FORMAT, *rPara.pResMgr ) ), - aRBRaw ( this, ResId( RB_RAW, *rPara.pResMgr ) ), - aRBASCII ( this, ResId( RB_ASCII, *rPara.pResMgr ) ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ) -{ - FreeResource(); - - // Config-Parameter lesen - - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PGM" ) ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - sal_Int32 nFormat = pConfigItem->ReadInt32( String( ResId( KEY_FORMAT, *pMgr ) ), 0 ); - - BOOL bCheck = FALSE; - if ( !nFormat ) - bCheck ^= TRUE; - aRBRaw.Check( bCheck ); - bCheck ^= TRUE; - aRBASCII.Check( bCheck ); - - aBtnOK.SetClickHdl( LINK( this, DlgExportEPGM, OK ) ); -} - -DlgExportEPGM::~DlgExportEPGM() -{ - delete pConfigItem; -} - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEPGM, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - sal_Int32 nFormat = 0; - if ( aRBASCII.IsChecked() ) - nFormat++; - pConfigItem->WriteInt32( String( ResId( KEY_FORMAT, *pMgr ) ), nFormat ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} diff --git a/filter/source/graphicfilter/epgm/dlgepgm.hrc b/filter/source/graphicfilter/epgm/dlgepgm.hrc deleted file mode 100644 index 876dfa840997..000000000000 --- a/filter/source/graphicfilter/epgm/dlgepgm.hrc +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "filter.hrc" - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define GRP_FORMAT 1 -#define RB_RAW 1 -#define RB_ASCII 2 diff --git a/filter/source/graphicfilter/epgm/dlgepgm.hxx b/filter/source/graphicfilter/epgm/dlgepgm.hxx deleted file mode 100644 index 3eb91bdb5fc6..000000000000 --- a/filter/source/graphicfilter/epgm/dlgepgm.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEPGM_HXX_ -#define _DLGEPGM_HXX_ -#include <svtools/fltcall.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <svtools/stdctrl.hxx> - - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen -|* -\************************************************************************/ - -class FilterConfigItem; -class ResMgr; - -class DlgExportEPGM : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - FixedLine aGrpFormat; - RadioButton aRBRaw; - RadioButton aRBASCII; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - DECL_LINK( OK, void * ); - -public: - DlgExportEPGM( FltCallDialogParameter& rPara ); - ~DlgExportEPGM(); -}; - -#endif // _DLGEPGM_HXX_ diff --git a/filter/source/graphicfilter/epgm/dlgepgm.src b/filter/source/graphicfilter/epgm/dlgepgm.src deleted file mode 100644 index 39e91d29fdf5..000000000000 --- a/filter/source/graphicfilter/epgm/dlgepgm.src +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgepgm.hrc" -ModalDialog DLG_EXPORT_EPGM -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 133 , 63 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "PGM Options" ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 73 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 73 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 73 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine GRP_FORMAT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "File format"; - }; - RadioButton RB_RAW - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Binary"; - }; - RadioButton RB_ASCII - { - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Text"; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/filter/source/graphicfilter/epgm/epgm.cxx b/filter/source/graphicfilter/epgm/epgm.cxx index 89fbc9929ab0..1f5da40dee43 100644 --- a/filter/source/graphicfilter/epgm/epgm.cxx +++ b/filter/source/graphicfilter/epgm/epgm.cxx @@ -35,9 +35,6 @@ #include <svl/solar.hrc> #include <svtools/fltcall.hxx> #include <svtools/FilterConfigItem.hxx> -#include "strings.hrc" -#include "dlgepgm.hrc" -#include "dlgepgm.hxx" //============================ PGMWriter ================================== @@ -240,58 +237,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGrap } // ------------------------------------------------------------------------ - -extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara ) -{ - BOOL bRet = FALSE; - - if ( rPara.pWindow ) - { - ByteString aResMgrName( "epg" ); - ResMgr* pResMgr; - - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - - if( pResMgr ) - { - rPara.pResMgr = pResMgr; - bRet = ( DlgExportEPGM( rPara ).Execute() == RET_OK ); - delete pResMgr; - } - else - bRet = TRUE; - } - - return bRet; -} - -// ------------------------------------------------------------------------ -#ifndef GCC -#endif - -// --------------- -// - Win16 trash - -// --------------- - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ - if ( nHeap ) - UnlockData( 0 ); - - hDLLInst = hDLL; - - return TRUE; -} - -// ------------------------------------------------------------------------ - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif diff --git a/filter/source/graphicfilter/epgm/epgmstr.src b/filter/source/graphicfilter/epgm/epgmstr.src deleted file mode 100644 index 8424505dbcd1..000000000000 --- a/filter/source/graphicfilter/epgm/epgmstr.src +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "strings.hrc" - -// Key fuer den Dialog -String KEY_FORMAT -{ - Text = "FileFormat"; -}; diff --git a/filter/source/graphicfilter/epgm/exports.map b/filter/source/graphicfilter/epgm/exports.map index 61e4682c6551..d4e28c44700c 100644 --- a/filter/source/graphicfilter/epgm/exports.map +++ b/filter/source/graphicfilter/epgm/exports.map @@ -1,7 +1,6 @@ UDK_3_0_0 { global: GraphicExport; - DoExportDialog; local: *; diff --git a/filter/source/graphicfilter/epgm/makefile.mk b/filter/source/graphicfilter/epgm/makefile.mk index 70ab5ec93c68..63d961feec97 100644 --- a/filter/source/graphicfilter/epgm/makefile.mk +++ b/filter/source/graphicfilter/epgm/makefile.mk @@ -43,17 +43,11 @@ DEPTARGET=vepgm CDEFS+= -DEDITDEBUG .ENDIF -SRS1NAME=$(TARGET) -SRC1FILES= dlgepgm.src \ - epgmstr.src .IF "$(L10N_framework)"=="" -SLOFILES = $(SLO)$/epgm.obj \ - $(SLO)$/dlgepgm.obj +SLOFILES = $(SLO)$/epgm.obj .ENDIF # ========================================================================== -RESLIB1NAME=$(TARGET2) -RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs .IF "$(L10N_framework)"=="" SHL1TARGET= epg$(DLLPOSTFIX) SHL1IMPLIB= epgm diff --git a/filter/source/graphicfilter/epgm/strings.hrc b/filter/source/graphicfilter/epgm/strings.hrc deleted file mode 100644 index 122719e87d4b..000000000000 --- a/filter/source/graphicfilter/epgm/strings.hrc +++ /dev/null @@ -1,27 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define KEY_FORMAT 256 diff --git a/filter/source/graphicfilter/epict/dlgepct.cxx b/filter/source/graphicfilter/epict/dlgepct.cxx deleted file mode 100644 index c274dc873560..000000000000 --- a/filter/source/graphicfilter/epict/dlgepct.cxx +++ /dev/null @@ -1,183 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_filter.hxx" -#ifndef GCC -#endif - -#include <vcl/msgbox.hxx> -#include <svtools/FilterConfigItem.hxx> -#include <com/sun/star/awt/Size.hpp> -#include "dlgepct.hxx" -#include "dlgepct.hrc" -#include "strings.hrc" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEPCT::DlgExportEPCT( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPCT, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), - aRbOriginal ( this, ResId( RB_ORIGINAL, *rPara.pResMgr ) ), - aRbSize ( this, ResId( RB_SIZE, *rPara.pResMgr ) ), - aGrpMode ( this, ResId( GRP_MODE, *rPara.pResMgr ) ), - aFtSizeX ( this, ResId( FT_SIZEX, *rPara.pResMgr ) ), - aMtfSizeX ( this, ResId( MTF_SIZEX, *rPara.pResMgr ) ), - aFtSizeY ( this, ResId( FT_SIZEY, *rPara.pResMgr ) ), - aMtfSizeY ( this, ResId( MTF_SIZEY, *rPara.pResMgr ) ), - aGrpSize ( this, ResId( GRP_SIZE, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ) -{ - FreeResource(); - - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PCT" ) ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - aBtnOK.SetClickHdl( LINK( this, DlgExportEPCT, OK ) ); - aRbOriginal.SetClickHdl( LINK( this, DlgExportEPCT, ClickRbOriginal ) ); - aRbSize.SetClickHdl( LINK( this, DlgExportEPCT, ClickRbSize ) ); - - // Config-Parameter lesen - sal_Int32 nStrMode = pConfigItem->ReadInt32( String( ResId( KEY_MODE, *pMgr ) ), 0 ); - ::com::sun::star::awt::Size aDefault( 10000, 10000 ); - ::com::sun::star::awt::Size aSize; - aSize = pConfigItem->ReadSize( String( ResId( KEY_SIZE, *pMgr ) ), aDefault ); - - aMtfSizeX.SetDefaultUnit( FUNIT_MM ); - aMtfSizeY.SetDefaultUnit( FUNIT_MM ); - aMtfSizeX.SetValue( aSize.Width ); - aMtfSizeY.SetValue( aSize.Height ); - - switch ( rPara.eFieldUnit ) - { - case FUNIT_NONE : - case FUNIT_KM : - case FUNIT_PERCENT : - case FUNIT_CUSTOM : - case FUNIT_MILE : - case FUNIT_FOOT : - case FUNIT_M : - break; // -Wall not handled. - case FUNIT_MM : - case FUNIT_CM : - case FUNIT_TWIP : - case FUNIT_POINT : - case FUNIT_PICA : - case FUNIT_INCH : - case FUNIT_100TH_MM : - { - aMtfSizeX.SetUnit( rPara.eFieldUnit ); - aMtfSizeY.SetUnit( rPara.eFieldUnit ); - } - break; - } - if ( nStrMode == 1 ) - { - aRbSize.Check( TRUE ); - ClickRbSize( NULL ); - } - else - { - aRbOriginal.Check( TRUE ); - ClickRbOriginal( NULL ); - } -} - -DlgExportEPCT::~DlgExportEPCT() -{ - delete pConfigItem; -} - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\**************************************** ********************************/ - -IMPL_LINK( DlgExportEPCT, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - ::com::sun::star::awt::Size aSize( - (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeX.GetValue(), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM ), - (sal_Int32)MetricField::ConvertDoubleValue( aMtfSizeY.GetValue(), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM ) ); - - sal_Int32 nStrMode = 0; - if ( aRbSize.IsChecked() ) - nStrMode++; - - pConfigItem->WriteInt32( String( ResId( KEY_MODE, *pMgr ) ), nStrMode ); - pConfigItem->WriteSize( String( ResId( KEY_SIZE, *pMgr ) ), aSize ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEPCT, ClickRbOriginal, void*, EMPTYARG ) -{ - aGrpSize.Disable(); - aFtSizeX.Disable(); - aMtfSizeX.Disable(); - aFtSizeY.Disable(); - aMtfSizeY.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEPCT, ClickRbSize, void*, EMPTYARG ) -{ - aGrpSize.Enable(); - aFtSizeX.Enable(); - aMtfSizeX.Enable(); - aFtSizeY.Enable(); - aMtfSizeY.Enable(); - - return 0; -} - - - diff --git a/filter/source/graphicfilter/epict/dlgepct.hrc b/filter/source/graphicfilter/epict/dlgepct.hrc deleted file mode 100644 index 0f92aa9bda3c..000000000000 --- a/filter/source/graphicfilter/epict/dlgepct.hrc +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <filter.hrc> - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define CBX_SIZE 2 -#define MTF_SIZEX 1 -#define MTF_SIZEY 2 -#define FT_SIZEX 1 -#define FT_SIZEY 2 -#define GRP_SIZE 1 -#define GRP_MODE 2 -#define RB_ORIGINAL 1 -#define RB_SIZE 2 - diff --git a/filter/source/graphicfilter/epict/dlgepct.hxx b/filter/source/graphicfilter/epict/dlgepct.hxx deleted file mode 100644 index e879822ab1f5..000000000000 --- a/filter/source/graphicfilter/epict/dlgepct.hxx +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEPCT_HXX_ -#define _DLGEPCT_HXX_ - -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <svtools/fltcall.hxx> - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen bei Vektorformaten -|* -\************************************************************************/ - -class FilterConfigItem; -class ResMgr; - -class DlgExportEPCT : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - RadioButton aRbOriginal; - RadioButton aRbSize; - FixedLine aGrpMode; - - FixedText aFtSizeX; - MetricField aMtfSizeX; - FixedText aFtSizeY; - MetricField aMtfSizeY; - FixedLine aGrpSize; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - DECL_LINK( OK, void* p ); - DECL_LINK( ClickRbOriginal,void* p ); - DECL_LINK( ClickRbSize,void* p ); - -public: - DlgExportEPCT( FltCallDialogParameter& rPara ); - ~DlgExportEPCT(); -}; - -#endif // _DLGEPCT_HXX_ - diff --git a/filter/source/graphicfilter/epict/dlgepct.src b/filter/source/graphicfilter/epict/dlgepct.src deleted file mode 100644 index d503c53cf89c..000000000000 --- a/filter/source/graphicfilter/epict/dlgepct.src +++ /dev/null @@ -1,163 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgepct.hrc" - -ModalDialog DLG_EXPORT_EPCT -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 178 , 89 ) ; - Text [ en-US ] = "PICT Options" ; - Moveable = TRUE ; - Closeable = TRUE ; - MetricField MTF_SIZEX - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 55 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - MetricField MTF_SIZEY - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 71 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - FixedLine GRP_SIZE - { - Pos = MAP_APPFONT ( 6 , 44 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Size" ; - }; - FixedText FT_SIZEX - { - Pos = MAP_APPFONT ( 12 , 57 ) ; - Size = MAP_APPFONT ( 45 , 8 ) ; - Text [ en-US ] = "Width" ; - }; - FixedText FT_SIZEY - { - Pos = MAP_APPFONT ( 12 , 73 ) ; - Size = MAP_APPFONT ( 45 , 8 ) ; - Text [ en-US ] = "Height" ; - }; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 122 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 122 , 24 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 122 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - RadioButton RB_ORIGINAL - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Original" ; - }; - RadioButton RB_SIZE - { - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Size" ; - }; - FixedLine GRP_MODE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Mode" ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx index 7e81077e3810..53bdfbdad6ff 100644 --- a/filter/source/graphicfilter/epict/epict.cxx +++ b/filter/source/graphicfilter/epict/epict.cxx @@ -48,9 +48,6 @@ #include <vcl/gdimtf.hxx> #include <tools/bigint.hxx> -#include "strings.hrc" -#include "dlgepct.hrc" -#include "dlgepct.hxx" #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> @@ -2331,57 +2328,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicExport(SvStream & rStream, Graphic & rGra } } -//================== GraphicDialog - die exportierte Funktion ================ - -extern "C" BOOL SAL_CALL DoExportDialog( FltCallDialogParameter& rPara ) -{ - BOOL bRet = FALSE; - - if ( rPara.pWindow ) - { - ByteString aResMgrName( "ept" ); - ResMgr* pResMgr; - - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - - if( pResMgr ) - { - rPara.pResMgr = pResMgr; - bRet = ( DlgExportEPCT( rPara ).Execute() == RET_OK ); - delete pResMgr; - } - else - bRet = TRUE; - } - - return bRet; -} - - -//=============================== fuer Windows ============================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif - diff --git a/filter/source/graphicfilter/epict/epictstr.src b/filter/source/graphicfilter/epict/epictstr.src deleted file mode 100644 index 8afebcb7564c..000000000000 --- a/filter/source/graphicfilter/epict/epictstr.src +++ /dev/null @@ -1,38 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "strings.hrc" - -String KEY_MODE -{ - Text = "ExportMode"; -}; - -String KEY_SIZE -{ - Text = "Size"; -}; diff --git a/filter/source/graphicfilter/epict/exports.map b/filter/source/graphicfilter/epict/exports.map index 61e4682c6551..d4e28c44700c 100644 --- a/filter/source/graphicfilter/epict/exports.map +++ b/filter/source/graphicfilter/epict/exports.map @@ -1,7 +1,6 @@ UDK_3_0_0 { global: GraphicExport; - DoExportDialog; local: *; diff --git a/filter/source/graphicfilter/epict/makefile.mk b/filter/source/graphicfilter/epict/makefile.mk index a7c99eb3f732..1e030e52dd9b 100644 --- a/filter/source/graphicfilter/epict/makefile.mk +++ b/filter/source/graphicfilter/epict/makefile.mk @@ -43,17 +43,11 @@ DEPTARGET=vepict CDEFS+= -DEDITDEBUG .ENDIF -SRS1NAME=$(TARGET) -SRC1FILES = dlgepct.src \ - epictstr.src .IF "$(L10N_framework)"=="" -SLOFILES = $(SLO)$/epict.obj \ - $(SLO)$/dlgepct.obj +SLOFILES = $(SLO)$/epict.obj .ENDIF # ========================================================================== -RESLIB1NAME=$(TARGET2) -RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs .IF "$(L10N_framework)"=="" SHL1TARGET= ept$(DLLPOSTFIX) SHL1IMPLIB= epict diff --git a/filter/source/graphicfilter/epict/strings.hrc b/filter/source/graphicfilter/epict/strings.hrc deleted file mode 100644 index 7834e3ea2bc0..000000000000 --- a/filter/source/graphicfilter/epict/strings.hrc +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define KEY_MODE 260 -#define KEY_SIZE 261 - diff --git a/filter/source/graphicfilter/eppm/dlgeppm.cxx b/filter/source/graphicfilter/eppm/dlgeppm.cxx deleted file mode 100644 index 23822bfebf7c..000000000000 --- a/filter/source/graphicfilter/eppm/dlgeppm.cxx +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_filter.hxx" -#ifndef GCC -#endif -#include <tools/ref.hxx> -#include <svtools/FilterConfigItem.hxx> -#include <vcl/msgbox.hxx> -#include "dlgeppm.hxx" -#include "dlgeppm.hrc" -#include "strings.hrc" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEPPM::DlgExportEPPM( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPPM, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aGrpFormat ( this, ResId( GRP_FORMAT, *rPara.pResMgr ) ), - aRBRaw ( this, ResId( RB_RAW, *rPara.pResMgr ) ), - aRBASCII ( this, ResId( RB_ASCII, *rPara.pResMgr ) ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ) -{ - FreeResource(); - - // Config-Parameter lesen - - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PPM" ) ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - sal_Int32 nFormat = pConfigItem->ReadInt32( String( ResId( KEY_FORMAT, *pMgr ) ), 0 ); - - BOOL bCheck = FALSE; - if ( !nFormat ) - bCheck ^= TRUE; - aRBRaw.Check( bCheck ); - bCheck ^= TRUE; - aRBASCII.Check( bCheck ); - - aBtnOK.SetClickHdl( LINK( this, DlgExportEPPM, OK ) ); -} - -DlgExportEPPM::~DlgExportEPPM() -{ - delete pConfigItem; -} - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEPPM, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - sal_Int32 nFormat = 0; - if ( aRBASCII.IsChecked() ) - nFormat++; - pConfigItem->WriteInt32( String( ResId( KEY_FORMAT, *pMgr ) ), nFormat ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} diff --git a/filter/source/graphicfilter/eppm/dlgeppm.hrc b/filter/source/graphicfilter/eppm/dlgeppm.hrc deleted file mode 100644 index 876dfa840997..000000000000 --- a/filter/source/graphicfilter/eppm/dlgeppm.hrc +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "filter.hrc" - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define GRP_FORMAT 1 -#define RB_RAW 1 -#define RB_ASCII 2 diff --git a/filter/source/graphicfilter/eppm/dlgeppm.hxx b/filter/source/graphicfilter/eppm/dlgeppm.hxx deleted file mode 100644 index a03ca3ad24f0..000000000000 --- a/filter/source/graphicfilter/eppm/dlgeppm.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEPPM_HXX_ -#define _DLGEPPM_HXX_ -#include <svtools/fltcall.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <svtools/stdctrl.hxx> - - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen -|* -\************************************************************************/ - -class FilterConfigItem; -class ResMgr; - -class DlgExportEPPM : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - FixedLine aGrpFormat; - RadioButton aRBRaw; - RadioButton aRBASCII; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - DECL_LINK( OK, void * ); - -public: - DlgExportEPPM( FltCallDialogParameter& rPara ); - ~DlgExportEPPM(); -}; - -#endif // _DLGEPPM_HXX_ diff --git a/filter/source/graphicfilter/eppm/dlgeppm.src b/filter/source/graphicfilter/eppm/dlgeppm.src deleted file mode 100644 index bf6c6ec653cb..000000000000 --- a/filter/source/graphicfilter/eppm/dlgeppm.src +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgeppm.hrc" -ModalDialog DLG_EXPORT_EPPM -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 133 , 63 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "PPM Options" ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 73 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 73 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 73 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine GRP_FORMAT - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 60 , 8 ) ; - Text [ en-US ] = "File format"; - }; - RadioButton RB_RAW - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Binary"; - }; - RadioButton RB_ASCII - { - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Text"; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/filter/source/graphicfilter/eppm/eppm.cxx b/filter/source/graphicfilter/eppm/eppm.cxx index bef9ce9d3077..856b2abf352b 100644 --- a/filter/source/graphicfilter/eppm/eppm.cxx +++ b/filter/source/graphicfilter/eppm/eppm.cxx @@ -35,9 +35,6 @@ #include <svl/solar.hrc> #include <svtools/fltcall.hxx> #include <svtools/FilterConfigItem.hxx> -#include "strings.hrc" -#include "dlgeppm.hrc" -#include "dlgeppm.hxx" //============================ PPMWriter ================================== @@ -248,58 +245,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGrap // ------------------------------------------------------------------------ -extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara ) -{ - BOOL bRet = FALSE; - - if ( rPara.pWindow ) - { - ByteString aResMgrName( "epp" ); - ResMgr* pResMgr; - - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - - if( pResMgr ) - { - rPara.pResMgr = pResMgr; - bRet = ( DlgExportEPPM( rPara ).Execute() == RET_OK ); - delete pResMgr; - } - else - bRet = TRUE; - } - - return bRet; -} - -#ifndef GCC -#endif - -// ------------------------------------------------------------------------ - -// --------------- -// - Win16 trash - -// --------------- - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ - if ( nHeap ) - UnlockData( 0 ); - - hDLLInst = hDLL; - - return TRUE; -} - -// ------------------------------------------------------------------------ - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif diff --git a/filter/source/graphicfilter/eppm/eppmstr.src b/filter/source/graphicfilter/eppm/eppmstr.src deleted file mode 100644 index 8424505dbcd1..000000000000 --- a/filter/source/graphicfilter/eppm/eppmstr.src +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "strings.hrc" - -// Key fuer den Dialog -String KEY_FORMAT -{ - Text = "FileFormat"; -}; diff --git a/filter/source/graphicfilter/eppm/exports.map b/filter/source/graphicfilter/eppm/exports.map index 61e4682c6551..d4e28c44700c 100644 --- a/filter/source/graphicfilter/eppm/exports.map +++ b/filter/source/graphicfilter/eppm/exports.map @@ -1,7 +1,6 @@ UDK_3_0_0 { global: GraphicExport; - DoExportDialog; local: *; diff --git a/filter/source/graphicfilter/eppm/makefile.mk b/filter/source/graphicfilter/eppm/makefile.mk index 44e6ca11d34a..6a41d81f1da6 100644 --- a/filter/source/graphicfilter/eppm/makefile.mk +++ b/filter/source/graphicfilter/eppm/makefile.mk @@ -42,17 +42,11 @@ DEPTARGET=veppm CDEFS+= -DEDITDEBUG .ENDIF -SRS1NAME=$(TARGET) -SRC1FILES= dlgeppm.src \ - eppmstr.src .IF "$(L10N_framework)"=="" -SLOFILES = $(SLO)$/eppm.obj \ - $(SLO)$/dlgeppm.obj +SLOFILES = $(SLO)$/eppm.obj .ENDIF # ========================================================================== -RESLIB1NAME=$(TARGET2) -RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs .IF "$(L10N_framework)"=="" SHL1TARGET= epp$(DLLPOSTFIX) SHL1IMPLIB= eppm diff --git a/filter/source/graphicfilter/eppm/strings.hrc b/filter/source/graphicfilter/eppm/strings.hrc deleted file mode 100644 index 122719e87d4b..000000000000 --- a/filter/source/graphicfilter/eppm/strings.hrc +++ /dev/null @@ -1,27 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#define KEY_FORMAT 256 diff --git a/filter/source/graphicfilter/eps/dlgeps.cxx b/filter/source/graphicfilter/eps/dlgeps.cxx deleted file mode 100644 index c6f2abba5912..000000000000 --- a/filter/source/graphicfilter/eps/dlgeps.cxx +++ /dev/null @@ -1,206 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_filter.hxx" -#ifndef GCC -#endif - -#include <tools/ref.hxx> -#include <vcl/msgbox.hxx> -#include <svtools/FilterConfigItem.hxx> -#include "dlgeps.hxx" -#include "dlgeps.hrc" -#include "strings.hrc" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEPS::DlgExportEPS( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPS, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aGrpPreview ( this, ResId( GRP_PREVIEW, *rPara.pResMgr ) ), - aCBPreviewTiff ( this, ResId( CB_PREVIEW_TIFF, *rPara.pResMgr ) ), - aCBPreviewEPSI ( this, ResId( CB_PREVIEW_EPSI, *rPara.pResMgr ) ), - aGrpVersion ( this, ResId( GRP_VERSION, *rPara.pResMgr ) ), - aRBLevel1 ( this, ResId( RB_LEVEL1, *rPara.pResMgr ) ), - aRBLevel2 ( this, ResId( RB_LEVEL2, *rPara.pResMgr ) ), - aGrpColor ( this, ResId( GRP_COLOR, *rPara.pResMgr ) ), - aRBColor ( this, ResId( RB_COLOR, *rPara.pResMgr ) ), - aRBGrayscale ( this, ResId( RB_GRAYSCALE, *rPara.pResMgr ) ), - aGrpCompression ( this, ResId( GRP_COMPRESSION, *rPara.pResMgr ) ), - aRBCompressionLZW ( this, ResId( RB_COMPRESSION_LZW, *rPara.pResMgr ) ), - aRBCompressionNone ( this, ResId( RB_COMPRESSION_NONE, *rPara.pResMgr ) ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ) -{ - FreeResource(); - - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/EPS" ) ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - // Config-Parameter lesen - String sPreview( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ); - String sVersion( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ); - String sColorFormat( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ); - String sCompressionMode( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ); - String sTextMode( RTL_CONSTASCII_USTRINGPARAM( "TextMode" ) ); - - sal_Int32 nPreview = pConfigItem->ReadInt32( sPreview, 0 ); - sal_Int32 nVersion = pConfigItem->ReadInt32( sVersion, 2 ); - sal_Int32 nColor = pConfigItem->ReadInt32( sColorFormat, 0 ); - sal_Int32 nCompr = pConfigItem->ReadInt32( sCompressionMode, 2 ); - - /* SJ: The following line is not superfluous, reading the item will also #106652# - create the corresponding FilterData Property. Since all filter - are no longer accessing the configuration itself, we have fill the - FilterData sequence with all available configuration items */ - pConfigItem->ReadInt32( sTextMode, 0 ); - - BOOL bCheck = FALSE; - if ( nPreview & 1 ) - bCheck = TRUE; - aCBPreviewTiff.Check( bCheck ); - if ( nPreview & 2 ) - bCheck = TRUE; - aCBPreviewEPSI.Check( bCheck ); - - bCheck = FALSE; - if ( nVersion == 1 ) - bCheck ^= TRUE; - aRBLevel1.Check( bCheck ); - bCheck ^= TRUE; - aRBLevel2.Check( bCheck ); - - bCheck = FALSE; - if ( nColor == 1 ) - bCheck ^= TRUE; - aRBColor.Check( bCheck ); - bCheck ^= TRUE; - aRBGrayscale.Check( bCheck ); - - bCheck = FALSE; - if ( nCompr == 1 ) - bCheck ^= TRUE; - aRBCompressionLZW.Check( bCheck ); - bCheck ^= TRUE; - aRBCompressionNone.Check( bCheck ); - - if ( aRBLevel1.IsChecked() ) - { - aRBColor.Disable(); - aRBGrayscale.Disable(); - aRBCompressionNone.Disable(); - aRBCompressionLZW.Disable(); - aRBCompressionNone.Disable(); - } - - aBtnOK.SetClickHdl( LINK( this, DlgExportEPS, OK ) ); - aRBLevel1.SetClickHdl( LINK( this, DlgExportEPS, LEVEL1 ) ); - aRBLevel2.SetClickHdl( LINK( this, DlgExportEPS, LEVEL2 ) ); -} - -DlgExportEPS::~DlgExportEPS() -{ - delete pConfigItem; -} - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEPS, OK, void *, EMPTYARG ) -{ - - // Config-Parameter schreiben - sal_Int32 nCheck = 0; - if ( aCBPreviewTiff.IsChecked() ) - nCheck++; - if ( aCBPreviewEPSI.IsChecked() ) - nCheck += 2; - - String sPreview( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ); - pConfigItem->WriteInt32( sPreview, nCheck ); - - nCheck = 1; - if ( aRBLevel2.IsChecked() ) - nCheck++; - String sVersion( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ); - pConfigItem->WriteInt32( sVersion, nCheck ); - - nCheck = 1; - if ( aRBGrayscale.IsChecked() ) - nCheck++; - String sColorFormat( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ); - pConfigItem->WriteInt32( sColorFormat, nCheck ); - - nCheck = 1; - if ( aRBCompressionNone.IsChecked() ) - nCheck++; - String sCompressionMode( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ); - pConfigItem->WriteInt32( sCompressionMode, nCheck ); - - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( DlgExportEPS, LEVEL1, void*, EMPTYARG ) -{ - if ( aRBLevel1.IsChecked() ) - { - aRBColor.Disable(); - aRBGrayscale.Disable(); - aRBCompressionLZW.Disable(); - aRBCompressionNone.Disable(); - } - return 0; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( DlgExportEPS, LEVEL2, void*, EMPTYARG ) -{ - if ( aRBLevel2.IsChecked() ) - { - aRBColor.Enable(); - aRBGrayscale.Enable(); - aRBCompressionLZW.Enable(); - aRBCompressionNone.Enable(); - } - return 0; -} diff --git a/filter/source/graphicfilter/eps/dlgeps.hrc b/filter/source/graphicfilter/eps/dlgeps.hrc deleted file mode 100644 index 061c8b2db6cb..000000000000 --- a/filter/source/graphicfilter/eps/dlgeps.hrc +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "filter.hrc" - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define GRP_PREVIEW 1 -#define GRP_VERSION 2 -#define GRP_COLOR 3 -#define GRP_COMPRESSION 4 -#define CB_PREVIEW_TIFF 1 -#define CB_PREVIEW_EPSI 2 -#define RB_LEVEL1 1 -#define RB_LEVEL2 2 -#define RB_COLOR 3 -#define RB_GRAYSCALE 4 -#define RB_COMPRESSION_LZW 5 -#define RB_COMPRESSION_NONE 6 diff --git a/filter/source/graphicfilter/eps/dlgeps.hxx b/filter/source/graphicfilter/eps/dlgeps.hxx deleted file mode 100644 index ada390b44e87..000000000000 --- a/filter/source/graphicfilter/eps/dlgeps.hxx +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _DLGEPS_HXX_ -#define _DLGEPS_HXX_ -#include <svtools/fltcall.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <vcl/lstbox.hxx> -#include <svtools/stdctrl.hxx> - - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen -|* -\************************************************************************/ - -class FilterConfigItem; -class ResMgr; - -class DlgExportEPS : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - FixedLine aGrpPreview; - CheckBox aCBPreviewTiff; - CheckBox aCBPreviewEPSI; - FixedLine aGrpVersion; - RadioButton aRBLevel1; - RadioButton aRBLevel2; - FixedLine aGrpColor; - RadioButton aRBColor; - RadioButton aRBGrayscale; - FixedLine aGrpCompression; - RadioButton aRBCompressionLZW; - RadioButton aRBCompressionNone; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - DECL_LINK( OK, void * ); - DECL_LINK( LEVEL1, void* ); - DECL_LINK( LEVEL2, void* ); - -public: - DlgExportEPS( FltCallDialogParameter& rPara ); - ~DlgExportEPS(); -}; - -#endif // _DLGEPS_HXX_ diff --git a/filter/source/graphicfilter/eps/dlgeps.src b/filter/source/graphicfilter/eps/dlgeps.src deleted file mode 100644 index 31ddccd5be4f..000000000000 --- a/filter/source/graphicfilter/eps/dlgeps.src +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************* - * - * 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 - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgeps.hrc" -ModalDialog DLG_EXPORT_EPS -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 230, 161 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "EPS Export Options"; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 174 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 174, 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 174 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - - FixedLine GRP_PREVIEW - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 162 , 8 ) ; - Text [ en-US ] = "Preview"; - }; - CheckBox CB_PREVIEW_TIFF - { - Pos = MAP_APPFONT ( 12, 14 ) ; - Size = MAP_APPFONT ( 150 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Image ~preview (TIFF)"; - }; - CheckBox CB_PREVIEW_EPSI - { - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 150, 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Interchange (EPSI)"; - }; - FixedLine GRP_VERSION - { - Pos = MAP_APPFONT ( 6, 41 ) ; - Size = MAP_APPFONT ( 162 , 8 ) ; - Text [ en-US ] = "Version"; - }; - RadioButton RB_LEVEL1 - { - Pos = MAP_APPFONT ( 12 , 52 ) ; - Size = MAP_APPFONT ( 150 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Level ~1"; - }; - RadioButton RB_LEVEL2 - { - Pos = MAP_APPFONT ( 12 , 66 ) ; - Size = MAP_APPFONT ( 150, 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Level ~2"; - }; - - FixedLine GRP_COLOR - { - Pos = MAP_APPFONT ( 6 , 79 ) ; - Size = MAP_APPFONT ( 162 , 8 ) ; - Text [ en-US ] = "Color format"; - }; - RadioButton RB_COLOR - { - Pos = MAP_APPFONT ( 12 , 90 ) ; - Size = MAP_APPFONT ( 150, 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Color"; - }; - RadioButton RB_GRAYSCALE - { - Pos = MAP_APPFONT ( 12 , 104 ) ; - Size = MAP_APPFONT ( 150, 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Grayscale"; - }; - - FixedLine GRP_COMPRESSION - { - Pos = MAP_APPFONT ( 6 , 117 ) ; - Size = MAP_APPFONT ( 162 , 8 ) ; - Text [ en-US ] = "Compression"; - }; - RadioButton RB_COMPRESSION_LZW - { - Pos = MAP_APPFONT ( 12, 128 ); - Size = MAP_APPFONT ( 150, 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "LZW encoding"; - }; - RadioButton RB_COMPRESSION_NONE - { - Pos = MAP_APPFONT ( 12, 141 ) ; - Size = MAP_APPFONT ( 150, 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "None"; - }; -}; - - - - - - - - - - - - - - - - - - - - - diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index 5e221b58c72e..7c3a26844bc6 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -48,8 +48,6 @@ #include <svtools/FilterConfigItem.hxx> #include <vcl/graphictools.hxx> #include "strings.hrc" -#include "dlgeps.hrc" -#include "dlgeps.hxx" #include <math.h> @@ -2739,55 +2737,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream & rStream, Graphic & rGr return aPSWriter.WritePS( rGraphic, rStream, pFilterConfigItem ); } -//--------------------------------------------------------------------------------- - -extern "C" BOOL __LOADONCALLAPI DoExportDialog( FltCallDialogParameter& rPara ) -{ - BOOL bRet = FALSE; - - if ( rPara.pWindow ) - { - ByteString aResMgrName( "eps" ); - ResMgr* pResMgr; - - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - - if( pResMgr ) - { - rPara.pResMgr = pResMgr; - bRet = ( DlgExportEPS( rPara ).Execute() == RET_OK ); - delete pResMgr; - } - else - bRet = TRUE; - } - - return bRet; -} - -//================== ein bischen Muell fuer Windows ========================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif diff --git a/filter/source/graphicfilter/eps/exports.map b/filter/source/graphicfilter/eps/exports.map index 61e4682c6551..d4e28c44700c 100644 --- a/filter/source/graphicfilter/eps/exports.map +++ b/filter/source/graphicfilter/eps/exports.map @@ -1,7 +1,6 @@ UDK_3_0_0 { global: GraphicExport; - DoExportDialog; local: *; diff --git a/filter/source/graphicfilter/eps/makefile.mk b/filter/source/graphicfilter/eps/makefile.mk index 189972e80e6e..8ed7f1610014 100644 --- a/filter/source/graphicfilter/eps/makefile.mk +++ b/filter/source/graphicfilter/eps/makefile.mk @@ -44,12 +44,10 @@ CDEFS+= -DEDITDEBUG .ENDIF SRS1NAME=$(TARGET) -SRC1FILES = dlgeps.src \ - epsstr.src +SRC1FILES = epsstr.src .IF "$(L10N_framework)"=="" EXCEPTIONSFILES=$(SLO)$/eps.obj -SLOFILES = $(SLO)$/eps.obj \ - $(SLO)$/dlgeps.obj +SLOFILES = $(SLO)$/eps.obj .ENDIF # ========================================================================== diff --git a/filter/source/graphicfilter/eras/eras.cxx b/filter/source/graphicfilter/eras/eras.cxx index 845dbf6ff83a..cb9005fdf0eb 100644 --- a/filter/source/graphicfilter/eras/eras.cxx +++ b/filter/source/graphicfilter/eras/eras.cxx @@ -286,32 +286,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGrap return aRASWriter.WriteRAS( rGraphic, rStream, pFilterConfigItem ); } -#ifndef GCC -#endif - -// --------------- -// - Win16 trash - -// --------------- - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ - if ( nHeap ) - UnlockData( 0 ); - - hDLLInst = hDLL; - - return TRUE; -} - -// ------------------------------------------------------------------------ - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx index 0e71141eb812..af3142806a12 100644 --- a/filter/source/graphicfilter/etiff/etiff.cxx +++ b/filter/source/graphicfilter/etiff/etiff.cxx @@ -616,33 +616,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGrap return TIFFWriter().WriteTIFF( rGraphic, rStream, pFilterConfigItem ); } -#ifndef GCC -#endif - -// --------------- -// - Win16 trash - -// --------------- - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ - if ( nHeap ) - UnlockData( 0 ); - - hDLLInst = hDLL; - - return TRUE; -} - -// ------------------------------------------------------------------------ - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif - diff --git a/filter/source/graphicfilter/expm/expm.cxx b/filter/source/graphicfilter/expm/expm.cxx index cd05331e5ade..083fb0f2f7b3 100644 --- a/filter/source/graphicfilter/expm/expm.cxx +++ b/filter/source/graphicfilter/expm/expm.cxx @@ -271,32 +271,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicExport( SvStream& rStream, Graphic& rGrap return aXPMWriter.WriteXPM( rGraphic, rStream, pFilterConfigItem ); } -#ifndef GCC -#endif - -// --------------- -// - Win16 trash - -// --------------- - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ - if ( nHeap ) - UnlockData( 0 ); - - hDLLInst = hDLL; - - return TRUE; -} - -// ------------------------------------------------------------------------ - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif diff --git a/filter/source/graphicfilter/idxf/idxf.cxx b/filter/source/graphicfilter/idxf/idxf.cxx index 149f4c2feb78..da8f830d32d5 100644 --- a/filter/source/graphicfilter/idxf/idxf.cxx +++ b/filter/source/graphicfilter/idxf/idxf.cxx @@ -51,32 +51,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGra return TRUE; } - -//============================= fuer Windows ================================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif - - diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx index 097fc83e35fe..caadcd4f3cdd 100644 --- a/filter/source/graphicfilter/ieps/ieps.cxx +++ b/filter/source/graphicfilter/ieps/ieps.cxx @@ -742,30 +742,3 @@ extern "C" BOOL GraphicImport(SvStream & rStream, Graphic & rGraphic, FilterConf return ( bRetValue ); } -//================== ein bischen Muell fuer Windows ========================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif - diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx index 6cab0cdc4e18..e0ffce9c6081 100644 --- a/filter/source/graphicfilter/ios2met/ios2met.cxx +++ b/filter/source/graphicfilter/ios2met/ios2met.cxx @@ -2755,30 +2755,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGra return bRet; } -//================== ein bischen Muell fuer Windows ========================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif - diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx b/filter/source/graphicfilter/ipbm/ipbm.cxx index 6b83fc1021c7..80c825c80791 100644 --- a/filter/source/graphicfilter/ipbm/ipbm.cxx +++ b/filter/source/graphicfilter/ipbm/ipbm.cxx @@ -536,30 +536,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGra return aPBMReader.ReadPBM( rStream, rGraphic ); } -//================== ein bischen Muell fuer Windows ========================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif - diff --git a/filter/source/graphicfilter/ipcd/ipcd.cxx b/filter/source/graphicfilter/ipcd/ipcd.cxx index 0d44993c252d..0b0b56acc5e5 100644 --- a/filter/source/graphicfilter/ipcd/ipcd.cxx +++ b/filter/source/graphicfilter/ipcd/ipcd.cxx @@ -392,31 +392,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGra return aPCDReader.ReadPCD( rStream, rGraphic, pConfigItem ); } -//============================= fuer Windows ================================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif - - diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx index 02c552744299..ca77be58a02e 100644 --- a/filter/source/graphicfilter/ipcx/ipcx.cxx +++ b/filter/source/graphicfilter/ipcx/ipcx.cxx @@ -429,30 +429,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGra return nRetValue; } -//================== ein bischen Muell fuer Windows ========================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif - diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index d1af028149b7..244ca56971be 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -36,12 +36,107 @@ #include <svtools/fltcall.hxx> #include <math.h> -// MT: NOOLDSV, someone should change the code... -enum PenStyle { PEN_NULL, PEN_SOLID, PEN_DOT, PEN_DASH, PEN_DASHDOT }; -enum BrushStyle { BRUSH_NULL, BRUSH_SOLID, BRUSH_HORZ, BRUSH_VERT, - BRUSH_CROSS, BRUSH_DIAGCROSS, BRUSH_UPDIAG, BRUSH_DOWNDIAG, - BRUSH_25, BRUSH_50, BRUSH_75, - BRUSH_BITMAP }; +namespace PictReaderInternal { + //! utilitary class to store a pattern, ... + class Pattern { + public: + //! constructor + Pattern() { + isColor = false; isRead = false; + penStyle=PEN_SOLID; brushStyle = BRUSH_SOLID; + nBitCount = 64; + } + + //! reads black/white pattern from SvStream + ULONG read(SvStream &stream); + //! sets the color + void setColor(Color &col) { isColor = true; color = col; } + /** returns a color which can be "used" to replace the pattern, + * created from ForeColor and BackColor, ... + * + * note: maybe, we must also use some mode PatCopy, ... to define the color + */ + Color getColor(Color bkColor=COL_WHITE, Color fgColor = COL_BLACK) const { + if (isColor) return color; + // we create a gray pattern from nBitCount + double alpha = nBitCount / 64.0; + return Color(BYTE(alpha*fgColor.GetRed()+(1.0-alpha)*bkColor.GetRed()), + BYTE(alpha*fgColor.GetGreen()+(1.0-alpha)*bkColor.GetGreen()), + BYTE(alpha*fgColor.GetBlue()+(1.0-alpha)*bkColor.GetBlue())); + } + + //! returns true if this is the default pattern + bool isDefault() const { return isRead == false; } + + // MT: NOOLDSV, someone should change the code... + enum PenStyle { PEN_NULL, PEN_SOLID, PEN_DOT, PEN_DASH, PEN_DASHDOT }; + enum BrushStyle { BRUSH_NULL, BRUSH_SOLID, BRUSH_HORZ, BRUSH_VERT, + BRUSH_CROSS, BRUSH_DIAGCROSS, BRUSH_UPDIAG, BRUSH_DOWNDIAG, + BRUSH_25, BRUSH_50, BRUSH_75, + BRUSH_BITMAP }; + // Data + enum PenStyle penStyle; + enum BrushStyle brushStyle; + short nBitCount; + + bool isColor; // true if it is a color pattern + Color color; + + protected: + // flag to know if the pattern came from reading the picture, or if it is the default pattern + bool isRead; + }; + + ULONG Pattern::read(SvStream &stream) { + short nx,ny; + unsigned char nbyte[8]; + ULONG nHiBytes, nLoBytes; + isColor = false; + + // Anzahl der Bits im Pattern zaehlen, die auf 1 gesetzt sind: + nBitCount=0; + for (ny=0; ny<8; ny++) { + stream >> ((char&)nbyte[ny]); + for (nx=0; nx<8; nx++) { + if ( (nbyte[ny] & (1<<nx)) != 0 ) nBitCount++; + } + } + + // Pattern in 2 Langworten unterbringen: + nHiBytes=(((((((ULONG)nbyte[0])<<8)| + (ULONG)nbyte[1])<<8)| + (ULONG)nbyte[2])<<8)| + (ULONG)nbyte[3]; + nLoBytes=(((((((ULONG)nbyte[4])<<8)| + (ULONG)nbyte[5])<<8)| + (ULONG)nbyte[6])<<8)| + (ULONG)nbyte[7]; + + // Einen PenStyle machen: + if (nBitCount<=0) penStyle=PEN_NULL; + else if (nBitCount<=16) penStyle=PEN_DOT; + else if (nBitCount<=32) penStyle=PEN_DASHDOT; + else if (nBitCount<=48) penStyle=PEN_DASH; + else penStyle=PEN_SOLID; + + // Einen BrushStyle machen: + if (nHiBytes==0xffffffff && nLoBytes==0xffffffff) brushStyle=BRUSH_SOLID; + else if (nHiBytes==0xff000000 && nLoBytes==0x00000000) brushStyle=BRUSH_HORZ; + else if (nHiBytes==0x80808080 && nLoBytes==0x80808080) brushStyle=BRUSH_VERT; + else if (nHiBytes==0xff808080 && nLoBytes==0x80808080) brushStyle=BRUSH_CROSS; + else if (nHiBytes==0x01824428 && nLoBytes==0x10284482) brushStyle=BRUSH_DIAGCROSS; + else if (nHiBytes==0x80402010 && nLoBytes==0x08040201) brushStyle=BRUSH_UPDIAG; + else if (nHiBytes==0x01020408 && nLoBytes==0x10204080) brushStyle=BRUSH_DOWNDIAG; + else if (nBitCount<=24) brushStyle=BRUSH_25; + else if (nBitCount<=40) brushStyle=BRUSH_50; + else if (nBitCount<=56) brushStyle=BRUSH_75; + else brushStyle=BRUSH_SOLID; + + isRead = true; + + return 8; + } +} //============================ PictReader ================================== @@ -51,7 +146,7 @@ enum PictDrawingMethod { }; class PictReader { - + typedef class PictReaderInternal::Pattern Pattern; private: SvStream * pPict; // Die einzulesende Pict-Datei @@ -67,11 +162,11 @@ private: Point aTextPosition; Color aActForeColor; Color aActBackColor; - PenStyle eActPenPenStyle; - BrushStyle eActPenBrushStyle; - BrushStyle eActFillStyle; - BrushStyle eActBackStyle; + Pattern eActPenPattern; + Pattern eActFillPattern; + Pattern eActBackPattern; USHORT nActPenSize; + // Note: Postscript mode is stored by setting eActRop to ROP_1 RasterOp eActROP; PictDrawingMethod eActMethod; Size aActOvalSize; @@ -100,9 +195,7 @@ private: ULONG ReadPolygon(Polygon & rPoly); - ULONG ReadPattern(PenStyle * pPenStyle, BrushStyle * pBrushStyle); - - ULONG ReadPixPattern(PenStyle * pPenStyle, BrushStyle * pBrushStyle); + ULONG ReadPixPattern(Pattern &pattern); Rectangle aLastRect; ULONG ReadAndDrawRect(PictDrawingMethod eMethod); @@ -146,9 +239,11 @@ private: void SetLineColor( const Color& rColor ); void SetFillColor( const Color& rColor ); + // OSNOLA: returns the text encoding which must be used for system id + static rtl_TextEncoding GetTextEncoding (USHORT fId = 0xFFFF); public: - PictReader() {} + PictReader() { aActFont.SetCharSet(GetTextEncoding()); } void ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile ); // Liesst aus dem Stream eine Pict-Datei und fuellt das GDIMetaFile @@ -208,6 +303,42 @@ public: } //=================== Methoden von PictReader ============================== +rtl_TextEncoding PictReader::GetTextEncoding (USHORT fId) { + static bool first = true; + static rtl_TextEncoding enc = RTL_TEXTENCODING_APPLE_ROMAN; + if (first) { + rtl_TextEncoding def = gsl_getSystemTextEncoding(); + // we keep gsl_getSystemTextEncoding only if it is a mac encoding + switch(def) { + case RTL_TEXTENCODING_APPLE_ROMAN: + case RTL_TEXTENCODING_APPLE_ARABIC: + case RTL_TEXTENCODING_APPLE_CENTEURO: + case RTL_TEXTENCODING_APPLE_CROATIAN: + case RTL_TEXTENCODING_APPLE_CYRILLIC: + case RTL_TEXTENCODING_APPLE_DEVANAGARI: + case RTL_TEXTENCODING_APPLE_FARSI: + case RTL_TEXTENCODING_APPLE_GREEK: + case RTL_TEXTENCODING_APPLE_GUJARATI: + case RTL_TEXTENCODING_APPLE_GURMUKHI: + case RTL_TEXTENCODING_APPLE_HEBREW: + case RTL_TEXTENCODING_APPLE_ICELAND: + case RTL_TEXTENCODING_APPLE_ROMANIAN: + case RTL_TEXTENCODING_APPLE_THAI: + case RTL_TEXTENCODING_APPLE_TURKISH: + case RTL_TEXTENCODING_APPLE_UKRAINIAN: + case RTL_TEXTENCODING_APPLE_CHINSIMP: + case RTL_TEXTENCODING_APPLE_CHINTRAD: + case RTL_TEXTENCODING_APPLE_JAPANESE: + case RTL_TEXTENCODING_APPLE_KOREAN: + enc = def; break; + default: break; + } + first = false; + } + if (fId == 13) return RTL_TEXTENCODING_ADOBE_DINGBATS; // CHECKME + if (fId == 23) return RTL_TEXTENCODING_ADOBE_SYMBOL; + return enc; +} void PictReader::SetLineColor( const Color& rColor ) { @@ -344,61 +475,7 @@ ULONG PictReader::ReadPolygon(Polygon & rPoly) return nDataSize; } -ULONG PictReader::ReadPattern(PenStyle * pPenStyle, BrushStyle * pBrushStyle) -{ - short nx,ny,nBitCount; - unsigned char nbyte[8]; - BrushStyle eBrStyle; - PenStyle ePnStyle; - ULONG nHiBytes, nLoBytes; - - // Anzahl der Bits im Pattern zaehlen, die auf 1 gesetzt sind: - nBitCount=0; - for (ny=0; ny<8; ny++) { - *pPict >> ((char&)nbyte[ny]); - for (nx=0; nx<8; nx++) { - if ( (nbyte[ny] & (1<<nx)) != 0 ) nBitCount++; - } - } - - // Pattern in 2 Langworten unterbringen: - nHiBytes=(((((((ULONG)nbyte[0])<<8)| - (ULONG)nbyte[1])<<8)| - (ULONG)nbyte[2])<<8)| - (ULONG)nbyte[3]; - nLoBytes=(((((((ULONG)nbyte[4])<<8)| - (ULONG)nbyte[5])<<8)| - (ULONG)nbyte[6])<<8)| - (ULONG)nbyte[7]; - - // Einen PenStyle machen: - if (nBitCount<=0) ePnStyle=PEN_NULL; - else if (nBitCount<=16) ePnStyle=PEN_DOT; - else if (nBitCount<=32) ePnStyle=PEN_DASHDOT; - else if (nBitCount<=48) ePnStyle=PEN_DASH; - else ePnStyle=PEN_SOLID; - - // Einen BrushStyle machen: - if (nHiBytes==0xffffffff && nLoBytes==0xffffffff) eBrStyle=BRUSH_SOLID; - else if (nHiBytes==0xff000000 && nLoBytes==0x00000000) eBrStyle=BRUSH_HORZ; - else if (nHiBytes==0x80808080 && nLoBytes==0x80808080) eBrStyle=BRUSH_VERT; - else if (nHiBytes==0xff808080 && nLoBytes==0x80808080) eBrStyle=BRUSH_CROSS; - else if (nHiBytes==0x01824428 && nLoBytes==0x10284482) eBrStyle=BRUSH_DIAGCROSS; - else if (nHiBytes==0x80402010 && nLoBytes==0x08040201) eBrStyle=BRUSH_UPDIAG; - else if (nHiBytes==0x01020408 && nLoBytes==0x10204080) eBrStyle=BRUSH_DOWNDIAG; - else if (nBitCount<=24) eBrStyle=BRUSH_25; - else if (nBitCount<=40) eBrStyle=BRUSH_50; - else if (nBitCount<=56) eBrStyle=BRUSH_75; - else eBrStyle=BRUSH_SOLID; - - if (pPenStyle!=0) *pPenStyle=ePnStyle; - - if (pBrushStyle!=0) *pBrushStyle=eBrStyle; - - return 8; -} - -ULONG PictReader::ReadPixPattern(PenStyle * pPenStyle, BrushStyle * pBrushStyle) +ULONG PictReader::ReadPixPattern(PictReader::Pattern &pattern) { // Keine Ahnung, ob dies richtig ist, weil kein Bild gefunden, das // PixPatterns enthaelt. Auch hier nur der Versuch, die Groesse der Daten zu @@ -411,13 +488,18 @@ ULONG PictReader::ReadPixPattern(PenStyle * pPenStyle, BrushStyle * pBrushStyle) *pPict >> nPatType; if (nPatType==1) { - ReadPattern(pPenStyle,pBrushStyle); + pattern.read(*pPict); nDataSize=ReadPixMapEtc(aBMP,FALSE,TRUE,NULL,NULL,FALSE,FALSE); + // CHANGEME: use average pixmap colors to update the pattern, ... if (nDataSize!=0xffffffff) nDataSize+=10; } else if (nPatType==2) { - ReadPattern(pPenStyle,pBrushStyle); - pPict->SeekRel(6); // RGBColor + pattern.read(*pPict); + // RGBColor + USHORT nR, nG, nB; + *pPict >> nR >> nG >> nB; + Color col((BYTE) ( nR >> 8 ), (BYTE) ( nG >> 8 ), (BYTE) ( nB >> 8 ) ); + pattern.setColor(col); nDataSize=16; } else nDataSize=0xffffffff; @@ -444,14 +526,15 @@ ULONG PictReader::ReadAndDrawRoundRect(PictDrawingMethod eMethod) { ReadRectangle(aLastRoundRect); DrawingMethod(eMethod); - pVirDev->DrawRect(aLastRoundRect,aActOvalSize.Width(),aActOvalSize.Height()); + // Osnola: the corner's size is equal to aActOvalSize/2, see Quickdraw Drawing Reference 3-63 + pVirDev->DrawRect(aLastRoundRect,(aActOvalSize.Width()+1)/2,(aActOvalSize.Height()+1)/2); return 8; } ULONG PictReader::ReadAndDrawSameRoundRect(PictDrawingMethod eMethod) { DrawingMethod(eMethod); - pVirDev->DrawRect(aLastRoundRect,aActOvalSize.Width(),aActOvalSize.Height()); + pVirDev->DrawRect(aLastRoundRect,(aActOvalSize.Width()+1)/2,(aActOvalSize.Height()+1)/2); return 0; } @@ -561,6 +644,23 @@ ULONG PictReader::ReadAndDrawSameRgn(PictDrawingMethod eMethod) void PictReader::DrawingMethod(PictDrawingMethod eMethod) { if( eActMethod==eMethod ) return; + if (eActROP == ROP_1) { + // Osnola: ignore postscript command + if (eMethod == PDM_TEXT) { + Font invisibleFont; + invisibleFont.SetColor(Color(COL_TRANSPARENT)); + invisibleFont.SetFillColor(Color(COL_TRANSPARENT)); + invisibleFont.SetTransparent(TRUE); + pVirDev->SetFont(invisibleFont); + } + else { + SetLineColor( Color(COL_TRANSPARENT) ); + SetFillColor( Color(COL_TRANSPARENT) ); + } + pVirDev->SetRasterOp(ROP_OVERPAINT); + eActMethod=eMethod; + return; + } switch (eMethod) { case PDM_FRAME: SetLineColor( aActForeColor ); @@ -569,22 +669,31 @@ void PictReader::DrawingMethod(PictDrawingMethod eMethod) break; case PDM_PAINT: SetLineColor( Color(COL_TRANSPARENT) ); - SetFillColor( aActForeColor ); + if (eActPenPattern.isDefault()) + SetFillColor( aActForeColor ); + else + SetFillColor(eActPenPattern.getColor(aActBackColor, aActForeColor)); pVirDev->SetRasterOp(eActROP); break; case PDM_ERASE: SetLineColor( Color(COL_TRANSPARENT) ); - SetFillColor( aActForeColor ); + if (eActBackPattern.isDefault()) + SetFillColor( aActBackColor );// Osnola: previously aActForeColor + else // checkMe + SetFillColor(eActBackPattern.getColor(COL_BLACK, aActBackColor)); pVirDev->SetRasterOp(ROP_OVERPAINT); break; - case PDM_INVERT: + case PDM_INVERT: // checkme SetLineColor( Color(COL_TRANSPARENT)); SetFillColor( Color( COL_BLACK ) ); pVirDev->SetRasterOp(ROP_INVERT); break; case PDM_FILL: SetLineColor( Color(COL_TRANSPARENT) ); - SetFillColor( aActForeColor ); + if (eActFillPattern.isDefault()) + SetFillColor( aActForeColor ); + else + SetFillColor(eActFillPattern.getColor(aActBackColor, aActForeColor)); pVirDev->SetRasterOp(ROP_OVERPAINT); break; case PDM_TEXT: @@ -615,7 +724,7 @@ ULONG PictReader::ReadAndDrawText() while ( nLen > 0 && ( (unsigned char)sText[ nLen - 1 ] ) < 32 ) nLen--; sText[ nLen ] = 0; - String aString( (const sal_Char*)&sText, gsl_getSystemTextEncoding() ); + String aString( (const sal_Char*)&sText, aActFont.GetCharSet());// OSNOLA: gsl_getSystemTextEncoding() ); pVirDev->DrawText( Point( aTextPosition.X(), aTextPosition.Y() ), aString ); return nDataLen; } @@ -1116,9 +1225,9 @@ ULONG PictReader::ReadData(USHORT nOpcode) break; } case 0x0002: // BkPat - nDataSize=ReadPattern(NULL,&eActBackStyle); - eActMethod=PDM_UNDEFINED; - break; + nDataSize=eActBackPattern.read(*pPict); + eActMethod=PDM_UNDEFINED; + break; case 0x0003: // TxFont *pPict >> nUSHORT; @@ -1129,8 +1238,7 @@ ULONG PictReader::ReadData(USHORT nOpcode) else if (nUSHORT == 22) aActFont.SetFamily(FAMILY_MODERN); else if (nUSHORT <= 1023) aActFont.SetFamily(FAMILY_SWISS); else aActFont.SetFamily(FAMILY_ROMAN); - if ( nUSHORT == 23 ) aActFont.SetCharSet( RTL_TEXTENCODING_SYMBOL ); - else aActFont.SetCharSet( gsl_getSystemTextEncoding() ); + aActFont.SetCharSet(GetTextEncoding(nUSHORT)); eActMethod=PDM_UNDEFINED; nDataSize=2; break; @@ -1170,7 +1278,10 @@ ULONG PictReader::ReadData(USHORT nOpcode) } case 0x0008: // PnMode *pPict >> nUSHORT; - switch (nUSHORT & 0x0007) { + // internal code for postscript command (Quickdraw Reference Drawing B-30,B-34) + if (nUSHORT==23) eActROP = ROP_1; + else { + switch (nUSHORT & 0x0007) { case 0: eActROP=ROP_OVERPAINT; break; // Copy case 1: eActROP=ROP_OVERPAINT; break; // Or case 2: eActROP=ROP_XOR; break; // Xor @@ -1179,18 +1290,19 @@ ULONG PictReader::ReadData(USHORT nOpcode) case 5: eActROP=ROP_OVERPAINT; break; // notOr case 6: eActROP=ROP_XOR; break; // notXor case 7: eActROP=ROP_OVERPAINT; break; // notBic + } } eActMethod=PDM_UNDEFINED; nDataSize=2; break; case 0x0009: // PnPat - nDataSize=ReadPattern(&eActPenPenStyle,&eActPenBrushStyle); + nDataSize=eActPenPattern.read(*pPict); eActMethod=PDM_UNDEFINED; break; case 0x000a: // FillPat - nDataSize=ReadPattern(NULL,&eActFillStyle); + nDataSize=eActFillPattern.read(*pPict); eActMethod=PDM_UNDEFINED; break; @@ -1232,17 +1344,17 @@ ULONG PictReader::ReadData(USHORT nOpcode) break; case 0x0012: // BkPixPat - nDataSize=ReadPixPattern(NULL,&eActBackStyle); + nDataSize=ReadPixPattern(eActBackPattern); eActMethod=PDM_UNDEFINED; break; case 0x0013: // PnPixPat - nDataSize=ReadPixPattern(&eActPenPenStyle,&eActPenBrushStyle); + nDataSize=ReadPixPattern(eActPenPattern); eActMethod=PDM_UNDEFINED; break; case 0x0014: // FillPixPat - nDataSize=ReadPixPattern(NULL,&eActFillStyle); + nDataSize=ReadPixPattern(eActFillPattern); eActMethod=PDM_UNDEFINED; break; @@ -1361,8 +1473,7 @@ ULONG PictReader::ReadData(USHORT nOpcode) else if (nUSHORT == 22) aActFont.SetFamily(FAMILY_MODERN); else if (nUSHORT <= 1023) aActFont.SetFamily(FAMILY_SWISS); else aActFont.SetFamily(FAMILY_ROMAN); - if (nUSHORT==23) aActFont.SetCharSet( RTL_TEXTENCODING_SYMBOL); - else aActFont.SetCharSet( gsl_getSystemTextEncoding() ); + aActFont.SetCharSet(GetTextEncoding(nUSHORT)); *pPict >> nByteLen; nLen=((USHORT)nByteLen)&0x00ff; pPict->Read( &sFName, nLen ); sFName[ nLen ] = 0; @@ -1803,16 +1914,12 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile ) aActForeColor = Color(COL_BLACK); aActBackColor = Color(COL_WHITE); - eActPenPenStyle = PEN_SOLID; - eActPenBrushStyle = BRUSH_SOLID; - eActFillStyle = BRUSH_SOLID; - eActBackStyle = BRUSH_SOLID; nActPenSize = 1; eActROP = ROP_OVERPAINT; eActMethod = PDM_UNDEFINED; aActOvalSize = Size(1,1); - aActFont.SetCharSet( gsl_getSystemTextEncoding() ); + aActFont.SetCharSet( GetTextEncoding()); aActFont.SetFamily(FAMILY_SWISS); aActFont.SetSize(Size(0,12)); aActFont.SetAlign(ALIGN_BASELINE); @@ -1909,29 +2016,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicImport( SvStream& rIStm, Graphic & rGraph return bRet; } -//================== ein bischen Muell fuer Windows ========================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx index 70cd1ab13f29..5a52c17956ed 100644 --- a/filter/source/graphicfilter/ipsd/ipsd.cxx +++ b/filter/source/graphicfilter/ipsd/ipsd.cxx @@ -735,29 +735,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGra return aPSDReader.ReadPSD( rStream, rGraphic ); } -//================== ein bischen Muell fuer Windows ========================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx index 6255dc486537..c20a85354471 100644 --- a/filter/source/graphicfilter/iras/iras.cxx +++ b/filter/source/graphicfilter/iras/iras.cxx @@ -354,30 +354,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGra return aRASReader.ReadRAS( rStream, rGraphic ); } -//================== ein bischen Muell fuer Windows ========================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif - diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx index 5dcb5f82ccab..38b97a025b16 100644 --- a/filter/source/graphicfilter/itga/itga.cxx +++ b/filter/source/graphicfilter/itga/itga.cxx @@ -729,30 +729,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGra return aTGAReader.ReadTGA( rStream, rGraphic ); } -//================== ein bischen Muell fuer Windows ========================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif - diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index 5ad400fc3149..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 ) - { - 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 ) + if ( bByteSwap ) { - 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 ) @@ -1312,31 +1332,3 @@ extern "C" BOOL __LOADONCALLAPI GraphicImport(SvStream & rStream, Graphic & rGra return TRUE; } -//============================= fuer Windows ================================== -#ifndef GCC -#endif - -#ifdef WIN - -static HINSTANCE hDLLInst = 0; // HANDLE der DLL - -extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR ) -{ -#ifndef WNT - if ( nHeap ) - UnlockData( 0 ); -#endif - - hDLLInst = hDLL; - - return TRUE; -} - -extern "C" int CALLBACK WEP( int ) -{ - return 1; -} - -#endif - - diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 805849279e6b..82b0480a3d0c 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -94,9 +94,7 @@ #include <vcl/virdev.hxx> #include <rtl/crc.h> #include <vos/xception.hxx> -#ifndef _VOS_NO_NAMESPACE using namespace vos; -#endif using namespace ::rtl; using namespace ::com::sun::star; diff --git a/filter/source/msfilter/mscodec.cxx b/filter/source/msfilter/mscodec.cxx index de17da6bde59..c6feb4fb57dd 100644 --- a/filter/source/msfilter/mscodec.cxx +++ b/filter/source/msfilter/mscodec.cxx @@ -34,12 +34,16 @@ #include <string.h> #include <tools/solar.h> +#include <comphelper/sequenceashashmap.hxx> +#include <comphelper/docpasswordhelper.hxx> + #define DEBUG_MSO_ENCRYPTION_STD97 0 #if DEBUG_MSO_ENCRYPTION_STD97 #include <stdio.h> #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>( (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,15 +266,18 @@ 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); } +#if 0 #if DEBUG_MSO_ENCRYPTION_STD97 static void lcl_PrintKeyData(const sal_uInt8* pKeyData, const char* msg) { @@ -261,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) @@ -276,65 +310,65 @@ 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); + fprintf(stdout, "MSCodec_Std97::InitCodec: --begin\n");fflush(stdout); #endif - sal_uInt8 pKeyData[64]; - int i, n; + sal_Bool bResult = sal_False; - // 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); + ::comphelper::SequenceAsHashMap aHashData( aData ); + uno::Sequence< sal_Int8 > aKey = aHashData.getUnpackedValueOrDefault( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "STD97EncryptionKey" ) ), uno::Sequence< sal_Int8 >() ); - lcl_PrintKeyData(pKeyData, "password data"); - - // 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; + lcl_PrintDigest(m_pDigestValue, "digest value"); + lcl_PrintDigest(m_pDocId, "DocId value"); + } + 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); + + lcl_PrintDigest(m_pDocId, "DocId value"); } bool MSCodec_Std97::VerifyKey ( @@ -411,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; @@ -528,6 +562,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/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 3f8d632b882b..29874b933d85 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -128,9 +128,7 @@ #include <ucbhelper/content.hxx> #include <ucbhelper/contentbroker.hxx> #include <vos/xception.hxx> -#ifndef _VOS_NO_NAMESPACE using namespace vos; -#endif #include "svx/EnhancedCustomShapeTypeNames.hxx" #include "svx/EnhancedCustomShapeGeometry.hxx" #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> diff --git a/filter/source/msfilter/powerpoint/pptimporteruno.cxx b/filter/source/msfilter/powerpoint/pptimporteruno.cxx index c1089f66a5c3..325d360344cf 100644 --- a/filter/source/msfilter/powerpoint/pptimporteruno.cxx +++ b/filter/source/msfilter/powerpoint/pptimporteruno.cxx @@ -51,37 +51,6 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -// ----------------------- -// - component_writeInfo - -// ----------------------- - -extern "C" sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey ) -{ - sal_Bool bRet = sal_False; - - if( pRegistryKey ) - { - try - { - NMSP_UNO::Reference< NMSP_REGISTRY::XRegistryKey > xNewKey( - reinterpret_cast< NMSP_REGISTRY::XRegistryKey * >( pRegistryKey )->createKey( - PptImporter_getImplementationName() ) ); - xNewKey = xNewKey->createKey( B2UCONST( "/UNO/SERVICES" ) ); - const SEQ( NMSP_RTL::OUString )& rSNL = PptImporter_getSupportedServiceNames(); - const NMSP_RTL::OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - bRet = sal_True; - } - catch( NMSP_REGISTRY::InvalidRegistryException& ) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - - return bRet; -} - // ------------------------ // - component_getFactory - // ------------------------ diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index bb125bd37a47..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" @@ -382,8 +384,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) @@ -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... @@ -1017,12 +1019,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 ) ), @@ -1043,6 +1045,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 ) ) { @@ -1081,6 +1085,8 @@ ImpPDFTabSecurityPage::ImpPDFTabSecurityPage( Window* i_pParent, (*pCurrent++)->SetPosPixel( aNewPos ); } } + + maPbSetPwd.SetClickHdl( LINK( this, ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl ) ); } // ----------------------------------------------------------------------------- @@ -1100,13 +1106,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->maPreparedOwnerPassword = maPreparedOwnerPassword; //verify print status paParent->mnPrint = 0; @@ -1135,10 +1139,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,39 +1184,44 @@ 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(); - enablePermissionControls(); -} + { + rtl::OUString aUserPW( aPwdDialog.GetPassword() ); + rtl::OUString aOwnerPW( aPwdDialog.GetPassword2() ); -IMPL_LINK( ImpPDFTabSecurityPage, ClickmaPbUserPwdHdl, void*, EMPTYARG ) -{ - ImplPwdPushButton(msUserPwdTitle, msUserPassword ); - return 0; -} + mbHaveUserPassword = (aUserPW.getLength() != 0); + mbHaveOwnerPassword = (aOwnerPW.getLength() != 0); -IMPL_LINK( ImpPDFTabSecurityPage, ClickmaPbOwnerPwdHdl, void*, EMPTYARG ) -{ - ImplPwdPushButton( msOwnerPwdTitle, msOwnerPassword ); + mxPreparedPasswords = vcl::PDFWriter::InitEncryption( aOwnerPW, aUserPW, true ); + + if( mbHaveOwnerPassword ) + { + maPreparedOwnerPassword = comphelper::OStorageHelper::CreatePackageEncryptionData( aOwnerPW ); + } + else + maPreparedOwnerPassword = Sequence< NamedValue >(); + // trash clear text passwords string memory + rtl_zeroMemory( (void*)aUserPW.getStr(), aUserPW.getLength() ); + rtl_zeroMemory( (void*)aOwnerPW.getStr(), aOwnerPW.getLength() ); + } + enablePermissionControls(); return 0; } 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.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..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 - // ---------------- @@ -126,14 +128,14 @@ protected: sal_Bool mbFirstPageLeft; sal_Bool mbEncrypt; - String msUserPassword; sal_Bool mbRestrictPermissions; - String msOwnerPassword; + com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > maPreparedOwnerPassword; 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; @@ -314,12 +316,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; @@ -339,16 +342,18 @@ class ImpPDFTabSecurityPage : public SfxTabPage CheckBox maCbEnableCopy; CheckBox maCbEnableAccessibility; - String msUserPassword; String msUserPwdTitle; - String msOwnerPassword; + bool mbHaveOwnerPassword; + bool mbHaveUserPassword; + com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > maPreparedOwnerPassword; String msOwnerPwdTitle; + com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > mxPreparedPasswords; + 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..1c941d6a9972 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"; }; ////////////////////////////////////////////////////////////// @@ -65,24 +65,28 @@ TabPage RID_PDF_TAB_GENER }; RadioButton RB_ALL { + HelpID = "filter:RadioButton:RID_PDF_TAB_GENER:RB_ALL"; Pos = MAP_APPFONT ( 12 , 14 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "~All"; }; RadioButton RB_RANGE { + HelpID = "filter:RadioButton:RID_PDF_TAB_GENER:RB_RANGE"; Pos = MAP_APPFONT ( 12 , 27 ) ; Size = MAP_APPFONT ( 101 , 10 ) ; Text[ en-US ] = "~Pages"; }; Edit ED_PAGES { + HelpID = "filter:Edit:RID_PDF_TAB_GENER:ED_PAGES"; Border = TRUE ; Pos = MAP_APPFONT ( 116, 26 ) ; Size = MAP_APPFONT ( 48 , 12 ) ; }; RadioButton RB_SELECTION { + HelpID = "filter:RadioButton:RID_PDF_TAB_GENER:RB_SELECTION"; Pos = MAP_APPFONT ( 12 , 40 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "~Selection"; @@ -95,12 +99,14 @@ TabPage RID_PDF_TAB_GENER }; RadioButton RB_LOSSLESSCOMPRESSION { + HelpID = "filter:RadioButton:RID_PDF_TAB_GENER:RB_LOSSLESSCOMPRESSION"; Pos = MAP_APPFONT ( 12 , 64 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "~Lossless compression"; }; RadioButton RB_JPEGCOMPRESSION { + HelpID = "filter:RadioButton:RID_PDF_TAB_GENER:RB_JPEGCOMPRESSION"; Pos = MAP_APPFONT ( 12 , 76 ) ; Size = MAP_APPFONT ( 158, 10 ) ; Text[ en-US ] = "~JPEG compression"; @@ -113,6 +119,7 @@ TabPage RID_PDF_TAB_GENER }; MetricField NF_QUALITY { + HelpID = "filter:MetricField:RID_PDF_TAB_GENER:NF_QUALITY"; Border = TRUE ; Pos = MAP_APPFONT ( 116, 88 ) ; Size = MAP_APPFONT ( 48, 12 ) ; @@ -124,6 +131,7 @@ TabPage RID_PDF_TAB_GENER }; CheckBox CB_REDUCEIMAGERESOLUTION { + HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_REDUCEIMAGERESOLUTION"; Pos = MAP_APPFONT ( 12 , 103 ) ; Size = MAP_APPFONT ( 101 , 10 ) ; TabStop = TRUE ; @@ -131,6 +139,7 @@ TabPage RID_PDF_TAB_GENER }; ComboBox CO_REDUCEIMAGERESOLUTION { + HelpID = "filter:ComboBox:RID_PDF_TAB_GENER:CO_REDUCEIMAGERESOLUTION"; Pos = MAP_APPFONT ( 116 , 102 ) ; Size = MAP_APPFONT ( 48 , 50 ) ; TabStop = TRUE ; @@ -152,6 +161,7 @@ TabPage RID_PDF_TAB_GENER }; CheckBox CB_PDFA_1B_SELECT { + HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_PDFA_1B_SELECT"; Pos = MAP_APPFONT ( 12, 128 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -159,6 +169,7 @@ TabPage RID_PDF_TAB_GENER }; CheckBox CB_TAGGEDPDF { + HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_TAGGEDPDF"; Pos = MAP_APPFONT ( 12 , 141 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -166,6 +177,7 @@ TabPage RID_PDF_TAB_GENER }; CheckBox CB_EXPORTFORMFIELDS { + HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTFORMFIELDS"; Pos = MAP_APPFONT ( 12 , 154 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -179,6 +191,7 @@ TabPage RID_PDF_TAB_GENER }; ListBox LB_FORMSFORMAT { + HelpID = "filter:ListBox:RID_PDF_TAB_GENER:LB_FORMSFORMAT"; Border = TRUE ; Pos = MAP_APPFONT ( 126, 166 ) ; Size = MAP_APPFONT ( 38, 48 ) ; @@ -195,6 +208,7 @@ TabPage RID_PDF_TAB_GENER }; CheckBox CB_ALLOWDUPLICATEFIELDNAMES { + HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_ALLOWDUPLICATEFIELDNAMES"; Pos = MAP_APPFONT( 30, 178 ); Size = MAP_APPFONT( 128, 10 ); TabStop = TRUE; @@ -202,6 +216,7 @@ TabPage RID_PDF_TAB_GENER }; CheckBox CB_EXPORTBOOKMARKS { + HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTBOOKMARKS"; Pos = MAP_APPFONT ( 12 , 190 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -209,6 +224,7 @@ TabPage RID_PDF_TAB_GENER }; CheckBox CB_EXPORTNOTES { + HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTNOTES"; Pos = MAP_APPFONT ( 12 , 203 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -216,6 +232,7 @@ TabPage RID_PDF_TAB_GENER }; CheckBox CB_EXPORTNOTESPAGES { + HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTNOTESPAGES"; Pos = MAP_APPFONT ( 12 , 216 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -223,6 +240,7 @@ TabPage RID_PDF_TAB_GENER }; CheckBox CB_EXPORTEMPTYPAGES { + HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTEMPTYPAGES"; Pos = MAP_APPFONT ( 12 , 229 ) ; Size = MAP_APPFONT ( 158 , 16 ) ; TabStop = TRUE ; @@ -231,6 +249,7 @@ TabPage RID_PDF_TAB_GENER }; CheckBox CB_EMBEDSTANDARDFONTS { + HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EMBEDSTANDARDFONTS"; Pos = MAP_APPFONT ( 12 , 248 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -238,6 +257,7 @@ TabPage RID_PDF_TAB_GENER }; CheckBox CB_ADDSTREAM { + HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_ADDSTREAM"; Pos = MAP_APPFONT ( 12 , 261 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -263,18 +283,21 @@ TabPage RID_PDF_TAB_OPNFTR }; RadioButton RB_OPNMODE_PAGEONLY { + HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_OPNMODE_PAGEONLY"; Pos = MAP_APPFONT ( 12 , 14 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "~Page only" ; }; RadioButton RB_OPNMODE_OUTLINE { + HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_OPNMODE_OUTLINE"; Pos = MAP_APPFONT ( 12 , 26 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "~Bookmarks and page" ; }; RadioButton RB_OPNMODE_THUMBS { + HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_OPNMODE_THUMBS"; Pos = MAP_APPFONT ( 12 , 38 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "~Thumbnails and page" ; @@ -288,6 +311,7 @@ TabPage RID_PDF_TAB_OPNFTR }; NumericField NUM_MAGNF_INITIAL_PAGE { + HelpID = "filter:NumericField:RID_PDF_TAB_OPNFTR:NUM_MAGNF_INITIAL_PAGE"; Pos = MAP_APPFONT( 124, 52 ); Size = MAP_APPFONT( 40, 12 ); Value = 1; @@ -305,6 +329,7 @@ TabPage RID_PDF_TAB_OPNFTR }; RadioButton RB_MAGNF_DEFAULT { + HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_MAGNF_DEFAULT"; // see PDF ref v 1.5 tab 8.2, pg. 542 ( /XYZ ) Pos = MAP_APPFONT ( 12 , 80 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; @@ -312,6 +337,7 @@ TabPage RID_PDF_TAB_OPNFTR }; RadioButton RB_MAGNF_WIND { + HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_MAGNF_WIND"; // see PDF ref v 1.5 tab 8.2, pg. 542 ( /Fit ) Pos = MAP_APPFONT ( 12 , 92 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; @@ -319,6 +345,7 @@ TabPage RID_PDF_TAB_OPNFTR }; RadioButton RB_MAGNF_WIDTH { + HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_MAGNF_WIDTH"; // see PDF ref v 1.5 tab 8.2, pg. 542 ( /FitH top ) Pos = MAP_APPFONT ( 12 , 104 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; @@ -326,6 +353,7 @@ TabPage RID_PDF_TAB_OPNFTR }; RadioButton RB_MAGNF_VISIBLE { + HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_MAGNF_VISIBLE"; // see PDF ref v 1.5 tab 8.2, pg. 542 ( /FitBH top ) Pos = MAP_APPFONT ( 12 , 116 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; @@ -333,6 +361,7 @@ TabPage RID_PDF_TAB_OPNFTR }; RadioButton RB_MAGNF_ZOOM { + HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_MAGNF_ZOOM"; // see PDF ref v 1.6 tab 8.2, pg. 551 ( /XYZ left top zoom ) Pos = MAP_APPFONT ( 12 , 128 ) ; Size = MAP_APPFONT ( 109 , 10 ) ; @@ -340,6 +369,7 @@ TabPage RID_PDF_TAB_OPNFTR }; MetricField NUM_MAGNF_ZOOM { + HelpID = "filter:MetricField:RID_PDF_TAB_OPNFTR:NUM_MAGNF_ZOOM"; Pos = MAP_APPFONT( 124, 128 ) ; Size = MAP_APPFONT( 40, 12 ) ; Unit = FUNIT_PERCENT; @@ -358,30 +388,35 @@ TabPage RID_PDF_TAB_OPNFTR }; RadioButton RB_PGLY_DEFAULT { + HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_PGLY_DEFAULT"; Pos = MAP_APPFONT ( 12 , 158 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "D~efault" ; }; RadioButton RB_PGLY_SINGPG { + HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_PGLY_SINGPG"; Pos = MAP_APPFONT ( 12 , 170 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "~Single page" ; }; RadioButton RB_PGLY_CONT { + HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_PGLY_CONT"; Pos = MAP_APPFONT ( 12 , 182 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "~Continuous" ; }; RadioButton RB_PGLY_CONTFAC { + HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_PGLY_CONTFAC"; Pos = MAP_APPFONT ( 12 , 194 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "C~ontinuous facing" ; }; CheckBox CB_PGLY_FIRSTLEFT { + HelpID = "filter:CheckBox:RID_PDF_TAB_OPNFTR:CB_PGLY_FIRSTLEFT"; Pos = MAP_APPFONT ( 22 , 206 ) ; Size = MAP_APPFONT ( 148 , 10 ) ; Text[ en-US ] = "First page is ~left" ; @@ -407,6 +442,7 @@ TabPage RID_PDF_TAB_VPREFER CheckBox CB_WNDOPT_RESINIT { + HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_WNDOPT_RESINIT"; Pos = MAP_APPFONT ( 12 , 14 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -414,6 +450,7 @@ TabPage RID_PDF_TAB_VPREFER }; CheckBox CB_WNDOPT_CNTRWIN { + HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_WNDOPT_CNTRWIN"; Pos = MAP_APPFONT ( 12 , 26 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -421,12 +458,14 @@ TabPage RID_PDF_TAB_VPREFER }; CheckBox CB_WNDOPT_OPNFULL { + HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_WNDOPT_OPNFULL"; Pos = MAP_APPFONT ( 12 , 38 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "~Open in full screen mode" ; }; CheckBox CB_DISPDOCTITLE { + HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_DISPDOCTITLE"; Pos = MAP_APPFONT ( 12 , 50 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -442,6 +481,7 @@ TabPage RID_PDF_TAB_VPREFER }; CheckBox CB_UOP_HIDEVMENUBAR { + HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_UOP_HIDEVMENUBAR"; Pos = MAP_APPFONT ( 12 , 76 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -449,6 +489,7 @@ TabPage RID_PDF_TAB_VPREFER }; CheckBox CB_UOP_HIDEVTOOLBAR { + HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_UOP_HIDEVTOOLBAR"; Pos = MAP_APPFONT ( 12 , 88 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -456,6 +497,7 @@ TabPage RID_PDF_TAB_VPREFER }; CheckBox CB_UOP_HIDEVWINCTRL { + HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_UOP_HIDEVWINCTRL"; Pos = MAP_APPFONT ( 12 , 100 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -471,6 +513,7 @@ TabPage RID_PDF_TAB_VPREFER }; CheckBox CB_TRANSITIONEFFECTS { + HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_TRANSITIONEFFECTS"; Pos = MAP_APPFONT ( 12 , 126 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -485,18 +528,21 @@ TabPage RID_PDF_TAB_VPREFER }; RadioButton RB_ALLBOOKMARKLEVELS { + HelpID = "filter:RadioButton:RID_PDF_TAB_VPREFER:RB_ALLBOOKMARKLEVELS"; Pos = MAP_APPFONT ( 12 , 152 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "All bookmark levels"; }; RadioButton RB_VISIBLEBOOKMARKLEVELS { + HelpID = "filter:RadioButton:RID_PDF_TAB_VPREFER:RB_VISIBLEBOOKMARKLEVELS"; Pos = MAP_APPFONT ( 12 , 166 ) ; Size = MAP_APPFONT ( 117 , 10 ) ; Text[ en-US ] = "Visible bookmark levels"; }; NumericField NUM_BOOKMARKLEVELS { + HelpID = "filter:NumericField:RID_PDF_TAB_VPREFER:NUM_BOOKMARKLEVELS"; Pos = MAP_APPFONT ( 132 , 165 ) ; Size = MAP_APPFONT ( 32 , 12 ) ; Border = TRUE; @@ -515,19 +561,29 @@ 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 { + HelpID = "filter:PushButton:RID_PDF_TAB_SECURITY:BTN_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 +607,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 ); @@ -595,18 +642,21 @@ TabPage RID_PDF_TAB_SECURITY }; RadioButton RB_PRINT_NONE { + HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_PRINT_NONE"; Pos = MAP_APPFONT ( 18 , 101 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text[ en-US ] = "~Not permitted"; }; RadioButton RB_PRINT_LOWRES { + HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_PRINT_LOWRES"; Pos = MAP_APPFONT ( 18 , 112 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text[ en-US ] = "~Low resolution (150 dpi)"; }; RadioButton RB_PRINT_HIGHRES { + HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_PRINT_HIGHRES"; Pos = MAP_APPFONT ( 18 , 123 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text[ en-US ] = "~High resolution"; @@ -621,24 +671,28 @@ TabPage RID_PDF_TAB_SECURITY }; RadioButton RB_CHANGES_NONE { + HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_NONE"; Pos = MAP_APPFONT ( 18 , 145 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text[ en-US ] = "No~t permitted"; }; RadioButton RB_CHANGES_INSDEL { + HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_INSDEL"; Pos = MAP_APPFONT ( 18 , 157 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text[ en-US ] = "~Inserting, deleting, and rotating pages"; }; RadioButton RB_CHANGES_FILLFORM { + HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_FILLFORM"; Pos = MAP_APPFONT ( 18 , 168 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text[ en-US ] = "~Filling in form fields"; }; RadioButton RB_CHANGES_COMMENT { + HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_COMMENT"; Pos = MAP_APPFONT ( 18 , 179 ) ; Size = MAP_APPFONT ( 152 , 16 ) ; WordBreak = TRUE ; @@ -646,6 +700,7 @@ TabPage RID_PDF_TAB_SECURITY }; RadioButton RB_CHANGES_ANY_NOCOPY { + HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_ANY_NOCOPY"; Pos = MAP_APPFONT ( 18 , 198 ) ; Size = MAP_APPFONT ( 152 , 10 ) ; Text[ en-US ] = "~Any except extracting pages"; @@ -653,6 +708,7 @@ TabPage RID_PDF_TAB_SECURITY CheckBox CB_ENDAB_COPY { + HelpID = "filter:CheckBox:RID_PDF_TAB_SECURITY:CB_ENDAB_COPY"; Pos = MAP_APPFONT ( 12 , 211 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -661,6 +717,7 @@ TabPage RID_PDF_TAB_SECURITY CheckBox CB_ENAB_ACCESS { + HelpID = "filter:CheckBox:RID_PDF_TAB_SECURITY:CB_ENAB_ACCESS"; Pos = MAP_APPFONT ( 12 , 224 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -679,6 +736,7 @@ TabPage RID_PDF_TAB_LINKS CheckBox CB_EXP_BMRK_TO_DEST { + HelpID = "filter:CheckBox:RID_PDF_TAB_LINKS:CB_EXP_BMRK_TO_DEST"; Pos = MAP_APPFONT ( 6 , 3 ) ; Size = MAP_APPFONT ( 164 , 16 ) ; TabStop = TRUE ; @@ -688,6 +746,7 @@ TabPage RID_PDF_TAB_LINKS CheckBox CB_CNV_OOO_DOCTOPDF { + HelpID = "filter:CheckBox:RID_PDF_TAB_LINKS:CB_CNV_OOO_DOCTOPDF"; Pos = MAP_APPFONT ( 6 , 22 ) ; Size = MAP_APPFONT ( 164 , 16 ) ; TabStop = TRUE ; @@ -697,6 +756,7 @@ TabPage RID_PDF_TAB_LINKS CheckBox CB_ENAB_RELLINKFSYS { + HelpID = "filter:CheckBox:RID_PDF_TAB_LINKS:CB_ENAB_RELLINKFSYS"; Pos = MAP_APPFONT ( 6 , 41 ) ; Size = MAP_APPFONT ( 164 , 16 ) ; TabStop = TRUE ; @@ -713,6 +773,7 @@ TabPage RID_PDF_TAB_LINKS RadioButton CB_VIEW_PDF_DEFAULT { + HelpID = "filter:RadioButton:RID_PDF_TAB_LINKS:CB_VIEW_PDF_DEFAULT"; Pos = MAP_APPFONT ( 12 , 71 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -721,6 +782,7 @@ TabPage RID_PDF_TAB_LINKS RadioButton CB_VIEW_PDF_APPLICATION { + HelpID = "filter:RadioButton:RID_PDF_TAB_LINKS:CB_VIEW_PDF_APPLICATION"; Pos = MAP_APPFONT ( 12 , 84 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -729,6 +791,7 @@ TabPage RID_PDF_TAB_LINKS RadioButton CB_VIEW_PDF_BROWSER { + HelpID = "filter:RadioButton:RID_PDF_TAB_LINKS:CB_VIEW_PDF_BROWSER"; Pos = MAP_APPFONT ( 12 , 97 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; @@ -782,6 +845,7 @@ TabDialog RID_PDF_EXPORT_DLG ModalDialog RID_PDF_ERROR_DLG { + HelpID = "filter:ModalDialog:RID_PDF_ERROR_DLG"; OutputSize = TRUE; SVLook = TRUE; Moveable = TRUE; diff --git a/filter/source/pdf/makefile.mk b/filter/source/pdf/makefile.mk index edf3147a822c..65028c7d5d8d 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 ----------------------------------- @@ -81,3 +82,11 @@ DEF1NAME=$(SHL1TARGET) # --- Targets ---------------------------------- .INCLUDE : target.mk + +ALLTAR : $(MISC)/pdffilter.component + +$(MISC)/pdffilter.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + pdffilter.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt pdffilter.component diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 43f6f1faf2f1..382dd12eeb83 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -32,46 +32,58 @@ #include "impdialog.hxx" #include "pdf.hrc" -#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 "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 <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 "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 "comphelper/storagehelper.hxx" +#include "unotools/streamwrap.hxx" +#include "com/sun/star/io/XSeekable.hpp" + #include "basegfx/polygon/b2dpolygon.hxx" #include "basegfx/polygon/b2dpolypolygon.hxx" #include "basegfx/polygon/b2dpolygontools.hxx" -#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 <unotools/configmgr.hxx> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/drawing/XShapes.hpp> +#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" +#include "com/sun/star/graphic/XGraphicProvider.hpp" using namespace ::rtl; using namespace ::vcl; @@ -80,15 +92,20 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::view; +using namespace ::com::sun::star::graphic; // ------------- // - 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 ), @@ -126,9 +143,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 ), @@ -246,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<beans::NamedValue>& rPwd ) : m_xSrcDoc( xDoc ), - m_aPassWd( rPwd ) + m_aPreparedPassword( rPwd ) {} virtual ~PDFExportStreamDoc(); @@ -267,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() > 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; - if( m_aPassWd.getLength() ) + if( m_aPreparedPassword.getLength() ) { - aArgs.getArray()[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) ); - aArgs.getArray()[2].Value <<= m_aPassWd; + aArgs.getArray()[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionData" ) ); + aArgs.getArray()[2].Value <<= m_aPreparedPassword; } + try { xStore->storeToURL( OUString( RTL_CONSTASCII_USTRINGPARAM( "private:stream" ) ), @@ -386,6 +402,11 @@ 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; + Reference< beans::XMaterialHolder > xEnc; + Sequence< beans::NamedValue > aPreparedPermissionPassword; + // getting the string for the creator String aCreator; @@ -404,7 +425,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 +526,15 @@ 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( "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" ) ) ) @@ -517,14 +569,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; } @@ -600,23 +655,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 && (xEnc.is() || aPermissionPassword.getLength() > 0) ) { - aContext.OwnerPassword = msPermissionPassword; - aContext.Encrypt = sal_True; + mbEncrypt = sal_True; //permission set as desired, done after } else @@ -634,9 +683,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,26 +694,36 @@ 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 && ! 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. @@ -727,7 +786,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; @@ -740,41 +799,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, aPreparedPermissionPassword ), 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 ) { @@ -922,12 +950,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 ); } } @@ -935,21 +1010,36 @@ void PDFExport::showErrors( const std::set< PDFWriter::ErrorCode >& rErrors ) sal_Bool PDFExport::ImplExportPage( PDFWriter& rWriter, PDFExtOutDevData& rPDFExtOutDevData, const GDIMetaFile& rMtf ) { - VirtualDevice aDummyVDev; const Size aSizePDF( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_POINT ) ); Point aOrigin; Rectangle aPageRect( aOrigin, rMtf.GetPrefSize() ); - sal_Bool bRet = sal_False; - - aDummyVDev.EnableOutput( sal_False ); - aDummyVDev.SetMapMode( rMtf.GetPrefMapMode() ); + sal_Bool bRet = sal_True; rWriter.NewPage( aSizePDF.Width(), aSizePDF.Height() ); rWriter.SetMapMode( rMtf.GetPrefMapMode() ); + vcl::PDFWriter::PlayMetafileContext aCtx; + GDIMetaFile aMtf; + if( mbRemoveTransparencies ) + { + aCtx.m_bTransparenciesWereRemoved = rWriter.GetReferenceDevice()-> + RemoveTransparenciesFromMetaFile( rMtf, aMtf, mnMaxImageResolution, mnMaxImageResolution, + false, true, mbReduceImageResolution ); + } + else + { + aMtf = rMtf; + } + aCtx.m_nMaxImageResolution = mbReduceImageResolution ? mnMaxImageResolution : 0; + aCtx.m_bOnlyLosslessCompression = mbUseLosslessCompression; + aCtx.m_nJPEGQuality = mnQuality; + + basegfx::B2DRectangle aB2DRect( aPageRect.Left(), aPageRect.Top(), aPageRect.Right(), aPageRect.Bottom() ); rWriter.SetClipRegion( basegfx::B2DPolyPolygon( basegfx::tools::createPolygonFromRect( aB2DRect ) ) ); - bRet = ImplWriteActions( rWriter, &rPDFExtOutDevData, rMtf, aDummyVDev ); + + rWriter.PlayMetafile( aMtf, aCtx, &rPDFExtOutDevData ); + rPDFExtOutDevData.ResetSyncData(); if( mbWatermark ) @@ -1031,949 +1121,4 @@ void PDFExport::ImplWriteWatermark( PDFWriter& rWriter, const Size& rPageSize ) rWriter.Pop(); } -// ----------------------------------------------------------------------------- - -sal_Bool PDFExport::ImplWriteActions( PDFWriter& rWriter, PDFExtOutDevData* pPDFExtOutDevData, - const GDIMetaFile& rInMtf, VirtualDevice& rDummyVDev ) -{ - bool bAssertionFired( false ); - - GDIMetaFile aMtf; - bool bTransparenciesRemoved = false; - if( mbRemoveTransparencies ) - { - bTransparenciesRemoved = rWriter.GetReferenceDevice()-> - RemoveTransparenciesFromMetaFile( rInMtf, aMtf, mnMaxImageResolution, mnMaxImageResolution, - false, true, mbReduceImageResolution ); - } - else - { - aMtf = rInMtf; - } - - - for( sal_uInt32 i = 0, nCount = aMtf.GetActionCount(); i < nCount; ) - { - if ( !pPDFExtOutDevData || !pPDFExtOutDevData->PlaySyncPageAct( rWriter, i ) ) - { - const MetaAction* pAction = aMtf.GetAction( i ); - const USHORT nType = pAction->GetType(); - - switch( nType ) - { - case( META_PIXEL_ACTION ): - { - const MetaPixelAction* pA = (const MetaPixelAction*) pAction; - rWriter.DrawPixel( pA->GetPoint(), pA->GetColor() ); - } - break; - - case( META_POINT_ACTION ): - { - const MetaPointAction* pA = (const MetaPointAction*) pAction; - rWriter.DrawPixel( pA->GetPoint() ); - } - break; - - case( META_LINE_ACTION ): - { - const MetaLineAction* pA = (const MetaLineAction*) pAction; - if ( pA->GetLineInfo().IsDefault() ) - rWriter.DrawLine( pA->GetStartPoint(), pA->GetEndPoint() ); - else - rWriter.DrawLine( pA->GetStartPoint(), pA->GetEndPoint(), pA->GetLineInfo() ); - } - break; - - case( META_RECT_ACTION ): - { - const MetaRectAction* pA = (const MetaRectAction*) pAction; - rWriter.DrawRect( pA->GetRect() ); - } - break; - - case( META_ROUNDRECT_ACTION ): - { - const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pAction; - rWriter.DrawRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound() ); - } - break; - - case( META_ELLIPSE_ACTION ): - { - const MetaEllipseAction* pA = (const MetaEllipseAction*) pAction; - rWriter.DrawEllipse( pA->GetRect() ); - } - break; - - case( META_ARC_ACTION ): - { - const MetaArcAction* pA = (const MetaArcAction*) pAction; - rWriter.DrawArc( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() ); - } - break; - - case( META_PIE_ACTION ): - { - const MetaArcAction* pA = (const MetaArcAction*) pAction; - rWriter.DrawPie( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() ); - } - break; - - case( META_CHORD_ACTION ): - { - const MetaChordAction* pA = (const MetaChordAction*) pAction; - rWriter.DrawChord( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint() ); - } - break; - - case( META_POLYGON_ACTION ): - { - const MetaPolygonAction* pA = (const MetaPolygonAction*) pAction; - rWriter.DrawPolygon( pA->GetPolygon() ); - } - break; - - case( META_POLYLINE_ACTION ): - { - const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction; - if ( pA->GetLineInfo().IsDefault() ) - rWriter.DrawPolyLine( pA->GetPolygon() ); - else - rWriter.DrawPolyLine( pA->GetPolygon(), pA->GetLineInfo() ); - } - break; - - case( META_POLYPOLYGON_ACTION ): - { - const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pAction; - rWriter.DrawPolyPolygon( pA->GetPolyPolygon() ); - } - break; - - case( META_GRADIENT_ACTION ): - { - const MetaGradientAction* pA = (const MetaGradientAction*) pAction; - const PolyPolygon aPolyPoly( pA->GetRect() ); - - ImplWriteGradient( rWriter, aPolyPoly, pA->GetGradient(), rDummyVDev ); - } - break; - - case( META_GRADIENTEX_ACTION ): - { - const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction; - ImplWriteGradient( rWriter, pA->GetPolyPolygon(), pA->GetGradient(), rDummyVDev ); - } - break; - - case META_HATCH_ACTION: - { - const MetaHatchAction* pA = (const MetaHatchAction*) pAction; - rWriter.DrawHatch( pA->GetPolyPolygon(), pA->GetHatch() ); - } - break; - - case( META_TRANSPARENT_ACTION ): - { - const MetaTransparentAction* pA = (const MetaTransparentAction*) pAction; - rWriter.DrawTransparent( pA->GetPolyPolygon(), pA->GetTransparence() ); - } - break; - - case( META_FLOATTRANSPARENT_ACTION ): - { - const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pAction; - - GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() ); - const Point& rPos = pA->GetPoint(); - const Size& rSize= pA->GetSize(); - const Gradient& rTransparenceGradient = pA->GetGradient(); - - // special case constant alpha value - if( rTransparenceGradient.GetStartColor() == rTransparenceGradient.GetEndColor() ) - { - const Color aTransCol( rTransparenceGradient.GetStartColor() ); - const USHORT nTransPercent = aTransCol.GetLuminance() * 100 / 255; - rWriter.BeginTransparencyGroup(); - ImplWriteActions( rWriter, NULL, aTmpMtf, rDummyVDev ); - rWriter.EndTransparencyGroup( Rectangle( rPos, rSize ), nTransPercent ); - } - else - { - const Size aDstSizeTwip( rDummyVDev.PixelToLogic( rDummyVDev.LogicToPixel( rSize ), MAP_TWIP ) ); - sal_Int32 nMaxBmpDPI = mbUseLosslessCompression ? 300 : 72; - if ( mbReduceImageResolution ) - { - if ( nMaxBmpDPI > mnMaxImageResolution ) - nMaxBmpDPI = mnMaxImageResolution; - } - const sal_Int32 nPixelX = (sal_Int32)((double)aDstSizeTwip.Width() * (double)nMaxBmpDPI / 1440.0); - const sal_Int32 nPixelY = (sal_Int32)((double)aDstSizeTwip.Height() * (double)nMaxBmpDPI / 1440.0); - if ( nPixelX && nPixelY ) - { - Size aDstSizePixel( nPixelX, nPixelY ); - VirtualDevice* pVDev = new VirtualDevice; - if( pVDev->SetOutputSizePixel( aDstSizePixel ) ) - { - Bitmap aPaint, aMask; - AlphaMask aAlpha; - Point aPoint; - - MapMode aMapMode( rDummyVDev.GetMapMode() ); - aMapMode.SetOrigin( aPoint ); - pVDev->SetMapMode( aMapMode ); - Size aDstSize( pVDev->PixelToLogic( aDstSizePixel ) ); - - Point aMtfOrigin( aTmpMtf.GetPrefMapMode().GetOrigin() ); - if ( aMtfOrigin.X() || aMtfOrigin.Y() ) - aTmpMtf.Move( -aMtfOrigin.X(), -aMtfOrigin.Y() ); - double fScaleX = (double)aDstSize.Width() / (double)aTmpMtf.GetPrefSize().Width(); - double fScaleY = (double)aDstSize.Height() / (double)aTmpMtf.GetPrefSize().Height(); - if( fScaleX != 1.0 || fScaleY != 1.0 ) - aTmpMtf.Scale( fScaleX, fScaleY ); - aTmpMtf.SetPrefMapMode( aMapMode ); - - // create paint bitmap - aTmpMtf.WindStart(); - aTmpMtf.Play( pVDev, aPoint, aDstSize ); - aTmpMtf.WindStart(); - - pVDev->EnableMapMode( FALSE ); - aPaint = pVDev->GetBitmap( aPoint, aDstSizePixel ); - pVDev->EnableMapMode( TRUE ); - - // create mask bitmap - pVDev->SetLineColor( COL_BLACK ); - pVDev->SetFillColor( COL_BLACK ); - pVDev->DrawRect( Rectangle( aPoint, aDstSize ) ); - pVDev->SetDrawMode( DRAWMODE_WHITELINE | DRAWMODE_WHITEFILL | DRAWMODE_WHITETEXT | - DRAWMODE_WHITEBITMAP | DRAWMODE_WHITEGRADIENT ); - aTmpMtf.WindStart(); - aTmpMtf.Play( pVDev, aPoint, aDstSize ); - aTmpMtf.WindStart(); - pVDev->EnableMapMode( FALSE ); - aMask = pVDev->GetBitmap( aPoint, aDstSizePixel ); - pVDev->EnableMapMode( TRUE ); - - // create alpha mask from gradient - pVDev->SetDrawMode( DRAWMODE_GRAYGRADIENT ); - pVDev->DrawGradient( Rectangle( aPoint, aDstSize ), rTransparenceGradient ); - pVDev->SetDrawMode( DRAWMODE_DEFAULT ); - pVDev->EnableMapMode( FALSE ); - pVDev->DrawMask( aPoint, aDstSizePixel, aMask, Color( COL_WHITE ) ); - aAlpha = pVDev->GetBitmap( aPoint, aDstSizePixel ); - ImplWriteBitmapEx( rWriter, rDummyVDev, rPos, rSize, BitmapEx( aPaint, aAlpha ) ); - } - delete pVDev; - } - } - } - break; - - case( META_EPS_ACTION ): - { - const MetaEPSAction* pA = (const MetaEPSAction*) pAction; - const GDIMetaFile aSubstitute( pA->GetSubstitute() ); - - rWriter.Push(); - rDummyVDev.Push(); - - MapMode aMapMode( aSubstitute.GetPrefMapMode() ); - Size aOutSize( rDummyVDev.LogicToLogic( pA->GetSize(), rDummyVDev.GetMapMode(), aMapMode ) ); - aMapMode.SetScaleX( Fraction( aOutSize.Width(), aSubstitute.GetPrefSize().Width() ) ); - aMapMode.SetScaleY( Fraction( aOutSize.Height(), aSubstitute.GetPrefSize().Height() ) ); - aMapMode.SetOrigin( rDummyVDev.LogicToLogic( pA->GetPoint(), rDummyVDev.GetMapMode(), aMapMode ) ); - - rWriter.SetMapMode( aMapMode ); - rDummyVDev.SetMapMode( aMapMode ); - ImplWriteActions( rWriter, NULL, aSubstitute, rDummyVDev ); - rDummyVDev.Pop(); - rWriter.Pop(); - } - break; - - case( META_COMMENT_ACTION ): - if( ! bTransparenciesRemoved ) - { - const MetaCommentAction* pA = (const MetaCommentAction*) pAction; - String aSkipComment; - - if( pA->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL ) - { - const MetaGradientExAction* pGradAction = NULL; - sal_Bool bDone = sal_False; - - while( !bDone && ( ++i < nCount ) ) - { - pAction = aMtf.GetAction( i ); - - if( pAction->GetType() == META_GRADIENTEX_ACTION ) - pGradAction = (const MetaGradientExAction*) pAction; - else if( ( pAction->GetType() == META_COMMENT_ACTION ) && - ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) ) - { - bDone = sal_True; - } - } - - if( pGradAction ) - ImplWriteGradient( rWriter, pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), rDummyVDev ); - } - else - { - const BYTE* pData = pA->GetData(); - if ( pData ) - { - SvMemoryStream aMemStm( (void*)pData, pA->GetDataSize(), STREAM_READ ); - sal_Bool bSkipSequence = sal_False; - ByteString sSeqEnd; - - if( pA->GetComment().Equals( "XPATHSTROKE_SEQ_BEGIN" ) ) - { - sSeqEnd = ByteString( "XPATHSTROKE_SEQ_END" ); - SvtGraphicStroke aStroke; - aMemStm >> aStroke; - - Polygon aPath; - aStroke.getPath( aPath ); - - PolyPolygon aStartArrow; - PolyPolygon aEndArrow; - double fTransparency( aStroke.getTransparency() ); - double fStrokeWidth( aStroke.getStrokeWidth() ); - SvtGraphicStroke::DashArray aDashArray; - - aStroke.getStartArrow( aStartArrow ); - aStroke.getEndArrow( aEndArrow ); - aStroke.getDashArray( aDashArray ); - - bSkipSequence = sal_True; - if ( aStartArrow.Count() || aEndArrow.Count() ) - bSkipSequence = sal_False; - if ( aDashArray.size() && ( fStrokeWidth != 0.0 ) && ( fTransparency == 0.0 ) ) - bSkipSequence = sal_False; - if ( bSkipSequence ) - { - PDFWriter::ExtLineInfo aInfo; - aInfo.m_fLineWidth = fStrokeWidth; - aInfo.m_fTransparency = fTransparency; - aInfo.m_fMiterLimit = aStroke.getMiterLimit(); - switch( aStroke.getCapType() ) - { - default: - case SvtGraphicStroke::capButt: aInfo.m_eCap = PDFWriter::capButt;break; - case SvtGraphicStroke::capRound: aInfo.m_eCap = PDFWriter::capRound;break; - case SvtGraphicStroke::capSquare: aInfo.m_eCap = PDFWriter::capSquare;break; - } - switch( aStroke.getJoinType() ) - { - default: - case SvtGraphicStroke::joinMiter: aInfo.m_eJoin = PDFWriter::joinMiter;break; - case SvtGraphicStroke::joinRound: aInfo.m_eJoin = PDFWriter::joinRound;break; - case SvtGraphicStroke::joinBevel: aInfo.m_eJoin = PDFWriter::joinBevel;break; - case SvtGraphicStroke::joinNone: - aInfo.m_eJoin = PDFWriter::joinMiter; - aInfo.m_fMiterLimit = 0.0; - break; - } - aInfo.m_aDashArray = aDashArray; - - if(SvtGraphicStroke::joinNone == aStroke.getJoinType() - && fStrokeWidth > 0.0) - { - // emulate no edge rounding by handling single edges - const sal_uInt16 nPoints(aPath.GetSize()); - const bool bCurve(aPath.HasFlags()); - - for(sal_uInt16 a(0); a + 1 < nPoints; a++) - { - if(bCurve - && POLY_NORMAL != aPath.GetFlags(a + 1) - && a + 2 < nPoints - && POLY_NORMAL != aPath.GetFlags(a + 2) - && a + 3 < nPoints) - { - const Polygon aSnippet(4, - aPath.GetConstPointAry() + a, - aPath.GetConstFlagAry() + a); - rWriter.DrawPolyLine( aSnippet, aInfo ); - a += 2; - } - else - { - const Polygon aSnippet(2, - aPath.GetConstPointAry() + a); - rWriter.DrawPolyLine( aSnippet, aInfo ); - } - } - } - else - { - rWriter.DrawPolyLine( aPath, aInfo ); - } - } - } - else if ( pA->GetComment().Equals( "XPATHFILL_SEQ_BEGIN" ) ) - { - sSeqEnd = ByteString( "XPATHFILL_SEQ_END" ); - SvtGraphicFill aFill; - aMemStm >> aFill; - - if ( ( aFill.getFillType() == SvtGraphicFill::fillSolid ) && ( aFill.getFillRule() == SvtGraphicFill::fillEvenOdd ) ) - { - double fTransparency = aFill.getTransparency(); - if ( fTransparency == 0.0 ) - { - PolyPolygon aPath; - aFill.getPath( aPath ); - - bSkipSequence = sal_True; - rWriter.DrawPolyPolygon( aPath ); - } - else if ( fTransparency == 1.0 ) - bSkipSequence = sal_True; - } -/* #i81548# removing optimization for fill textures, because most of the texture settings are not - exported properly. In OpenOffice 3.1 the drawing layer will support graphic primitives, then it - will not be a problem to optimize the filltexture export. But for wysiwyg is more important than - filesize. - else if( aFill.getFillType() == SvtGraphicFill::fillTexture && aFill.isTiling() ) - { - sal_Int32 nPattern = mnCachePatternId; - Graphic aPatternGraphic; - aFill.getGraphic( aPatternGraphic ); - bool bUseCache = false; - SvtGraphicFill::Transform aPatTransform; - aFill.getTransform( aPatTransform ); - - if( mnCachePatternId >= 0 ) - { - SvtGraphicFill::Transform aCacheTransform; - maCacheFill.getTransform( aCacheTransform ); - if( aCacheTransform.matrix[0] == aPatTransform.matrix[0] && - aCacheTransform.matrix[1] == aPatTransform.matrix[1] && - aCacheTransform.matrix[2] == aPatTransform.matrix[2] && - aCacheTransform.matrix[3] == aPatTransform.matrix[3] && - aCacheTransform.matrix[4] == aPatTransform.matrix[4] && - aCacheTransform.matrix[5] == aPatTransform.matrix[5] - ) - { - Graphic aCacheGraphic; - maCacheFill.getGraphic( aCacheGraphic ); - if( aCacheGraphic == aPatternGraphic ) - bUseCache = true; - } - } - - if( ! bUseCache ) - { - - // paint graphic to metafile - GDIMetaFile aPattern; - rDummyVDev.SetConnectMetaFile( &aPattern ); - rDummyVDev.Push(); - rDummyVDev.SetMapMode( aPatternGraphic.GetPrefMapMode() ); - - aPatternGraphic.Draw( &rDummyVDev, Point( 0, 0 ) ); - rDummyVDev.Pop(); - rDummyVDev.SetConnectMetaFile( NULL ); - aPattern.WindStart(); - - MapMode aPatternMapMode( aPatternGraphic.GetPrefMapMode() ); - // prepare pattern from metafile - Size aPrefSize( aPatternGraphic.GetPrefSize() ); - // FIXME: this magic -1 shouldn't be necessary - aPrefSize.Width() -= 1; - aPrefSize.Height() -= 1; - aPrefSize = rWriter.GetReferenceDevice()-> - LogicToLogic( aPrefSize, - &aPatternMapMode, - &rWriter.GetReferenceDevice()->GetMapMode() ); - // build bounding rectangle of pattern - Rectangle aBound( Point( 0, 0 ), aPrefSize ); - rWriter.BeginPattern( aBound ); - rWriter.Push(); - rDummyVDev.Push(); - rWriter.SetMapMode( aPatternMapMode ); - rDummyVDev.SetMapMode( aPatternMapMode ); - ImplWriteActions( rWriter, NULL, aPattern, rDummyVDev ); - rDummyVDev.Pop(); - rWriter.Pop(); - - nPattern = rWriter.EndPattern( aPatTransform ); - - // try some caching and reuse pattern - mnCachePatternId = nPattern; - maCacheFill = aFill; - } - - // draw polypolygon with pattern fill - PolyPolygon aPath; - aFill.getPath( aPath ); - rWriter.DrawPolyPolygon( aPath, nPattern, aFill.getFillRule() == SvtGraphicFill::fillEvenOdd ); - - bSkipSequence = sal_True; - } -*/ - } - if ( bSkipSequence ) - { - while( ++i < nCount ) - { - pAction = aMtf.GetAction( i ); - if ( pAction->GetType() == META_COMMENT_ACTION ) - { - ByteString sComment( ((MetaCommentAction*)pAction)->GetComment() ); - if ( sComment.Equals( sSeqEnd ) ) - break; - } - // #i44496# - // the replacement action for stroke is a filled rectangle - // the set fillcolor of the replacement is part of the graphics - // state and must not be skipped - else if( pAction->GetType() == META_FILLCOLOR_ACTION ) - { - const MetaFillColorAction* pMA = (const MetaFillColorAction*) pAction; - if( pMA->IsSetting() ) - rWriter.SetFillColor( pMA->GetColor() ); - else - rWriter.SetFillColor(); - } - } - } - } - } - } - break; - - case( META_BMP_ACTION ): - { - const MetaBmpAction* pA = (const MetaBmpAction*) pAction; - BitmapEx aBitmapEx( pA->GetBitmap() ); - Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(), - aBitmapEx.GetPrefMapMode(), rDummyVDev.GetMapMode() ) ); - if( ! ( aSize.Width() && aSize.Height() ) ) - aSize = rDummyVDev.PixelToLogic( aBitmapEx.GetSizePixel() ); - ImplWriteBitmapEx( rWriter, rDummyVDev, pA->GetPoint(), aSize, aBitmapEx ); - } - break; - - case( META_BMPSCALE_ACTION ): - { - const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction; - ImplWriteBitmapEx( rWriter, rDummyVDev, pA->GetPoint(), pA->GetSize(), BitmapEx( pA->GetBitmap() ) ); - } - break; - - case( META_BMPSCALEPART_ACTION ): - { - const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction; - BitmapEx aBitmapEx( pA->GetBitmap() ); - aBitmapEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ); - ImplWriteBitmapEx( rWriter, rDummyVDev, pA->GetDestPoint(), pA->GetDestSize(), aBitmapEx ); - } - break; - - case( META_BMPEX_ACTION ): - { - const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction; - BitmapEx aBitmapEx( pA->GetBitmapEx() ); - Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(), - aBitmapEx.GetPrefMapMode(), rDummyVDev.GetMapMode() ) ); - ImplWriteBitmapEx( rWriter, rDummyVDev, pA->GetPoint(), aSize, aBitmapEx ); - } - break; - - case( META_BMPEXSCALE_ACTION ): - { - const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction; - ImplWriteBitmapEx( rWriter, rDummyVDev, pA->GetPoint(), pA->GetSize(), pA->GetBitmapEx() ); - } - break; - - case( META_BMPEXSCALEPART_ACTION ): - { - const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction; - BitmapEx aBitmapEx( pA->GetBitmapEx() ); - aBitmapEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) ); - ImplWriteBitmapEx( rWriter, rDummyVDev, pA->GetDestPoint(), pA->GetDestSize(), aBitmapEx ); - } - break; - - case( META_MASK_ACTION ): - case( META_MASKSCALE_ACTION ): - case( META_MASKSCALEPART_ACTION ): - { - DBG_ERROR( "MetaMask...Action not supported yet" ); - } - break; - - case( META_TEXT_ACTION ): - { - const MetaTextAction* pA = (const MetaTextAction*) pAction; - rWriter.DrawText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ) ); - } - break; - - case( META_TEXTRECT_ACTION ): - { - const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction; - rWriter.DrawText( pA->GetRect(), String( pA->GetText() ), pA->GetStyle() ); - } - break; - - case( META_TEXTARRAY_ACTION ): - { - const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction; - rWriter.DrawTextArray( pA->GetPoint(), pA->GetText(), pA->GetDXArray(), pA->GetIndex(), pA->GetLen() ); - } - break; - - case( META_STRETCHTEXT_ACTION ): - { - const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction; - rWriter.DrawStretchText( pA->GetPoint(), pA->GetWidth(), pA->GetText(), pA->GetIndex(), pA->GetLen() ); - } - break; - - - case( META_TEXTLINE_ACTION ): - { - const MetaTextLineAction* pA = (const MetaTextLineAction*) pAction; - rWriter.DrawTextLine( pA->GetStartPoint(), pA->GetWidth(), pA->GetStrikeout(), pA->GetUnderline(), pA->GetOverline() ); - - } - break; - - case( META_CLIPREGION_ACTION ): - { - const MetaClipRegionAction* pA = (const MetaClipRegionAction*) pAction; - - if( pA->IsClipping() ) - { - if( pA->GetRegion().IsEmpty() ) - rWriter.SetClipRegion( basegfx::B2DPolyPolygon() ); - else - { - Region aReg( pA->GetRegion() ); - rWriter.SetClipRegion( aReg.ConvertToB2DPolyPolygon() ); - } - } - else - rWriter.SetClipRegion(); - } - break; - - case( META_ISECTRECTCLIPREGION_ACTION ): - { - const MetaISectRectClipRegionAction* pA = (const MetaISectRectClipRegionAction*) pAction; - rWriter.IntersectClipRegion( pA->GetRect() ); - } - break; - - case( META_ISECTREGIONCLIPREGION_ACTION ): - { - const MetaISectRegionClipRegionAction* pA = (const MetaISectRegionClipRegionAction*) pAction; - Region aReg( pA->GetRegion() ); - rWriter.IntersectClipRegion( aReg.ConvertToB2DPolyPolygon() ); - } - break; - - case( META_MOVECLIPREGION_ACTION ): - { - const MetaMoveClipRegionAction* pA = (const MetaMoveClipRegionAction*) pAction; - rWriter.MoveClipRegion( pA->GetHorzMove(), pA->GetVertMove() ); - } - break; - - case( META_MAPMODE_ACTION ): - { - const_cast< MetaAction* >( pAction )->Execute( &rDummyVDev ); - rWriter.SetMapMode( rDummyVDev.GetMapMode() ); - } - break; - - case( META_LINECOLOR_ACTION ): - { - const MetaLineColorAction* pA = (const MetaLineColorAction*) pAction; - - if( pA->IsSetting() ) - rWriter.SetLineColor( pA->GetColor() ); - else - rWriter.SetLineColor(); - } - break; - - case( META_FILLCOLOR_ACTION ): - { - const MetaFillColorAction* pA = (const MetaFillColorAction*) pAction; - - if( pA->IsSetting() ) - rWriter.SetFillColor( pA->GetColor() ); - else - rWriter.SetFillColor(); - } - break; - - case( META_TEXTLINECOLOR_ACTION ): - { - const MetaTextLineColorAction* pA = (const MetaTextLineColorAction*) pAction; - - if( pA->IsSetting() ) - rWriter.SetTextLineColor( pA->GetColor() ); - else - rWriter.SetTextLineColor(); - } - break; - - case( META_OVERLINECOLOR_ACTION ): - { - const MetaOverlineColorAction* pA = (const MetaOverlineColorAction*) pAction; - - if( pA->IsSetting() ) - rWriter.SetOverlineColor( pA->GetColor() ); - else - rWriter.SetOverlineColor(); - } - break; - - case( META_TEXTFILLCOLOR_ACTION ): - { - const MetaTextFillColorAction* pA = (const MetaTextFillColorAction*) pAction; - - if( pA->IsSetting() ) - rWriter.SetTextFillColor( pA->GetColor() ); - else - rWriter.SetTextFillColor(); - } - break; - - case( META_TEXTCOLOR_ACTION ): - { - const MetaTextColorAction* pA = (const MetaTextColorAction*) pAction; - rWriter.SetTextColor( pA->GetColor() ); - } - break; - - case( META_TEXTALIGN_ACTION ): - { - const MetaTextAlignAction* pA = (const MetaTextAlignAction*) pAction; - rWriter.SetTextAlign( pA->GetTextAlign() ); - } - break; - - case( META_FONT_ACTION ): - { - const MetaFontAction* pA = (const MetaFontAction*) pAction; - rWriter.SetFont( pA->GetFont() ); - } - break; - - case( META_PUSH_ACTION ): - { - const MetaPushAction* pA = (const MetaPushAction*) pAction; - - rDummyVDev.Push( pA->GetFlags() ); - rWriter.Push( pA->GetFlags() ); - } - break; - - case( META_POP_ACTION ): - { - rDummyVDev.Pop(); - rWriter.Pop(); - } - break; - - case( META_LAYOUTMODE_ACTION ): - { - const MetaLayoutModeAction* pA = (const MetaLayoutModeAction*) pAction; - rWriter.SetLayoutMode( pA->GetLayoutMode() ); - } - break; - - case META_TEXTLANGUAGE_ACTION: - { - const MetaTextLanguageAction* pA = (const MetaTextLanguageAction*) pAction; - rWriter.SetDigitLanguage( pA->GetTextLanguage() ); - } - break; - - case( META_WALLPAPER_ACTION ): - { - const MetaWallpaperAction* pA = (const MetaWallpaperAction*) pAction; - rWriter.DrawWallpaper( pA->GetRect(), pA->GetWallpaper() ); - } - break; - - case( META_RASTEROP_ACTION ): - { - // !!! >>> we don't want to support this actions - } - break; - - case( META_REFPOINT_ACTION ): - { - // !!! >>> we don't want to support this actions - } - break; - - default: - // #i24604# Made assertion fire only once per - // metafile. The asserted actions here are all - // deprecated - if( !bAssertionFired ) - { - bAssertionFired = true; - DBG_ERROR( "PDFExport::ImplWriteActions: deprecated and unsupported MetaAction encountered" ); - } - break; - } - i++; - } - } - - return sal_True; -} - -// ----------------------------------------------------------------------------- - -void PDFExport::ImplWriteGradient( PDFWriter& rWriter, const PolyPolygon& rPolyPoly, const Gradient& rGradient, VirtualDevice& rDummyVDev ) -{ - GDIMetaFile aTmpMtf; - - rDummyVDev.AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf ); - - rWriter.Push(); - rWriter.IntersectClipRegion( rPolyPoly.getB2DPolyPolygon() ); - ImplWriteActions( rWriter, NULL, aTmpMtf, rDummyVDev ); - rWriter.Pop(); -} - -// ----------------------------------------------------------------------------- - -void PDFExport::ImplWriteBitmapEx( PDFWriter& rWriter, VirtualDevice& rDummyVDev, - const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx ) -{ - if ( !rBitmapEx.IsEmpty() && rSize.Width() && rSize.Height() ) - { - BitmapEx aBitmapEx( rBitmapEx ); - Point aPoint( rPoint ); - Size aSize( rSize ); - - // #i19065# Negative sizes have mirror semantics on - // OutputDevice. BitmapEx and co. have no idea about that, so - // perform that _before_ doing anything with aBitmapEx. - ULONG nMirrorFlags(BMP_MIRROR_NONE); - if( aSize.Width() < 0 ) - { - aSize.Width() *= -1; - aPoint.X() -= aSize.Width(); - nMirrorFlags |= BMP_MIRROR_HORZ; - } - if( aSize.Height() < 0 ) - { - aSize.Height() *= -1; - aPoint.Y() -= aSize.Height(); - nMirrorFlags |= BMP_MIRROR_VERT; - } - - if( nMirrorFlags != BMP_MIRROR_NONE ) - { - aBitmapEx.Mirror( nMirrorFlags ); - } - if ( mbReduceImageResolution ) - { - // do downsampling if neccessary - const Size aDstSizeTwip( rDummyVDev.PixelToLogic( rDummyVDev.LogicToPixel( aSize ), MAP_TWIP ) ); - const Size aBmpSize( aBitmapEx.GetSizePixel() ); - const double fBmpPixelX = aBmpSize.Width(); - const double fBmpPixelY = aBmpSize.Height(); - const double fMaxPixelX = aDstSizeTwip.Width() * mnMaxImageResolution / 1440.0; - const double fMaxPixelY = aDstSizeTwip.Height() * mnMaxImageResolution / 1440.0; - - // check, if the bitmap DPI exceeds the maximum DPI (allow 4 pixel rounding tolerance) - if( ( ( fBmpPixelX > ( fMaxPixelX + 4 ) ) || - ( fBmpPixelY > ( fMaxPixelY + 4 ) ) ) && - ( fBmpPixelY > 0.0 ) && ( fMaxPixelY > 0.0 ) ) - { - // do scaling - Size aNewBmpSize; - const double fBmpWH = fBmpPixelX / fBmpPixelY; - const double fMaxWH = fMaxPixelX / fMaxPixelY; - - if( fBmpWH < fMaxWH ) - { - aNewBmpSize.Width() = FRound( fMaxPixelY * fBmpWH ); - aNewBmpSize.Height() = FRound( fMaxPixelY ); - } - else if( fBmpWH > 0.0 ) - { - aNewBmpSize.Width() = FRound( fMaxPixelX ); - aNewBmpSize.Height() = FRound( fMaxPixelX / fBmpWH); - } - if( aNewBmpSize.Width() && aNewBmpSize.Height() ) - aBitmapEx.Scale( aNewBmpSize ); - else - aBitmapEx.SetEmpty(); - } - } - - const Size aSizePixel( aBitmapEx.GetSizePixel() ); - if ( aSizePixel.Width() && aSizePixel.Height() ) - { - sal_Bool bUseJPGCompression = !mbUseLosslessCompression; - if ( ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) ) - bUseJPGCompression = sal_False; - - SvMemoryStream aStrm; - Bitmap aMask; - - bool bTrueColorJPG = true; - if ( bUseJPGCompression ) - { - sal_uInt32 nZippedFileSize; // sj: we will calculate the filesize of a zipped bitmap - { // to determine if jpeg compression is usefull - SvMemoryStream aTemp; - aTemp.SetCompressMode( aTemp.GetCompressMode() | COMPRESSMODE_ZBITMAP ); - aTemp.SetVersion( SOFFICE_FILEFORMAT_40 ); // sj: up from version 40 our bitmap stream operator - aTemp << aBitmapEx; // is capable of zlib stream compression - aTemp.Seek( STREAM_SEEK_TO_END ); - nZippedFileSize = aTemp.Tell(); - } - if ( aBitmapEx.IsTransparent() ) - { - if ( aBitmapEx.IsAlpha() ) - aMask = aBitmapEx.GetAlpha().GetBitmap(); - else - aMask = aBitmapEx.GetMask(); - } - GraphicFilter aGraphicFilter; - Graphic aGraphic( aBitmapEx.GetBitmap() ); - sal_uInt16 nFormatName = aGraphicFilter.GetExportFormatNumberForShortName( OUString( RTL_CONSTASCII_USTRINGPARAM( "JPG" ) ) ); - sal_Int32 nColorMode = 0; - - Sequence< PropertyValue > aFilterData( 2 ); - aFilterData[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ); - aFilterData[ 0 ].Value <<= mnQuality; - aFilterData[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ); - aFilterData[ 1 ].Value <<= nColorMode; - - /*sal_uInt16 nError =*/ aGraphicFilter.ExportGraphic( aGraphic, String(), aStrm, nFormatName, &aFilterData ); - bTrueColorJPG = ((aGraphicFilter.GetExportGraphicHint() & GRFILTER_OUTHINT_GREY) == 0); - aStrm.Seek( STREAM_SEEK_TO_END ); - if ( aStrm.Tell() > nZippedFileSize ) - bUseJPGCompression = sal_False; - } - if ( bUseJPGCompression ) - rWriter.DrawJPGBitmap( aStrm, bTrueColorJPG, aSizePixel, Rectangle( aPoint, aSize ), aMask ); - else if ( aBitmapEx.IsTransparent() ) - rWriter.DrawBitmapEx( aPoint, aSize, aBitmapEx ); - else - rWriter.DrawBitmap( aPoint, aSize, aBitmapEx.GetBitmap() ); - } - } -} - diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx index 18c760b85675..5b07a50765b1 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; @@ -98,9 +99,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; @@ -117,17 +116,13 @@ private: //<--- sal_Bool ImplExportPage( ::vcl::PDFWriter& rWriter, ::vcl::PDFExtOutDevData& rPDFExtOutDevData, const GDIMetaFile& rMtf ); - sal_Bool ImplWriteActions( ::vcl::PDFWriter& rWriter, ::vcl::PDFExtOutDevData* pPDFExtOutDevData, - const GDIMetaFile& rMtf, VirtualDevice& rDummyVDev ); - void ImplWriteGradient( ::vcl::PDFWriter& rWriter, const PolyPolygon& rPolyPoly, - const Gradient& rGradient, VirtualDevice& rDummyVDev ); - void ImplWriteBitmapEx( ::vcl::PDFWriter& rWriter, VirtualDevice& rDummyVDev, - const Point& rPoint, const Size& rSize, const BitmapEx& rBitmap ); - 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.component b/filter/source/pdf/pdffilter.component new file mode 100644 index 000000000000..438d697a77b1 --- /dev/null +++ b/filter/source/pdf/pdffilter.component @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.PDF.PDFDialog"> + <service name="com.sun.star.document.PDFDialog"/> + </implementation> + <implementation name="com.sun.star.comp.PDF.PDFFilter"> + <service name="com.sun.star.document.PDFFilter"/> + </implementation> + <implementation name="com.sun.star.comp.PDF.PDFExportInteractionHandler"> + <service name="com.sun.star.filter.pdfexport.PDFExportInteractionHandler"/> + </implementation> +</component> 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 <com/sun/star/beans/XPropertyAccess.hpp> #include <comphelper/property.hxx> #include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> #include <osl/diagnose.h> #include <rtl/process.h> 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 + * <http://www.openoffice.org/license.html> + * 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 + * <http://www.openoffice.org/license.html> + * 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..69b3d7a1ebc2 100644 --- a/filter/source/pdf/pdfuno.cxx +++ b/filter/source/pdf/pdfuno.cxx @@ -36,6 +36,7 @@ #include <pdffilter.hxx> #include <pdfdialog.hxx> +#include <pdfinteract.hxx> using namespace ::rtl; using namespace ::cppu; @@ -53,41 +54,6 @@ extern "C" // ------------------------------------------------------------------------- - SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pRegistryKey ) - { - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey; - sal_Int32 nPos; - - xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( PDFFilter_getImplementationName() ); - xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - const Sequence< OUString > & rSNL1 = PDFFilter_getSupportedServiceNames(); - const OUString * pArray1 = rSNL1.getConstArray(); - for ( nPos = rSNL1.getLength(); nPos--; ) - xNewKey->createKey( pArray1[nPos] ); - - xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( PDFDialog_getImplementationName() ); - xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - const Sequence< OUString > & rSNL2 = PDFDialog_getSupportedServiceNames(); - const OUString * pArray2 = rSNL2.getConstArray(); - for ( nPos = rSNL2.getLength(); nPos--; ) - xNewKey->createKey( pArray2[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; - } - - // ------------------------------------------------------------------------- - SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { OUString aImplName( OUString::createFromAscii( pImplName ) ); @@ -111,6 +77,13 @@ extern "C" 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() ) { diff --git a/filter/source/placeware/exports.dxp b/filter/source/placeware/exports.dxp index 9630d7e06768..f0e1c69934bc 100644 --- a/filter/source/placeware/exports.dxp +++ b/filter/source/placeware/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/filter/source/placeware/makefile.mk b/filter/source/placeware/makefile.mk index 3238193c52ae..e3bd32a9197f 100644 --- a/filter/source/placeware/makefile.mk +++ b/filter/source/placeware/makefile.mk @@ -65,3 +65,11 @@ DEF1NAME= $(SHL1TARGET) # --- Targets ---------------------------------- .INCLUDE : target.mk + +ALLTAR : $(MISC)/placeware.component + +$(MISC)/placeware.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + placeware.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt placeware.component diff --git a/filter/source/placeware/placeware.component b/filter/source/placeware/placeware.component new file mode 100644 index 000000000000..9a6ca703ef2d --- /dev/null +++ b/filter/source/placeware/placeware.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.Impress.PlaceWareExportFilter"> + <service name="com.sun.star.document.ExportFilter"/> + </implementation> +</component> diff --git a/filter/source/placeware/uno.cxx b/filter/source/placeware/uno.cxx index c11b4392a1b4..49a660b05241 100644 --- a/filter/source/placeware/uno.cxx +++ b/filter/source/placeware/uno.cxx @@ -59,32 +59,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * /* pServiceManager */, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( PlaceWareExportFilter_getImplementationName() ) ); - xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - - const Sequence< OUString > & rSNL = PlaceWareExportFilter_getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/filter/source/svg/makefile.mk b/filter/source/svg/makefile.mk index 12c1210c18c4..44bac23381f5 100644 --- a/filter/source/svg/makefile.mk +++ b/filter/source/svg/makefile.mk @@ -81,3 +81,11 @@ DEF1NAME=$(SHL1TARGET) # --- Targets ---------------------------------- .INCLUDE : target.mk + +ALLTAR : $(MISC)/svgfilter.component + +$(MISC)/svgfilter.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + svgfilter.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt svgfilter.component diff --git a/filter/source/svg/svgfilter.component b/filter/source/svg/svgfilter.component new file mode 100644 index 000000000000..82db624ff9e0 --- /dev/null +++ b/filter/source/svg/svgfilter.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.Draw.SVGFilter"> + <service name="com.sun.star.document.SVGFilter"/> + </implementation> +</component> diff --git a/filter/source/svg/svguno.cxx b/filter/source/svg/svguno.cxx index aa91889fc93f..f20bfb6a526d 100644 --- a/filter/source/svg/svguno.cxx +++ b/filter/source/svg/svguno.cxx @@ -51,32 +51,6 @@ extern "C" *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== - SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void * /* pServiceManager */, void * pRegistryKey ) - { - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( SVGFilter_getImplementationName() ) ); - xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - - const Sequence< OUString > & rSNL = SVGFilter_getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; - } - //================================================================================================== SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/filter/source/t602/filterenv.cxx b/filter/source/t602/filterenv.cxx index f7fc319c27e3..d1e1a2536f8b 100644 --- a/filter/source/t602/filterenv.cxx +++ b/filter/source/t602/filterenv.cxx @@ -52,41 +52,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * /* pServiceManager */, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - sal_Int32 nPos = 0; - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( T602ImportFilter_getImplementationName() ) ); - xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - - const Sequence< OUString > & rSNL = T602ImportFilter_getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - xNewKey = reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( T602ImportFilterDialog_getImplementationName() ); - xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - - const Sequence< OUString > & rSNL2 = T602ImportFilterDialog_getSupportedServiceNames(); - pArray = rSNL2.getConstArray(); - for ( nPos = rSNL2.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/filter/source/t602/makefile.mk b/filter/source/t602/makefile.mk index c65de1bc9b7c..141794b346b5 100644 --- a/filter/source/t602/makefile.mk +++ b/filter/source/t602/makefile.mk @@ -60,3 +60,11 @@ SHL1STDLIBS= \ # --- Targets ------------------------------------------------------ .INCLUDE : target.mk + +ALLTAR : $(MISC)/t602filter.component + +$(MISC)/t602filter.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + t602filter.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt t602filter.component diff --git a/filter/source/t602/t602filter.component b/filter/source/t602/t602filter.component new file mode 100644 index 000000000000..fe512bf483ca --- /dev/null +++ b/filter/source/t602/t602filter.component @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.Writer.T602ImportFilter"> + <service name="com.sun.star.document.ExtendedTypeDetection"/> + <service name="com.sun.star.document.ImportFilter"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.T602ImportFilterDialog"> + <service name="com.sun.star.ui.dialogs.FilterOptionsDialog"/> + </implementation> +</component> diff --git a/filter/source/xmlfilteradaptor/genericfilter.cxx b/filter/source/xmlfilteradaptor/genericfilter.cxx index f91c7e4f296c..8af896b84938 100644 --- a/filter/source/xmlfilteradaptor/genericfilter.cxx +++ b/filter/source/xmlfilteradaptor/genericfilter.cxx @@ -82,58 +82,6 @@ void SAL_CALL component_getImplementationEnvironment( //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - - void * /* pServiceManager */, void * pRegistryKey ) - -{ - - if (pRegistryKey) - - { - - try - - { - - Reference< XRegistryKey > xNewKey( - - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( XmlFilterAdaptor_getImplementationName() ) ); - - xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - - - - const Sequence< OUString > & rSNL = XmlFilterAdaptor_getSupportedServiceNames(); - - const OUString * pArray = rSNL.getConstArray(); - - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - - xNewKey->createKey( pArray[nPos] ); - - - - return sal_True; - - } - - catch (InvalidRegistryException &) - - { - - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - - } - - } - - return sal_False; - -} - -//================================================================================================== - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) diff --git a/filter/source/xmlfilteradaptor/makefile.mk b/filter/source/xmlfilteradaptor/makefile.mk index b3d39f860388..0e3732c20885 100644 --- a/filter/source/xmlfilteradaptor/makefile.mk +++ b/filter/source/xmlfilteradaptor/makefile.mk @@ -60,3 +60,11 @@ SHL1STDLIBS= $(COMPHELPERLIB) \ .INCLUDE : target.mk + +ALLTAR : $(MISC)/xmlfa.component + +$(MISC)/xmlfa.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + xmlfa.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt xmlfa.component diff --git a/filter/source/xmlfilteradaptor/xmlfa.component b/filter/source/xmlfilteradaptor/xmlfa.component new file mode 100644 index 000000000000..d835782c2f38 --- /dev/null +++ b/filter/source/xmlfilteradaptor/xmlfa.component @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.Writer.XmlFilterAdaptor"> + <service name="com.sun.star.document.ExportFilter"/> + <service name="com.sun.star.document.ImportFilter"/> + </implementation> +</component> diff --git a/filter/source/xmlfilterdetect/fdcomp.cxx b/filter/source/xmlfilterdetect/fdcomp.cxx index 10820fc8f280..8f68f35cc0dc 100644 --- a/filter/source/xmlfilterdetect/fdcomp.cxx +++ b/filter/source/xmlfilterdetect/fdcomp.cxx @@ -82,58 +82,6 @@ void SAL_CALL component_getImplementationEnvironment( //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - - void * /* pServiceManager */, void * pRegistryKey ) - -{ - - if (pRegistryKey) - - { - - try - - { - - Reference< XRegistryKey > xNewKey( - - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( FilterDetect_getImplementationName() ) ); - - xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - - - - const Sequence< OUString > & rSNL = FilterDetect_getSupportedServiceNames(); - - const OUString * pArray = rSNL.getConstArray(); - - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - - xNewKey->createKey( pArray[nPos] ); - - - - return sal_True; - - } - - catch (InvalidRegistryException &) - - { - - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - - } - - } - - return sal_False; - -} - -//================================================================================================== - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) diff --git a/filter/source/xmlfilterdetect/makefile.mk b/filter/source/xmlfilterdetect/makefile.mk index d13c4af5f576..582b73950ef9 100644 --- a/filter/source/xmlfilterdetect/makefile.mk +++ b/filter/source/xmlfilterdetect/makefile.mk @@ -58,3 +58,11 @@ SHL1STDLIBS= $(UCBHELPERLIB) \ $(SALLIB) .INCLUDE : target.mk + +ALLTAR : $(MISC)/xmlfd.component + +$(MISC)/xmlfd.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + xmlfd.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt xmlfd.component diff --git a/filter/source/xmlfilterdetect/xmlfd.component b/filter/source/xmlfilterdetect/xmlfd.component new file mode 100644 index 000000000000..3796b0e1fb46 --- /dev/null +++ b/filter/source/xmlfilterdetect/xmlfd.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.filters.XMLFilterDetect"> + <service name="com.sun.star.document.ExtendedTypeDetection"/> + </implementation> +</component> diff --git a/filter/source/xslt/export/uof/odf2uof_text.xsl b/filter/source/xslt/export/uof/odf2uof_text.xsl index cea93c8a0864..0586c1724c31 100644 --- a/filter/source/xslt/export/uof/odf2uof_text.xsl +++ b/filter/source/xslt/export/uof/odf2uof_text.xsl @@ -4029,13 +4029,7 @@ <xsl:element name="字:文本串"> <xsl:attribute name="uof:locID">t0109</xsl:attribute> <xsl:attribute name="uof:attrList">标识符</xsl:attribute> - <xsl:variable name="stt"> - <xsl:value-of select="./text:a"/> - </xsl:variable> - <xsl:variable name="end"> - <xsl:value-of select="."/> - </xsl:variable> - <xsl:value-of select="substring-after($end,$stt)"/> + <xsl:value-of select="$bijiao"/> </xsl:element> </xsl:if> </字:句> diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl index 6229544cf02f..1c47b8f25ce8 100644 --- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl +++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl @@ -57,8 +57,16 @@ <xsl:key match="style:master-page" name="masterPageElements" use="@style:name"/> <xsl:key match="style:page-layout" name="pageLayoutElements" use="@style:name"/> <xsl:key name="writingModeStyles" match="/*/office:styles/style:style/style:paragraph-properties/@style:writing-mode | /*/office:automatic-styles/style:style/style:paragraph-properties/@style:writing-mode" use="'test'"/> + <xsl:template name="create-body"> <xsl:param name="globalData"/> + <xsl:call-template name="create-body.collect-page-properties"> + <xsl:with-param name="globalData" select="$globalData"/> + </xsl:call-template> + </xsl:template> + + <xsl:template name="create-body.collect-page-properties"> + <xsl:param name="globalData"/> <!-- approximation to find the correct master page style (with page dimensions) --> <xsl:variable name="masterPageNames"> @@ -75,10 +83,10 @@ <!-- Take the first of the masterpage list and get the according style:master-page element and find the @style:page-layout-name --> <xsl:variable name="pageLayoutName" select="key('masterPageElements', substring-before($masterPageNames,';'))/@style:page-layout-name"/> - <xsl:variable name="pageProperties"> + <xsl:variable name="pagePropertiesRTF"> <xsl:choose> <xsl:when test="not($pageLayoutName) or $pageLayoutName = ''"> - <xsl:copy-of select="$globalData/styles-file/*/office:automatic-styles/style:page-layout[1]/style:page-layout-properties"/> + <xsl:value-of select="$globalData/styles-file/*/office:automatic-styles/style:page-layout[1]/style:page-layout-properties"/> </xsl:when> <xsl:otherwise> <!-- Find the according style:page-layout and store the properties in a variable --> @@ -86,6 +94,36 @@ </xsl:otherwise> </xsl:choose> </xsl:variable> + + <xsl:choose> + <xsl:when test="function-available('common:node-set')"> + <xsl:call-template name="create-body.create"> + <xsl:with-param name="globalData" select="common:node-set($globalData)"/> + <xsl:with-param name="pageProperties" select="common:node-set($pagePropertiesRTF)"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="function-available('xalan:nodeset')"> + <xsl:call-template name="create-body.create"> + <xsl:with-param name="globalData" select="xalan:nodeset($globalData)"/> + <xsl:with-param name="pageProperties" select="xalan:nodeset($pagePropertiesRTF)"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="function-available('xt:node-set')"> + <xsl:call-template name="create-body.create"> + <xsl:with-param name="globalData" select="xt:node-set($globalData)"/> + <xsl:with-param name="pageProperties" select="xt:node-set($pagePropertiesRTF)"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes">The required node-set function was not found!</xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="create-body.create"> + <xsl:param name="globalData"/> + <xsl:param name="pageProperties"/> + <xsl:element name="body"> <!-- direction of text flow --> <xsl:variable name="writingMode" select="$pageProperties/style:page-layout-properties/@style:writing-mode"/> @@ -102,8 +140,8 @@ </xsl:when> <xsl:otherwise> <!-- As CSS writing-mode is not implemented by all browsers, a heuristic is done --> - <xsl:variable name="writingMode" select="key('writingModeStyles', 'test')"/> - <xsl:if test="contains($writingMode, 'rl')"> + <xsl:variable name="writingModeTest" select="key('writingModeStyles', 'test')"/> + <xsl:if test="contains($writingModeTest, 'rl')"> <xsl:attribute name="dir">rtl</xsl:attribute> </xsl:if> </xsl:otherwise> @@ -579,13 +617,13 @@ </xsl:variable> <xsl:choose> <xsl:when test="$tabIndent='NaN'"> - <xsl:variable name="tabPosition"> + <xsl:variable name="tabPositionTmp"> <xsl:call-template name="convert2cm"> <xsl:with-param name="value" select="$tabStops/style:tab-stop[last()]/@style:position"/> </xsl:call-template> </xsl:variable> <!-- Heuristic: for every tab that is more than specified give a further 1 cm --> - <xsl:value-of select="$parentMarginLeft + $tabPosition + count($tabStops/style:tab-stop) - $tabCount"/> + <xsl:value-of select="$parentMarginLeft + $tabPositionTmp + count($tabStops/style:tab-stop) - $tabCount"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$tabIndent"/> @@ -1767,6 +1805,11 @@ <xsl:param name="minLabelWidth"/> <xsl:param name="listIndent" /> + <!-- The text:list-header shall not be labeled. According to ODF specification (sect. 4.3.2): + "The <text:list-header> element represents a list header and is a special kind of list item. It + contains one or more paragraphs that are displayed before a list. The paragraphs are formatted + like list items but they do not have a preceding number or bullet." --> + <xsl:variable name="isListHeader" select="boolean(self::text:list-header)"/> <xsl:variable name="listIndentNew"> <xsl:choose> @@ -1785,13 +1828,16 @@ <xsl:variable name="itemNumberNew"> <xsl:if test="$listStyle/text:list-style/text:list-level-style-number"> <xsl:choose> + <xsl:when test="$isListHeader">0</xsl:when> <xsl:when test="$isEmptyList"> <!-- An empty list item (no text:h/text:p as child), will not count as item and does not increment the count. --> <xsl:variable name="tempItemNumber"> <xsl:choose> <!-- siblings will be incremented by one --> <xsl:when test="$itemNumber"> - <xsl:value-of select="$itemNumber + 1"/> + <xsl:if test="not($isListHeader)"> + <xsl:value-of select="$itemNumber + 1"/> + </xsl:if> </xsl:when> <!-- if a higher list level had content the numbering starts with 1 --> <xsl:when test="$isListNumberingReset and $listLevel > 1"> @@ -1866,6 +1912,7 @@ <xsl:when test="$display"> <xsl:value-of select="$display"/> </xsl:when> + <xsl:when test="$isListHeader">0</xsl:when> <xsl:otherwise>1</xsl:otherwise> </xsl:choose> </xsl:with-param> @@ -1876,9 +1923,10 @@ </xsl:variable> <xsl:element name="li"> <xsl:choose> - <xsl:when test="$isEmptyList"> + <xsl:when test="$isEmptyList or $isListHeader"> <xsl:apply-templates> <xsl:with-param name="globalData" select="$globalData"/> + <xsl:with-param name="isNextLevelNumberingReset" select="$isListHeader or $isNextLevelNumberingReset"/> <xsl:with-param name="itemLabel" select="$itemLabelNew"/> <xsl:with-param name="listLevel" select="$listLevel + 1"/> <xsl:with-param name="listStyleName" select="$listStyleName"/> @@ -1889,7 +1937,7 @@ <xsl:apply-templates mode="list-item-children" select="*[1]"> <xsl:with-param name="globalData" select="$globalData"/> <xsl:with-param name="isEmptyList" select="$isEmptyList"/> - <xsl:with-param name="isNextLevelNumberingReset" select="$isNextLevelNumberingReset"/> + <xsl:with-param name="isNextLevelNumberingReset" select="$isListHeader or $isNextLevelNumberingReset"/> <!-- The new created label is given to the children --> <xsl:with-param name="itemLabel" select="$itemLabelNew"/> <xsl:with-param name="listLabelElement"> @@ -2088,7 +2136,7 @@ <!-- The Numbering start value (or offset from regular counteing) is used at the first item of offset, - but have to be reused on following item/headers with no text:start-value --> + but have to be reused on following items with no text:start-value --> <xsl:template name="getItemNumber"> <xsl:param name="listLevel"/> <xsl:param name="listLevelStyle"/> @@ -2123,6 +2171,9 @@ the level 3 gets a 'pseudoLevel' --> <xsl:param name="pseudoLevel" select="0" /> + <xsl:variable name="isListHeader" select="boolean(self::text:list-header)"/> + <xsl:variable name="isEmptyList" select="not(*[name() = 'text:h' or name() = 'text:p'])"/> + <!-- set the next of preceding list items. Starting from the current to the next previous text:list-item --> <xsl:variable name="precedingListItemOfSameLevelAndStyle" select="$precedingListItemsOfSameLevelAndStyle[$precedingListItemsOfSameLevelAndStyleCount - $IteratorSameLevelAndStyle + 1]"/> <xsl:variable name="precedingListItemOfSameStyle" select="$precedingListItemsOfSameStyle[$precedingListItemsOfSameStyleCount - $IteratorSameStyle + 1]"/> @@ -2155,7 +2206,7 @@ <xsl:when test="$currentListLevel < $listLevel"> <xsl:choose> <!-- if it has content the counting is ended --> - <xsl:when test="*[name() = 'text:h' or name() = 'text:p']"> + <xsl:when test="not($isEmptyList or $isListHeader)"> <!-- 2DO: Perhaps the children still have to be processed --> <xsl:value-of select="$itemNumber + $pseudoLevel"/> </xsl:when> @@ -2210,7 +2261,7 @@ <xsl:with-param name="pseudoLevel"> <xsl:choose> <!-- empty list item does not count --> - <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])"> + <xsl:when test="$isEmptyList or $isListHeader"> <xsl:value-of select="$pseudoLevel"/> </xsl:when> <xsl:otherwise>1</xsl:otherwise> @@ -2243,11 +2294,14 @@ <xsl:param name="precedingListItemsOfSameStyleCount"/> <xsl:param name="pseudoLevel" /> + <xsl:variable name="isListHeader" select="boolean(self::text:list-header)"/> + <xsl:variable name="isEmptyList" select="not(*[name() = 'text:h' or name() = 'text:p'])"/> + <xsl:choose> <xsl:when test="@text:start-value"> <xsl:choose> - <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])"> - <!-- empty list item does not count --> + <xsl:when test="$isEmptyList or $isListHeader"> + <!-- empty list item does not count. neither does list header --> <xsl:call-template name="countListItemTillStartValue"> <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" /> <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/> @@ -2269,8 +2323,8 @@ </xsl:when> <xsl:when test="$listLevelStyle/@text:start-value"> <xsl:choose> - <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])"> - <!-- empty list item does not count --> + <xsl:when test="$isEmptyList or $isListHeader"> + <!-- empty list item does not count. neither does list header --> <xsl:call-template name="countListItemTillStartValue"> <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" /> <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/> @@ -2292,8 +2346,8 @@ </xsl:when> <xsl:otherwise> <xsl:choose> - <xsl:when test="not(*[name() = 'text:h' or name() = 'text:p'])"> - <!-- empty list item does not count --> + <xsl:when test="$isEmptyList or $isListHeader"> + <!-- empty list item does not count. neither does list header --> <xsl:call-template name="countListItemTillStartValue"> <xsl:with-param name="IteratorSameLevelAndStyle" select="$IteratorSameLevelAndStyle + 1" /> <xsl:with-param name="IteratorSameStyle" select="$IteratorSameStyle + 1"/> diff --git a/filter/source/xsltdialog/exports.dxp b/filter/source/xsltdialog/exports.dxp index 9630d7e06768..f0e1c69934bc 100644 --- a/filter/source/xsltdialog/exports.dxp +++ b/filter/source/xsltdialog/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/filter/source/xsltdialog/makefile.mk b/filter/source/xsltdialog/makefile.mk index 728a94bf0d36..c8b95594df4f 100644 --- a/filter/source/xsltdialog/makefile.mk +++ b/filter/source/xsltdialog/makefile.mk @@ -92,3 +92,11 @@ DEF1EXPORTFILE=exports.dxp # --- Targets ---------------------------------- .INCLUDE : target.mk + +ALLTAR : $(MISC)/xsltdlg.component + +$(MISC)/xsltdlg.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + xsltdlg.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt xsltdlg.component diff --git a/filter/source/xsltdialog/xmlfileview.cxx b/filter/source/xsltdialog/xmlfileview.cxx index a9cb18bed8d2..8bd0001dc198 100644 --- a/filter/source/xsltdialog/xmlfileview.cxx +++ b/filter/source/xsltdialog/xmlfileview.cxx @@ -55,6 +55,8 @@ #include "xmlfileview.hrc" #include "xmlfilterhelpids.hrc" +#include <deque> + using namespace rtl; using namespace osl; using namespace com::sun::star::lang; @@ -77,8 +79,7 @@ struct SwTextPortion svtools::ColorConfigEntry eType; }; -SV_DECL_VARARR(SwTextPortions, SwTextPortion,16,16) -SV_IMPL_VARARR(SwTextPortions, SwTextPortion); +typedef std::deque<SwTextPortion> SwTextPortions; class XMLErrorHandler : public ::cppu::WeakImplHelper1< XErrorHandler > { @@ -688,10 +689,10 @@ void lcl_Highlight(const String& rSource, SwTextPortions& aPortionList) const USHORT nStrLen = rSource.Len(); - USHORT nInsert = 0; // Anzahl der eingefuegten Portions - USHORT nActPos = 0; //Position, an der '<' gefunden wurde - USHORT nOffset = 0; //Offset von nActPos zur '<' - USHORT nPortStart = USHRT_MAX; // fuer die TextPortion + USHORT nInsert = 0; // Number of inserted Portions + USHORT nActPos = 0; // Position, at the '<' was found + USHORT nOffset = 0; // Offset of nActPos for '<' + USHORT nPortStart = USHRT_MAX; // For the TextPortion USHORT nPortEnd = 0; // SwTextPortion aText; while(nActPos < nStrLen) @@ -709,7 +710,8 @@ void lcl_Highlight(const String& rSource, SwTextPortions& aPortionList) aText.nStart += 1; aText.nEnd = nActPos - 1; aText.eType = svtools::HTMLUNKNOWN; - aPortionList.Insert(aText, nInsert++); + aPortionList.push_back( aText ); + nInsert++; } sal_Unicode cFollowFirst = rSource.GetChar((xub_StrLen)(nActPos + 1)); sal_Unicode cFollowNext = rSource.GetChar((xub_StrLen)(nActPos + 2)); @@ -801,7 +803,8 @@ void lcl_Highlight(const String& rSource, SwTextPortions& aPortionList) aText2.nStart = nPortStart + 1; aText2.nEnd = nPortEnd; aText2.eType = eFoundType; - aPortionList.Insert(aText2, nInsert++); + aPortionList.push_back( aText2 ); + nInsert++; eFoundType = svtools::HTMLUNKNOWN; } @@ -815,7 +818,8 @@ void lcl_Highlight(const String& rSource, SwTextPortions& aPortionList) aText.nStart = nPortEnd + 1; aText.nEnd = nActPos - 1; aText.eType = svtools::HTMLUNKNOWN; - aPortionList.Insert(aText, nInsert++); + aPortionList.push_back( aText ); + nInsert++; } } @@ -833,7 +837,7 @@ void XMLFileWindow::ImpDoHighlight( const String& rSource, USHORT nLineOff ) SwTextPortions aPortionList; lcl_Highlight(rSource, aPortionList); - USHORT nCount = aPortionList.Count(); + size_t nCount = aPortionList.size(); if ( !nCount ) return; @@ -841,7 +845,7 @@ void XMLFileWindow::ImpDoHighlight( const String& rSource, USHORT nLineOff ) if ( rLast.nStart > rLast.nEnd ) // Nur bis Bug von MD behoeben { nCount--; - aPortionList.Remove( nCount); + aPortionList.pop_back(); if ( !nCount ) return; } @@ -857,7 +861,7 @@ void XMLFileWindow::ImpDoHighlight( const String& rSource, USHORT nLineOff ) // Wenn zwei gleiche Attribute hintereinander eingestellt werden, // optimiert das die TextEngine. USHORT nLastEnd = 0; - for ( USHORT i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { SwTextPortion& r = aPortionList[i]; DBG_ASSERT( r.nLine == aPortionList[0].nLine, "doch mehrere Zeilen ?" ); @@ -877,7 +881,7 @@ void XMLFileWindow::ImpDoHighlight( const String& rSource, USHORT nLineOff ) } svtools::ColorConfig aConfig; - for ( USHORT i = 0; i < aPortionList.Count(); i++ ) + for ( size_t i = 0; i < aPortionList.size(); i++ ) { SwTextPortion& r = aPortionList[i]; if ( r.nStart > r.nEnd ) // Nur bis Bug von MD behoeben diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index c744a65fc274..e22ac2790955 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -403,37 +403,7 @@ void SAL_CALL component_getImplementationEnvironment( { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//================================================================================================== - -void singlecomponent_writeInfo( Reference< XRegistryKey >& xNewKey, const Sequence< OUString > & rSNL ) -{ - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); -} - -sal_Bool SAL_CALL component_writeInfo( - void * /* pServiceManager */, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( XMLFilterDialogComponent_getImplementationName() ) ); - xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - singlecomponent_writeInfo( xNewKey, XMLFilterDialogComponent_getSupportedServiceNames() ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; -} //================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) diff --git a/filter/source/xsltdialog/xmlfilterhelpids.hrc b/filter/source/xsltdialog/xmlfilterhelpids.hrc index 9c49d0537723..cced0609f5f4 100644 --- a/filter/source/xsltdialog/xmlfilterhelpids.hrc +++ b/filter/source/xsltdialog/xmlfilterhelpids.hrc @@ -27,62 +27,55 @@ #ifndef _XMLFILTERHELPIDS_HRC_ #define _XMLFILTERHELPIDS_HRC_ -#ifndef _FILTER_HRC -#include "filter.hrc" -#endif - -#define HID_XML_SOURCE_FILE_DIALOG (HID_FILTER_XSLT_START + 0) -#define HID_XML_SOURCE_FILE_VALIDATE (HID_FILTER_XSLT_START + 1) -#define HID_XML_FILTER_SETTINGS_DIALOG (HID_FILTER_XSLT_START + 2) -#define HID_XML_FILTER_LIST (HID_FILTER_XSLT_START + 3) -#define HID_XML_FILTER_NEW (HID_FILTER_XSLT_START + 4) -#define HID_XML_FILTER_EDIT (HID_FILTER_XSLT_START + 5) -#define HID_XML_FILTER_TEST (HID_FILTER_XSLT_START + 6) -#define HID_XML_FILTER_DELETE (HID_FILTER_XSLT_START + 7) -#define HID_XML_FILTER_SAVE (HID_FILTER_XSLT_START + 8) -#define HID_XML_FILTER_OPEN (HID_FILTER_XSLT_START + 9) -#define HID_XML_FILTER_CLOSE (HID_FILTER_XSLT_START + 10) - -#define HID_XML_FILTER_TABDIALOG (HID_FILTER_XSLT_START + 11) -#define HID_XML_FILTER_TABPAGE_BASIC (HID_FILTER_XSLT_START + 12) -#define HID_XML_FILTER_TABPAGE_XSLT (HID_FILTER_XSLT_START + 13) -#define HID_XML_FILTER_NAME (HID_FILTER_XSLT_START + 14) -#define HID_XML_FILTER_APPLICATION (HID_FILTER_XSLT_START + 15) -#define HID_XML_FILTER_INTERFACE_NAME (HID_FILTER_XSLT_START + 16) -#define HID_XML_FILTER_EXTENSION (HID_FILTER_XSLT_START + 17) -#define HID_XML_FILTER_DESCRIPTION (HID_FILTER_XSLT_START + 18) -#define HID_XML_FILTER_DOCTYPE (HID_FILTER_XSLT_START + 19) -#define HID_XML_FILTER_DTD (HID_FILTER_XSLT_START + 20) -#define HID_XML_FILTER_DTD_BROWSE (HID_FILTER_XSLT_START + 21) -#define HID_XML_FILTER_EXPORT_XSLT (HID_FILTER_XSLT_START + 22) -#define HID_XML_FILTER_EXPORT_XSLT_BROWSE (HID_FILTER_XSLT_START + 23) -#define HID_XML_FILTER_IMPORT_XSLT (HID_FILTER_XSLT_START + 24) -#define HID_XML_FILTER_IMPORT_XSLT_BROWSE (HID_FILTER_XSLT_START + 25) -#define HID_XML_FILTER_IMPORT_TEMPLATE (HID_FILTER_XSLT_START + 26) -#define HID_XML_FILTER_TEST_DIALOG (HID_FILTER_XSLT_START + 27) +#define HID_XML_SOURCE_FILE_DIALOG "FILTER_HID_XML_SOURCE_FILE_DIALOG" +#define HID_XML_SOURCE_FILE_VALIDATE "FILTER_HID_XML_SOURCE_FILE_VALIDATE" +#define HID_XML_FILTER_SETTINGS_DIALOG "FILTER_HID_XML_FILTER_SETTINGS_DIALOG" +#define HID_XML_FILTER_LIST "FILTER_HID_XML_FILTER_LIST" +#define HID_XML_FILTER_NEW "FILTER_HID_XML_FILTER_NEW" +#define HID_XML_FILTER_EDIT "FILTER_HID_XML_FILTER_EDIT" +#define HID_XML_FILTER_TEST "FILTER_HID_XML_FILTER_TEST" +#define HID_XML_FILTER_DELETE "FILTER_HID_XML_FILTER_DELETE" +#define HID_XML_FILTER_SAVE "FILTER_HID_XML_FILTER_SAVE" +#define HID_XML_FILTER_OPEN "FILTER_HID_XML_FILTER_OPEN" +#define HID_XML_FILTER_CLOSE "FILTER_HID_XML_FILTER_CLOSE" -#define HID_XML_FILTER_TEST_EXPORT_BROWSE (HID_FILTER_XSLT_START + 28) -#define HID_XML_FILTER_TEST_EXPORT_CURRENT (HID_FILTER_XSLT_START + 29) -#define HID_XML_FILTER_TEST_EXPORT_CURRENT_FILE (HID_FILTER_XSLT_START + 30) +#define HID_XML_FILTER_TABDIALOG "FILTER_HID_XML_FILTER_TABDIALOG" +#define HID_XML_FILTER_TABPAGE_BASIC "FILTER_HID_XML_FILTER_TABPAGE_BASIC" +#define HID_XML_FILTER_TABPAGE_XSLT "FILTER_HID_XML_FILTER_TABPAGE_XSLT" +#define HID_XML_FILTER_NAME "FILTER_HID_XML_FILTER_NAME" +#define HID_XML_FILTER_APPLICATION "FILTER_HID_XML_FILTER_APPLICATION" +#define HID_XML_FILTER_INTERFACE_NAME "FILTER_HID_XML_FILTER_INTERFACE_NAME" +#define HID_XML_FILTER_EXTENSION "FILTER_HID_XML_FILTER_EXTENSION" +#define HID_XML_FILTER_DESCRIPTION "FILTER_HID_XML_FILTER_DESCRIPTION" +#define HID_XML_FILTER_DOCTYPE "FILTER_HID_XML_FILTER_DOCTYPE" +#define HID_XML_FILTER_DTD "FILTER_HID_XML_FILTER_DTD" +#define HID_XML_FILTER_DTD_BROWSE "FILTER_HID_XML_FILTER_DTD_BROWSE" +#define HID_XML_FILTER_EXPORT_XSLT "FILTER_HID_XML_FILTER_EXPORT_XSLT" +#define HID_XML_FILTER_EXPORT_XSLT_BROWSE "FILTER_HID_XML_FILTER_EXPORT_XSLT_BROWSE" +#define HID_XML_FILTER_IMPORT_XSLT "FILTER_HID_XML_FILTER_IMPORT_XSLT" +#define HID_XML_FILTER_IMPORT_XSLT_BROWSE "FILTER_HID_XML_FILTER_IMPORT_XSLT_BROWSE" +#define HID_XML_FILTER_IMPORT_TEMPLATE "FILTER_HID_XML_FILTER_IMPORT_TEMPLATE" +#define HID_XML_FILTER_TEST_DIALOG "FILTER_HID_XML_FILTER_TEST_DIALOG" -#define HID_XML_FILTER_TEST_IMPORT_XSLT_FILE (HID_FILTER_XSLT_START + 31) -#define HID_XML_FILTER_TEST_IMPORT_TEMPLATE_FILE (HID_FILTER_XSLT_START + 32) -#define HID_XML_FILTER_TEST_IMPORT_DISPLAY_SOURCE (HID_FILTER_XSLT_START + 33) -#define HID_XML_FILTER_TEST_IMPORT_BROWSE (HID_FILTER_XSLT_START + 34) -#define HID_XML_FILTER_TEST_IMPORT_RECENT (HID_FILTER_XSLT_START + 35) -#define HID_XML_FILTER_TEST_IMPORT_RECENT_FILE (HID_FILTER_XSLT_START + 36) -#define HID_XML_FILTER_TEST_CLOSE (HID_FILTER_XSLT_START + 37) +#define HID_XML_FILTER_TEST_EXPORT_BROWSE "FILTER_HID_XML_FILTER_TEST_EXPORT_BROWSE" +#define HID_XML_FILTER_TEST_EXPORT_CURRENT "FILTER_HID_XML_FILTER_TEST_EXPORT_CURRENT" +#define HID_XML_FILTER_TEST_EXPORT_CURRENT_FILE "FILTER_HID_XML_FILTER_TEST_EXPORT_CURRENT_FILE" -#define HID_XML_FILTER_IMPORT_TEMPLATE_BROWSE (HID_FILTER_XSLT_START + 38) +#define HID_XML_FILTER_TEST_IMPORT_XSLT_FILE "FILTER_HID_XML_FILTER_TEST_IMPORT_XSLT_FILE" +#define HID_XML_FILTER_TEST_IMPORT_TEMPLATE_FILE "FILTER_HID_XML_FILTER_TEST_IMPORT_TEMPLATE_FILE" +#define HID_XML_FILTER_TEST_IMPORT_DISPLAY_SOURCE "FILTER_HID_XML_FILTER_TEST_IMPORT_DISPLAY_SOURCE" +#define HID_XML_FILTER_TEST_IMPORT_BROWSE "FILTER_HID_XML_FILTER_TEST_IMPORT_BROWSE" +#define HID_XML_FILTER_TEST_IMPORT_RECENT "FILTER_HID_XML_FILTER_TEST_IMPORT_RECENT" +#define HID_XML_FILTER_TEST_IMPORT_RECENT_FILE "FILTER_HID_XML_FILTER_TEST_IMPORT_RECENT_FILE" +#define HID_XML_FILTER_TEST_CLOSE "FILTER_HID_XML_FILTER_TEST_CLOSE" -#define HID_XML_FILTER_TEST_VALIDATE_OUPUT (HID_FILTER_XSLT_START + 39) -#define HID_XML_FILTER_OUTPUT_WINDOW (HID_FILTER_XSLT_START + 40) +#define HID_XML_FILTER_IMPORT_TEMPLATE_BROWSE "FILTER_HID_XML_FILTER_IMPORT_TEMPLATE_BROWSE" -#define HID_XML_FILTER_TEST_EXPORT_XSLT_FILE (HID_FILTER_XSLT_START + 41) +#define HID_XML_FILTER_TEST_VALIDATE_OUPUT "FILTER_HID_XML_FILTER_TEST_VALIDATE_OUPUT" +#define HID_XML_FILTER_OUTPUT_WINDOW "FILTER_HID_XML_FILTER_OUTPUT_WINDOW" -#define HID_XML_FILTER_TABPAGE_CTRL (HID_FILTER_XSLT_START + 42) +#define HID_XML_FILTER_TEST_EXPORT_XSLT_FILE "FILTER_HID_XML_FILTER_TEST_EXPORT_XSLT_FILE" -// last help id is HID_FILTER_XSLT_END ! -// #define HID_FILTER_XSLT_END (HID_FILTER_START + 99) +#define HID_XML_FILTER_TABPAGE_CTRL "FILTER_HID_XML_FILTER_TABPAGE_CTRL" #endif diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index 46cab18f6c77..9334c892028e 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -1433,9 +1433,7 @@ XMLFilterListBox::XMLFilterListBox( SvxPathControl_Impl * pParent ) static long nTabs[] = {3, 0, nTabSize, 2*nTabSize }; Size aHeadSize( mpHeaderBar->GetSizePixel() ); - WinBits nBits = WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP; pParent->SetFocusControl( this ); - SetWindowBits( nBits ); // SetDoubleClickHdl( aLink ); // SetSelectHdl( LINK( this, SvxPathTabPage, PathSelect_Impl ) ); SetSelectionMode( MULTIPLE_SELECTION ); diff --git a/filter/source/xsltdialog/xsltdlg.component b/filter/source/xsltdialog/xsltdlg.component new file mode 100644 index 000000000000..086208f4f830 --- /dev/null +++ b/filter/source/xsltdialog/xsltdlg.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="XMLFilterDialogComponent"> + <service name="com.sun.star.comp.ui.XSLTFilterDialog"/> + </implementation> +</component> diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx index 2ee532086ef5..cccad09bae2e 100644 --- a/filter/source/xsltfilter/XSLTFilter.cxx +++ b/filter/source/xsltfilter/XSLTFilter.cxx @@ -682,31 +682,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo(void * /* pServiceManager */, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( - OUString::createFromAscii( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) ); - - const Sequence< OUString > & rSNL = getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; -} - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/filter/source/xsltfilter/XSLTFilter.jar.component b/filter/source/xsltfilter/XSLTFilter.jar.component new file mode 100644 index 000000000000..d4ecd66f3b53 --- /dev/null +++ b/filter/source/xsltfilter/XSLTFilter.jar.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.Java2" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="XSLTransformer"> + <service name="com.sun.star.comp.JAXTHelper"/> + </implementation> +</component> diff --git a/filter/source/xsltfilter/XSLTransformer.java b/filter/source/xsltfilter/XSLTransformer.java index 4806c18b8161..315170ec7f98 100644 --- a/filter/source/xsltfilter/XSLTransformer.java +++ b/filter/source/xsltfilter/XSLTransformer.java @@ -81,9 +81,8 @@ import com.sun.star.lib.uno.adapter.XOutputStreamToOutputStreamAdapter; import net.sf.saxon.FeatureKeys; /** This outer class provides an inner class to implement the service - * description, a method to instantiate the - * component on demand (__getServiceFactory()), and a method to give - * information about the component (__writeRegistryServiceInfo()). + * description and a method to instantiate the + * component on demand (__getServiceFactory()). */ public class XSLTransformer implements XTypeProvider, XServiceName, XServiceInfo, XActiveDataSink, @@ -476,9 +475,4 @@ public class XSLTransformer } return xSingleServiceFactory; } - - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(XSLTransformer.class.getName(), - _serviceName, regKey); - } } diff --git a/filter/source/xsltfilter/makefile.mk b/filter/source/xsltfilter/makefile.mk index a5e27135e17a..f96534df4e2d 100644 --- a/filter/source/xsltfilter/makefile.mk +++ b/filter/source/xsltfilter/makefile.mk @@ -83,3 +83,17 @@ $(JAVACLASSFILES) : $(CLASSDIR) $(CLASSDIR) : $(MKDIR) $(CLASSDIR) .ENDIF + +ALLTAR : $(MISC)/XSLTFilter.jar.component $(MISC)/xsltfilter.component + +$(MISC)/XSLTFilter.jar.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt XSLTFilter.jar.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_JAVA)$(JARTARGET)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt XSLTFilter.jar.component + +$(MISC)/xsltfilter.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + xsltfilter.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt xsltfilter.component diff --git a/filter/source/xsltfilter/xsltfilter.component b/filter/source/xsltfilter/xsltfilter.component new file mode 100644 index 000000000000..25a479794b29 --- /dev/null +++ b/filter/source/xsltfilter/xsltfilter.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.documentconversion.XSLTFilter"> + <service name="com.sun.star.documentconversion.XSLTFilter"/> + </implementation> +</component> diff --git a/filter/source/xsltvalidate/XSLTValidate.component b/filter/source/xsltvalidate/XSLTValidate.component new file mode 100644 index 000000000000..7d357be55119 --- /dev/null +++ b/filter/source/xsltvalidate/XSLTValidate.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.Java2" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="XSLTValidate$_XSLTValidate"> + <service name="com.sun.star.documentconversion.XSLTValidate"/> + </implementation> +</component> diff --git a/filter/source/xsltvalidate/XSLTValidate.java b/filter/source/xsltvalidate/XSLTValidate.java index 6dba438f4e47..591b7c6f354c 100644 --- a/filter/source/xsltvalidate/XSLTValidate.java +++ b/filter/source/xsltvalidate/XSLTValidate.java @@ -53,9 +53,8 @@ import com.sun.star.uno.AnyConverter; import com.sun.star.lib.uno.adapter.*; /** This outer class provides an inner class to implement the service - * description, a method to instantiate the - * component on demand (__getServiceFactory()), and a method to give - * information about the component (__writeRegistryServiceInfo()). + * description and a method to instantiate the + * component on demand (__getServiceFactory()). */ public class XSLTValidate { @@ -330,18 +329,4 @@ public class XSLTValidate { return xSingleServiceFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - - return FactoryHelper.writeRegistryServiceInfo(_XSLTValidate.class.getName(), - _XSLTValidate.__serviceName, regKey); - } } diff --git a/filter/source/xsltvalidate/makefile.mk b/filter/source/xsltvalidate/makefile.mk index 5337d31a4bd7..1ceb740fcf6a 100644 --- a/filter/source/xsltvalidate/makefile.mk +++ b/filter/source/xsltvalidate/makefile.mk @@ -74,3 +74,11 @@ $(JARMANIFEST) : $(CLASSDIR) $(CLASSDIR) : $(MKDIR) $(CLASSDIR) + +ALLTAR : $(MISC)/XSLTValidate.component + +$(MISC)/XSLTValidate.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt XSLTValidate.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_JAVA)$(JARTARGET)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt XSLTValidate.component diff --git a/hwpfilter/prj/d.lst b/hwpfilter/prj/d.lst index 32763725af8b..0848b21f27ac 100644 --- a/hwpfilter/prj/d.lst +++ b/hwpfilter/prj/d.lst @@ -2,4 +2,4 @@ ..\%__SRC%\lib\ihwp*.lib %_DEST%\bin%_EXT%\ihwp*.lib ..\%__SRC%\lib\libhwp.so %_DEST%\lib%_EXT%\libhwp.so ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib - +..\%__SRC%\misc\hwp.component %_DEST%\xml%_EXT%\hwp.component diff --git a/hwpfilter/source/hwp.component b/hwpfilter/source/hwp.component new file mode 100644 index 000000000000..5280cfbbd46b --- /dev/null +++ b/hwpfilter/source/hwp.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.comp.hwpimport.HwpImportFilter"> + <service name="com.sun.star.document.ImportFilter"/> + </implementation> +</component> diff --git a/hwpfilter/source/hwpreader.hxx b/hwpfilter/source/hwpreader.hxx index c5fdb180f776..239a1ff225d6 100644 --- a/hwpfilter/source/hwpreader.hxx +++ b/hwpfilter/source/hwpreader.hxx @@ -345,30 +345,6 @@ extern "C" *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - - sal_Bool SAL_CALL component_writeInfo( - void * , void * pRegistryKey ) - { - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xKey( reinterpret_cast< XRegistryKey * >( pRegistryKey ) ); - - Reference< XRegistryKey > xNewKey = xKey->createKey( - OUString::createFromAscii( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ); - xNewKey->createKey( OUString::createFromAscii( SERVICE_NAME ) ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; - } - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * ) { void * pRet = 0; diff --git a/hwpfilter/source/makefile.mk b/hwpfilter/source/makefile.mk index 98b00d0618d6..494b4a30d74d 100644 --- a/hwpfilter/source/makefile.mk +++ b/hwpfilter/source/makefile.mk @@ -1,6 +1,4 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +#************************************************************************* NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # Copyright 2000, 2010 Oracle and/or its affiliates. # @@ -95,3 +93,11 @@ DEF1NAME=$(SHL1TARGET) # --- Tagets ------------------------------------------------------- .INCLUDE : target.mk + +ALLTAR : $(MISC)/hwp.component + +$(MISC)/hwp.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + hwp.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt hwp.component 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 <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/NamedValue.hpp> + #include <rtl/cipher.h> #include <rtl/digest.h> @@ -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 <memory> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/document/XExporter.hpp> #include <com/sun/star/document/XFilter.hpp> @@ -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/drawingml/fillproperties.hxx b/oox/inc/oox/drawingml/fillproperties.hxx index 42457e6f4dde..d62651ebdc20 100644 --- a/oox/inc/oox/drawingml/fillproperties.hxx +++ b/oox/inc/oox/drawingml/fillproperties.hxx @@ -117,6 +117,8 @@ struct BlipFillProperties OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch. OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moFillRect; /// Stretch fill offsets. + OptValue< ::com::sun::star::geometry::IntegerRectangle2D > + moClipRect; OptValue< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs). OptValue< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs). OptValue< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent). 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/inc/oox/helper/graphichelper.hxx b/oox/inc/oox/helper/graphichelper.hxx index 37002940cb17..1c112efcf923 100644 --- a/oox/inc/oox/helper/graphichelper.hxx +++ b/oox/inc/oox/helper/graphichelper.hxx @@ -148,6 +148,10 @@ public: @return The URL of the created and internally cached graphic object. */ ::rtl::OUString importEmbeddedGraphicObject( const ::rtl::OUString& rStreamName ) const; + /** calculates the orignal size of a graphic which is necessary to be able to calculate cropping values + @return The original Graphic size in 100thmm */ + ::com::sun::star::awt::Size getOriginalSize( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ) const; + // ------------------------------------------------------------------------ private: typedef ::std::map< sal_Int32, sal_Int32 > SystemPalette; diff --git a/oox/inc/oox/ppt/slidepersist.hxx b/oox/inc/oox/ppt/slidepersist.hxx index 31156a56ee84..bcb0c5803d61 100644 --- a/oox/inc/oox/ppt/slidepersist.hxx +++ b/oox/inc/oox/ppt/slidepersist.hxx @@ -91,6 +91,7 @@ public: void setBackgroundProperties( const oox::drawingml::FillPropertiesPtr pFillPropertiesPtr ){ mpBackgroundPropertiesPtr = pFillPropertiesPtr; } oox::drawingml::FillPropertiesPtr getBackgroundProperties() const { return mpBackgroundPropertiesPtr; } + oox::drawingml::Color& getBackgroundColorRef() { return maBackgroundColorRef; } sal_Bool isMasterPage() const { return mbMaster; } sal_Bool isNotesPage() const { return mbNotes; } @@ -130,6 +131,7 @@ private: SlidePersistPtr mpMasterPagePtr; oox::drawingml::ShapePtr maShapesPtr; + oox::drawingml::Color maBackgroundColorRef; oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr; ::std::list< boost::shared_ptr< TimeNode > > maTimeNodeList; 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/prj/d.lst b/oox/prj/d.lst index 482a270926a3..f656056b119e 100644 --- a/oox/prj/d.lst +++ b/oox/prj/d.lst @@ -41,3 +41,4 @@ mkdir: %_DEST%\inc%_EXT%\oox\xls dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi" ..\xml\components.xml %_DEST%\xml%_EXT%\components.xml +..\%__SRC%\misc\oox.component %_DEST%\xml%_EXT%\oox.component 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 <string.h> #include "oox/helper/attributelist.hxx" +#include <comphelper/sequenceashashmap.hxx> +#include <comphelper/docpasswordhelper.hxx> + +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>( (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/facreg.cxx b/oox/source/core/facreg.cxx index de6212984093..ed54ae81e7e5 100644 --- a/oox/source/core/facreg.cxx +++ b/oox/source/core/facreg.cxx @@ -77,45 +77,6 @@ OOX_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Ch *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -void SAL_CALL writeInfo( registry::XRegistryKey * pRegistryKey, const OUString& rImplementationName, const uno::Sequence< OUString >& rServices ) -{ - uno::Reference< registry::XRegistryKey > xNewKey( - pRegistryKey->createKey( - OUString( sal_Unicode( '/' ) ) + rImplementationName + OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ) ); - - for( sal_Int32 i = 0; i < rServices.getLength(); i++ ) - xNewKey->createKey( rServices.getConstArray()[i]); -} - -#define WRITEINFO(className)\ - writeInfo( pKey, className##_getImplementationName(), className##_getSupportedServiceNames() ) - -OOX_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void * , void * pRegistryKey ) -{ - if( pRegistryKey ) - { - try - { - registry::XRegistryKey *pKey = reinterpret_cast< registry::XRegistryKey * >( pRegistryKey ); - - WRITEINFO( ::oox::core::FilterDetect ); - WRITEINFO( ::oox::ppt::PowerPointImport ); - WRITEINFO( ::oox::xls::BiffDetector ); - WRITEINFO( ::oox::xls::ExcelFilter ); - WRITEINFO( ::oox::xls::ExcelBiffFilter ); - WRITEINFO( ::oox::shape::ShapeContextHandler ); - WRITEINFO( ::oox::shape::FastTokenHandlerService ); - WRITEINFO( ::oox::docprop::OOXMLDocPropImportImpl ); - WRITEINFO( ::oox::xls::OOXMLFormulaParser ); - } - catch (registry::InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_True; -} - #define SINGLEFACTORY(classname)\ if( classname##_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )\ {\ diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index 9b7b00988dd0..6d2b98454444 100755..100644 --- 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/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 168055935104..08d001f09a62 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/Gradient.hpp> +#include <com/sun/star/text/GraphicCrop.hpp> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/drawing/BitmapMode.hpp> #include <com/sun/star/drawing/ColorMode.hpp> @@ -435,6 +436,26 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe OUString aGraphicUrl = rGraphicHelper.createGraphicObject( xGraphic ); if( aGraphicUrl.getLength() > 0 ) rPropMap[ PROP_GraphicURL ] <<= aGraphicUrl; + + // cropping + if ( maBlipProps.moClipRect.has() ) + { + geometry::IntegerRectangle2D oClipRect( maBlipProps.moClipRect.get() ); + awt::Size aOriginalSize( rGraphicHelper.getOriginalSize( xGraphic ) ); + if ( aOriginalSize.Width && aOriginalSize.Height ) + { + text::GraphicCrop aGraphCrop( 0, 0, 0, 0 ); + if ( oClipRect.X1 ) + aGraphCrop.Left = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Width ) * oClipRect.X1 ) / 100000 ); + if ( oClipRect.Y1 ) + aGraphCrop.Top = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y1 ) / 100000 ); + if ( oClipRect.X2 ) + aGraphCrop.Right = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Width ) * oClipRect.X2 ) / 100000 ); + if ( oClipRect.Y2 ) + aGraphCrop.Bottom = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y2 ) / 100000 ); + rPropMap[ PROP_GraphicCrop ] <<= aGraphCrop; + } + } } // color effect diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx index b9d7fa7e1142..cb2037294786 100644 --- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx +++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx @@ -225,7 +225,15 @@ Reference< XFastContextHandler > BlipFillContext::createFastChildContext( return new BlipContext( *this, rxAttribs, mrBlipProps ); case A_TOKEN( srcRect ): - // TODO + { + rtl::OUString aDefault( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "0" ) ) ); + ::com::sun::star::geometry::IntegerRectangle2D aClipRect; + aClipRect.X1 = GetPercent( aAttribs.getString( XML_l, aDefault ) ); + aClipRect.Y1 = GetPercent( aAttribs.getString( XML_t, aDefault ) ); + aClipRect.X2 = GetPercent( aAttribs.getString( XML_r, aDefault ) ); + aClipRect.Y2 = GetPercent( aAttribs.getString( XML_b, aDefault ) ); + mrBlipProps.moClipRect = aClipRect; + } break; case A_TOKEN( tile ): 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..cb8304b76d04 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; + + xStart = Reference< XTextRange >( xAt, UNO_QUERY ); + aPropSet = PropertySet( xStart ); + aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase ); + } + } } } else 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 diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index 455778f939f7..ae664cf86668 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -38,6 +38,7 @@ #include <comphelper/seqstream.hxx> #include "tokens.hxx" #include "oox/helper/containerhelper.hxx" +#include <com/sun/star/beans/XPropertySet.hpp> using ::rtl::OUString; using ::com::sun::star::awt::DeviceInfo; @@ -52,6 +53,7 @@ using ::com::sun::star::graphic::GraphicObject; using ::com::sun::star::graphic::XGraphic; using ::com::sun::star::graphic::XGraphicObject; using ::com::sun::star::graphic::XGraphicProvider; +using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::io::XInputStream; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::uno::Exception; @@ -352,6 +354,29 @@ OUString GraphicHelper::importEmbeddedGraphicObject( const OUString& rStreamName return xGraphic.is() ? createGraphicObject( xGraphic ) : OUString(); } +Size GraphicHelper::getOriginalSize( const Reference< XGraphic >& xGraphic ) const +{ + Size aSize100thMM( 0, 0 ); + Reference< XPropertySet > xGraphicPropertySet( xGraphic, UNO_QUERY_THROW ); + if ( xGraphicPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size100thMM" ) ) ) >>= aSize100thMM ) + { + if ( !aSize100thMM.Width && !aSize100thMM.Height ) + { // MAPMODE_PIXEL USED :-( + Size aSourceSizePixel( 0, 0 ); + if ( xGraphicPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SizePixel" ) ) ) >>= aSourceSizePixel ) + { + const DeviceInfo& rDeviceInfo = getDeviceInfo(); + if ( rDeviceInfo.PixelPerMeterX && rDeviceInfo.PixelPerMeterY ) + { + aSize100thMM.Width = static_cast< sal_Int32 >( ( aSourceSizePixel.Width * 100000.0 ) / rDeviceInfo.PixelPerMeterX ); + aSize100thMM.Height = static_cast< sal_Int32 >( ( aSourceSizePixel.Height * 100000.0 ) / rDeviceInfo.PixelPerMeterY ); + } + } + } + } + return aSize100thMM; +} + // ============================================================================ } // namespace oox diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 69f32e01e7eb..7e77f5a54938 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -145,7 +145,14 @@ Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( s mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr ); } break; + case NMSP_PPT|XML_bgRef: // a:CT_StyleMatrixReference + { + FillPropertiesPtr pFillPropertiesPtr( new FillProperties( + *mpSlidePersistPtr->getTheme()->getFillStyle( xAttribs->getOptionalValue( XML_idx ).toInt32() ) ) ); + xRet.set( new ColorContext( *this, mpSlidePersistPtr->getBackgroundColorRef() ) ); + mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr ); + } break; case NMSP_PPT|XML_clrMap: // CT_ColorMapping diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index ce99ffc49f19..8555ba371b77 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -173,12 +173,17 @@ void SlidePersist::createBackground( const XmlFilterBase& rFilterBase ) { try { + sal_Int32 nPhClr = API_RGB_TRANSPARENT; + if ( maBackgroundColorRef.isUsed() ) + nPhClr = maBackgroundColorRef.getColor( rFilterBase.getGraphicHelper() ); + PropertyMap aPropMap; static const rtl::OUString sBackground( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ); uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xPropertySet( aPropMap.makePropertySet() ); PropertySet aPropSet( xPropertySet ); - mpBackgroundPropertiesPtr->pushToPropSet( aPropSet, rFilterBase.getModelObjectHelper(), rFilterBase.getGraphicHelper() ); + mpBackgroundPropertiesPtr->pushToPropSet( aPropSet, rFilterBase.getModelObjectHelper(), + rFilterBase.getGraphicHelper(), oox::drawingml::FillProperties::DEFAULT_IDS, 0, nPhClr ); xPagePropSet->setPropertyValue( sBackground, Any( xPropertySet ) ); } catch( Exception ) diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index da1aeb2ed265..ba51c3577a8e 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -166,6 +166,7 @@ Geometry3D GradientName Graphic GraphicColorMode +GraphicCrop GraphicSize GraphicURL GridColor 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(); } diff --git a/oox/util/makefile.mk b/oox/util/makefile.mk index 8bbf8a3650f2..329ced792164 100644 --- a/oox/util/makefile.mk +++ b/oox/util/makefile.mk @@ -94,3 +94,11 @@ DEFLIB1NAME =$(TARGET) .ENDIF # L10N_framework .INCLUDE : target.mk + +ALLTAR : $(MISC)/oox.component + +$(MISC)/oox.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + oox.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt oox.component diff --git a/oox/util/oox.component b/oox/util/oox.component new file mode 100644 index 000000000000..686ee6f1728e --- /dev/null +++ b/oox/util/oox.component @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.Impress.oox.PowerPointImport"> + <service name="com.sun.star.comp.ooxpptx"/> + </implementation> + <implementation name="com.sun.star.comp.oox.BiffDetector"> + <service name="com.sun.star.frame.ExtendedTypeDetection"/> + </implementation> + <implementation name="com.sun.star.comp.oox.ExcelBiffFilter"> + <service name="com.sun.star.comp.oox.ExcelBiffFilter"/> + </implementation> + <implementation name="com.sun.star.comp.oox.ExcelFilter"> + <service name="com.sun.star.comp.oox.ExcelFilter"/> + </implementation> + <implementation name="com.sun.star.comp.oox.FastTokenHandlerService"> + <service name="com.sun.star.xml.sax.FastTokenHandler"/> + </implementation> + <implementation name="com.sun.star.comp.oox.FormatDetector"> + <service name="com.sun.star.frame.ExtendedTypeDetection"/> + </implementation> + <implementation name="com.sun.star.comp.oox.OOXMLFormulaParser"> + <service name="com.sun.star.sheet.FilterFormulaParser"/> + </implementation> + <implementation name="com.sun.star.comp.oox.ShapeContextHandler"> + <service name="com.sun.star.xml.sax.FastShapeContextHandler"/> + </implementation> + <implementation name="com.sun.star.comp.oox.docprop.OOXMLDocumentPropertiesImporter"> + <service name="com.sun.star.document.OOXMLDocumentPropertiesImporter"/> + </implementation> +</component> diff --git a/unoxml/prj/build.lst b/unoxml/prj/build.lst index cc54f6d3ad28..1a6b330c2c6b 100644 --- a/unoxml/prj/build.lst +++ b/unoxml/prj/build.lst @@ -4,3 +4,5 @@ ux unoxml\source\xpath nmake - all ux_xpath ux_dom NULL ux unoxml\source\events nmake - all ux_events ux_dom NULL ux unoxml\source\service nmake - all ux_service ux_dom ux_xpath ux_events NULL ux unoxml\source\rdf nmake - all ux_librdf NULL + +ux unoxml\qa\complex\unoxml nmake - all ux_complex ux_librdf NULL diff --git a/unoxml/prj/d.lst b/unoxml/prj/d.lst index e2bf5df03b34..4fcedbdba7a2 100644 --- a/unoxml/prj/d.lst +++ b/unoxml/prj/d.lst @@ -1,3 +1,5 @@ ..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so ..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT%\lib*.dylib ..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll +..\%__SRC%\misc\unordf.component %_DEST%\xml%_EXT%\unordf.component +..\%__SRC%\misc\unoxml.component %_DEST%\xml%_EXT%\unoxml.component diff --git a/unoxml/qa/complex/tests.sce b/unoxml/qa/complex/tests.sce deleted file mode 100644 index 20596551f156..000000000000 --- a/unoxml/qa/complex/tests.sce +++ /dev/null @@ -1 +0,0 @@ --o complex.unoxml.RDFRepositoryTest diff --git a/unoxml/qa/complex/RDFRepositoryTest.java b/unoxml/qa/complex/unoxml/RDFRepositoryTest.java index f3f9cbd8ae41..d047ef77440e 100644 --- a/unoxml/qa/complex/RDFRepositoryTest.java +++ b/unoxml/qa/complex/unoxml/RDFRepositoryTest.java @@ -27,21 +27,16 @@ package complex.unoxml; -import complexlib.ComplexTestCase; import helper.StreamSimulator; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.Any; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XInitialization; -import com.sun.star.lang.XEventListener; import com.sun.star.lang.XServiceInfo; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.WrappedTargetRuntimeException; import com.sun.star.beans.XPropertySet; -import com.sun.star.beans.PropertyValue; import com.sun.star.beans.Pair; import com.sun.star.beans.StringPair; import com.sun.star.container.XEnumeration; @@ -52,6 +47,15 @@ import com.sun.star.io.XOutputStream; import com.sun.star.text.XTextRange; import com.sun.star.text.XText; import com.sun.star.rdf.*; +import lib.TestParameters; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; /** * Test case for service com.sun.star.rdf.Repository @@ -60,7 +64,7 @@ import com.sun.star.rdf.*; * * @author mst */ -public class RDFRepositoryTest extends ComplexTestCase +public class RDFRepositoryTest { XComponentContext xContext; String tempDir; @@ -80,112 +84,113 @@ public class RDFRepositoryTest extends ComplexTestCase XLiteral littype; String rdfs = "http://www.w3.org/2000/01/rdf-schema#"; - public String[] getTestMethodNames () - { - return new String[] { "check", "checkSPARQL", "checkRDFa" }; - } + /** + * The test parameters + */ + private static TestParameters param = null; + +// public String[] getTestMethodNames () +// { +// return new String[] { "check", "checkSPARQL", "checkRDFa" }; +// } - public void before() + @Before public void before() { try { - XMultiServiceFactory xMSF = (XMultiServiceFactory) param.getMSF(); - assure("could not create MultiServiceFactory.", xMSF != null); - XPropertySet xPropertySet = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class, xMSF); + XMultiServiceFactory xMSF = getMSF(); + param = new TestParameters(); + param.put("ServiceFactory", xMSF); + + assertNotNull("could not create MultiServiceFactory.", xMSF); + XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xMSF); Object defaultCtx = xPropertySet.getPropertyValue("DefaultContext"); - xContext = (XComponentContext) - UnoRuntime.queryInterface(XComponentContext.class, defaultCtx); - assure("could not get component context.", xContext != null); + xContext = UnoRuntime.queryInterface(XComponentContext.class, defaultCtx); + assertNotNull("could not get component context.", xContext); tempDir = util.utils.getOfficeTemp/*Dir*/(xMSF); - log.println("tempdir: " + tempDir); + System.out.println("tempdir: " + tempDir); foo = URI.create(xContext, "uri:foo"); - assure("foo", null != foo); + assertNotNull("foo", foo); bar = URI.create(xContext, "uri:bar"); - assure("bar", null != bar); + assertNotNull("bar", bar); baz = URI.create(xContext, "uri:baz"); - assure("baz", null != baz); + assertNotNull("baz", baz); uint = URI.create(xContext, "uri:int"); - assure("uint", null != uint); + assertNotNull("uint", uint); blank = BlankNode.create(xContext, "_:uno"); - assure("blank", null != blank); + assertNotNull("blank", blank); lit = Literal.create(xContext, "i am the literal"); - assure("lit", null != lit); + assertNotNull("lit", lit); litlang = Literal.createWithLanguage(xContext, "i am the literal", "en"); - assure("litlang", null != litlang); + assertNotNull("litlang", litlang); littype = Literal.createWithType(xContext, "42", uint); - assure("littype", null != littype); + assertNotNull("littype", littype); rdfslabel = URI.create(xContext, rdfs + "label"); - assure("rdfslabel", null != rdfslabel); + assertNotNull("rdfslabel", rdfslabel); manifest = URI.create(xContext, "manifest:manifest"); //FIXME - assure("manifest", null != manifest); + assertNotNull("manifest", manifest); uuid = URI.create(xContext, "urn:uuid:224ab023-77b8-4396-a75a-8cecd85b81e3"); - assure("uuid", null != uuid); + assertNotNull("uuid", uuid); base = URI.create(xContext, "base-uri:"); //FIXME - assure("base", null != base); + assertNotNull("base", base); } catch (Exception e) { report(e); } + //FIXME: ? +// xRep = Repository.create(xContext); + System.out.println("Creating service Repository..."); + xRep = UnoRuntime.queryInterface(XDocumentRepository.class, Repository.create(xContext)); + assertNotNull("null", xRep); + System.out.println("...done"); } - public void after() + @After public void after() { xRep = null; } - public void check() + @Test public void check() { try { - - log.println("Creating service Repository..."); - - //FIXME: ? -// xRep = Repository.create(xContext); - xRep = (XDocumentRepository) UnoRuntime.queryInterface( - XDocumentRepository.class, Repository.create(xContext)); - assure("null", null != xRep); - - log.println("...done"); - - log.println("Checking that new repository is really empty..."); - assure("empty: graphs", 0 == xRep.getGraphNames().length); + System.out.println("Checking that new repository is really empty..."); + assertTrue("empty: graphs", 0 == xRep.getGraphNames().length); XEnumeration stmts; stmts = xRep.getStatements(null, null, null); - assure("empty: stmts", !stmts.hasMoreElements()); + assertTrue("empty: stmts", !stmts.hasMoreElements()); - log.println("...done"); + System.out.println("...done"); - log.println("Checking graph creation..."); + System.out.println("Checking graph creation..."); XNamedGraph xFooGraph = xRep.createGraph(foo); - assure("foo graph", null != xFooGraph); + assertNotNull("foo graph", xFooGraph); try { xRep.createGraph(foo); - assure("creating duplicate graph was allowed", false); + assertFalse("creating duplicate graph was allowed", false); } catch (ElementExistException e) { // ignore } try { xRep.createGraph(null); - assure("invalid graph name was allowed", false); + assertFalse("invalid graph name was allowed", false); } catch (IllegalArgumentException e) { // ignore } XURI[] names = xRep.getGraphNames(); - assure("no foo graph in getGraphNames", + assertTrue("no foo graph in getGraphNames", 1 == names.length && eq(names[0], foo)); - assure("no foo graph", null != xRep.getGraph(foo)); + assertNotNull("no foo graph", xRep.getGraph(foo)); stmts = xFooGraph.getStatements(null, null, null); - assure("stmts in foo graph", !stmts.hasMoreElements()); + assertTrue("stmts in foo graph", !stmts.hasMoreElements()); XOutputStream xFooOut = new StreamSimulator(tempDir + "empty.rdf", false, param); @@ -195,94 +200,94 @@ public class RDFRepositoryTest extends ComplexTestCase XInputStream xFooIn = new StreamSimulator(tempDir + "empty.rdf", true, param); xRep.importGraph(FileFormat.RDF_XML, xFooIn, bar, base); - assure("no bar graph", null != xRep.getGraph(bar)); + assertNotNull("no bar graph", xRep.getGraph(bar)); - log.println("...done"); + System.out.println("...done"); - log.println("Checking graph manipulation..."); + System.out.println("Checking graph manipulation..."); XEnumeration xFooEnum; Statement xFoo_FooBarBaz = new Statement(foo, bar, baz, foo); xFooGraph.addStatement(foo, bar, baz); xFooEnum = xFooGraph.getStatements(null, null, null); - assure("addStatement(foo,bar,baz)", + assertTrue("addStatement(foo,bar,baz)", eq(xFooEnum, new Statement[] { xFoo_FooBarBaz })); Statement xFoo_FooBarBlank = new Statement(foo, bar, blank, foo); xFooGraph.addStatement(foo, bar, blank); xFooEnum = xFooGraph.getStatements(null, null, null); - assure("addStatement(foo,bar,blank)", + assertTrue("addStatement(foo,bar,blank)", eq(xFooEnum, new Statement[] { xFoo_FooBarBaz, xFoo_FooBarBlank })); xFooEnum = xRep.getStatements(null, null, null); - assure("addStatement(foo,bar,blank) (global)", + assertTrue("addStatement(foo,bar,blank) (global)", eq(xFooEnum, new Statement[] { xFoo_FooBarBaz, xFoo_FooBarBlank })); Statement xFoo_BazBarLit = new Statement(baz, bar, lit, foo); xFooGraph.addStatement(baz, bar, lit); xFooEnum = xFooGraph.getStatements(null, null, null); - assure("addStatement(baz,bar,lit)", + assertTrue("addStatement(baz,bar,lit)", eq(xFooEnum, new Statement[] { xFoo_FooBarBaz, xFoo_FooBarBlank, xFoo_BazBarLit })); xFooEnum = xFooGraph.getStatements(baz, bar, null); - assure("addStatement(baz,bar,lit) (baz,bar)", + assertTrue("addStatement(baz,bar,lit) (baz,bar)", eq(xFooEnum, new Statement[] { xFoo_BazBarLit })); Statement xFoo_BazBarLitlang = new Statement(baz, bar, litlang, foo); xFooGraph.addStatement(baz, bar, litlang); xFooEnum = xFooGraph.getStatements(null, null, null); - assure("addStatement(baz,bar,litlang)", + assertTrue("addStatement(baz,bar,litlang)", eq(xFooEnum, new Statement[] { xFoo_FooBarBaz, xFoo_FooBarBlank, xFoo_BazBarLit, xFoo_BazBarLitlang })); xFooEnum = xFooGraph.getStatements(null, null, baz); - assure("addStatement(baz,bar,litlang) (baz)", + assertTrue("addStatement(baz,bar,litlang) (baz)", eq(xFooEnum, new Statement[] { xFoo_FooBarBaz })); Statement xFoo_BazBarLittype = new Statement(baz, bar, littype, foo); xFooGraph.addStatement(baz, bar, littype); xFooEnum = xFooGraph.getStatements(null, null, null); - assure("addStatement(baz,bar,littype)", + assertTrue("addStatement(baz,bar,littype)", eq(xFooEnum, new Statement[] { xFoo_FooBarBaz, xFoo_FooBarBlank, xFoo_BazBarLit, xFoo_BazBarLitlang, xFoo_BazBarLittype })); xFooGraph.removeStatements(baz, bar, litlang); xFooEnum = xFooGraph.getStatements(null, null, null); - assure("removeStatement(baz,bar,litlang)", + assertTrue("removeStatement(baz,bar,litlang)", eq(xFooEnum, new Statement[] { xFoo_FooBarBaz, xFoo_FooBarBlank, xFoo_BazBarLit, xFoo_BazBarLittype })); xFooGraph.removeStatements(foo, bar, null); xFooEnum = xFooGraph.getStatements(null, null, null); - assure("removeStatement(foo,bar,null)", + assertTrue("removeStatement(foo,bar,null)", eq(xFooEnum, new Statement[] { xFoo_BazBarLit, xFoo_BazBarLittype })); xFooGraph.addStatement(foo, bar, baz); xFooEnum = xFooGraph.getStatements(null, null, null); - assure("addStatement(foo,bar,baz) (re-add)", + assertTrue("addStatement(foo,bar,baz) (re-add)", eq(xFooEnum, new Statement[] { xFoo_FooBarBaz, xFoo_BazBarLit, xFoo_BazBarLittype })); xFooGraph.addStatement(foo, bar, baz); xFooEnum = xFooGraph.getStatements(null, null, null); - assure("addStatement(foo,bar,baz) (duplicate)", + assertTrue("addStatement(foo,bar,baz) (duplicate)", eq(xFooEnum, new Statement[] { xFoo_FooBarBaz, xFoo_BazBarLit, xFoo_BazBarLittype })); xFooGraph.addStatement(xFooGraph, bar, baz); xFooEnum = xFooGraph.getStatements(null, null, null); - assure("addStatement(foo,bar,baz) (triplicate, as graph)", + assertTrue("addStatement(foo,bar,baz) (triplicate, as graph)", eq(xFooEnum, new Statement[] { xFoo_FooBarBaz, xFoo_BazBarLit, xFoo_BazBarLittype })); - log.println("...done"); + System.out.println("...done"); - log.println("Checking graph import/export..."); + System.out.println("Checking graph import/export..."); xFooOut = new StreamSimulator(tempDir + "foo.rdf", false, param); xRep.exportGraph(FileFormat.RDF_XML, xFooOut, foo, base); @@ -291,7 +296,7 @@ public class RDFRepositoryTest extends ComplexTestCase xFooIn = new StreamSimulator(tempDir + "foo.rdf", true, param); try { xRep.importGraph(FileFormat.RDF_XML, xFooIn, bar, base); - assure("importing existing graph did not fail", false); + assertFalse("importing existing graph did not fail", false); } catch (ElementExistException e) { // ignore } @@ -299,77 +304,77 @@ public class RDFRepositoryTest extends ComplexTestCase xFooIn = new StreamSimulator(tempDir + "foo.rdf", true, param); xRep.importGraph(FileFormat.RDF_XML, xFooIn, baz, base); XNamedGraph xBazGraph = xRep.getGraph(baz); - assure("no baz graph", null != xBazGraph); + assertNotNull("no baz graph", xBazGraph); Statement xBaz_FooBarBaz = new Statement(foo, bar, baz, baz); Statement xBaz_BazBarLit = new Statement(baz, bar, lit, baz); Statement xBaz_BazBarLittype = new Statement(baz, bar, littype, baz); XEnumeration xBazEnum = xBazGraph.getStatements(null, null, null); - assure("importing exported graph", + assertTrue("importing exported graph", eq(xBazEnum, new Statement[] { xBaz_FooBarBaz, xBaz_BazBarLit, xBaz_BazBarLittype })); - log.println("...done"); + System.out.println("...done"); - log.println("Checking graph deletion..."); + System.out.println("Checking graph deletion..."); xFooGraph.clear(); xFooEnum = xFooGraph.getStatements(null, null, null); - assure("clear", eq(xFooEnum, new Statement[] { })); + assertTrue("clear", eq(xFooEnum, new Statement[] { })); xRep.destroyGraph(baz); - assure("baz graph zombie", null == xRep.getGraph(baz)); + assertNull("baz graph zombie", xRep.getGraph(baz)); try { xBazGraph.clear(); - assure("deleted graph not invalid (clear)", false); + assertFalse("deleted graph not invalid (clear)", false); } catch (NoSuchElementException e) { // ignore } try { xBazGraph.addStatement(foo, foo, foo); - assure("deleted graph not invalid (add)", false); + assertFalse("deleted graph not invalid (add)", false); } catch (NoSuchElementException e) { // ignore } try { xBazGraph.removeStatements(null, null, null); - assure("deleted graph not invalid (remove)", false); + assertFalse("deleted graph not invalid (remove)", false); } catch (NoSuchElementException e) { // ignore } try { xBazGraph.getStatements(null, null, null); - assure("deleted graph not invalid (get)", false); + assertFalse("deleted graph not invalid (get)", false); } catch (NoSuchElementException e) { // ignore } - log.println("...done"); + System.out.println("...done"); } catch (Exception e) { report(e); } } - public void checkSPARQL() + @Test public void checkSPARQL() { try { - log.println("Checking SPARQL queries..."); + System.out.println("Checking SPARQL queries..."); - XInputStream xIn = new StreamSimulator( - util.utils.getFullTestDocName("example.rdf"), true, param); + XInputStream xIn = new StreamSimulator(TestDocument.getUrl("example.rdf"), true, param); + // util.utils.getFullTestDocName("example.rdf"), true, param); xRep.importGraph(FileFormat.RDF_XML, xIn, manifest, base); String query; query = "SELECT ?p WHERE { ?p rdf:type pkg:Package . }"; XQuerySelectResult result = xRep.querySelect(mkNss() + query); - assure("query: package-id\n" + query, + assertTrue("query: package-id\n" + query, eq(result, new String[] { "p" }, new XNode[][] { { uuid } })); @@ -377,7 +382,7 @@ public class RDFRepositoryTest extends ComplexTestCase "> WHERE { ?pkg rdf:type pkg:Package . ?pkg pkg:hasPart ?part ." + " ?part pkg:path ?path . ?part rdf:type odf:ContentFile. }"; result = xRep.querySelect(mkNss() + query); - assure("query: contentfile", + assertTrue("query: contentfile", eq(result, new String[] { "part", "path" }, new XNode[][] { { BlankNode.create(xContext, "whatever"), Literal.create(xContext, "content.xml") } })); @@ -386,7 +391,7 @@ public class RDFRepositoryTest extends ComplexTestCase + "?pkg rdf:type pkg:Package . ?pkg pkg:hasPart ?part . " + "?part pkg:path ?path . ?part rdf:type odf:ContentFile. }"; result = xRep.querySelect(mkNss() + query); - assure("query: contentfile\n" + query, + assertTrue("query: contentfile\n" + query, eq(result, new String[] { "pkg", "path" }, new XNode[][] { { uuid , Literal.create(xContext, "content.xml") } })); @@ -395,7 +400,7 @@ public class RDFRepositoryTest extends ComplexTestCase + "?pkg rdf:type pkg:Package . ?pkg pkg:hasPart ?part . " + "?part pkg:path ?path . ?part rdf:type odf:StylesFile. }"; result = xRep.querySelect(mkNss() + query); - assure("query: stylesfile\n" + query, + assertTrue("query: stylesfile\n" + query, eq(result, new String[] { "part", "path" }, new XNode[][] { })); @@ -403,7 +408,7 @@ public class RDFRepositoryTest extends ComplexTestCase + "?pkg rdf:type pkg:Package . ?pkg pkg:hasPart ?part . " + "?part pkg:path ?path . ?part rdf:type odf:MetadataFile. }"; result = xRep.querySelect(mkNss() + query); - assure("query: metadatafile\n" + query, + assertTrue("query: metadatafile\n" + query, eq(result, new String[] { "part", "path" }, new XNode[][] { { URI.create(xContext, "http://hospital-employee/doctor"), @@ -424,9 +429,9 @@ public class RDFRepositoryTest extends ComplexTestCase + " pkg:idref ?idref . " + " FILTER (?type = odf:ContentFile || ?type = odf:StylesFile)" + " }"; -//log.println(query); +//System.out.println(query); result = xRep.querySelect(mkNss() + query); - assure("query: example-element-2\n" + query, + assertTrue("query: example-element-2\n" + query, eq(result, new String[] { "path", "idref" }, new XNode[][] { { Literal.create(xContext, "content.xml"), @@ -438,24 +443,24 @@ public class RDFRepositoryTest extends ComplexTestCase lit.getStringValue() + "\" } FROM <" + toS(manifest) + "> WHERE { ?pkg rdf:type pkg:Package . } "; XEnumeration xResultEnum = xRep.queryConstruct(mkNss() + query); - assure("query: construct\n" + query, + assertTrue("query: construct\n" + query, eq(xResultEnum, new Statement[] { x_PkgFooLit })); query = "ASK { ?pkg rdf:type pkg:Package . }"; boolean bResult = xRep.queryAsk(mkNss() + query); - assure("query: ask\n" + query, bResult); + assertTrue("query: ask\n" + query, bResult); - log.println("...done"); + System.out.println("...done"); } catch (Exception e) { report(e); } } - public void checkRDFa() + @Test public void checkRDFa() { try { - log.println("Checking RDFa gunk..."); + System.out.println("Checking RDFa gunk..."); String content = "behold, for i am the content."; XTextRange xTR = new TestRange(content); @@ -463,19 +468,19 @@ public class RDFRepositoryTest extends ComplexTestCase Pair<Statement[], Boolean> result = xRep.getStatementRDFa((XMetadatable)xTR); - assure("RDFa: get: not empty (initial)", + assertTrue("RDFa: get: not empty (initial)", 0 == result.First.length); try { xRep.setStatementRDFa(foo, new XURI[] {}, xM, "", null); - assure("RDFa: set: no predicate", false); + assertFalse("RDFa: set: no predicate", false); } catch (IllegalArgumentException e) { // ignore } try { xRep.setStatementRDFa(foo, new XURI[] {bar}, null, "", null); - assure("RDFa: set: null", false); + assertFalse("RDFa: set: null", false); } catch (IllegalArgumentException e) { // ignore } @@ -485,16 +490,16 @@ public class RDFRepositoryTest extends ComplexTestCase xRep.setStatementRDFa(foo, new XURI[] { bar }, xM, "", null); result = xRep.getStatementRDFa((XMetadatable)xTR); - assure("RDFa: get: without content", + assertTrue("RDFa: get: without content", !result.Second && (1 == result.First.length) - && eq((Statement)result.First[0], x_FooBarTRLit)); + && eq(result.First[0], x_FooBarTRLit)); //FIXME: do this? xTR.setString(lit.getStringValue()); /* Statement xFooBarLit = new Statement(foo, bar, lit, null); result = xRep.getStatementRDFa((XMetadatable)xTR); - assure("RDFa: get: change", + assertTrue("RDFa: get: change", eq((Statement)result.First, xFooBarLit) && null == result.Second); */ @@ -502,17 +507,17 @@ public class RDFRepositoryTest extends ComplexTestCase xRep.setStatementRDFa(foo, new XURI[] { bar }, xM, "42", uint); result = xRep.getStatementRDFa((XMetadatable)xTR); - assure("RDFa: get: with content", + assertTrue("RDFa: get: with content", result.Second && (1 == result.First.length) && - eq((Statement)result.First[0], x_FooBarLittype)); + eq(result.First[0], x_FooBarLittype)); //FIXME: do this? xTR.setString(content); /* Statement xFooLabelTRLit = new Statement(foo, rdfslabel, trlit, null); result = xRep.getStatementRDFa((XMetadatable)xTR); - assure("RDFa: get: change (label)", + assertTrue("RDFa: get: change (label)", eq((Statement)result.First, xFooBarLittype) && eq((Statement)result.Second, xFooLabelTRLit)); */ @@ -520,7 +525,7 @@ public class RDFRepositoryTest extends ComplexTestCase xRep.removeStatementRDFa((XMetadatable)xTR); result = xRep.getStatementRDFa((XMetadatable)xTR); - assure("RDFa: get: not empty (removed)", + assertTrue("RDFa: get: not empty (removed)", 0 == result.First.length); xRep.setStatementRDFa(foo, new XURI[] { foo, bar, baz }, xM, @@ -529,7 +534,7 @@ public class RDFRepositoryTest extends ComplexTestCase Statement x_FooFooTRLit = new Statement(foo, foo, trlit, null); Statement x_FooBazTRLit = new Statement(foo, baz, trlit, null); result = xRep.getStatementRDFa((XMetadatable) xTR); - assure("RDFa: get: without content (multiple predicates, reinsert)", + assertTrue("RDFa: get: without content (multiple predicates, reinsert)", !result.Second && eq(result.First, new Statement[] { x_FooFooTRLit, x_FooBarTRLit, x_FooBazTRLit })); @@ -537,10 +542,10 @@ public class RDFRepositoryTest extends ComplexTestCase xRep.removeStatementRDFa((XMetadatable)xTR); result = xRep.getStatementRDFa((XMetadatable) xTR); - assure("RDFa: get: not empty (re-removed)", + assertTrue("RDFa: get: not empty (re-removed)", 0 == result.First.length); - log.println("...done"); + System.out.println("...done"); } catch (Exception e) { report(e); @@ -553,36 +558,38 @@ public class RDFRepositoryTest extends ComplexTestCase { if (e instanceof WrappedTargetException) { - log.println("Cause:"); + System.out.println("Cause:"); Exception cause = (Exception) (((WrappedTargetException)e).TargetException); - log.println(cause.toString()); + System.out.println(cause.toString()); report2(cause); } else if (e instanceof WrappedTargetRuntimeException) { - log.println("Cause:"); + System.out.println("Cause:"); Exception cause = (Exception) (((WrappedTargetRuntimeException)e).TargetException); - log.println(cause.toString()); + System.out.println(cause.toString()); report2(cause); } } public void report(Exception e) { - log.println("Exception occurred:"); - e.printStackTrace((java.io.PrintWriter) log); + System.out.println("Exception occurred:"); + e.printStackTrace(); report2(e); - failed(); + fail(); } public static String toS(XNode n) { - if (null == n) return "< null >"; + if (null == n) + { + return "< null >"; + } return n.getStringValue(); } static boolean isBlank(XNode i_node) { - XBlankNode blank = (XBlankNode) UnoRuntime.queryInterface( - XBlankNode.class, i_node); + XBlankNode blank = UnoRuntime.queryInterface(XBlankNode.class, i_node); return blank != null; } @@ -615,7 +622,7 @@ public class RDFRepositoryTest extends ComplexTestCase java.util.Collection c = new java.util.Vector(); while (i_Enum.hasMoreElements()) { Statement s = (Statement) i_Enum.nextElement(); -//log.println("toSeq: " + s.getSubject().getStringValue() + " " + s.getPredicate().getStringValue() + " " + s.getObject().getStringValue() + "."); +//System.out.println("toSeq: " + s.getSubject().getStringValue() + " " + s.getPredicate().getStringValue() + " " + s.getObject().getStringValue() + "."); c.add(s); } // return (Statement[]) c.toArray(); @@ -650,7 +657,10 @@ public class RDFRepositoryTest extends ComplexTestCase { XNode[] left = (XNode[]) i_Left; XNode[] right = (XNode[]) i_Right; - if (left.length != right.length) throw new RuntimeException(); + if (left.length != right.length) + { + throw new RuntimeException(); + } for (int i = 0; i < left.length; ++i) { int eq = (left[i].getStringValue().compareTo( right[i].getStringValue())); @@ -667,10 +677,22 @@ public class RDFRepositoryTest extends ComplexTestCase int eq; Statement left = (Statement) i_Left; Statement right = (Statement) i_Right; - if ((eq = cmp(left.Graph, right.Graph )) != 0) return eq; - if ((eq = cmp(left.Subject, right.Subject )) != 0) return eq; - if ((eq = cmp(left.Predicate, right.Predicate)) != 0) return eq; - if ((eq = cmp(left.Object, right.Object )) != 0) return eq; + if ((eq = cmp(left.Graph, right.Graph )) != 0) + { + return eq; + } + if ((eq = cmp(left.Subject, right.Subject )) != 0) + { + return eq; + } + if ((eq = cmp(left.Predicate, right.Predicate)) != 0) + { + return eq; + } + if ((eq = cmp(left.Object, right.Object )) != 0) + { + return eq; + } return 0; } @@ -693,23 +715,23 @@ public class RDFRepositoryTest extends ComplexTestCase XURI lG = i_Left.Graph; XURI rG = i_Right.Graph; if (!eq(lG, rG)) { - log.println("Graphs differ: " + toS(lG) + " != " + toS(rG)); + System.out.println("Graphs differ: " + toS(lG) + " != " + toS(rG)); return false; } if (!eq(i_Left.Subject, i_Right.Subject)) { - log.println("Subjects differ: " + + System.out.println("Subjects differ: " + i_Left.Subject.getStringValue() + " != " + i_Right.Subject.getStringValue()); return false; } if (!eq(i_Left.Predicate, i_Right.Predicate)) { - log.println("Predicates differ: " + + System.out.println("Predicates differ: " + i_Left.Predicate.getStringValue() + " != " + i_Right.Predicate.getStringValue()); return false; } if (!eq(i_Left.Object, i_Right.Object)) { - log.println("Objects differ: " + + System.out.println("Objects differ: " + i_Left.Object.getStringValue() + " != " + i_Right.Object.getStringValue()); return false; @@ -720,7 +742,7 @@ public class RDFRepositoryTest extends ComplexTestCase static boolean eq(Statement[] i_Result, Statement[] i_Expected) { if (i_Result.length != i_Expected.length) { - log.println("eq: different lengths: " + i_Result.length + " " + + System.out.println("eq: different lengths: " + i_Result.length + " " + i_Expected.length); return false; } @@ -729,7 +751,10 @@ public class RDFRepositoryTest extends ComplexTestCase java.util.Arrays.sort(i_Result, new StmtComp()); java.util.Arrays.sort(expected, new StmtComp()); for (int i = 0; i < expected.length; ++i) { - if (!eq(i_Result[i], expected[i])) return false; + if (!eq(i_Result[i], expected[i])) + { + return false; + } } return true; } @@ -760,11 +785,11 @@ public class RDFRepositoryTest extends ComplexTestCase XEnumeration iter = (XEnumeration) i_Result; XNode[][] bindings = toSeqs(iter); if (vars.length != i_Vars.length) { - log.println("var lengths differ"); + System.out.println("var lengths differ"); return false; } if (bindings.length != i_Bindings.length) { - log.println("binding lengths differ: " + i_Bindings.length + + System.out.println("binding lengths differ: " + i_Bindings.length + " vs " + bindings.length ); return false; } @@ -772,16 +797,16 @@ public class RDFRepositoryTest extends ComplexTestCase java.util.Arrays.sort(i_Bindings, new BindingComp()); for (int i = 0; i < i_Bindings.length; ++i) { if (i_Bindings[i].length != i_Vars.length) { - log.println("TEST ERROR!"); + System.out.println("TEST ERROR!"); throw new Exception(); } if (bindings[i].length != i_Vars.length) { - log.println("binding length and var length differ"); + System.out.println("binding length and var length differ"); return false; } for (int j = 0; j < i_Vars.length; ++j) { if (!eq(bindings[i][j], i_Bindings[i][j])) { - log.println("bindings differ: " + + System.out.println("bindings differ: " + toS(bindings[i][j]) + " != " + toS(i_Bindings[i][j])); return false; } @@ -789,7 +814,7 @@ public class RDFRepositoryTest extends ComplexTestCase } for (int i = 0; i < i_Vars.length; ++i) { if (!vars[i].equals(i_Vars[i])) { - log.println("variable names differ: " + + System.out.println("variable names differ: " + vars[i] + " != " + i_Vars[i]); return false; } @@ -828,7 +853,7 @@ public class RDFRepositoryTest extends ComplexTestCase { return new StringPair(m_Stream, m_XmlId); } public void setMetadataReference(StringPair i_Ref) throws IllegalArgumentException - { m_Stream = (String)i_Ref.First; m_XmlId = (String)i_Ref.Second; } + { m_Stream = i_Ref.First; m_XmlId = i_Ref.Second; } public void ensureMetadataReference() { m_Stream = "content.xml"; m_XmlId = "42"; } @@ -843,5 +868,26 @@ public class RDFRepositoryTest extends ComplexTestCase public String getString() { return m_Text; } public void setString(String i_Str) { m_Text = i_Str; } } + + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + + // setup and close connections + @BeforeClass public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); } diff --git a/unoxml/qa/complex/unoxml/TestDocument.java b/unoxml/qa/complex/unoxml/TestDocument.java new file mode 100644 index 000000000000..bce9510e4d94 --- /dev/null +++ b/unoxml/qa/complex/unoxml/TestDocument.java @@ -0,0 +1,39 @@ +/************************************************************************* +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +package complex.unoxml; + +import java.io.File; +import org.openoffice.test.OfficeFileUrl; + +final class TestDocument { + public static String getUrl(String name) { + return OfficeFileUrl.getAbsolute(new File("testdocuments", name)); + } + + private TestDocument() {} +} diff --git a/unoxml/qa/complex/makefile.mk b/unoxml/qa/complex/unoxml/makefile.mk index c74cbcb80dcf..136d23a9a232 100644 --- a/unoxml/qa/complex/makefile.mk +++ b/unoxml/qa/complex/unoxml/makefile.mk @@ -25,35 +25,35 @@ # #***********************************************************************/ -PRJ = ..$/.. -TARGET = unoxml_test -PRJNAME = $(TARGET) -PACKAGE = complex$/unoxml +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- +PRJ = ../../.. +PRJNAME = unoxml +TARGET = qa_complex_unoxml -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = RDFRepositoryTest.java \ +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/unoxml +JAVATESTFILES = \ + RDFRepositoryTest.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +JAVAFILES = $(JAVATESTFILES) \ + TestDocument.java -#----- make a jar from compiled files ------------------------------ +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -MAXLINELENGTH = 100000 +# Sample how to debug +# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y +.END -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE - -# --- Targets ------------------------------------------------------ +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -.INCLUDE : target.mk +ALLTAR : javatest +.END -run: - +java -cp $(CLASSPATH) org.openoffice.Runner -TestBase java_complex -sce tests.sce -tdoc $(PWD)$/testdocuments diff --git a/unoxml/qa/complex/testdocuments/example.rdf b/unoxml/qa/complex/unoxml/testdocuments/example.rdf index 07ef7f07b6fd..07ef7f07b6fd 100644 --- a/unoxml/qa/complex/testdocuments/example.rdf +++ b/unoxml/qa/complex/unoxml/testdocuments/example.rdf diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index 656aa1cbef6c..fcd43832adf0 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -53,50 +53,12 @@ namespace DOM { - void CDocument::addnode(xmlNodePtr aNode) - { - if (aNode != (xmlNodePtr)m_aDocPtr) - { - Reference< XNode >* nref = new Reference< XNode >(CNode::get(aNode)); - m_aNodeRefList.push_back(nref); - } - } - CDocument::~CDocument() { - Reference< XNode >* pRef; - nodereflist_t::const_iterator r = m_aNodeRefList.begin(); - while (r!=m_aNodeRefList.end()) - { - pRef = *r; - delete pRef; - r++; - } - - // get rid of leftover instances, if anybody still holds a - // reference to one of these, it will be invalid! - /* - CNode* aNode = 0; - nodelist_t::const_iterator i = m_aNodeList.begin(); - while (i!=m_aNodeList.end()) - { - aNode = CNode::get(*i, sal_False); - if (aNode != 0) - { - // CNode::remove(*i); - // delete will remove - delete aNode; - } - i++; - } - */ - xmlFreeDoc(m_aDocPtr); - } CDocument::CDocument(xmlDocPtr aDocPtr): - m_aNodeRefList(), m_aDocPtr(aDocPtr), m_streamListeners() { diff --git a/unoxml/source/dom/document.hxx b/unoxml/source/dom/document.hxx index b653619031a1..3fe593ff2b24 100644 --- a/unoxml/source/dom/document.hxx +++ b/unoxml/source/dom/document.hxx @@ -72,12 +72,9 @@ namespace DOM XActiveDataControl, XActiveDataSource, XSAXSerializable, XFastSAXSerializable> { friend class CNode; - typedef std::list< Reference< XNode >* > nodereflist_t; typedef set< Reference< XStreamListener > > listenerlist_t; private: - nodereflist_t m_aNodeRefList; - xmlDocPtr m_aDocPtr; // datacontrol/source state @@ -87,8 +84,6 @@ namespace DOM protected: CDocument(xmlDocPtr aDocPtr); - void addnode(xmlNodePtr aNode); - public: virtual ~CDocument(); diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx index fb4a6bf508b3..d4b317b425b3 100644 --- a/unoxml/source/dom/node.cxx +++ b/unoxml/source/dom/node.cxx @@ -228,7 +228,7 @@ namespace DOM // m_aNodeType = NodeType::NOTATION_NODE; pNode = static_cast< CNode* >(new CAttr((xmlAttrPtr)aNode)); break; - // unsopported node types + // unsupported node types case XML_HTML_DOCUMENT_NODE: case XML_ELEMENT_DECL: case XML_ATTRIBUTE_DECL: @@ -238,18 +238,10 @@ namespace DOM pNode = 0; break; } - } - if ( pNode != 0 ) - { - if(CNode::theNodeMap.insert(nodemap_t::value_type(aNode, pNode)).second) + + if ( pNode != 0 ) { - // insertion done, register node with document - xmlDocPtr doc = aNode->doc; - if( doc != NULL) - { - CDocument* pDoc = static_cast< CDocument* >(CNode::get((xmlNodePtr)doc)); - pDoc->addnode(aNode); - } else + if(!CNode::theNodeMap.insert(nodemap_t::value_type(aNode, pNode)).second) { // if insertion failed, delete the new instance and return null delete pNode; diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index a7e50e7e232d..83de4df8050f 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -39,7 +39,10 @@ #include <boost/shared_array.hpp> #include <boost/bind.hpp> -#include <librdf.h> +#include <libxslt/security.h> + +// #i114999# do not include librdf.h, it is broken in redland 1.0.11 +#include <redland.h> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -64,19 +67,6 @@ #include <comphelper/stlunosequence.hxx> #include <comphelper/sequenceasvector.hxx> #include <comphelper/makesequence.hxx> -#include <librdf.h> -#include <libxslt/security.h> - -#include <boost/utility.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/shared_array.hpp> -#include <boost/bind.hpp> - -#include <map> -#include <functional> -#include <algorithm> - -#include <string.h> /** diff --git a/unoxml/source/rdf/librdf_services.cxx b/unoxml/source/rdf/librdf_services.cxx index 03949934560d..08e776d214fe 100644 --- a/unoxml/source/rdf/librdf_services.cxx +++ b/unoxml/source/rdf/librdf_services.cxx @@ -72,12 +72,5 @@ extern "C" void * SAL_CALL component_getFactory( implName, serviceManager, registryKey, entries); } -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * serviceManager, void * registryKey) -{ - return ::cppu::component_writeInfoHelper(serviceManager, registryKey, - entries); -} - } // extern "C" diff --git a/unoxml/source/rdf/makefile.mk b/unoxml/source/rdf/makefile.mk index 3f6d7f445297..1dbcffb8b6ac 100644 --- a/unoxml/source/rdf/makefile.mk +++ b/unoxml/source/rdf/makefile.mk @@ -82,3 +82,11 @@ SHL1STDLIBS= \ .INCLUDE : target.mk + +ALLTAR : $(MISC)/unordf.component + +$(MISC)/unordf.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + unordf.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt unordf.component diff --git a/unoxml/source/rdf/unordf.component b/unoxml/source/rdf/unordf.component new file mode 100644 index 000000000000..a828e7b05d47 --- /dev/null +++ b/unoxml/source/rdf/unordf.component @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="CBlankNode"> + <service name="com.sun.star.rdf.BlankNode"/> + </implementation> + <implementation name="CLiteral"> + <service name="com.sun.star.rdf.Literal"/> + </implementation> + <implementation name="CURI"> + <service name="com.sun.star.rdf.URI"/> + </implementation> + <implementation name="librdf_Repository"> + <service name="com.sun.star.rdf.Repository"/> + </implementation> +</component> diff --git a/unoxml/source/service/makefile.mk b/unoxml/source/service/makefile.mk index 93aec0746323..5fbe62f67ec4 100644 --- a/unoxml/source/service/makefile.mk +++ b/unoxml/source/service/makefile.mk @@ -76,3 +76,11 @@ SHL1STDLIBS= \ .INCLUDE : target.mk + +ALLTAR : $(MISC)/unoxml.component + +$(MISC)/unoxml.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + unoxml.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt unoxml.component diff --git a/unoxml/source/service/services.cxx b/unoxml/source/service/services.cxx index 218015852c83..6b1a2f6f0979 100644 --- a/unoxml/source/service/services.cxx +++ b/unoxml/source/service/services.cxx @@ -60,44 +60,6 @@ component_getImplementationEnvironment(const sal_Char **ppEnvironmentTypeName, u *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; } -sal_Bool SAL_CALL -component_writeInfo(void * /*pServiceManager*/, void* pRegistryKey ) -{ - Reference< XRegistryKey > xKey(reinterpret_cast< XRegistryKey* >(pRegistryKey)); - Reference< XRegistryKey > xNewKey; - OUString aImpl; - - // register DOM service - aImpl = OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - aImpl += CDocumentBuilder::_getImplementationName(); - aImpl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); - xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(CDocumentBuilder::_getSupportedServiceNames()[0]); - - // register DOM service - aImpl = OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - aImpl += CSAXDocumentBuilder::_getImplementationName(); - aImpl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); - xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(CSAXDocumentBuilder::_getSupportedServiceNames()[0]); - - // register XPath service - aImpl = OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - aImpl += CXPathAPI::_getImplementationName(); - aImpl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); - xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(CXPathAPI::_getSupportedServiceNames()[0]); - - // register EventTest service - aImpl = OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - aImpl += CTestListener::_getImplementationName(); - aImpl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); - xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(CTestListener::_getSupportedServiceNames()[0]); - - return sal_True; -} - void* SAL_CALL component_getFactory(const sal_Char *pImplementationName, void *pServiceManager, void * /*pRegistryKey*/) { diff --git a/unoxml/source/service/unoxml.component b/unoxml/source/service/unoxml.component new file mode 100644 index 000000000000..d8c907e6475b --- /dev/null +++ b/unoxml/source/service/unoxml.component @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.xml.dom.DocumentBuilder"> + <service name="com.sun.star.xml.dom.DocumentBuilder"/> + </implementation> + <implementation name="com.sun.star.comp.xml.dom.SAXDocumentBuilder"> + <service name="com.sun.star.xml.dom.SAXDocumentBuilder"/> + </implementation> + <implementation name="com.sun.star.comp.xml.dom.events.TestListener"> + <service name="com.sun.star.comp.xml.dom.events.TestListener"/> + </implementation> + <implementation name="com.sun.star.comp.xml.xpath.XPathAPI"> + <service name="com.sun.star.xml.xpath.XPathAPI"/> + </implementation> +</component> diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx index 80666d9e2031..f40082e25e9b 100644 --- a/unoxml/source/xpath/xpathapi.cxx +++ b/unoxml/source/xpath/xpathapi.cxx @@ -352,7 +352,7 @@ namespace XPath throw XPathException(); } xmlXPathFreeContext(xpathCtx); - Reference< XXPathObject > aObj(new CXPathObject(xpathObj)); + Reference< XXPathObject > aObj(new CXPathObject(xpathObj, contextNode)); return aObj; } diff --git a/unoxml/source/xpath/xpathapi.hxx b/unoxml/source/xpath/xpathapi.hxx index fdfff24353cc..048fafaae8e9 100644 --- a/unoxml/source/xpath/xpathapi.hxx +++ b/unoxml/source/xpath/xpathapi.hxx @@ -69,7 +69,7 @@ namespace XPath private: nsmap_t m_nsmap; - const Reference < XMultiServiceFactory >& m_aFactory; + const Reference< XMultiServiceFactory > m_aFactory; extensions_t m_extensions; public: diff --git a/unoxml/source/xpath/xpathobject.cxx b/unoxml/source/xpath/xpathobject.cxx index 083d19080c4b..757de0c5aac4 100644 --- a/unoxml/source/xpath/xpathobject.cxx +++ b/unoxml/source/xpath/xpathobject.cxx @@ -31,8 +31,8 @@ namespace XPath { - CXPathObject::CXPathObject(xmlXPathObjectPtr xpathObj) - : m_pXPathObj(xpathObj, xmlXPathFreeObject) + CXPathObject::CXPathObject(xmlXPathObjectPtr xpathObj, const Reference< XNode >& contextNode) + : m_pXPathObj(xpathObj, xmlXPathFreeObject), m_xContextNode(contextNode) { switch (m_pXPathObj->type) { diff --git a/unoxml/source/xpath/xpathobject.hxx b/unoxml/source/xpath/xpathobject.hxx index 8e256bc8a994..348fae8e21e6 100644 --- a/unoxml/source/xpath/xpathobject.hxx +++ b/unoxml/source/xpath/xpathobject.hxx @@ -52,10 +52,11 @@ namespace XPath { private: boost::shared_ptr<xmlXPathObject> m_pXPathObj; + const Reference< XNode > m_xContextNode; XPathObjectType m_xPathObjectType; public: - CXPathObject(xmlXPathObjectPtr xpathObj); + CXPathObject(xmlXPathObjectPtr xpathObj, const Reference< XNode >& contextNode); /** get object type diff --git a/writerfilter/prj/d.lst b/writerfilter/prj/d.lst index f941f4266035..1d09ecf9ad2b 100644 --- a/writerfilter/prj/d.lst +++ b/writerfilter/prj/d.lst @@ -2,6 +2,7 @@ ..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll ..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib +..\%__SRC%\misc\writerfilter.component %_DEST%\xml%_EXT%\writerfilter.component mkdir: %_DEST%\inc%_EXT%\writerfilter\doctok ..\%__SRC%\inc\doctok\sprmids.hxx %_DEST%\inc%_EXT%\writerfilter\doctok\sprmids.hxx diff --git a/writerfilter/qa/cppunittests/doctok/makefile.mk b/writerfilter/qa/cppunittests/doctok/makefile.mk index 298bb4da906b..e7de9f8b4446 100644 --- a/writerfilter/qa/cppunittests/doctok/makefile.mk +++ b/writerfilter/qa/cppunittests/doctok/makefile.mk @@ -28,8 +28,6 @@ PRJ=..$/..$/.. PRJNAME=writerfilter TARGET=test-doctok -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/writerfilter/qa/cppunittests/qname/makefile.mk b/writerfilter/qa/cppunittests/qname/makefile.mk index c2e989d91beb..2f51eb3844c7 100644 --- a/writerfilter/qa/cppunittests/qname/makefile.mk +++ b/writerfilter/qa/cppunittests/qname/makefile.mk @@ -28,8 +28,6 @@ PRJ=..$/..$/.. PRJNAME=writerfilter TARGET=test-qname -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/writerfilter/qa/cppunittests/sl/makefile.mk b/writerfilter/qa/cppunittests/sl/makefile.mk index b7a943e376e9..fa7cafc1dd00 100644 --- a/writerfilter/qa/cppunittests/sl/makefile.mk +++ b/writerfilter/qa/cppunittests/sl/makefile.mk @@ -28,8 +28,6 @@ PRJ=..$/..$/.. PRJNAME=writerfilter TARGET=test-od_sl -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/writerfilter/qa/cppunittests/xxml/makefile.mk b/writerfilter/qa/cppunittests/xxml/makefile.mk index 32d0febc1c85..7f0d3f9731b4 100644 --- a/writerfilter/qa/cppunittests/xxml/makefile.mk +++ b/writerfilter/qa/cppunittests/xxml/makefile.mk @@ -28,8 +28,6 @@ PRJ=..$/..$/.. PRJNAME=writerfilter TARGET=test-xxml -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/writerfilter/source/dmapper/BorderHandler.cxx b/writerfilter/source/dmapper/BorderHandler.cxx index df2503793884..9fa737f47de2 100644 --- a/writerfilter/source/dmapper/BorderHandler.cxx +++ b/writerfilter/source/dmapper/BorderHandler.cxx @@ -51,6 +51,9 @@ BorderHandler::BorderHandler( bool bOOXML ) : m_nLineDistance(0), m_bOOXML( bOOXML ) { + const int nBorderCount(BORDER_COUNT); + std::fill_n(m_aFilledLines, nBorderCount, false); + std::fill_n(m_aBorderLines, nBorderCount, table::BorderLine()); } /*-- 24.04.2007 09:06:35--------------------------------------------------- diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 4c176b59b4ef..301774dc2b96 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -627,7 +627,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) #ifdef DEBUG_DOMAINMAPPER dmapper_logger->attribute("isTextAppend", xTextAppend.is()); - dmapper_logger->attribute("isIgnor", m_TableManager.isIgnore()); + dmapper_logger->attribute("isIgnor", getTableManager().isIgnore()); #endif if(xTextAppend.is() && ! getTableManager( ).isIgnore()) diff --git a/writerfilter/source/dmapper/FontTable.cxx b/writerfilter/source/dmapper/FontTable.cxx index 20f3d602156b..4bde0ac275b5 100644 --- a/writerfilter/source/dmapper/FontTable.cxx +++ b/writerfilter/source/dmapper/FontTable.cxx @@ -39,7 +39,7 @@ namespace dmapper struct FontTable_Impl { - std::vector< FontEntry > aFontEntries; + std::vector< FontEntry::Pointer_t > aFontEntries; FontEntry::Pointer_t pCurrentEntry; FontTable_Impl() {} }; @@ -568,7 +568,7 @@ void FontTable::entry(int /*pos*/, writerfilter::Reference<Properties>::Pointer_ m_pImpl->pCurrentEntry.reset(new FontEntry); ref->resolve(*this); //append it to the table - m_pImpl->aFontEntries.push_back( *m_pImpl->pCurrentEntry ); + m_pImpl->aFontEntries.push_back( m_pImpl->pCurrentEntry ); m_pImpl->pCurrentEntry.reset(); } /*-- 19.06.2006 12:04:34--------------------------------------------------- @@ -657,12 +657,9 @@ void FontTable::endShape( ) -----------------------------------------------------------------------*/ const FontEntry::Pointer_t FontTable::getFontEntry(sal_uInt32 nIndex) { - FontEntry::Pointer_t pRet; - if(m_pImpl->aFontEntries.size() > nIndex) - { - pRet.reset(&m_pImpl->aFontEntries[nIndex]); - } - return pRet; + return (m_pImpl->aFontEntries.size() > nIndex) + ? m_pImpl->aFontEntries[nIndex] + : FontEntry::Pointer_t(); } /*-- 21.06.2006 11:21:38--------------------------------------------------- diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 5f2e2268abb8..5088e8729577 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -235,7 +235,7 @@ void lcl_mergeProps( PropertyMapPtr pToFill, PropertyMapPtr pToAdd, TblStyleTyp ( nStyleId == TBL_STYLE_FIRSTCOL ) }; - for ( int i = 0 ; i < 7; i++ ) + for ( unsigned i = 0 ; i != sizeof(pPropsToCheck) / sizeof(PropertyIds); i++ ) { PropertyIds nId = pPropsToCheck[i]; PropertyDefinition aProp( nId, false ); diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx new file mode 100644 index 000000000000..040843afd7ce --- /dev/null +++ b/writerfilter/source/filter/RtfFilter.cxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Miklos Vajna. + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_ +#include <cppuhelper/implementationentry.hxx> +#endif +#include <osl/module.hxx> +#include <tools/solar.h> +#include <RtfFilter.hxx> + +using namespace ::rtl; +using namespace ::cppu; +using namespace ::com::sun::star; + +RtfFilter::RtfFilter( const uno::Reference< uno::XComponentContext >& rxContext) : + m_xContext( rxContext ) +{ +} + +RtfFilter::~RtfFilter() +{ +} + +sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescriptor ) + throw (uno::RuntimeException) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + if( m_xSrcDoc.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW); + uno::Reference< uno::XInterface > xIfc( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfExport" ))), uno::UNO_QUERY_THROW); + if (!xIfc.is()) + return sal_False; + uno::Reference< document::XExporter > xExprtr(xIfc, uno::UNO_QUERY_THROW); + uno::Reference< document::XFilter > xFltr(xIfc, uno::UNO_QUERY_THROW); + if (!xExprtr.is() || !xFltr.is()) + return sal_False; + xExprtr->setSourceDocument(m_xSrcDoc); + return xFltr->filter(aDescriptor); + } + else if ( m_xDstDoc.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW); + uno::Reference< uno::XInterface > xIfc( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfImport" ))), uno::UNO_QUERY_THROW); + if (!xIfc.is()) + return sal_False; + uno::Reference< document::XImporter > xImprtr(xIfc, uno::UNO_QUERY_THROW); + uno::Reference< document::XFilter > xFltr(xIfc, uno::UNO_QUERY_THROW); + if (!xImprtr.is() || !xFltr.is()) + return sal_False; + xImprtr->setTargetDocument(m_xDstDoc); + return xFltr->filter(aDescriptor); + } + return sal_False; +} + +void RtfFilter::cancel( ) throw (uno::RuntimeException) +{ +} + +void RtfFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc ) + throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + m_xSrcDoc = xDoc; +} + +void RtfFilter::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc ) + throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + m_xDstDoc = xDoc; +} + +void RtfFilter::initialize( const uno::Sequence< uno::Any >& /*aArguments*/ ) throw (uno::Exception, uno::RuntimeException) +{ + // The DOCX exporter here extracts 'type' of the filter, ie 'Word' or + // 'Word Template' but we don't need it for RTF. +} + +OUString RtfFilter::getImplementationName( ) throw (uno::RuntimeException) +{ + return RtfFilter_getImplementationName(); +} + +#define SERVICE_NAME1 "com.sun.star.document.ImportFilter" +#define SERVICE_NAME2 "com.sun.star.document.ExportFilter" +sal_Bool RtfFilter::supportsService( const OUString& rServiceName ) throw (uno::RuntimeException) +{ + return (rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ) || + rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME2 ) )); +} + +uno::Sequence< OUString > RtfFilter::getSupportedServiceNames( ) throw (uno::RuntimeException) +{ + return RtfFilter_getSupportedServiceNames(); +} + +/* Helpers, used by shared lib exports. */ + +OUString RtfFilter_getImplementationName () throw (uno::RuntimeException) +{ + return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfFilter" ) ); +} + +uno::Sequence< OUString > RtfFilter_getSupportedServiceNames( ) throw (uno::RuntimeException) +{ + uno::Sequence < OUString > aRet(2); + OUString* pArray = aRet.getArray(); + pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) ); + pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) ); + return aRet; +} +#undef SERVICE_NAME1 +#undef SERVICE_NAME2 + +uno::Reference< uno::XInterface > RtfFilter_createInstance( const uno::Reference< uno::XComponentContext >& xContext) + throw( uno::Exception ) +{ + return (cppu::OWeakObject*) new RtfFilter( xContext ); +} + +/* vi:set shiftwidth=4 expandtab: */ diff --git a/writerfilter/source/filter/RtfFilter.hxx b/writerfilter/source/filter/RtfFilter.hxx new file mode 100644 index 000000000000..3a4be622ab17 --- /dev/null +++ b/writerfilter/source/filter/RtfFilter.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Miklos Vajna. + * + * 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 + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _RTFFILTER_HXX +#define _RTFFILTER_HXX + +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <cppuhelper/implbase5.hxx> +#include <WriterFilterDllApi.hxx> + +class WRITERFILTER_DLLPUBLIC RtfFilter : public cppu::WeakImplHelper5 +< + com::sun::star::document::XFilter, + com::sun::star::document::XImporter, + com::sun::star::document::XExporter, + com::sun::star::lang::XInitialization, + com::sun::star::lang::XServiceInfo +> +{ + +protected: + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xSrcDoc, m_xDstDoc; + ::rtl::OUString m_sFilterName; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xHandler; + + +public: + RtfFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext); + virtual ~RtfFilter(); + + // XFilter + virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancel( ) + throw (::com::sun::star::uno::RuntimeException); + + // XImporter + virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // XExporter + virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw (::com::sun::star::uno::RuntimeException); + +}; + + +::rtl::OUString RtfFilter_getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL RtfFilter_getSupportedServiceNames( ) + throw ( ::com::sun::star::uno::RuntimeException ); + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL RtfFilter_createInstance( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > &xContext) + throw( ::com::sun::star::uno::Exception ); +#endif + diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 71a97d72f391..deede335d9af 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -30,6 +30,7 @@ #endif #include <WriterFilter.hxx> #include <WriterFilterDetection.hxx> +#include <RtfFilter.hxx> using namespace ::rtl; using namespace ::cppu; @@ -56,6 +57,7 @@ static struct ::cppu::ImplementationEntry s_component_entries [] = { { WriterFilter_createInstance, WriterFilter_getImplementationName, WriterFilter_getSupportedServiceNames, ::cppu::createSingleComponentFactory, 0, 0 }, { WriterFilterDetection_createInstance, WriterFilterDetection_getImplementationName, WriterFilterDetection_getSupportedServiceNames, ::cppu::createSingleComponentFactory, 0, 0} , + { RtfFilter_createInstance, RtfFilter_getImplementationName, RtfFilter_getSupportedServiceNames, ::cppu::createSingleComponentFactory, 0, 0 }, { 0, 0, 0, 0, 0, 0 } // terminate with NULL }; @@ -64,11 +66,6 @@ void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvType *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( ::com::sun::star::lang::XMultiServiceFactory * xMgr, ::com::sun::star::registry::XRegistryKey * xRegistry ) -{ - return ::cppu::component_writeInfoHelper( xMgr, xRegistry, s_component_entries ); -} - void * SAL_CALL component_getFactory(sal_Char const * implName, ::com::sun::star::lang::XMultiServiceFactory * xMgr, ::com::sun::star::registry::XRegistryKey * xRegistry ) { return ::cppu::component_getFactoryHelper(implName, xMgr, xRegistry, s_component_entries ); diff --git a/writerfilter/source/filter/makefile.mk b/writerfilter/source/filter/makefile.mk index f578e2853243..6b11fd4ff1f3 100644 --- a/writerfilter/source/filter/makefile.mk +++ b/writerfilter/source/filter/makefile.mk @@ -40,7 +40,8 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES= $(SLO)$/WriterFilter.obj \ $(SLO)$/WriterFilterDetection.obj \ - $(SLO)$/ImportFilter.obj + $(SLO)$/ImportFilter.obj \ + $(SLO)$/RtfFilter.obj # --- Targets ---------------------------------- diff --git a/writerfilter/source/ooxml/OOXMLFactory.cxx b/writerfilter/source/ooxml/OOXMLFactory.cxx index 964d9e1cb5ee..a277d5928af6 100644 --- a/writerfilter/source/ooxml/OOXMLFactory.cxx +++ b/writerfilter/source/ooxml/OOXMLFactory.cxx @@ -25,6 +25,8 @@ * ************************************************************************/ +#include <stdio.h> + #include <rtl/instance.hxx> #include <osl/mutex.hxx> #include "OOXMLFactory.hxx" diff --git a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx index 1768d486c80d..83c568dfba50 100644 --- a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx @@ -193,9 +193,6 @@ void SAL_CALL OOXMLFastDocumentHandler::startDocument() void SAL_CALL OOXMLFastDocumentHandler::endDocument() throw (uno::RuntimeException, xml::sax::SAXException) { -#ifdef DEBUG_CONTEXT_STACK - OOXMLFastContextHandler::dumpOpenContexts(); -#endif } void SAL_CALL OOXMLFastDocumentHandler::setDocumentLocator diff --git a/writerfilter/unocomponent/component.cxx b/writerfilter/unocomponent/component.cxx index 327e61e41a21..06e837ef4cd6 100644 --- a/writerfilter/unocomponent/component.cxx +++ b/writerfilter/unocomponent/component.cxx @@ -61,12 +61,6 @@ static struct ::cppu::ImplementationEntry s_component_entries [] = *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( ::com::sun::star::lang::XMultiServiceFactory * xMgr, ::com::sun::star::registry::XRegistryKey * xRegistry ) -{ - return ::cppu::component_writeInfoHelper( xMgr, xRegistry, s_component_entries ); -} - - void * SAL_CALL component_getFactory(sal_Char const * implName, ::com::sun::star::lang::XMultiServiceFactory * xMgr, ::com::sun::star::registry::XRegistryKey * xRegistry ) { fprintf(stderr, "Loading service: %s: ", implName); diff --git a/writerfilter/unocomponent/exports.dxp b/writerfilter/unocomponent/exports.dxp index 028ac4175990..f0e1c69934bc 100644 --- a/writerfilter/unocomponent/exports.dxp +++ b/writerfilter/unocomponent/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/writerfilter/util/makefile.mk b/writerfilter/util/makefile.mk index f5981222743c..c2f5c9ee37e1 100644 --- a/writerfilter/util/makefile.mk +++ b/writerfilter/util/makefile.mk @@ -75,4 +75,10 @@ DEF1NAME=$(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/writerfilter.component +$(MISC)/writerfilter.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt writerfilter.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt writerfilter.component diff --git a/writerfilter/util/writerfilter.component b/writerfilter/util/writerfilter.component new file mode 100644 index 000000000000..7a81b6cc3a2b --- /dev/null +++ b/writerfilter/util/writerfilter.component @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.Writer.WriterFilter"> + <service name="com.sun.star.document.ExportFilter"/> + <service name="com.sun.star.document.ImportFilter"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.WriterFilterDetector"> + <service name="com.sun.star.document.ExtendedTypeDetection"/> + </implementation> + <implementation name="com.sun.star.comp.Writer.RtfFilter"> + <service name="com.sun.star.document.ImportFilter"/> + <service name="com.sun.star.document.ExportFilter"/> + </implementation> +</component> diff --git a/writerperfect/prj/d.lst b/writerperfect/prj/d.lst index 5b5852c6a86f..971d1ce6f50e 100644 --- a/writerperfect/prj/d.lst +++ b/writerperfect/prj/d.lst @@ -2,3 +2,4 @@ ..\%__SRC%\bin\wpft*.dll %_DEST%\bin%_EXT% ..\%__SRC%\bin\wpftgo.dll %_DEST%\bin%_EXT%\wpftgo.dll ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib +..\%__SRC%\misc\wpft.component %_DEST%\xml%_EXT%\wpft.component diff --git a/writerperfect/source/wpdimp/wpft_genericfilter.cxx b/writerperfect/source/wpdimp/wpft_genericfilter.cxx index c117b93af3c7..b107d5ff4a71 100644 --- a/writerperfect/source/wpdimp/wpft_genericfilter.cxx +++ b/writerperfect/source/wpdimp/wpft_genericfilter.cxx @@ -46,33 +46,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * /* pServiceManager */, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - sal_Int32 nPos = 0; - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( WordPerfectImportFilter_getImplementationName() ) ); - xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - - const Sequence< OUString > & rSNL = WordPerfectImportFilter_getSupportedServiceNames(); - const OUString * pArray = rSNL.getConstArray(); - for ( nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/writerperfect/util/makefile.mk b/writerperfect/util/makefile.mk index dca29e005287..ae8cf0b73641 100644 --- a/writerperfect/util/makefile.mk +++ b/writerperfect/util/makefile.mk @@ -43,3 +43,11 @@ SHL1VERSIONMAP=$(SOLARENV)/src/component.map DEF1NAME=$(SHL1TARGET) .INCLUDE : target.mk + +ALLTAR : $(MISC)/wpft.component + +$(MISC)/wpft.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + wpft.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt wpft.component diff --git a/writerperfect/util/wpft.component b/writerperfect/util/wpft.component new file mode 100644 index 000000000000..2d8a013606a9 --- /dev/null +++ b/writerperfect/util/wpft.component @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.Writer.WordPerfectImportFilter"> + <service name="com.sun.star.document.ExtendedTypeDetection"/> + <service name="com.sun.star.document.ImportFilter"/> + </implementation> +</component> diff --git a/xmerge/prj/d.lst b/xmerge/prj/d.lst index 03cd7235c126..9cfd7927ed00 100644 --- a/xmerge/prj/d.lst +++ b/xmerge/prj/d.lst @@ -9,3 +9,4 @@ mkdir: %_DEST%\doc%_EXT%\xmerge ..\%__SRC%\doc\javadoc\package-list %_DEST%\doc%_EXT%\xmerge\package-list ..\%__SRC%\doc\xmerge_javadoc.zip %_DEST%\doc%_EXT%\xmerge_javadoc.zip ..\%__SRC%\doc\writer2latex_javadoc.zip %_DEST%\doc%_EXT%\writer2latex_javadoc.zip +..\%__SRC%\misc\XMergeBridge.component %_DEST%\xml%_EXT%\XMergeBridge.component diff --git a/xmerge/source/bridge/XMergeBridge.component b/xmerge/source/bridge/XMergeBridge.component new file mode 100644 index 000000000000..c48aae6a0e20 --- /dev/null +++ b/xmerge/source/bridge/XMergeBridge.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* 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 +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.Java2" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="XMergeBridge$_XMergeBridge"> + <service name="com.sun.star.documentconversion.XMergeBridge"/> + </implementation> +</component> diff --git a/xmerge/source/bridge/java/XMergeBridge.java b/xmerge/source/bridge/java/XMergeBridge.java index 38503d3b49ff..c2dafd75c996 100644 --- a/xmerge/source/bridge/java/XMergeBridge.java +++ b/xmerge/source/bridge/java/XMergeBridge.java @@ -74,9 +74,8 @@ import java.net.URI; /** This outer class provides an inner class to implement the service - * description, a method to instantiate the - * component on demand (__getServiceFactory()), and a method to give - * information about the component (__writeRegistryServiceInfo()). + * description and a method to instantiate the + * component on demand (__getServiceFactory()). */ public class XMergeBridge { @@ -695,21 +694,4 @@ public class XMergeBridge { return xSingleServiceFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - - return FactoryHelper.writeRegistryServiceInfo(_XMergeBridge.class.getName(), - _XMergeBridge.__serviceName, regKey); - } } - - - diff --git a/xmerge/source/bridge/makefile.mk b/xmerge/source/bridge/makefile.mk index 77a39a568966..05fa5a738d84 100644 --- a/xmerge/source/bridge/makefile.mk +++ b/xmerge/source/bridge/makefile.mk @@ -33,3 +33,11 @@ PRJNAME=xmerge .IF "$(L10N_framework)"=="" ALLTAR: ANTBUILD .ENDIF + +ALLTAR : $(MISC)/XMergeBridge.component + +$(MISC)/XMergeBridge.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt XMergeBridge.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_JAVA)XMergeBridge.jar' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt XMergeBridge.component |