diff options
26 files changed, 1008 insertions, 708 deletions
diff --git a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java index 8467f1b75812..cc7545ad3e22 100644 --- a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java +++ b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java @@ -153,7 +153,18 @@ public class LocalOfficeConnection {} } - /** + /** + * protected Constructor + * Initialise a LocalOfficeConnection with an already running office. + * This C'Tor is only used in complex tests at the moment. + * @param xContext + */ + protected LocalOfficeConnection(com.sun.star.uno.XComponentContext xContext) + { + this.mContext = xContext; + } + + /** * Sets a connection URL. * This implementation accepts a UNO URL with following format:<br /> * <pre> diff --git a/bean/com/sun/star/comp/beans/OOoBean.java b/bean/com/sun/star/comp/beans/OOoBean.java index b10becb3ce9a..44871d2a2675 100644 --- a/bean/com/sun/star/comp/beans/OOoBean.java +++ b/bean/com/sun/star/comp/beans/OOoBean.java @@ -601,8 +601,15 @@ public class OOoBean xURLTransformer = (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface( com.sun.star.util.XURLTransformer.class, xServiceFactory.createInstance( "com.sun.star.util.URLTransformer") ); - xDispatcher = (com.sun.star.frame.XDispatchProvider)UnoRuntime.queryInterface( - com.sun.star.frame.XDispatchProvider.class, aFrame ); + + try + { + xDispatcher = UnoRuntime.queryInterface(com.sun.star.frame.XDispatchProvider.class, aFrame); + } + catch (Exception e) + { + /*ignore!*/ + } // get XComponentLoader from frame com.sun.star.frame.XComponentLoader xLoader = (com.sun.star.frame.XComponentLoader) diff --git a/bean/prj/build.lst b/bean/prj/build.lst index 3767e8fff387..91d443344555 100644 --- a/bean/prj/build.lst +++ b/bean/prj/build.lst @@ -4,3 +4,7 @@ ob bean\com\sun\star\beans nmake - all ob_legacybeanjava ob_beanjava NULL ob bean\native\win32 nmake - n ob_beanwin32 NULL ob bean\native\unix nmake - u ob_beanunix NULL ob bean\util nmake - all ob_util ob_beanjava ob_legacybeanjava ob_beanwin32.n ob_beanunix.u NULL + +# complex tests compileable but fail at runtime +# ob bean\qa\complex\bean nmake - all ob_qa_complex ob_util NULL + diff --git a/bean/qa/complex/OOoBeanTest.java b/bean/qa/complex/bean/OOoBeanTest.java index 2d038e8b37af..69c63e11a91a 100644 --- a/bean/qa/complex/OOoBeanTest.java +++ b/bean/qa/complex/bean/OOoBeanTest.java @@ -24,86 +24,90 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -package complex; - - -import complexlib.ComplexTestCase; -import java.io.*; -import java.awt.Rectangle; -import java.awt.Insets; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.image.BufferedImage; -import java.awt.image.PixelGrabber; -import java.awt.GridBagLayout; -import java.awt.GridBagConstraints; +package complex.bean; + + +// import complexlib.ComplexTestCase; +import com.sun.star.lang.XMultiServiceFactory; import java.awt.event.*; -import java.awt.Frame; -import java.awt.Toolkit; -import java.awt.Robot; import java.awt.event.KeyEvent; -import java.awt.Button; -import javax.imageio.ImageIO; -import javax.imageio.stream.FileImageOutputStream; import com.sun.star.comp.beans.OOoBean; import com.sun.star.uno.UnoRuntime; -import com.sun.star.text.XTextDocument; import java.awt.*; -public class OOoBeanTest extends ComplexTestCase -{ +// 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.*; - public String[] getTestMethodNames() +class PrivateLocalOfficeConnection extends com.sun.star.comp.beans.LocalOfficeConnection +{ + public PrivateLocalOfficeConnection(com.sun.star.uno.XComponentContext xContext) { - // TODO think about trigger of sub-tests from outside - return new String[] - { - "test1", - "test2", - "test3", - "test4", - "test5", - "test6", - "test6a", - "test7", - "test8" - }; + super(xContext); } +} + +public class OOoBeanTest +{ + +// public String[] getTestMethodNames() +// { +// // TODO think about trigger of sub-tests from outside +// return new String[] +// { +// "test1", +// "test2", +// "test3", +// "test4", +// "test5", +// "test6", +// "test6a", +// "test7", +// "test8" +// }; +// } /** For X-Windows we need to prolong the time between painting windows. Because it takes longer than on Windows. */ - int getSleepTime(int time) + private int getSleepTime(int time) { int ret = time; if (isWindows() == false) + { return time * 5; + } return time; } /** If it cannot be determined if we run on Windows then we assume that we do not. */ - boolean isWindows() + private boolean isWindows() { boolean ret = false; String os = System.getProperty("os.name"); if (os != null) { os = os.trim(); - if (os.indexOf("Win") == 0) + if (os.toLowerCase().indexOf("win") == 0) + { ret = true; + } } return ret; } - public String getText(OOoBean bean) throws Exception + private String getText(OOoBean bean) throws Exception { com.sun.star.frame.XModel model = (com.sun.star.frame.XModel)bean.getDocument(); com.sun.star.text.XTextDocument myDoc = - (XTextDocument) UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, - model); + UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, model); com.sun.star.text.XText xText = myDoc.getText(); return xText.getString(); } @@ -112,34 +116,40 @@ public class OOoBeanTest extends ComplexTestCase * 2.Add OOoBean (no document loaded yet) * 3.Show frame * 4.Load document + * @throws Exception */ - public void test1() throws Exception + @Test public void test1() throws Exception { WriterFrame f = null; try { - f = new WriterFrame(100 ,100, 500 ,400, false); + f = new WriterFrame(100 ,100, 500 ,400, false, connection.getComponentContext()); f.setText("OOoBean test."); Thread.sleep(1000); } finally { if (f != null) + { f.dispose(); + } } } /** Sizing, painting + * @throws Exception */ - public void test2() throws Exception + @Test public void test2() throws Exception { WriterFrame f = null; ScreenComparer capturer = null; try { - f = new WriterFrame(100, 100, 500,500, false); + f = new WriterFrame(100, 100, 500,500, false, connection.getComponentContext()); if (f.checkUnoFramePosition() == false) - failed("Sizing error: Client are of Java frame does not match the UNO window.", true); + { + fail("Sizing error: Client are of Java frame does not match the UNO window."); + } capturer = new ScreenComparer(100, 100, 500, 500); //Minimize Window and back @@ -153,15 +163,19 @@ public class OOoBeanTest extends ComplexTestCase f.setExtendedState(Frame.ICONIFIED); Thread.sleep(getSleepTime(200)); if (f.checkUnoFramePosition() == false) - failed("Sizing error: Frame was iconified.", true); + { + fail("Sizing error: Frame was iconified."); + } f.setExtendedState(Frame.NORMAL); Thread.sleep(getSleepTime(200)); if (f.checkUnoFramePosition() == false) - failed("Sizing error: Frame size set back to normal after it was iconified.", true); + { + fail("Sizing error: Frame size set back to normal after it was iconified."); + } capturer.grabTwo(f.getClientArea()); if (capturer.compare() == false) { - failed("Painting error: Minimize (iconify) frame and back to normal size.", true); + fail("Painting error: Minimize (iconify) frame and back to normal size."); capturer.writeImages(); } } @@ -174,15 +188,19 @@ public class OOoBeanTest extends ComplexTestCase f.setExtendedState(Frame.MAXIMIZED_BOTH); Thread.sleep(getSleepTime(200)); if (f.checkUnoFramePosition() == false) - failed("Sizing error: Frame maximized.", true); + { + fail("Sizing error: Frame maximized."); + } f.setExtendedState(Frame.NORMAL); Thread.sleep(getSleepTime(200)); if (f.checkUnoFramePosition() == false) - failed("Sizing error: Frame set from maximized to normal.", true); + { + fail("Sizing error: Frame set from maximized to normal."); + } capturer.grabTwo(f.getClientArea()); if (capturer.compare() == false) { - failed("Painting error: Maximize frame and back to normal size", true); + fail("Painting error: Maximize frame and back to normal size"); capturer.writeImages(); } } @@ -194,12 +212,14 @@ public class OOoBeanTest extends ComplexTestCase f.setBounds(0, 0, oldPosition.width, oldPosition.height); Thread.sleep(getSleepTime(200)); if (f.checkUnoFramePosition() == false) - failed("Sizing error: Frame moved.", true); + { + fail("Sizing error: Frame moved."); + } capturer.grabTwo(f.getClientArea()); if (capturer.compare() == false) { - failed("Painting error: Move frame to a different position.", true); + fail("Painting error: Move frame to a different position."); capturer.writeImages(); } @@ -217,7 +237,7 @@ public class OOoBeanTest extends ComplexTestCase capturer.grabTwo(f.getClientArea()); if (capturer.compare() == false) { - failed("Painting error: Move frame to a different position.", true); + fail("Painting error: Move frame to a different position."); capturer.writeImages(); } curY+= 50; @@ -242,12 +262,14 @@ public class OOoBeanTest extends ComplexTestCase f.toFront(); Thread.sleep(getSleepTime(200)); if (f.checkUnoFramePosition() == false) - failed("Sizing error: Frame moved from back to front.", true); + { + fail("Sizing error: Frame moved from back to front."); + } capturer.grabTwo(f.getClientArea()); if (capturer.compare() == false) { - failed("Painting error: Move frame to back and to front.", true); + fail("Painting error: Move frame to back and to front."); capturer.writeImages(); } } @@ -257,7 +279,9 @@ public class OOoBeanTest extends ComplexTestCase finally { if (f != null) + { f.dispose(); + } } } @@ -267,33 +291,39 @@ public class OOoBeanTest extends ComplexTestCase 3. Create Frame (do not show yet) 4. Add OOoBean to Frame 5. Show Frame - */ - public void test3() throws Exception + * @throws Exception + */ + @Test public void test3() throws Exception { WriterFrame f = null; try { - f = new WriterFrame(100, 100, 500, 300, true); + f = new WriterFrame(100, 100, 500, 300, true, connection.getComponentContext()); if (f.checkUnoFramePosition() == false) - failed("Sizing error.", true); + { + fail("Sizing error."); + } } finally { if (f != null) + { f.dispose(); + } } } /** Test repeated OOoBean.aquireSystemWindow and OOoBean.releaseSystemWindow * calls. + * @throws Exception */ - public void test4() throws Exception + @Test public void test4() throws Exception { WriterFrame f = null; try { - f = new WriterFrame(100, 100, 500, 300, false); + f = new WriterFrame(100, 100, 500, 300, false, connection.getComponentContext()); OOoBean b = f.getBean(); for (int i = 0; i < 100; i++) { @@ -301,26 +331,33 @@ public class OOoBeanTest extends ComplexTestCase b.aquireSystemWindow(); } if (f.checkUnoFramePosition() == false) - failed("Sizing error.", true); + { + fail("Sizing error."); + } } finally { if (f != null) + { f.dispose(); + } if (isWindows() == false) + { Thread.sleep(10000); + } } } /** Adding and removing the bean to a Java frame multiple times. * Test painting and sizing. + * @throws Exception */ - public void test5() throws Exception + @Test public void test5() throws Exception { WriterFrame f = null; try { - f = new WriterFrame(100, 100, 500, 400, false); + f = new WriterFrame(100, 100, 500, 400, false, connection.getComponentContext()); f.goToStart(); f.pageDown(); Thread.sleep(1000); @@ -340,21 +377,27 @@ public class OOoBeanTest extends ComplexTestCase if (capturer.compare() == false) { - failed("Painting error: adding and removing OOoBean " + - "repeatedly to java.lang.Frame.", true); + fail("Painting error: adding and removing OOoBean " + + "repeatedly to java.lang.Frame."); capturer.writeImages(); } if (f.checkUnoFramePosition() == false) - failed("Sizing error.", true); + { + fail("Sizing error."); + } } finally { if (f != null) + { f.dispose(); + } if (isWindows() == false) + { Thread.sleep(10000); + } } } @@ -363,12 +406,13 @@ public class OOoBeanTest extends ComplexTestCase * it should still be possible to enter text in the window. This does not * work all the time on Windows. This is probably a timing problem. When using * Thread.sleep (position #1) then it should work. + * @throws Exception */ - public void test6() throws Exception + @Test public void test6() throws Exception { for (int j = 0; j < 10; j++) { - final OOoBean bean = new OOoBean(); + final OOoBean bean = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext())); java.awt.Frame frame = null; bean.setOOoCallTimeOut(10000); try { @@ -395,7 +439,9 @@ public class OOoBeanTest extends ComplexTestCase } if (isWindows() == false) + { Thread.sleep(5000); + } Robot roby = new Robot(); roby.keyPress(KeyEvent.VK_H); @@ -405,10 +451,10 @@ public class OOoBeanTest extends ComplexTestCase String s = getText(bean); if ( ! s.equals(buf.toString())) { - failed("Focus error: After removing and adding the bean, the" + + fail("Focus error: After removing and adding the bean, the" + "office window does not receive keyboard input.\n" + "Try typing in the window, you've got 30s!!! This " + - "test may not work with Linux/Solaris", true); + "test may not work with Linux/Solaris"); Thread.sleep(30000); break; } @@ -428,12 +474,13 @@ public class OOoBeanTest extends ComplexTestCase * different. The bean is added and removed from withing the event dispatch * thread. Using Thread.sleep at various points (#1, #2, #3) seems to workaround * the problem. + * @throws Exception */ - public void test6a() throws Exception + @Test public void test6a() throws Exception { for (int j = 0; j < 50; j++) { - final OOoBean bean = new OOoBean(); + final OOoBean bean = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext())); final java.awt.Frame frame = new Frame("Openoffice.org"); bean.setOOoCallTimeOut(10000); @@ -486,7 +533,9 @@ public class OOoBeanTest extends ComplexTestCase } if (isWindows() == false) + { Thread.sleep(5000); + } Robot roby = new Robot(); roby.mouseMove(300, 200); @@ -521,10 +570,10 @@ public class OOoBeanTest extends ComplexTestCase if ( ! sH.equals(s2)) { - failed("Focus error: After removing and adding the bean, the" + + fail("Focus error: After removing and adding the bean, the" + "office window does not receive keyboard input.\n" + "Try typing in the window, you've got 30s!!! This " + - "test may not work with Linux/Solaris", true); + "test may not work with Linux/Solaris"); System.out.println("j: " + j + " i: " + i); Thread.sleep(30000); break; @@ -543,13 +592,14 @@ public class OOoBeanTest extends ComplexTestCase } /** Repeatedly loading a document in one and the same OOoBean instance. + * @throws Exception */ - public void test7() throws Exception + @Test public void test7() throws Exception { WriterFrame f = null; try { - f = new WriterFrame(100 ,100, 500 ,400, false); + f = new WriterFrame(100 ,100, 500 ,400, false, connection.getComponentContext()); String text = "OOoBean test."; for (int i = 0; i < 10; i++) @@ -561,28 +611,34 @@ public class OOoBeanTest extends ComplexTestCase f.validate(); if (text.equals(f.getText()) == false) - failed("Repeated loading of a document failed."); + { + fail("Repeated loading of a document failed."); + } Thread.sleep(1000); } } finally { if (f != null) + { f.dispose(); + } } } /** Using multiple instances of OOoBean at the same time + * @throws Exception */ - public void test8() throws Exception + + @Test public void test8() throws Exception { - OOoBean bean1 = new OOoBean(); + OOoBean bean1 = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext())); BeanPanel bp1 = new BeanPanel(bean1); - OOoBean bean2 = new OOoBean(); + OOoBean bean2 = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext())); BeanPanel bp2 = new BeanPanel(bean2); - OOoBean bean3 = new OOoBean(); + OOoBean bean3 = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext())); BeanPanel bp3 = new BeanPanel(bean3); - OOoBean bean4 = new OOoBean(); + OOoBean bean4 = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext())); BeanPanel bp4 = new BeanPanel(bean4); try @@ -651,6 +707,31 @@ public class OOoBeanTest extends ComplexTestCase } } + + + + 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/bean/qa/complex/ScreenComparer.java b/bean/qa/complex/bean/ScreenComparer.java index a2547a763c58..9bb0a41f40d8 100644 --- a/bean/qa/complex/ScreenComparer.java +++ b/bean/qa/complex/bean/ScreenComparer.java @@ -24,19 +24,19 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -package complex; +package complex.bean; -import complexlib.ComplexTestCase; +// import complexlib.ComplexTestCase; import java.io.File; import java.awt.Rectangle; -import java.awt.BorderLayout; +// import java.awt.BorderLayout; import java.awt.image.BufferedImage; import java.awt.image.PixelGrabber; -import java.awt.event.*; -import java.awt.Frame; +// import java.awt.event.*; +// import java.awt.Frame; import javax.imageio.ImageIO; -import javax.imageio.stream.FileImageOutputStream; +// import javax.imageio.stream.FileImageOutputStream; @@ -104,7 +104,9 @@ class ScreenComparer public boolean compare() throws Exception { if (m_img1 == null || m_img2 == null) + { throw new Exception("Only one image captured!"); + } boolean ret = true; int w1 = m_img1.getWidth(); int h1 = m_img1.getHeight(); @@ -127,19 +129,31 @@ class ScreenComparer int pixel2 = 0; //get the pixel for m_img1 if (x < w1 && y < h1) + { pixel1 = m_img1.getRGB(x, y); + } else + { bOutOfRange = true; + } if (x < w2 && y < h2) + { pixel2 = m_img2.getRGB(x, y); + } else + { bOutOfRange = true; + } if (bOutOfRange || pixel1 != pixel2) + { m_imgDiff.setRGB(x, y, m_diffColor); + } else + { m_imgDiff.setRGB(x, y, pixel1); + } } } @@ -165,7 +179,9 @@ class ScreenComparer for (index = 0; index < lenAr; index++) { if (pixels1[index] != pixels2[index]) + { break; + } } //If the images are different, then create the diff image diff --git a/bean/qa/complex/WriterFrame.java b/bean/qa/complex/bean/WriterFrame.java index b2aff726ad05..b4611fb30b1a 100644 --- a/bean/qa/complex/WriterFrame.java +++ b/bean/qa/complex/bean/WriterFrame.java @@ -24,67 +24,71 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -package complex; +package complex.bean; -import complexlib.ComplexTestCase; +// import com.sun.star.comp.beans.LocalOfficeConnection; +import com.sun.star.uno.XComponentContext; import java.awt.Rectangle; import java.awt.Insets; import java.awt.BorderLayout; -import java.awt.event.*; -import java.awt.Frame; -import java.awt.Dimension; import com.sun.star.comp.beans.OOoBean; import com.sun.star.uno.UnoRuntime; -import com.sun.star.text.XTextDocument; + class WriterFrame extends java.awt.Frame { com.sun.star.comp.beans.OOoBean m_bean; - String m_sDocURL = "private:factory/swriter"; + final static String m_sDocURL = "private:factory/swriter"; /** @param loadBeforeVisible the OOoBean is added to the frame before it is displayable. Then the Java Frame does not have a native window peer yet. */ - public WriterFrame(int x, int y, int width, int height, boolean loadBeforeVisible) throws Exception + public WriterFrame(int x, int y, int width, int height, boolean loadBeforeVisible, XComponentContext _xConn) throws Exception { - if (loadBeforeVisible == false) + try { - m_bean = new com.sun.star.comp.beans.OOoBean(); - add(m_bean, BorderLayout.CENTER); - pack(); - setBounds(x, y, width, height); - setVisible(true); - m_bean.loadFromURL(m_sDocURL, null); - validate(); + if (loadBeforeVisible == false) + { + m_bean = new com.sun.star.comp.beans.OOoBean(new PrivateLocalOfficeConnection(_xConn)); + add(m_bean, BorderLayout.CENTER); + pack(); + setBounds(x, y, width, height); + setVisible(true); + m_bean.loadFromURL(m_sDocURL, null); + validate(); + } + else + { + m_bean = new com.sun.star.comp.beans.OOoBean(new PrivateLocalOfficeConnection(_xConn)); + m_bean.loadFromURL(m_sDocURL, null); + add(m_bean, BorderLayout.CENTER); + pack(); + setBounds(x, y, width, height); + setVisible(true); + m_bean.aquireSystemWindow(); + } } - else + catch (Exception e) { - m_bean = new com.sun.star.comp.beans.OOoBean(); - m_bean.loadFromURL(m_sDocURL, null); - add(m_bean, BorderLayout.CENTER); - pack(); - setBounds(x, y, width, height); - setVisible(true); - m_bean.aquireSystemWindow(); + System.out.println("Exception caught: " + e.getMessage()); } } public WriterFrame() throws Exception { - this(0, 0, 800, 400, false); + this(0, 0, 800, 400, false, null); } public void setText(String s) throws Exception { com.sun.star.frame.XModel model = (com.sun.star.frame.XModel)m_bean.getDocument(); com.sun.star.text.XTextDocument myDoc = - (XTextDocument) UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, - model); + UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, model); com.sun.star.text.XText xText = myDoc.getText(); com.sun.star.text.XTextCursor xTCursor = xText.createTextCursor(); //inserting some Text @@ -95,12 +99,12 @@ class WriterFrame extends java.awt.Frame { com.sun.star.frame.XModel model = (com.sun.star.frame.XModel)m_bean.getDocument(); com.sun.star.text.XTextDocument myDoc = - (XTextDocument) UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, - model); + UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, model); com.sun.star.text.XText xText = myDoc.getText(); return xText.getString(); } + @Override public void dispose() { m_bean.stopOOoConnection(); setVisible(false); @@ -121,8 +125,7 @@ class WriterFrame extends java.awt.Frame com.sun.star.frame.XController xController = xModel.getCurrentController(); com.sun.star.text.XTextViewCursorSupplier xVCSupplier = - (com.sun.star.text.XTextViewCursorSupplier) UnoRuntime.queryInterface ( - com.sun.star.text.XTextViewCursorSupplier.class, xController ); + UnoRuntime.queryInterface(com.sun.star.text.XTextViewCursorSupplier.class, xController); com.sun.star.text.XTextViewCursor xTViewCursor = xVCSupplier.getViewCursor ( ); xTViewCursor.gotoStart(false); @@ -135,12 +138,10 @@ class WriterFrame extends java.awt.Frame com.sun.star.frame.XController xController = xModel.getCurrentController(); com.sun.star.text.XTextViewCursorSupplier xVCSupplier = - (com.sun.star.text.XTextViewCursorSupplier) UnoRuntime.queryInterface ( - com.sun.star.text.XTextViewCursorSupplier.class, xController ); + UnoRuntime.queryInterface(com.sun.star.text.XTextViewCursorSupplier.class, xController); com.sun.star.text.XTextViewCursor xTViewCursor = xVCSupplier.getViewCursor ( ); com.sun.star.view.XScreenCursor xScreenCursor = - (com.sun.star.view.XScreenCursor) UnoRuntime.queryInterface ( - com.sun.star.view.XScreenCursor.class, xTViewCursor ); + UnoRuntime.queryInterface(com.sun.star.view.XScreenCursor.class, xTViewCursor); xScreenCursor.screenDown(); } diff --git a/bean/qa/complex/bean/makefile.mk b/bean/qa/complex/bean/makefile.mk new file mode 100644 index 000000000000..9a21e52ac916 --- /dev/null +++ b/bean/qa/complex/bean/makefile.mk @@ -0,0 +1,134 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + +PRJ = ../../.. +PRJNAME = bean +TARGET = qa_complex_bean + +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/bean + +# here store only Files which contain a @Test +JAVATESTFILES = \ + OOoBeanTest.java + +# put here all other files +JAVAFILES = $(JAVATESTFILES) \ + ScreenComparer.java \ + WriterFrame.java + +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar officebean.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) + +# Sample how to debug +# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y + +.END + +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk + +ALLTAR : javatest + +.END + +# +# +# +# +# PRJ := ..$/.. +# PRJNAME := bean +# TARGET := test_bean +# PACKAGE = complex +# +# .INCLUDE: settings.mk +# +# #----- compile .java files ----------------------------------------- +# +# JARFILES = officebean.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +# JAVAFILES = OOoBeanTest.java ScreenComparer.java WriterFrame.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 -------------------------------------- +# +# # test base is java complex +# CT_TESTBASE = -TestBase java_complex +# +# # test looks something like the.full.package.TestName +# CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) +# +# # start the runner application +# CT_APP = org.openoffice.Runner +# +# CT_NOOFFICE = -NoOffice +# +# +# OFFICE_CLASSPATH_TMP:=$(foreach,i,$(JARFILES) $(office)$/program$/classes$/$(i)$(PATH_SEPERATOR)) +# +# OFFICE_CLASSPATH=$(OFFICE_CLASSPATH_TMP:t"")$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(CLASSDIR) +# +# OOOBEAN_OPTIONS=-Dcom.sun.star.officebean.Options=-norestore -DOOoBean.Images=$(MISC) +# +# +# .INCLUDE: target.mk +# +# ALLTAR : RUNINSTRUCTIONS +# +# # --- Targets ------------------------------------------------------ +# +# #The OOoBean uses the classpath to find the office installation. +# #Therefore we must use the jar files from the office. +# RUN: +# java -cp $(OFFICE_CLASSPATH) $(OOOBEAN_OPTIONS) $(CT_APP) $(CT_NOOFFICE) $(CT_TESTBASE) $(CT_TEST) +# run: RUN +# +# rund: +# java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8100 -cp $(OFFICE_CLASSPATH) $(OOOBEAN_OPTIONS) $(CT_APP) $(CT_NOOFFICE) $(CT_TESTBASE) $(CT_TEST) +# +# +# +# RUNINSTRUCTIONS : +# @echo . +# @echo ########################### N O T E ###################################### +# @echo . +# @echo "To run the test you have to provide the office location." +# @echo Example: +# @echo dmake run office="d:/myOffice" +# @echo . +# diff --git a/bean/qa/complex/makefile.mk b/bean/qa/complex/makefile.mk deleted file mode 100644 index e7b88ce3400c..000000000000 --- a/bean/qa/complex/makefile.mk +++ /dev/null @@ -1,95 +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. -# -#************************************************************************* - -PRJ := ..$/.. -PRJNAME := bean -TARGET := test_bean -PACKAGE = complex - -.INCLUDE: settings.mk - -#----- compile .java files ----------------------------------------- - -JARFILES = officebean.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = OOoBeanTest.java ScreenComparer.java WriterFrame.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 -------------------------------------- - -# test base is java complex -CT_TESTBASE = -TestBase java_complex - -# test looks something like the.full.package.TestName -CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) - -# start the runner application -CT_APP = org.openoffice.Runner - -CT_NOOFFICE = -NoOffice - - -OFFICE_CLASSPATH_TMP:=$(foreach,i,$(JARFILES) $(office)$/program$/classes$/$(i)$(PATH_SEPERATOR)) - -OFFICE_CLASSPATH=$(OFFICE_CLASSPATH_TMP:t"")$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(CLASSDIR) - -OOOBEAN_OPTIONS=-Dcom.sun.star.officebean.Options=-norestore -DOOoBean.Images=$(MISC) - - -.INCLUDE: target.mk - -ALLTAR : RUNINSTRUCTIONS - -# --- Targets ------------------------------------------------------ - -#The OOoBean uses the classpath to find the office installation. -#Therefore we must use the jar files from the office. -RUN: - java -cp $(OFFICE_CLASSPATH) $(OOOBEAN_OPTIONS) $(CT_APP) $(CT_NOOFFICE) $(CT_TESTBASE) $(CT_TEST) -run: RUN - -rund: - java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8100 -cp $(OFFICE_CLASSPATH) $(OOOBEAN_OPTIONS) $(CT_APP) $(CT_NOOFFICE) $(CT_TESTBASE) $(CT_TEST) - - - -RUNINSTRUCTIONS : - @echo . - @echo ########################### N O T E ###################################### - @echo . - @echo "To run the test you have to provide the office location." - @echo Example: - @echo dmake run office="d:/myOffice" - @echo . - diff --git a/cui/source/options/optimprove.src b/cui/source/options/optimprove.src index 231eaf3d35b7..523dc8545ca9 100644 --- a/cui/source/options/optimprove.src +++ b/cui/source/options/optimprove.src @@ -86,30 +86,30 @@ TabPage RID_SVXPAGE_IMPROVEMENT FixedText FT_NR_REPORTS { Pos = MAP_APPFONT ( 12 , 132 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; + Size = MAP_APPFONT ( 96 , 8 ) ; Text [ en-US ] = "Number of reports sent:" ; }; FixedText FT_NR_REPORTS_VALUE { - Pos = MAP_APPFONT ( 95 , 132 ) ; + Pos = MAP_APPFONT ( 111 , 132 ) ; Size = MAP_APPFONT ( 100 , 10 ) ; }; FixedText FT_NR_ACTIONS { Pos = MAP_APPFONT ( 12 , 145 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; + Size = MAP_APPFONT ( 96 , 8 ) ; Text [ en-US ] = "Number of tracked actions:" ; }; FixedText FT_NR_ACTIONS_VALUE { - Pos = MAP_APPFONT ( 95 , 145 ) ; + Pos = MAP_APPFONT ( 111 , 145 ) ; Size = MAP_APPFONT ( 100 , 10 ) ; }; PushButton PB_SHOWDATA { HelpID = "cui:PushButton:RID_SVXPAGE_IMPROVEMENT:PB_SHOWDATA"; Pos = MAP_APPFONT ( 12 , 161 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; Text [ en-US ] = "~Show Data" ; }; String STR_INFO diff --git a/extensions/prj/build.lst b/extensions/prj/build.lst index 1489e2a4e0e4..e6a4e02a8096 100644 --- a/extensions/prj/build.lst +++ b/extensions/prj/build.lst @@ -34,3 +34,6 @@ ex extensions\source\update\feed nmake - all ex_updchkfeed ex ex extensions\source\update\check nmake - all ex_updchk ex_inc NULL ex extensions\source\update\ui nmake - all ex_updchkui ex_inc NULL ex extensions\util nmake - all ex_util ex_preload ex_abpilot ex_dbpilots ex_logging ex_ldap ex_propctrlr ex_bib ex_plutil ex_oooimprovecore NULL + +# Fails at the moment +# ex extensions\qa\complex\extensions nmake - all ex_complex ex_util NULL diff --git a/extensions/qa/complex/extensions/OfficeResourceLoader.java b/extensions/qa/complex/extensions/OfficeResourceLoader.java index d0b2f1db2db8..f28d04d3d438 100644 --- a/extensions/qa/complex/extensions/OfficeResourceLoader.java +++ b/extensions/qa/complex/extensions/OfficeResourceLoader.java @@ -26,6 +26,7 @@ ************************************************************************/ package complex.extensions; +import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.resource.XResourceBundle; @@ -34,7 +35,15 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.uno.XComponentContext; import com.sun.star.lang.Locale; -public class OfficeResourceLoader extends complexlib.ComplexTestCase +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.*; + +public class OfficeResourceLoader { XResourceBundleLoader m_loader; XResourceBundle m_bundle; @@ -45,37 +54,36 @@ public class OfficeResourceLoader extends complexlib.ComplexTestCase } /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "checkSimpleStringAccess", - "checkLocales" - }; - } +// public String[] getTestMethodNames() +// { +// return new String[] { +// "checkSimpleStringAccess", +// "checkLocales" +// }; +// } /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return "Extensions - OfficeResourceLoader"; - } +// public String getTestObjectName() +// { +// return "Extensions - OfficeResourceLoader"; +// } /* ------------------------------------------------------------------ */ - public void before() throws com.sun.star.uno.Exception, java.lang.Exception + @Before public void before() throws com.sun.star.uno.Exception, java.lang.Exception { - XPropertySet orb = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, param.getMSF() ); - XComponentContext context = (XComponentContext)UnoRuntime.queryInterface( XComponentContext.class, - orb.getPropertyValue( "DefaultContext" ) ); + XPropertySet orb = UnoRuntime.queryInterface(XPropertySet.class, getMSF()); + XComponentContext context = UnoRuntime.queryInterface(XComponentContext.class, orb.getPropertyValue("DefaultContext")); m_loader = com.sun.star.resource.OfficeResourceLoader.get( context ); } /* ------------------------------------------------------------------ */ - public void after() throws com.sun.star.uno.Exception, java.lang.Exception + @After public void after() throws com.sun.star.uno.Exception, java.lang.Exception { } /* ------------------------------------------------------------------ */ - public void checkSimpleStringAccess() throws com.sun.star.uno.Exception, java.lang.Exception + @Test public void checkSimpleStringAccess() throws com.sun.star.uno.Exception, java.lang.Exception { // default bundle (UI locale) m_bundle = m_loader.loadBundle_Default( "orl" ); @@ -88,34 +96,62 @@ public class OfficeResourceLoader extends complexlib.ComplexTestCase && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) ) - assure( "invalid 'en-US' string", testString.equals( "Dummy String" ) ); + { + assertTrue( "invalid 'en-US' string", testString.equals( "Dummy String" ) ); + } if ( resourceLocale.Language.equals( "de" ) && resourceLocale.Country.equals( "" ) && resourceLocale.Variant.equals( "" ) ) - assure( "invalid 'de' string", testString.equals( "Attrappen-Zeichenkette" ) ); + { + assertTrue( "invalid 'de' string", testString.equals( "Attrappen-Zeichenkette" ) ); + } if ( resourceLocale.Language.equals( "" ) && resourceLocale.Country.equals( "" ) && resourceLocale.Variant.equals( "" ) ) - assure( "invalid unlocalized string", testString.equals( "unlocalized string" ) ); + { + assertTrue( "invalid unlocalized string", testString.equals( "unlocalized string" ) ); + } } /* ------------------------------------------------------------------ */ - public void checkLocales() throws com.sun.star.uno.Exception, java.lang.Exception + @Test public void checkLocales() throws com.sun.star.uno.Exception, java.lang.Exception { // en-US bundle (should always be built and thus present and thus found) m_bundle = m_loader.loadBundle( "orl", new Locale( "en", "US", "" ) ); Locale resourceLocale = m_bundle.getLocale(); - assure( "'en-US' could not be loaded", + assertTrue( "'en-US' could not be loaded", resourceLocale.Language.equals( "en" ) && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) ); // some (invalid) locale which is usually no built, and should thus fallback to en-US m_bundle = m_loader.loadBundle( "orl", new Locale( "inv", "al", "id" ) ); resourceLocale = m_bundle.getLocale(); - assure( "non-existing locale request does not fallback to en-US", + assertTrue( "non-existing locale request does not fallback to en-US", resourceLocale.Language.equals( "en" ) && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) ); } + + + 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/extensions/qa/complex/extensions/makefile.mk b/extensions/qa/complex/extensions/makefile.mk index 96c2afb40bf3..281960b32da9 100644 --- a/extensions/qa/complex/extensions/makefile.mk +++ b/extensions/qa/complex/extensions/makefile.mk @@ -25,12 +25,26 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = ExtensionsComplexTests +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + +PRJ = ../../.. PRJNAME = extensions -PACKAGE = complex$/$(PRJNAME) +TARGET = qa_complex_extensions + +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/extensions +JAVATESTFILES = \ + OfficeResourceLoader.java + +JAVAFILES = $(JAVATESTFILES) + +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar ConnectivityTools.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END + -RES_TARGET = orl .IF "$(GUI)"=="WNT" command_seperator=&& @@ -38,11 +52,11 @@ command_seperator=&& command_seperator=; .ENDIF -# --- Settings ----------------------------------------------------- -.INCLUDE : settings.mk +.INCLUDE: settings.mk #----- resource files for the OfficeResourceLoader test ------------ +RES_TARGET = orl SRS1NAME=$(RES_TARGET)_A_ SRC1FILES= \ @@ -66,36 +80,19 @@ RES2FILELIST=\ RESLIB2NAME=$(RES_TARGET)_B_ RESLIB2SRSFILES=$(RES2FILELIST) +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -#----- compile .java files ----------------------------------------- -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar ConnectivityTools.jar -JAVAFILES = $(shell @$(FIND) .$/*.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 - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk +#----- resource files for the OfficeResourceLoader test ------------ -RUNNER_CLASSPATH = -cp $(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/ConnectivityTools.jar -RUNNER_ARGS = org.openoffice.Runner -TestBase java_complex -run:copy_resources - +java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -sce extensions_all.sce +ALLTAR : copy_resources javatest -run_%:copy_resources - +java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -o complex.$(PRJNAME).$(@:s/run_//) +copy_resources: $(RESLIB1TARGETN) $(RESLIB2TARGETN) + $(foreach,i,$(RESLIB1TARGETN) $(COPY) $i $(i:s/de/invalid/:s/_A_//) $(command_seperator)) echo + $(foreach,i,$(RESLIB2TARGETN) $(COPY) $i $(i:s/en-US/invalid/:s/_B_//) $(command_seperator)) echo -copy_resources: $(RESLIB1TARGETN) $(RESLIB2TARGETN) - @$(foreach,i,$(RESLIB1TARGETN) $(COPY) $i $(i:s/de/invalid/:s/_A_//) $(command_seperator)) echo. - @$(foreach,i,$(RESLIB2TARGETN) $(COPY) $i $(i:s/en-US/invalid/:s/_B_//) $(command_seperator)) echo. +.END diff --git a/forms/prj/build.lst b/forms/prj/build.lst index cc71868b734d..2d7c5f49c7e5 100644 --- a/forms/prj/build.lst +++ b/forms/prj/build.lst @@ -16,3 +16,4 @@ fm forms\source\runtime nmake - all frm_runtime NULL fm forms\util nmake - all fm_util fm_component fm_solar_component fm_solar_control fm_helper fm_misc fm_resource fm_richtext frm_runtime fm_xforms NULL fm forms\qa nmake - all fm_qa NULL fm forms\qa\unoapi nmake - all fm_qa_unoapi NULL +fm forms\qa\complex\forms nmake - all fm_qa_complex NULL diff --git a/forms/qa/complex/forms/CheckOGroupBoxModel.java b/forms/qa/complex/forms/CheckOGroupBoxModel.java index 8a2ae5c7f0e4..490a2ae695c5 100755 --- a/forms/qa/complex/forms/CheckOGroupBoxModel.java +++ b/forms/qa/complex/forms/CheckOGroupBoxModel.java @@ -24,7 +24,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - package complex.forms; import com.sun.star.beans.Property; @@ -37,88 +36,127 @@ import com.sun.star.drawing.XControlShape; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; -import complexlib.ComplexTestCase; -import java.io.PrintWriter; +// import complexlib.ComplexTestCase; +import com.sun.star.util.CloseVetoException; +import com.sun.star.util.XCloseable; import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; import util.FormTools; import util.SOfficeFactory; import util.ValueChanger; +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.*; + /** */ -public class CheckOGroupBoxModel extends ComplexTestCase { - - private XMultiPropertySet xPropSet = null; - - public String[] getTestMethodNames() { - return new String[] {"setPropertyValues"}; - } - - public void before() { - XComponent xDrawDoc = null; - SOfficeFactory SOF = SOfficeFactory.getFactory(((XMultiServiceFactory) param.getMSF())); - - try { - log.println("creating a draw document"); - xDrawDoc = SOF.createDrawDoc(null); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace((PrintWriter)log); - failed("Couldn't create document."); +public class CheckOGroupBoxModel +{ + + private XMultiPropertySet m_xPropSet; + private XComponent m_xDrawDoc; + +// public String[] getTestMethodNames() { +// return new String[] {"setPropertyValues"}; +// } + @Before public void before() + { + // XComponent xDrawDoc = null; + SOfficeFactory SOF = SOfficeFactory.getFactory(getMSF()); + + try + { + System.out.println("creating a draw document"); + m_xDrawDoc = SOF.createDrawDoc(null); + } + catch (com.sun.star.uno.Exception e) + { + fail("Couldn't create document."); } String objName = "GroupBox"; - XControlShape shape = FormTools.insertControlShape(xDrawDoc, 5000, 7000, 2000, 2000, objName); - xPropSet = (XMultiPropertySet)UnoRuntime.queryInterface(XMultiPropertySet.class, shape.getControl()); + XControlShape shape = FormTools.insertControlShape(m_xDrawDoc, 5000, 7000, 2000, 2000, objName); + m_xPropSet = UnoRuntime.queryInterface(XMultiPropertySet.class, shape.getControl()); } - - public void setPropertyValues() { + @After public void after() + { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, m_xDrawDoc); + if (xClose != null) + { + try + { + xClose.close(true); + } + catch (CloseVetoException ex) + { + fail("Can't close document. Exception caught: " + ex.getMessage()); + /* ignore! */ + } + } + } + @Test public void setPropertyValues() + { String[] boundPropsToTest = getBoundPropsToTest(); MyChangeListener ml = new MyChangeListener(); - xPropSet.addPropertiesChangeListener(boundPropsToTest, ml); + m_xPropSet.addPropertiesChangeListener(boundPropsToTest, ml); - Object[] gValues = xPropSet.getPropertyValues(boundPropsToTest); + Object[] gValues = m_xPropSet.getPropertyValues(boundPropsToTest); Object[] newValue = new Object[gValues.length]; - log.println("Trying to change all properties."); - for (int i=0; i<boundPropsToTest.length; i++) { + System.out.println("Trying to change all properties."); + for (int i = 0; i < boundPropsToTest.length; i++) + { newValue[i] = ValueChanger.changePValue(gValues[i]); } - try { - xPropSet.setPropertyValues(boundPropsToTest, newValue); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace((PrintWriter)log); - failed("Exception occured while trying to change the properties."); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace((PrintWriter)log); - failed("Exception occured while trying to change the properties."); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace((PrintWriter)log); - failed("Exception occured while trying to change the properties."); + try + { + m_xPropSet.setPropertyValues(boundPropsToTest, newValue); + } + catch (com.sun.star.beans.PropertyVetoException e) + { + fail("Exception occured while trying to change the properties."); + } + catch (com.sun.star.lang.IllegalArgumentException e) + { + fail("Exception occured while trying to change the properties."); + } + catch (com.sun.star.lang.WrappedTargetException e) + { + fail("Exception occured while trying to change the properties."); } // end of try-catch - assure("Listener was not called.", ml.wasListenerCalled()); - xPropSet.removePropertiesChangeListener(ml); + assertTrue("Listener was not called.", ml.wasListenerCalled()); + m_xPropSet.removePropertiesChangeListener(ml); } - private String[] getBoundPropsToTest() { - Property[] properties = xPropSet.getPropertySetInfo().getProperties(); + private String[] getBoundPropsToTest() + { + Property[] properties = m_xPropSet.getPropertySetInfo().getProperties(); String[] testPropsNames = null; - Vector tNames = new Vector(); + Vector<String> tNames = new Vector<String>(); - for (int i = 0; i < properties.length; i++) { + for (int i = 0; i < properties.length; i++) + { Property property = properties[i]; String name = property.Name; - boolean isWritable = ((property.Attributes & - PropertyAttribute.READONLY) == 0); - boolean isNotNull = ((property.Attributes & - PropertyAttribute.MAYBEVOID) == 0); - boolean isBound = ((property.Attributes & - PropertyAttribute.BOUND) != 0); - - if ( isWritable && isNotNull && isBound) { + boolean isWritable = ((property.Attributes + & PropertyAttribute.READONLY) == 0); + boolean isNotNull = ((property.Attributes + & PropertyAttribute.MAYBEVOID) == 0); + boolean isBound = ((property.Attributes + & PropertyAttribute.BOUND) != 0); + + if (isWritable && isNotNull && isBound) + { tNames.add(name); } @@ -126,22 +164,59 @@ public class CheckOGroupBoxModel extends ComplexTestCase { //get a array of bound properties testPropsNames = new String[tNames.size()]; - testPropsNames = (String[])tNames.toArray(testPropsNames); + testPropsNames = tNames.toArray(testPropsNames); return testPropsNames; } /** - * Listener implementation which sets a flag when - * listener was called. - */ - public class MyChangeListener implements XPropertiesChangeListener { + * Listener implementation which sets a flag when + * listener was called. + */ + public class MyChangeListener implements XPropertiesChangeListener + { + boolean propertiesChanged = false; - public void propertiesChange(PropertyChangeEvent[] e) { - propertiesChanged = true; + + public void propertiesChange(PropertyChangeEvent[] e) + { + propertiesChanged = true; + } + + public void disposing(EventObject obj) + { + } + + public boolean wasListenerCalled() + { + return propertiesChanged; + } + + public void reset() + { + propertiesChanged = false; } - public void disposing (EventObject obj) {} - public boolean wasListenerCalled() { return propertiesChanged; } - public void reset() { propertiesChanged = false; } }; + 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/forms/qa/complex/forms/makefile.mk b/forms/qa/complex/forms/makefile.mk index 6caf244cddc1..c5895b708fb1 100755 --- a/forms/qa/complex/forms/makefile.mk +++ b/forms/qa/complex/forms/makefile.mk @@ -25,54 +25,93 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = CheckOGroupBoxModel -PRJNAME = $(TARGET) -PACKAGE = complex$/forms - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar mysql.jar -JAVAFILES = CheckOGroupBoxModel.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +PRJ = ../../.. +PRJNAME = forms +TARGET = qa_complex_forms -#----- make a jar from compiled files ------------------------------ +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/forms -MAXLINELENGTH = 100000 +# here store only Files which contain a @Test +JAVATESTFILES = \ + CheckOGroupBoxModel.java -JARCLASSDIRS = $(PACKAGE) +# put here all other files +JAVAFILES = $(JAVATESTFILES) -# --- Parameters for the test -------------------------------------- -# start an office if the parameter is set for the makefile -.IF "$(OFFICE)" == "" -CT_APPEXECCOMMAND = -.ELSE -CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" -.ENDIF +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -# test base is java complex -CT_TESTBASE = -TestBase java_complex +# Sample how to debug +# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y -# build up package name with "." instead of $/ -CT_PACKAGE = -o $(PACKAGE:s\$/\.\) +.END -# start the runner application -CT_APP = org.openoffice.Runner +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -# --- Targets ------------------------------------------------------ +ALLTAR : javatest -.IF "$(depend)" == "" -run : ALLTAR -.ELSE -run : ALLDEP -.ENDIF +.END -.INCLUDE : target.mk -run: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).$(JAVAFILES:b) +# +# +# +# PRJ = ..$/..$/.. +# TARGET = CheckOGroupBoxModel +# PRJNAME = $(TARGET) +# PACKAGE = complex$/forms +# +# # --- Settings ----------------------------------------------------- +# .INCLUDE: settings.mk +# +# +# #----- compile .java files ----------------------------------------- +# +# JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar mysql.jar +# JAVAFILES = CheckOGroupBoxModel.java +# JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +# +# #----- make a jar from compiled files ------------------------------ +# +# MAXLINELENGTH = 100000 +# +# JARCLASSDIRS = $(PACKAGE) +# +# # --- Parameters for the test -------------------------------------- +# +# # start an office if the parameter is set for the makefile +# .IF "$(OFFICE)" == "" +# CT_APPEXECCOMMAND = +# .ELSE +# CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" +# .ENDIF +# +# # test base is java complex +# CT_TESTBASE = -TestBase java_complex +# +# # build up package name with "." instead of $/ +# CT_PACKAGE = -o $(PACKAGE:s\$/\.\) +# +# # start the runner application +# CT_APP = org.openoffice.Runner +# +# # --- Targets ------------------------------------------------------ +# +# .IF "$(depend)" == "" +# run : ALLTAR +# .ELSE +# run : ALLDEP +# .ENDIF +# +# .INCLUDE : target.mk +# +# run: +# +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).$(JAVAFILES:b) diff --git a/forms/qa/unoapi/forms.sce b/forms/qa/unoapi/forms.sce index 073472f03126..8ac840e7ca1e 100644 --- a/forms/qa/unoapi/forms.sce +++ b/forms/qa/unoapi/forms.sce @@ -24,7 +24,7 @@ -o forms.OImageButtonModel -o forms.OImageControlControl -o forms.OImageControlModel --o forms.OListBoxControl +#i114669 -o forms.OListBoxControl -o forms.OListBoxModel -o forms.ONavigationBarControl -o forms.ONavigationBarModel diff --git a/forms/qa/unoapi/knownissues.xcl b/forms/qa/unoapi/knownissues.xcl index 2e10a269c681..eb8efe91b4f0 100644 --- a/forms/qa/unoapi/knownissues.xcl +++ b/forms/qa/unoapi/knownissues.xcl @@ -125,5 +125,11 @@ forms.OFileControlModel::com::sun::star::form::FormControlModel forms.OImageControlModel::com::sun::star::beans::XMultiPropertySet forms.OImageControlModel::com::sun::star::beans::XPropertySet +### i113201 ### +forms.OEditModel::com::sun::star::form::validation::XValidatableFormComponent + +### i114209 ### +forms.OGridControlModel::com::sun::star::view::XSelectionSupplier + ### i111333 ### forms.OImageControlControl::com::sun::star::awt::XControl diff --git a/forms/source/component/Currency.cxx b/forms/source/component/Currency.cxx index 89a3b93b4a43..c08d4ea3e36c 100644 --- a/forms/source/component/Currency.cxx +++ b/forms/source/component/Currency.cxx @@ -104,7 +104,8 @@ void OCurrencyModel::implConstruct() try { // get the system international informations - const LocaleDataWrapper& aLocaleInfo = SvtSysLocale().GetLocaleData(); + const SvtSysLocale aSysLocale; + const LocaleDataWrapper& aLocaleInfo = aSysLocale.GetLocaleData(); ::rtl::OUString sCurrencySymbol; sal_Bool bPrependCurrencySymbol; diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx index 05ae1ab1a6e9..577d105afcde 100755..100644 --- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx +++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx @@ -376,6 +376,9 @@ sal_Bool SAL_CALL SpellChecker::isValid( const OUString& rWord, const Locale& rL return TRUE; #endif + // return FALSE to process SPELLML requests (they are longer than the header) + if (rWord.match(A2OU(SPELLML_HEADER), 0) && (rWord.getLength() > 10)) return FALSE; + // Get property values to be used. // These are be the default values set in the SN_LINGU_PROPERTIES // PropertySet which are overridden by the supplied ones from the diff --git a/setup_native/source/java/javaversion.dat b/setup_native/source/java/javaversion.dat index bb935ac2ce58..a647694a7619 100755 --- a/setup_native/source/java/javaversion.dat +++ b/setup_native/source/java/javaversion.dat @@ -26,30 +26,30 @@ #************************************************************************* # GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})") -JAVAVERSION=Java 6 Update 21 -WINDOWSJAVAVERSION=Java 6 Update 21 +JAVAVERSION=Java 6 Update 22 +WINDOWSJAVAVERSION=Java 6 Update 22 # Windows (scp2 and downloadtemplate.nsi) -WINDOWSJAVAFILENAME=jre-6u21-windows-i586.exe -WINDOWSJAVAREGISTRYENTRY=1.6.0_21 +WINDOWSJAVAFILENAME=jre-6u22-windows-i586.exe +WINDOWSJAVAREGISTRYENTRY=1.6.0_22 # Linux (scp2) -LINUXJAVAFILENAME=jre-6u21-linux-i586.rpm +LINUXJAVAFILENAME=jre-6u22-linux-i586.rpm # Linux (rpmUnit.xml, rpm -qp <filename> ) -LINUXJAVANAME=jre-1.6.0_21-fcs +LINUXJAVANAME=jre-1.6.0_22-fcs # Linux-x64 (scp2) -LINUXX64JAVAFILENAME=jre-6u21-linux-amd64.rpm +LINUXX64JAVAFILENAME=jre-6u22-linux-amd64.rpm # Solaris Sparc (scp2) -SOLSJAVARTPACKED=SUNWj6rt_1_6_0_21_sparc.tar.gz -SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_21_sparc.tar.gz -SOLSJAVAMANPACKED=SUNWj6man_1_6_0_21_sparc.tar.gz +SOLSJAVARTPACKED=SUNWj6rt_1_6_0_22_sparc.tar.gz +SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_22_sparc.tar.gz +SOLSJAVAMANPACKED=SUNWj6man_1_6_0_22_sparc.tar.gz # Solaris x86 (scp2) -SOLIJAVARTPACKED=SUNWj6rt_1_6_0_21_x86.tar.gz -SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_21_x86.tar.gz -SOLIJAVAMANPACKED=SUNWj6man_1_6_0_21_x86.tar.gz +SOLIJAVARTPACKED=SUNWj6rt_1_6_0_22_x86.tar.gz +SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_22_x86.tar.gz +SOLIJAVAMANPACKED=SUNWj6man_1_6_0_22_x86.tar.gz # Solaris (pkgUnit.xml, needs only to be changed in major changes) SOLARISJAVART=SUNWj6rt diff --git a/setup_native/source/java/javaversion2.dat b/setup_native/source/java/javaversion2.dat index bb935ac2ce58..a647694a7619 100644 --- a/setup_native/source/java/javaversion2.dat +++ b/setup_native/source/java/javaversion2.dat @@ -26,30 +26,30 @@ #************************************************************************* # GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})") -JAVAVERSION=Java 6 Update 21 -WINDOWSJAVAVERSION=Java 6 Update 21 +JAVAVERSION=Java 6 Update 22 +WINDOWSJAVAVERSION=Java 6 Update 22 # Windows (scp2 and downloadtemplate.nsi) -WINDOWSJAVAFILENAME=jre-6u21-windows-i586.exe -WINDOWSJAVAREGISTRYENTRY=1.6.0_21 +WINDOWSJAVAFILENAME=jre-6u22-windows-i586.exe +WINDOWSJAVAREGISTRYENTRY=1.6.0_22 # Linux (scp2) -LINUXJAVAFILENAME=jre-6u21-linux-i586.rpm +LINUXJAVAFILENAME=jre-6u22-linux-i586.rpm # Linux (rpmUnit.xml, rpm -qp <filename> ) -LINUXJAVANAME=jre-1.6.0_21-fcs +LINUXJAVANAME=jre-1.6.0_22-fcs # Linux-x64 (scp2) -LINUXX64JAVAFILENAME=jre-6u21-linux-amd64.rpm +LINUXX64JAVAFILENAME=jre-6u22-linux-amd64.rpm # Solaris Sparc (scp2) -SOLSJAVARTPACKED=SUNWj6rt_1_6_0_21_sparc.tar.gz -SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_21_sparc.tar.gz -SOLSJAVAMANPACKED=SUNWj6man_1_6_0_21_sparc.tar.gz +SOLSJAVARTPACKED=SUNWj6rt_1_6_0_22_sparc.tar.gz +SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_22_sparc.tar.gz +SOLSJAVAMANPACKED=SUNWj6man_1_6_0_22_sparc.tar.gz # Solaris x86 (scp2) -SOLIJAVARTPACKED=SUNWj6rt_1_6_0_21_x86.tar.gz -SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_21_x86.tar.gz -SOLIJAVAMANPACKED=SUNWj6man_1_6_0_21_x86.tar.gz +SOLIJAVARTPACKED=SUNWj6rt_1_6_0_22_x86.tar.gz +SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_22_x86.tar.gz +SOLIJAVAMANPACKED=SUNWj6man_1_6_0_22_x86.tar.gz # Solaris (pkgUnit.xml, needs only to be changed in major changes) SOLARISJAVART=SUNWj6rt diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java index f46c3fd657d4..323ded34385a 100644 --- a/wizards/com/sun/star/wizards/db/DBMetaData.java +++ b/wizards/com/sun/star/wizards/db/DBMetaData.java @@ -38,12 +38,10 @@ import com.sun.star.awt.XWindowPeer; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.UnknownPropertyException; import com.sun.star.beans.XPropertySet; -import com.sun.star.container.XChild; import com.sun.star.container.XHierarchicalNameAccess; import com.sun.star.container.XHierarchicalNameContainer; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; -import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XModel; import com.sun.star.frame.XStorable; import com.sun.star.lang.XComponent; @@ -91,7 +89,6 @@ import java.util.logging.Logger; public class DBMetaData { - private XNameAccess xQueryNames; public XDatabaseMetaData xDBMetaData; private XDataSource m_dataSource; @@ -109,12 +106,8 @@ public class DBMetaData public com.sun.star.lang.XMultiServiceFactory xMSF; public XComponent xConnectionComponent; - private XNameAccess m_xTableNames; - private XInteractionHandler oInteractionHandler; private XNameAccess xNameAccess; private XInterface xDatabaseContext; - private XCompletedConnection xCompleted; - // private int[] nDataTypes = null; private XWindowPeer xWindowPeer; private String[] TableNames = new String[] {}; private String[] QueryNames = new String[] {}; @@ -212,15 +205,13 @@ public class DBMetaData return lDateCorrection; } - void getInterfaces(XMultiServiceFactory xMSF) + private void getInterfaces(XMultiServiceFactory xMSF) { try { this.xMSF = xMSF; xDatabaseContext = (XInterface) xMSF.createInstance("com.sun.star.sdb.DatabaseContext"); xNameAccess = UnoRuntime.queryInterface( XNameAccess.class, xDatabaseContext ); - XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.task.InteractionHandler"); - oInteractionHandler = UnoRuntime.queryInterface( XInteractionHandler.class, xInteractionHandler ); DataSourceNames = xNameAccess.getElementNames(); } catch (Exception exception) @@ -257,7 +248,6 @@ public class DBMetaData public boolean hasTableByName(String _stablename) { - // getTableNames(); return getTableNamesAsNameAccess().hasByName(_stablename); } @@ -371,11 +361,6 @@ public class DBMetaData return bHasEscapeProcessing; } - // public void initCommandNames() - // { - // getTableNames(); - // } - public XNameAccess getQueryNamesAsNameAccess() { XQueriesSupplier xDBQueries = UnoRuntime.queryInterface( XQueriesSupplier.class, DBConnection ); @@ -416,7 +401,7 @@ public class DBMetaData return TableNames; } - void InitializeWidthList() + private void InitializeWidthList() { WidthList = new int[17][2]; WidthList[0][0] = DataType.BIT; // == -7; @@ -581,7 +566,7 @@ public class DBMetaData return m_dataSource; } - private void setDataSourceByName(String _DataSourceName, boolean bgetInterfaces) + private void setDataSourceByName(String _DataSourceName) { try { @@ -601,7 +586,6 @@ public class DBMetaData public void getDataSourceInterfaces() throws Exception { - xCompleted = UnoRuntime.queryInterface( XCompletedConnection.class, getDataSource() ); xDataSourcePropertySet = UnoRuntime.queryInterface( XPropertySet.class, getDataSource() ); bPasswordIsRequired = ((Boolean) xDataSourcePropertySet.getPropertyValue("IsPasswordRequired")).booleanValue(); } @@ -684,8 +668,8 @@ public class DBMetaData private boolean getConnection(String _DataSourceName) { - setDataSourceByName(_DataSourceName, true); - return getConnection( getDataSource() ); + setDataSourceByName(_DataSourceName); + return getConnection( getDataSource() ); } private boolean getConnection(com.sun.star.sdbc.XConnection _DBConnection) @@ -955,7 +939,7 @@ public class DBMetaData NamedValueCollection creationArgs = new NamedValueCollection(); creationArgs.put( "Name", basename ); creationArgs.put( "URL", documentURL ); - creationArgs.put( "AsTemplate", new Boolean( i_createTemplate ) ); + creationArgs.put( "AsTemplate", i_createTemplate ); XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, _xDocNameAccess ); Object oDBDocument = xDocMSF.createInstanceWithArguments( "com.sun.star.sdb.DocumentDefinition", creationArgs.getPropertyValues() ); XHierarchicalNameContainer xHier = UnoRuntime.queryInterface( XHierarchicalNameContainer.class, _xDocNameAccess ); @@ -967,7 +951,7 @@ public class DBMetaData } catch (Exception e) { - e.printStackTrace(System.out); + e.printStackTrace(); } } @@ -1103,13 +1087,11 @@ public class DBMetaData public void finish() { xQueryNames = null; - oInteractionHandler = null; xNameAccess = null; xDatabaseContext = null; xDBMetaData = null; m_dataSource = null; xModel = null; - xCompleted = null; xDataSourcePropertySet = null; xWindowPeer = null; DBConnection = null; diff --git a/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java index 5c65d73794f0..e03323c6ebbc 100644 --- a/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java +++ b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java @@ -57,7 +57,8 @@ public abstract class DatabaseObjectWizard extends WizardDialog { try { - m_docUI.loadComponent( i_type, i_name, i_forEditing ); + if ( m_docUI != null ) + m_docUI.loadComponent( i_type, i_name, i_forEditing ); } catch ( IllegalArgumentException ex ) { diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 0a52f6a3a7a9..235da2d7c04a 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -47,6 +47,7 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.sdbc.SQLException; import com.sun.star.lang.XInitialization; import com.sun.star.awt.XWindow; +import com.sun.star.sdb.SQLFilterOperator; import com.sun.star.wizards.common.*; @@ -60,7 +61,7 @@ public class SQLQueryComposer // String m_sFromClause; public XSingleSelectQueryAnalyzer m_xQueryAnalyzer; Vector composedCommandNames = new Vector(1); - private XSingleSelectQueryComposer m_xQueryComposer; + private XSingleSelectQueryComposer m_queryComposer; XMultiServiceFactory xMSF; boolean bincludeGrouping = true; @@ -72,7 +73,7 @@ public class SQLQueryComposer xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, CurDBMetaData.DBConnection); final Object oQueryComposer = xMSF.createInstance("com.sun.star.sdb.SingleSelectQueryComposer"); m_xQueryAnalyzer = (XSingleSelectQueryAnalyzer) UnoRuntime.queryInterface(XSingleSelectQueryAnalyzer.class, oQueryComposer); - m_xQueryComposer = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, m_xQueryAnalyzer); + m_queryComposer = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, m_xQueryAnalyzer); XSQLQueryComposerFactory xSQLComposerFactory; xSQLComposerFactory = (XSQLQueryComposerFactory) UnoRuntime.queryInterface(XSQLQueryComposerFactory.class, CurDBMetaData.DBConnection); // /* XSQLQueryComposer */ xSQLQueryComposer = xSQLComposerFactory.createQueryComposer(); @@ -160,7 +161,7 @@ public class SQLQueryComposer { for (int i = 0; i < CurDBMetaData.getFilterConditions().length; i++) { - m_xQueryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions()); + m_queryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions()); } } catch (Exception exception) @@ -172,7 +173,7 @@ public class SQLQueryComposer public void prependSortingCriteria() throws SQLException { XIndexAccess xColumnIndexAccess = m_xQueryAnalyzer.getOrderColumns(); - m_xQueryComposer.setOrder(""); + m_queryComposer.setOrder(""); for (int i = 0; i < CurDBMetaData.getSortFieldNames().length; i++) { appendSortingCriterion(i, false); @@ -186,7 +187,7 @@ public class SQLQueryComposer if (JavaTools.FieldInTable(CurDBMetaData.getSortFieldNames(), sName) == -1) { boolean bascend = AnyConverter.toBoolean(xColumnPropertySet.getPropertyValue("IsAscending")); - m_xQueryComposer.appendOrderByColumn(xColumnPropertySet, bascend); + m_queryComposer.appendOrderByColumn(xColumnPropertySet, bascend); } } catch (Exception e) @@ -203,13 +204,13 @@ public class SQLQueryComposer String sSort = CurDBMetaData.getSortFieldNames()[_SortIndex][1]; boolean bascend = (sSort.equals("ASC")); - m_xQueryComposer.appendOrderByColumn(xColumn, bascend); + m_queryComposer.appendOrderByColumn(xColumn, bascend); } public void appendSortingcriteria(boolean _baddAliasFieldNames) throws SQLException { String sOrder = ""; - m_xQueryComposer.setOrder(""); + m_queryComposer.setOrder(""); for (int i = 0; i < CurDBMetaData.getSortFieldNames().length; i++) { String sSortValue = CurDBMetaData.getSortFieldNames()[i][0]; @@ -223,7 +224,7 @@ public class SQLQueryComposer } sOrder += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + CurDBMetaData.AggregateFieldNames[iAggregate][0] + ")"; sOrder += " " + CurDBMetaData.getSortFieldNames()[i][1]; - m_xQueryComposer.setOrder(sOrder); + m_queryComposer.setOrder(sOrder); } else { @@ -232,7 +233,7 @@ public class SQLQueryComposer sOrder = m_xQueryAnalyzer.getOrder(); } // just for debug! - sOrder = m_xQueryComposer.getOrder(); + sOrder = m_queryComposer.getOrder(); int dummy = 0; } @@ -241,7 +242,7 @@ public class SQLQueryComposer for (int i = 0; i < CurDBMetaData.GroupFieldNames.length; i++) { XPropertySet xColumn = CurDBMetaData.getColumnObjectByFieldName(CurDBMetaData.GroupFieldNames[i], _baddAliasFieldNames); - m_xQueryComposer.appendGroupByColumn(xColumn); + m_queryComposer.appendGroupByColumn(xColumn); } String s = m_xQueryAnalyzer.getQuery(); } @@ -309,7 +310,7 @@ public class SQLQueryComposer if (CurDBMetaData.getFilterConditions().length > 0) { CurDBMetaData.setFilterConditions(replaceConditionsByAlias(CurDBMetaData.getFilterConditions())); - m_xQueryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions()); + m_queryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions()); } } } @@ -319,7 +320,7 @@ public class SQLQueryComposer appendGroupByColumns(_baddAliasFieldNames); if (CurDBMetaData.GroupByFilterConditions.length > 0) { - m_xQueryComposer.setStructuredHavingClause(CurDBMetaData.GroupByFilterConditions); + m_queryComposer.setStructuredHavingClause(CurDBMetaData.GroupByFilterConditions); } } appendSortingcriteria(_baddAliasFieldNames); @@ -426,8 +427,63 @@ public class SQLQueryComposer typeexception.printStackTrace(System.out); } } + + /** + * retrieves a normalized structured filter + * + * <p>XSingleSelectQueryComposer.getStructuredFilter has a strange habit of returning the predicate (equal, not equal, etc) + * effectively twice: Once as SQLFilterOperator, and once in the value. That is, if you have a term "column <> 3", then + * you'll get an SQLFilterOperator.NOT_EQUAL (which is fine), <strong>and</strong> the textual value of the condition + * will read "<> 3". The latter is strange enough, but even more strange is that this behavior is not even consistent: + * for SQLFilterOperator.EQUAL, the "=" sign is not include in the textual value.</p> + * + * <p>To abstract from this weirdness, use this function here, which strips the unwanted tokens from the textual value + * representation.</p> + */ + public PropertyValue[][] getNormalizedStructuredFilter() + { + final PropertyValue[][] structuredFilter = m_queryComposer.getStructuredFilter(); + for ( int i=0; i<structuredFilter.length; ++i ) + { + for ( int j=0; j<structuredFilter[i].length; ++j ) + { + if ( !( structuredFilter[i][j].Value instanceof String ) ) + continue; + final StringBuffer textualValue = new StringBuffer( (String)structuredFilter[i][j].Value ); + switch ( structuredFilter[i][j].Handle ) + { + case SQLFilterOperator.EQUAL: + break; + case SQLFilterOperator.NOT_EQUAL: + case SQLFilterOperator.LESS_EQUAL: + case SQLFilterOperator.GREATER_EQUAL: + textualValue.delete( 0, 2 ); + break; + case SQLFilterOperator.LESS: + case SQLFilterOperator.GREATER: + textualValue.delete( 0, 1 ); + break; + case SQLFilterOperator.NOT_LIKE: + textualValue.delete( 0, 8 ); + break; + case SQLFilterOperator.LIKE: + textualValue.delete( 0, 4 ); + break; + case SQLFilterOperator.SQLNULL: + textualValue.delete( 0, 7 ); + break; + case SQLFilterOperator.NOT_SQLNULL: + textualValue.delete( 0, 11 ); + break; + } + structuredFilter[i][j].Value = textualValue.toString().trim(); + } + } + return structuredFilter; + } + public XSingleSelectQueryComposer getQueryComposer() { - return m_xQueryComposer; + return m_queryComposer; } } diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java index 53fc67f01192..a0970534d657 100644 --- a/wizards/com/sun/star/wizards/query/QueryWizard.java +++ b/wizards/com/sun/star/wizards/query/QueryWizard.java @@ -36,8 +36,10 @@ import com.sun.star.sdbc.SQLException; import com.sun.star.uno.AnyConverter; import com.sun.star.wizards.ui.UIConsts; import com.sun.star.uno.UnoRuntime; +import com.sun.star.wizards.common.Desktop; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.common.Resource; import com.sun.star.wizards.db.DatabaseObjectWizard; import com.sun.star.wizards.db.QueryMetaData; @@ -59,15 +61,15 @@ public class QueryWizard extends DatabaseObjectWizard private static final int SOGROUPFILTER_PAGE = 6; private static final int SOTITLES_PAGE = 7; protected static final int SOSUMMARY_PAGE = 8; - private CommandFieldSelection CurDBCommandFieldSelection; - private SortingComponent CurSortingComponent; - private FieldSelection CurGroupFieldSelection; - private TitlesComponent CurTitlesComponent; - private FilterComponent CurFilterComponent; - private FilterComponent CurGroupFilterComponent; - private AggregateComponent CurAggregateComponent; - private Finalizer CurFinalizer; - private QuerySummary CurDBMetaData; + private CommandFieldSelection m_DBCommandFieldSelectio; + private SortingComponent m_sortingComponent; + private FieldSelection m_groupFieldSelection; + private TitlesComponent m_titlesComponent; + private FilterComponent m_filterComponent; + private FilterComponent m_groupFilterComponent; + private AggregateComponent m_aggregateComponent; + private Finalizer m_finalizer; + private QuerySummary m_DBMetaData; private String reslblFieldHeader; private String reslblAliasHeader; private String reslblFields; @@ -82,30 +84,85 @@ public class QueryWizard extends DatabaseObjectWizard { super( xMSF, 40970, i_wizardContext ); addResourceHandler("QueryWizard", "dbw"); - CurDBMetaData = new QuerySummary(xMSF, m_oResource); + m_DBMetaData = new QuerySummary(xMSF, m_oResource); } -/* public static void main(String args[]) + public static void main(String i_args[]) { - String ConnectStr = "uno:pipe,name=foo;urp;StarOffice.ServiceManager"; + final String settings[] = new String[] { null, null, null }; + final int IDX_PIPE_NAME = 0; + final int IDX_LOCATION = 1; + final int IDX_DSN = 2; + + // some simple parsing + boolean failure = false; + int settingsIndex = -1; + for ( int i=0; i<i_args.length; ++i ) + { + if ( settingsIndex >= 0 ) + { + settings[ settingsIndex ] = i_args[i]; + settingsIndex = -1; + continue; + } + + if ( i_args[i].equals( "--pipe-name" ) ) + { + settingsIndex = IDX_PIPE_NAME; + continue; + } + + if ( i_args[i].equals( "--database-location" ) ) + { + settingsIndex = IDX_LOCATION; + continue; + } + + if ( i_args[i].equals( "--data-source-name" ) ) + { + settingsIndex = IDX_DSN; + continue; + } + + failure = true; + } + + if ( settings[ IDX_PIPE_NAME ] == null ) + failure = true; + + if ( ( settings[ IDX_DSN ] == null ) && ( settings[ IDX_LOCATION ] == null ) ) + failure = true; + + if ( failure ) + { + System.err.println( "supported arguments: " ); + System.err.println( " --pipe-name <name> : specifies the name of the pipe to connect to the running OOo instance" ); + System.err.println( " --database-location <url> : specifies the URL of the database document to work with" ); + System.err.println( " --data-source-name <name> : specifies the name of the data source to work with" ); + return; + } + + final String ConnectStr = "uno:pipe,name=" + settings[IDX_PIPE_NAME] + ";urp;StarOffice.ServiceManager"; try { - XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr); - if (xLocMSF != null) + final XMultiServiceFactory serviceFactory = Desktop.connect(ConnectStr); + if (serviceFactory != null) { PropertyValue[] curproperties = new PropertyValue[1]; - curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///G:/temp/abc.odb"); -// curproperties[0] = Properties.createProperty("DataSourceName", "TESTDB"); + if ( settings[ IDX_LOCATION ] != null ) + curproperties[0] = Properties.createProperty( "DatabaseLocation", settings[ IDX_LOCATION ] ); + else + curproperties[0] = Properties.createProperty( "DataSourceName", settings[ IDX_DSN ] ); - QueryWizard CurQueryWizard = new QueryWizard(xLocMSF); - CurQueryWizard.startQueryWizard(xLocMSF, curproperties); + QueryWizard CurQueryWizard = new QueryWizard( serviceFactory, curproperties ); + CurQueryWizard.startQueryWizard(); } } catch (java.lang.Exception jexception) { jexception.printStackTrace(System.out); } - }*/ + } public final XFrame getFrame() { @@ -116,7 +173,7 @@ public class QueryWizard extends DatabaseObjectWizard { try { - if ( CurDBMetaData.getConnection( m_wizardContext ) ) + if ( m_DBMetaData.getConnection( m_wizardContext ) ) { reslblFields = m_oResource.getResText(UIConsts.RID_QUERY + 4); reslblFieldHeader = m_oResource.getResText(UIConsts.RID_QUERY + 19); //Fielnames in AliasComponent @@ -138,11 +195,11 @@ public class QueryWizard extends DatabaseObjectWizard setRightPaneHeaders(m_oResource, UIConsts.RID_QUERY + 70, 8); this.setMaxStep(8); buildSteps(); - this.CurDBCommandFieldSelection.preselectCommand( m_wizardContext, false ); + this.m_DBCommandFieldSelectio.preselectCommand( m_wizardContext, false ); XWindowPeer windowPeer = UnoRuntime.queryInterface( XWindowPeer.class, m_frame.getContainerWindow() ); createWindowPeer(windowPeer); - CurDBMetaData.setWindowPeer(this.xControl.getPeer()); + m_DBMetaData.setWindowPeer(this.xControl.getPeer()); insertQueryRelatedSteps(); executeDialog( m_frame.getContainerWindow().getPosSize() ); } @@ -151,14 +208,14 @@ public class QueryWizard extends DatabaseObjectWizard { jexception.printStackTrace(System.out); } - CurGroupFilterComponent = null; - CurTitlesComponent = null; - CurAggregateComponent = null; - CurDBCommandFieldSelection = null; + m_groupFilterComponent = null; + m_titlesComponent = null; + m_aggregateComponent = null; + m_DBCommandFieldSelectio = null; xWindowPeer = null; - CurFinalizer = null; - CurDBMetaData.finish(); - CurDBMetaData = null; + m_finalizer = null; + m_DBMetaData.finish(); + m_DBMetaData = null; System.gc(); return m_createdQuery; @@ -181,17 +238,17 @@ public class QueryWizard extends DatabaseObjectWizard case SOAGGREGATE_PAGE: if (_bEnabled == true) { - bEnabled = ((CurDBMetaData.hasNumericalFields()) && (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar())); + bEnabled = ((m_DBMetaData.hasNumericalFields()) && (m_DBMetaData.xDBMetaData.supportsCoreSQLGrammar())); } break; case SOGROUPSELECTION_PAGE: - bEnabled = CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY; + bEnabled = m_DBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY; break; case SOGROUPFILTER_PAGE: bEnabled = false; if (_bEnabled == true) { - bEnabled = (CurDBMetaData.GroupByFilterConditions.length > 0); + bEnabled = (m_DBMetaData.GroupByFilterConditions.length > 0); } break; @@ -225,11 +282,11 @@ public class QueryWizard extends DatabaseObjectWizard i = insertRoadmapItem(0, true, SOFIELDSELECTION_PAGE - 1, SOFIELDSELECTION_PAGE); i = insertRoadmapItem(i, false, SOSORTING_PAGE - 1, SOSORTING_PAGE); // Orderby is always supported i = insertRoadmapItem(i, false, SOFILTER_PAGE - 1, SOFILTER_PAGE); - if (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar()) + if (m_DBMetaData.xDBMetaData.supportsCoreSQLGrammar()) { - i = insertRoadmapItem(i, CurDBMetaData.hasNumericalFields(), SOAGGREGATE_PAGE - 1, SOAGGREGATE_PAGE); + i = insertRoadmapItem(i, m_DBMetaData.hasNumericalFields(), SOAGGREGATE_PAGE - 1, SOAGGREGATE_PAGE); } - if (CurDBMetaData.xDBMetaData.supportsGroupBy()) + if (m_DBMetaData.xDBMetaData.supportsGroupBy()) { i = insertRoadmapItem(i, false, SOGROUPSELECTION_PAGE - 1, SOGROUPSELECTION_PAGE); i = insertRoadmapItem(i, false, SOGROUPFILTER_PAGE - 1, SOGROUPFILTER_PAGE); @@ -251,28 +308,25 @@ public class QueryWizard extends DatabaseObjectWizard { try { -// curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411); -// curDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); - - CurDBCommandFieldSelection = new CommandFieldSelection(this, CurDBMetaData, 120, reslblFields, reslblSelFields, reslblTables, true, 40850); - CurDBCommandFieldSelection.setAppendMode(true); - CurDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); - CurSortingComponent = new SortingComponent(this, SOSORTING_PAGE, 95, 27, 210, 40865); - CurFilterComponent = new FilterComponent(this, xMSF, SOFILTER_PAGE, 97, 27, 209, 3, CurDBMetaData, 40878); - CurFilterComponent.addNumberFormats(); + m_DBCommandFieldSelectio = new CommandFieldSelection(this, m_DBMetaData, 120, reslblFields, reslblSelFields, reslblTables, true, 40850); + m_DBCommandFieldSelectio.setAppendMode(true); + m_DBCommandFieldSelectio.addFieldSelectionListener(new FieldSelectionListener()); + m_sortingComponent = new SortingComponent(this, SOSORTING_PAGE, 95, 27, 210, 40865); + m_filterComponent = new FilterComponent(this, xMSF, SOFILTER_PAGE, 97, 27, 209, 3, m_DBMetaData, 40878); + m_filterComponent.addNumberFormats(); - if (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar()) + if (m_DBMetaData.xDBMetaData.supportsCoreSQLGrammar()) { - CurAggregateComponent = new AggregateComponent(this, CurDBMetaData, SOAGGREGATE_PAGE, 97, 69, 209, 5, 40895); + m_aggregateComponent = new AggregateComponent(this, m_DBMetaData, SOAGGREGATE_PAGE, 97, 69, 209, 5, 40895); } - if (CurDBMetaData.xDBMetaData.supportsGroupBy()) + if (m_DBMetaData.xDBMetaData.supportsGroupBy()) { - CurGroupFieldSelection = new FieldSelection(this, SOGROUPSELECTION_PAGE, 95, 27, 210, 150, reslblFields, this.reslblGroupBy, 40915, false); - CurGroupFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); - CurGroupFilterComponent = new FilterComponent(this, xMSF, SOGROUPFILTER_PAGE, 97, 27, 209, 3, CurDBMetaData, 40923); + m_groupFieldSelection = new FieldSelection(this, SOGROUPSELECTION_PAGE, 95, 27, 210, 150, reslblFields, this.reslblGroupBy, 40915, false); + m_groupFieldSelection.addFieldSelectionListener(new FieldSelectionListener()); + m_groupFilterComponent = new FilterComponent(this, xMSF, SOGROUPFILTER_PAGE, 97, 27, 209, 3, m_DBMetaData, 40923); } - CurTitlesComponent = new TitlesComponent(this, SOTITLES_PAGE, 97, 37, 207, 7, reslblFieldHeader, reslblAliasHeader, 40940); - CurFinalizer = new Finalizer(this, CurDBMetaData); + m_titlesComponent = new TitlesComponent(this, SOTITLES_PAGE, 97, 37, 207, 7, reslblFieldHeader, reslblAliasHeader, 40940); + m_finalizer = new Finalizer(this, m_DBMetaData); enableNavigationButtons(false, false, false); } catch (com.sun.star.uno.Exception exception) @@ -288,10 +342,10 @@ public class QueryWizard extends DatabaseObjectWizard || ( switchToStep( ncurStep, SOSUMMARY_PAGE ) ) ) { - m_createdQuery = CurFinalizer.finish(); + m_createdQuery = m_finalizer.finish(); if ( m_createdQuery.length() > 0 ) { - loadSubComponent( CommandType.QUERY, m_createdQuery, CurFinalizer.displayQueryDesign() ); + loadSubComponent( CommandType.QUERY, m_createdQuery, m_finalizer.displayQueryDesign() ); xDialog.endExecute(); return true; } @@ -305,11 +359,11 @@ public class QueryWizard extends DatabaseObjectWizard { if (nOldStep <= SOGROUPSELECTION_PAGE && nNewStep > SOGROUPSELECTION_PAGE) { - if (CurDBMetaData.xDBMetaData.supportsGroupBy()) + if (m_DBMetaData.xDBMetaData.supportsGroupBy()) { - CurDBMetaData.setGroupFieldNames(CurGroupFieldSelection.getSelectedFieldNames()); - CurDBMetaData.GroupFieldNames = JavaTools.removeOutdatedFields(CurDBMetaData.GroupFieldNames, CurDBMetaData.NonAggregateFieldNames); - CurDBMetaData.GroupByFilterConditions = JavaTools.removeOutdatedFields(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.GroupFieldNames); + m_DBMetaData.setGroupFieldNames(m_groupFieldSelection.getSelectedFieldNames()); + m_DBMetaData.GroupFieldNames = JavaTools.removeOutdatedFields(m_DBMetaData.GroupFieldNames, m_DBMetaData.NonAggregateFieldNames); + m_DBMetaData.GroupByFilterConditions = JavaTools.removeOutdatedFields(m_DBMetaData.GroupByFilterConditions, m_DBMetaData.GroupFieldNames); } } switch (nNewStep) @@ -317,24 +371,24 @@ public class QueryWizard extends DatabaseObjectWizard case SOFIELDSELECTION_PAGE: break; case SOSORTING_PAGE: - CurSortingComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.getSortFieldNames()); + m_sortingComponent.initialize(m_DBMetaData.getDisplayFieldNames(), m_DBMetaData.getSortFieldNames()); break; case SOFILTER_PAGE: - CurFilterComponent.initialize(CurDBMetaData.getFilterConditions(), CurDBMetaData.getDisplayFieldNames()); + m_filterComponent.initialize(m_DBMetaData.getFilterConditions(), m_DBMetaData.getDisplayFieldNames()); break; case SOAGGREGATE_PAGE: - CurAggregateComponent.initialize(); + m_aggregateComponent.initialize(); break; case SOGROUPSELECTION_PAGE: break; case SOGROUPFILTER_PAGE: - CurGroupFilterComponent.initialize(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.getGroupFieldNames()); + m_groupFilterComponent.initialize(m_DBMetaData.GroupByFilterConditions, m_DBMetaData.getGroupFieldNames()); break; case SOTITLES_PAGE: - CurTitlesComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.FieldTitleSet); + m_titlesComponent.initialize(m_DBMetaData.getDisplayFieldNames(), m_DBMetaData.FieldTitleSet); break; case SOSUMMARY_PAGE: - CurFinalizer.initialize(); + m_finalizer.initialize(); break; default: break; @@ -351,27 +405,27 @@ public class QueryWizard extends DatabaseObjectWizard switch (nOldStep) { case SOFIELDSELECTION_PAGE: - CurDBMetaData.reorderFieldColumns(CurDBCommandFieldSelection.getSelectedFieldNames()); - CurDBMetaData.initializeFieldTitleSet(true); - CurDBMetaData.setNumericFields(); + m_DBMetaData.reorderFieldColumns(m_DBCommandFieldSelectio.getSelectedFieldNames()); + m_DBMetaData.initializeFieldTitleSet(true); + m_DBMetaData.setNumericFields(); searchForOutdatedFields(); break; case SOSORTING_PAGE: - CurDBMetaData.setSortFieldNames(CurSortingComponent.getSortFieldNames()); + m_DBMetaData.setSortFieldNames(m_sortingComponent.getSortFieldNames()); break; case SOFILTER_PAGE: - CurDBMetaData.setFilterConditions(CurFilterComponent.getFilterConditions()); + m_DBMetaData.setFilterConditions(m_filterComponent.getFilterConditions()); break; case SOAGGREGATE_PAGE: - CurDBMetaData.AggregateFieldNames = CurAggregateComponent.getAggregateFieldNames(); + m_DBMetaData.AggregateFieldNames = m_aggregateComponent.getAggregateFieldNames(); break; case SOGROUPSELECTION_PAGE: break; case SOGROUPFILTER_PAGE: - CurDBMetaData.setGroupByFilterConditions(this.CurGroupFilterComponent.getFilterConditions()); + m_DBMetaData.setGroupByFilterConditions(this.m_groupFilterComponent.getFilterConditions()); break; case SOTITLES_PAGE: - CurDBMetaData.setFieldTitles(CurTitlesComponent.getFieldTitles()); + m_DBMetaData.setFieldTitles(m_titlesComponent.getFieldTitles()); break; case SOSUMMARY_PAGE: break; @@ -382,15 +436,15 @@ public class QueryWizard extends DatabaseObjectWizard { try { - if (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY) + if (m_DBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY) { - if (CurDBMetaData.xDBMetaData.supportsGroupBy()) + if (m_DBMetaData.xDBMetaData.supportsGroupBy()) { - CurDBMetaData.setNonAggregateFieldNames(); - CurGroupFieldSelection.initialize(CurDBMetaData.getUniqueAggregateFieldNames(), false, CurDBMetaData.xDBMetaData.getMaxColumnsInGroupBy()); - CurGroupFieldSelection.intializeSelectedFields(CurDBMetaData.NonAggregateFieldNames); - CurGroupFieldSelection.setMultipleMode(false); - setStepEnabled(SOGROUPFILTER_PAGE, CurAggregateComponent.isGroupingpossible() && CurDBMetaData.NonAggregateFieldNames.length > 0); + m_DBMetaData.setNonAggregateFieldNames(); + m_groupFieldSelection.initialize(m_DBMetaData.getUniqueAggregateFieldNames(), false, m_DBMetaData.xDBMetaData.getMaxColumnsInGroupBy()); + m_groupFieldSelection.intializeSelectedFields(m_DBMetaData.NonAggregateFieldNames); + m_groupFieldSelection.setMultipleMode(false); + setStepEnabled(SOGROUPFILTER_PAGE, m_aggregateComponent.isGroupingpossible() && m_DBMetaData.NonAggregateFieldNames.length > 0); } } } @@ -403,18 +457,18 @@ public class QueryWizard extends DatabaseObjectWizard private void searchForOutdatedFields() { - String[] sFieldNames = CurDBMetaData.getFieldNames(); - String[][] sRemovedFields = JavaTools.removeOutdatedFields(CurDBMetaData.getSortFieldNames(), sFieldNames); - CurDBMetaData.setSortFieldNames(sRemovedFields); - CurDBMetaData.setFilterConditions(JavaTools.removeOutdatedFields(CurDBMetaData.getFilterConditions(), sFieldNames)); - CurDBMetaData.AggregateFieldNames = JavaTools.removeOutdatedFields(CurDBMetaData.AggregateFieldNames, sFieldNames); + String[] sFieldNames = m_DBMetaData.getFieldNames(); + String[][] sRemovedFields = JavaTools.removeOutdatedFields(m_DBMetaData.getSortFieldNames(), sFieldNames); + m_DBMetaData.setSortFieldNames(sRemovedFields); + m_DBMetaData.setFilterConditions(JavaTools.removeOutdatedFields(m_DBMetaData.getFilterConditions(), sFieldNames)); + m_DBMetaData.AggregateFieldNames = JavaTools.removeOutdatedFields(m_DBMetaData.AggregateFieldNames, sFieldNames); } private void enableWizardSteps(String[] NewItems) { boolean bEnabled = NewItems.length > 0; - setControlProperty("btnWizardNext", "Enabled", new Boolean(bEnabled)); - setControlProperty("btnWizardFinish", "Enabled", new Boolean(bEnabled)); + setControlProperty("btnWizardNext", "Enabled", bEnabled); + setControlProperty("btnWizardFinish", "Enabled", bEnabled); enableRoadmapItems(NewItems, bEnabled); // Note: Performancewise this could be improved } @@ -446,15 +500,15 @@ public class QueryWizard extends DatabaseObjectWizard { if (ID == 1) { - CurDBMetaData.addSeveralFieldColumns(SelItems, CurDBCommandFieldSelection.getSelectedCommandName()); + m_DBMetaData.addSeveralFieldColumns(SelItems, m_DBCommandFieldSelectio.getSelectedCommandName()); enableWizardSteps(NewItems); - CurDBCommandFieldSelection.changeSelectedFieldNames(CurDBMetaData.getDisplayFieldNames()); - CurDBCommandFieldSelection.toggleCommandListBox(NewItems); + m_DBCommandFieldSelectio.changeSelectedFieldNames(m_DBMetaData.getDisplayFieldNames()); + m_DBCommandFieldSelectio.toggleCommandListBox(NewItems); } else { - boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0); - Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTER_PAGE), "Enabled", new Boolean(bEnabled)); + boolean bEnabled = (m_groupFieldSelection.getSelectedFieldNames().length > 0); + Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTER_PAGE), "Enabled", bEnabled); } } @@ -464,30 +518,30 @@ public class QueryWizard extends DatabaseObjectWizard if (ID == 1) { enableWizardSteps(NewItems); - String[] sSelfieldNames = CurDBMetaData.getFieldNames(SelItems, CurDBCommandFieldSelection.getSelectedCommandName()); - CurDBCommandFieldSelection.addItemsToFieldsListbox(sSelfieldNames); - CurDBMetaData.removeSeveralFieldColumnsByDisplayFieldName(SelItems); - CurDBCommandFieldSelection.toggleCommandListBox(NewItems); + String[] sSelfieldNames = m_DBMetaData.getFieldNames(SelItems, m_DBCommandFieldSelectio.getSelectedCommandName()); + m_DBCommandFieldSelectio.addItemsToFieldsListbox(sSelfieldNames); + m_DBMetaData.removeSeveralFieldColumnsByDisplayFieldName(SelItems); + m_DBCommandFieldSelectio.toggleCommandListBox(NewItems); } else { - boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0); + boolean bEnabled = (m_groupFieldSelection.getSelectedFieldNames().length > 0); String CurDisplayFieldName = SelItems[0]; - if (JavaTools.FieldInList(CurDBMetaData.NonAggregateFieldNames, CurDisplayFieldName) > -1) + if (JavaTools.FieldInList(m_DBMetaData.NonAggregateFieldNames, CurDisplayFieldName) > -1) { showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, resmsgNonNumericAsGroupBy); - CurGroupFieldSelection.xSelectedFieldsListBox.addItems(SelItems, CurGroupFieldSelection.xSelectedFieldsListBox.getItemCount()); - String FieldList[] = CurGroupFieldSelection.xFieldsListBox.getItems(); + m_groupFieldSelection.xSelectedFieldsListBox.addItems(SelItems, m_groupFieldSelection.xSelectedFieldsListBox.getItemCount()); + String FieldList[] = m_groupFieldSelection.xFieldsListBox.getItems(); int index = JavaTools.FieldInList(FieldList, CurDisplayFieldName); if (index > -1) { - CurGroupFieldSelection.xFieldsListBox.removeItems((short) index, (short) 1); + m_groupFieldSelection.xFieldsListBox.removeItems((short) index, (short) 1); } } else { - Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTER_PAGE), "Enabled", new Boolean(bEnabled)); + Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTER_PAGE), "Enabled", bEnabled); } } } diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java index 2bb9e8765329..e53f0792e268 100644 --- a/wizards/com/sun/star/wizards/ui/FilterComponent.java +++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java @@ -27,7 +27,6 @@ package com.sun.star.wizards.ui; // import java.util.Vector; -import com.sun.star.awt.ItemEvent; import com.sun.star.awt.TextEvent; import com.sun.star.awt.VclWindowPeerAttribute; import com.sun.star.awt.XControl; @@ -40,21 +39,22 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.lang.EventObject; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lib.uno.helper.PropertySet; +import com.sun.star.sdb.SQLFilterOperator; import com.sun.star.sdbc.DataType; import com.sun.star.uno.Any; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Exception; import com.sun.star.uno.Type; +import com.sun.star.uno.TypeClass; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; import com.sun.star.wizards.common.NumberFormatter; import com.sun.star.wizards.common.Helper; import com.sun.star.wizards.common.HelpIds; import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.Properties; import com.sun.star.wizards.db.FieldColumn; import com.sun.star.wizards.db.QueryMetaData; +import com.sun.star.wizards.db.SQLQueryComposer; import java.util.logging.Level; import java.util.logging.Logger; @@ -62,19 +62,9 @@ public class FilterComponent { private Integer IStep; - // private int iStartPosX; - // private int iStartPosY; - // int Count; private int RowCount; - // private int FilterCount; private static String[] sLogicOperators; - private static String[] sBooleanValues; - // private /* public */ String[] FieldNames; - private XRadioButton optMatchAll; private XRadioButton optMatchAny; - // private String soptMatchAll; - // private String soptMatchAny; - // private String[] sHeadLines; private String slblFieldNames; private String slblOperators; private String slblValue; @@ -82,7 +72,6 @@ public class FilterComponent private int BaseID = 2300; private String sIncSuffix; private ControlRow[] oControlRows; - // private Vector FilterNames; private String sDuplicateCondition; final int SOOPTORMODE = 100; final int SOOPTANDMODE = 101; @@ -128,20 +117,16 @@ public class FilterComponent final int SO_OPTQUERYMODE = 5; int SOI_MATCHALL = 0; int SOI_MATCHANY = 1; - // int ifilterstate = SOI_MATCHALL; int curHelpID; class ItemListenerImpl implements com.sun.star.awt.XItemListener { - public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject) { int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList); String sControlName = ""; switch (iKey) { - // case SOOPTQUERYMODE: - // getfilterstate(); case SO_FIRSTFIELDNAME: case SO_SECONDFIELDNAME: case SO_THIRDFIELDNAME: @@ -153,24 +138,11 @@ public class FilterComponent FieldColumn CurFieldColumn = new FieldColumn(oQueryMetaData, CurDisplayFieldName); String sControlNameTextValue = "txtValue" + sControlNameSuffix; -// String sControlNameBooleanList = "lstBoolean" + sControlNameSuffix; -// if (aFieldColumn.FieldType == DataType.BOOLEAN) -// { -// // scheint aufgrund eines Fehlers in Toolkit nicht zu funktionieren -// CurUnoDialog.setControlVisible(sControlNameTextValue, false); -// CurUnoDialog.setControlVisible(sControlNameBooleanList, true); -// } -// else -// { -// CurUnoDialog.setControlVisible(sControlNameTextValue, true); -// CurUnoDialog.setControlVisible(sControlNameBooleanList, false); - XControl xValueControl = CurUnoDialog.xDlgContainer.getControl(sControlNameTextValue); XInterface xValueModel = (XInterface) UnoDialog.getModel(xValueControl); Helper.setUnoPropertyValue(xValueModel, "TreatAsNumber", Boolean.valueOf(CurFieldColumn.isNumberFormat())); final NumberFormatter aNumberFormatter = oQueryMetaData.getNumberFormatter(); aNumberFormatter.setNumberFormat(xValueModel, CurFieldColumn.getDBFormatKey(), aNumberFormatter); -// } break; case SO_FIRSTCONDITION: @@ -181,7 +153,6 @@ public class FilterComponent break; case SOOPTORMODE: case SOOPTANDMODE: - // getfilterstate(); return; case SO_FIRSTBOOLFIELDNAME: @@ -211,24 +182,6 @@ public class FilterComponent togglefollowingControlRow(sName); } - public void disposing(EventObject EventObject) - { - } - } - - public void fieldconditionchanged(ItemEvent EventObject) - { - String sName = getControlName(EventObject.Source); - togglefollowingControlRow(sName); - } - - public void disposing(com.sun.star.lang.EventObject eventObject) - { - } - - class ActionListenerImpl implements com.sun.star.awt.XActionListener - { - public void disposing(EventObject eventObject) { } @@ -285,6 +238,7 @@ public class FilterComponent int nFilterCount = getFilterCount(); if (nFilterCount > 0) { + final SQLQueryComposer composer = oQueryMetaData.getSQLQueryComposer(); try { final String serviceName = "com.sun.star.beans.PropertyBag"; @@ -292,31 +246,32 @@ public class FilterComponent column.addProperty("Type", PropertyAttribute.BOUND, DataType.VARCHAR); column.addProperty("Name", PropertyAttribute.BOUND, ""); + column.addProperty("Value", (short)( PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE ), null ); final XPropertySet columnSet = UnoRuntime.queryInterface(XPropertySet.class, column); - if ( oQueryMetaData.getSQLQueryComposer().getQuery().length() == 0) + if ( composer.getQuery().length() == 0) { - final String fromClause = oQueryMetaData.getSQLQueryComposer().getFromClause(); - StringBuffer sql = new StringBuffer(); - sql.append(oQueryMetaData.getSQLQueryComposer().getSelectClause(true)); + final String fromClause = composer.getFromClause(); + StringBuilder sql = new StringBuilder(); + sql.append(composer.getSelectClause(true)); sql.append(' '); sql.append(fromClause); - oQueryMetaData.getSQLQueryComposer().getQueryComposer().setElementaryQuery(sql.toString()); + composer.getQueryComposer().setElementaryQuery(sql.toString()); } - int a = 0; + composer.getQueryComposer().setStructuredFilter( new PropertyValue[][] {} ); for (int i = 0; i < RowCount; i++) { - ControlRow CurControlRow = oControlRows[i]; - if (CurControlRow.isEnabled()) + ControlRow currentControlRow = oControlRows[i]; + if (currentControlRow.isEnabled()) { - if (CurControlRow.isConditionComplete()) + if (currentControlRow.isConditionComplete()) { - String sFieldName = CurControlRow.getSelectedFieldName(); - int nOperator = (int) CurControlRow.getSelectedOperator(); + String sFieldName = currentControlRow.getSelectedFieldName(); + int nOperator = (int) currentControlRow.getSelectedOperator(); FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName); columnSet.setPropertyValue("Name", aFieldColumn.getFieldName()); columnSet.setPropertyValue("Type", aFieldColumn.getXColumnPropertySet().getPropertyValue("Type")); - Object value = CurControlRow.getValue(); + Object value = currentControlRow.getValue(); switch(aFieldColumn.getFieldType()) { case DataType.TIMESTAMP: @@ -324,13 +279,24 @@ public class FilterComponent value = ((Double)value) - oQueryMetaData.getNullDateCorrection(); break; } - column.addProperty("Value", PropertyAttribute.MAYBEVOID, value); + column.removeProperty( "Value" ); + final short operator = currentControlRow.getSelectedOperator(); + if ( ( operator == SQLFilterOperator.SQLNULL ) + || ( operator == SQLFilterOperator.NOT_SQLNULL ) + || AnyConverter.isVoid( value ) + ) + { + column.addProperty("Value", (short)( PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE ), new String() ); + value = new Any( new Type( TypeClass.VOID ), null ); + } + else + column.addProperty("Value", (short)( PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE ), value ); columnSet.setPropertyValue("Value", value); - oQueryMetaData.getSQLQueryComposer().getQueryComposer().appendFilterByColumn(columnSet, getfilterstate() == this.SOI_MATCHALL,nOperator); + composer.getQueryComposer().appendFilterByColumn(columnSet, getfilterstate() == this.SOI_MATCHALL,nOperator); } } } - filterconditions = oQueryMetaData.getSQLQueryComposer().getQueryComposer().getStructuredFilter(); + filterconditions = composer.getNormalizedStructuredFilter(); int[] iduplicate = JavaTools.getDuplicateFieldIndex(filterconditions); if (iduplicate[0] != -1) { @@ -338,9 +304,7 @@ public class FilterComponent String smsgDuplicateCondition = getDisplayCondition(sDuplicateCondition, aduplicatecondition, null); CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, smsgDuplicateCondition); CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", Integer.valueOf(1), Integer.valueOf(2))); - return new PropertyValue[][] - { - }; + return new PropertyValue[][]{}; } } catch (Exception ex) @@ -403,22 +367,6 @@ public class FilterComponent return ifilterstate; } - private void addfiltercondition(int _index, String _curFieldName, Object _curValue, int _curOperator) - { - String ValString = String.valueOf(_curValue); - PropertyValue oPropertyValue = Properties.createProperty(_curFieldName, ValString, _curOperator); - getfilterstate(); - if (getfilterstate() == this.SOI_MATCHALL) - { - if (_index == 0) - { - filterconditions[0] = new PropertyValue[getFilterCount()]; - } - filterconditions[0][_index] = new PropertyValue(); - filterconditions[0][_index] = oPropertyValue; - } - } - private int getFilterCount() { int a = 0; @@ -430,8 +378,6 @@ public class FilterComponent } } return a; - // FilterCount = a; - // return FilterCount; } /** Creates a new instance of FilterComponent @@ -457,8 +403,6 @@ public class FilterComponent this.oQueryMetaData = _oQueryMetaData; boolean bEnabled; sIncSuffix = com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.getDlgNameAccess(), "optMatchAll"); - // iStartPosX = iPosX; - // iStartPosY = iPosY; String soptMatchAll = CurUnoDialog.m_oResource.getResText(BaseID + 9); String soptMatchAny = CurUnoDialog.m_oResource.getResText(BaseID + 10); @@ -466,14 +410,13 @@ public class FilterComponent slblOperators = CurUnoDialog.m_oResource.getResText(BaseID + 24); slblValue = CurUnoDialog.m_oResource.getResText(BaseID + 25); sLogicOperators = CurUnoDialog.m_oResource.getResArray(BaseID + 26, 10 /* 7 */); // =, <>, <, >, <=, >=, like, !like, is null, !is null - sBooleanValues = CurUnoDialog.m_oResource.getResArray(BaseID + 36, 2); // true, false sDuplicateCondition = CurUnoDialog.m_oResource.getResText(BaseID + 89); // create Radiobuttons // * match all // * match one - optMatchAll = CurUnoDialog.insertRadioButton("optMatchAll" + sIncSuffix, SOOPTANDMODE, new ItemListenerImpl(), + CurUnoDialog.insertRadioButton("optMatchAll" + sIncSuffix, SOOPTANDMODE, new ItemListenerImpl(), new String[] { "Height", @@ -534,13 +477,6 @@ public class FilterComponent public void initialize(PropertyValue[][] _filterconditions, String[] _fieldnames) { - // String aFieldNamesWithAdditionalEmpty[] = new String[_fieldnames.length + 1]; - // for (int i = 0; i < _fieldnames.length; i++) - // { - // aFieldNamesWithAdditionalEmpty[i] = _fieldnames[i]; - // } - // aFieldNamesWithAdditionalEmpty[_fieldnames.length] = ""; - int i; for (i = 0; i < RowCount; i++) { @@ -593,9 +529,8 @@ public class FilterComponent // // // ------------------------------------------------------------------------- - class ControlRow + final class ControlRow { - private final static int SOLSTFIELDNAME = 3; private final static int SOLSTOPERATOR = 4; private final static int SOTXTVALUE = 5; @@ -776,7 +711,6 @@ public class FilterComponent Short.valueOf(curtabindex++), Integer.valueOf(nValueWidth) }); - } catch (Exception exception) { @@ -821,13 +755,6 @@ public class FilterComponent String sValue = (String.valueOf(oValue)); return (!sValue.equals("")); } -// String sBoolValue=""; -// short aSelectedBoolValue[] = (short[])Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[6]), "SelectedItems"); -// if (aSelectedBoolValue.length > 0) -// { -// sBoolValue = String.valueOf(aSelectedBoolValue[0] == 1); -// return !sBoolValue.equals(""); -// } } } return false; @@ -839,16 +766,10 @@ public class FilterComponent } } - private void fieldnamechanged(ItemEvent EventObject) - { - int i = 0; - } - protected void setCondition(PropertyValue _filtercondition) { try { - int ikey; XListBox xFieldsListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, ControlElements[SOLSTFIELDNAME]); xFieldsListBox.selectItem(_filtercondition.Name, true); XListBox xOperatorListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, ControlElements[SOLSTOPERATOR]); @@ -918,8 +839,8 @@ public class FilterComponent private void settovoid() { - CurUnoDialog.deselectListBox(ControlElements[SOLSTFIELDNAME]); - CurUnoDialog.deselectListBox(ControlElements[SOLSTOPERATOR]); + WizardDialog.deselectListBox(ControlElements[SOLSTFIELDNAME]); + WizardDialog.deselectListBox(ControlElements[SOLSTOPERATOR]); Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", com.sun.star.uno.Any.VOID); } @@ -954,7 +875,7 @@ public class FilterComponent } else if (!isConditionComplete()) { - CurUnoDialog.deselectListBox(ControlElements[SOLSTOPERATOR]); + WizardDialog.deselectListBox(ControlElements[SOLSTOPERATOR]); } } @@ -1025,43 +946,9 @@ public class FilterComponent protected String getDateTimeString(boolean bgetDate) { - double dblValue = ((Double) getValue()).doubleValue(); - NumberFormatter oNumberFormatter = oQueryMetaData.getNumberFormatter(); - return oNumberFormatter.convertNumberToString(iDateTimeFormat, dblValue); + double dblValue = ((Double) getValue()).doubleValue(); + NumberFormatter oNumberFormatter = oQueryMetaData.getNumberFormatter(); + return oNumberFormatter.convertNumberToString(iDateTimeFormat, dblValue); } } } -// com.sun.star.sdb.SQLFilterOperator.EQUAL -// com.sun.star.sdb.SQLFilterOperator.NOT_EQUAL -// com.sun.star.sdb.SQLFilterOperator.LESS -// com.sun.star.sdb.SQLFilterOperator.GREATER -// com.sun.star.sdb.SQLFilterOperator.LESS_EQUAL -// com.sun.star.sdb.SQLFilterOperator.GREATER_EQUAL -// com.sun.star.sdb.SQLFilterOperator.LIKE -// com.sun.star.sdb.SQLFilterOperator.NOT_LIKE -// com.sun.star.sdb.SQLFilterOperator.SQLNULL -// com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL - -/* constants SQLFilterOperator -{ -/// equal to -const long EQUAL = 1; -/// not equal to -const long NOT_EQUAL = 2; -/// less than -const long LESS = 3; -/// greater than -const long GREATER = 4; -/// less or eqal than -const long LESS_EQUAL = 5; -/// greater or eqal than -const long GREATER_EQUAL = 6; -/// like -const long LIKE = 7; -/// not like -const long NOT_LIKE = 8; -/// is null -const long SQLNULL = 9; -/// is not null -const long NOT_SQLNULL = 10; -}; */ |