2012-06-21 11:53:00 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
package util;
|
|
|
|
|
|
|
|
// access the implementations via names
|
|
|
|
import com.sun.star.uno.XInterface;
|
|
|
|
import com.sun.star.uno.UnoRuntime;
|
|
|
|
import com.sun.star.lang.XComponent;
|
|
|
|
import com.sun.star.drawing.XControlShape;
|
|
|
|
import com.sun.star.drawing.XDrawPage;
|
|
|
|
import com.sun.star.lang.XMultiServiceFactory;
|
|
|
|
import com.sun.star.awt.Size;
|
|
|
|
import com.sun.star.awt.Point;
|
|
|
|
import com.sun.star.awt.XControlModel;
|
|
|
|
import com.sun.star.container.XNameContainer;
|
CWS-TOOLING: integrate CWS dba32h
2009-10-12 12:21:44 +0200 msc r276827 : remove warning for issue 102712 because the issue is fixed
2009-10-05 07:14:20 +0200 oj r276658 : #105585# add missing dependency for OOO_UI
2009-10-02 12:50:19 +0200 fs r276632 : #i105505#
If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized.
In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl
call attachResource. This ensures that the model is initialized completely, including firing the necessary
events.
2009-10-02 12:46:12 +0200 fs r276631 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document
2009-10-01 13:09:07 +0200 fs r276596 : do not rely on the name 'Standard' for the one and only form in a document
2009-10-01 12:35:56 +0200 fs r276589 : #i105509# don't rely on default form component names, use indexes
2009-10-01 11:19:18 +0200 fs r276584 : copying the fix for #i105082# into this CWS
2009-10-01 11:13:22 +0200 fs r276583 : improved logs
2009-10-01 11:10:44 +0200 fs r276581 : #i105505#
2009-10-01 08:07:57 +0200 fs r276575 : manual merge of trunk, to allow cwslocalize to run
2009-09-30 22:48:30 +0200 fs r276574 : removed that strange ONLOAD definition
2009-09-30 12:58:18 +0200 fs r276553 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 12:56:45 +0200 fs r276552 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 11:47:45 +0200 fs r276549 : #i105235#
2009-09-29 12:27:40 +0200 fs r276521 : #i105367#
2009-09-28 12:08:17 +0200 oj r276485 : #i105371# export version in manifest.xml as well
2009-09-28 12:07:02 +0200 oj r276484 : #i105371# export version in manifest.xml as well
2009-09-28 09:48:01 +0200 oj r276481 : #i105366# init drivers when not empty
2009-09-25 14:31:27 +0200 fs r276466 : CWS-TOOLING: rebase CWS dba32h to trunk@276429 (milestone: DEV300:m60)
2009-09-24 13:52:54 +0200 fs r276422 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document)
2009-09-24 11:42:03 +0200 fs r276413 : #i105234# proper zoom handling for the nav bar
2009-09-24 11:41:40 +0200 fs r276412 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double
2009-09-23 12:21:22 +0200 oj r276377 : remove dos lineends
2009-09-23 11:44:52 +0200 oj r276376 : #i105216# load config on demand
2009-09-23 11:44:19 +0200 oj r276375 : #i105216# load config on demand
2009-09-23 11:43:35 +0200 oj r276374 : #i105216# load config on demand
2009-09-21 09:13:03 +0200 oj r276307 : #i105158# use Thread support
2009-09-18 13:06:50 +0200 fs r276277 : #i105147#
2009-09-18 11:48:23 +0200 oj r276271 : #i105158# new method for thread safety
2009-09-18 10:42:56 +0200 fs r276266 : CWS-TOOLING: rebase CWS dba32h to trunk@276192 (milestone: DEV300:m59)
2009-09-18 08:30:03 +0200 oj r276263 : #i105016# load correct ldap so
2009-09-17 13:42:31 +0200 oj r276240 : change count of check boxes
2009-09-17 13:32:59 +0200 oj r276239 : revert false to true for currency
2009-09-17 09:14:46 +0200 oj r276220 : #i104901# add patch for every issue
2009-09-17 09:10:29 +0200 oj r276219 : #i104901# add patch for every issue
2009-09-11 13:47:49 +0200 oj r276060 : #i104901# fix for indentity
2009-09-11 12:14:14 +0200 fs r276056 : #i104594# allow to render controls without an SdrPageView
2009-09-11 11:49:31 +0200 fs r276055 : CWS-TOOLING: rebase CWS dba32h to trunk@276043 (milestone: DEV300:m58)
2009-09-10 08:41:40 +0200 oj r276021 : #i104911# export variable-set not for repeating sections
2009-10-14 18:48:09 +00:00
|
|
|
import com.sun.star.container.XIndexContainer;
|
2003-01-27 15:27:53 +00:00
|
|
|
import com.sun.star.form.XFormsSupplier;
|
|
|
|
import com.sun.star.form.XForm;
|
|
|
|
import com.sun.star.form.XLoadable;
|
|
|
|
import com.sun.star.text.XTextDocument;
|
|
|
|
import com.sun.star.beans.XPropertySet;
|
2003-01-31 10:32:36 +00:00
|
|
|
import com.sun.star.uno.AnyConverter;
|
|
|
|
import com.sun.star.uno.Type;
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* contains helper methods forms
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class FormTools {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* creates a XControlShape
|
|
|
|
*
|
|
|
|
* @param oDoc the document
|
|
|
|
* @param height the height of the shape
|
|
|
|
* @param width the width of the shape
|
|
|
|
* @param x the x-position of the shape
|
|
|
|
* @param y the y-position of the shape
|
|
|
|
* @param kind the kind of the shape
|
|
|
|
* @return the created XControlShape
|
|
|
|
*/
|
|
|
|
public static XControlShape createControlShape( XComponent oDoc, int height,
|
2017-01-16 15:24:56 +01:00
|
|
|
int width, int x, int y, String kind )
|
|
|
|
throws com.sun.star.uno.Exception
|
|
|
|
{
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
Size size = new Size();
|
|
|
|
Point position = new Point();
|
|
|
|
XControlShape oCShape = null;
|
|
|
|
XControlModel aControl = null;
|
|
|
|
|
2012-06-27 15:40:17 +02:00
|
|
|
XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2017-01-16 15:24:56 +01:00
|
|
|
Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape");
|
|
|
|
Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind);
|
|
|
|
XPropertySet model_props = UnoRuntime.queryInterface(XPropertySet.class,aCon);
|
|
|
|
model_props.setPropertyValue("DefaultControl","com.sun.star.form.control."+kind);
|
|
|
|
aControl = UnoRuntime.queryInterface( XControlModel.class, aCon );
|
|
|
|
oCShape = UnoRuntime.queryInterface( XControlShape.class, oInt );
|
|
|
|
size.Height = height;
|
|
|
|
size.Width = width;
|
|
|
|
position.X = x;
|
|
|
|
position.Y = y;
|
|
|
|
oCShape.setSize(size);
|
|
|
|
oCShape.setPosition(position);
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
oCShape.setControl(aControl);
|
|
|
|
|
|
|
|
return oCShape;
|
|
|
|
} // finish createControlShape
|
|
|
|
|
|
|
|
public static XControlShape createUnoControlShape( XComponent oDoc, int height,
|
2017-01-16 15:24:56 +01:00
|
|
|
int width, int x, int y, String kind, String defControl )
|
|
|
|
throws com.sun.star.uno.Exception
|
|
|
|
{
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
Size size = new Size();
|
|
|
|
Point position = new Point();
|
|
|
|
XControlShape oCShape = null;
|
|
|
|
XControlModel aControl = null;
|
|
|
|
|
2017-01-16 15:24:56 +01:00
|
|
|
XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
|
|
|
|
|
|
|
|
Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape");
|
|
|
|
Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind);
|
|
|
|
XPropertySet model_props = UnoRuntime.queryInterface(XPropertySet.class,aCon);
|
|
|
|
model_props.setPropertyValue("DefaultControl","com.sun.star.awt."+defControl);
|
|
|
|
aControl = UnoRuntime.queryInterface( XControlModel.class, aCon );
|
|
|
|
oCShape = UnoRuntime.queryInterface( XControlShape.class, oInt );
|
|
|
|
size.Height = height;
|
|
|
|
size.Width = width;
|
|
|
|
position.X = x;
|
|
|
|
position.Y = y;
|
|
|
|
oCShape.setSize(size);
|
|
|
|
oCShape.setPosition(position);
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
oCShape.setControl(aControl);
|
|
|
|
|
|
|
|
return oCShape;
|
|
|
|
} // finish createControlShape
|
|
|
|
|
|
|
|
public static XControlShape createControlShapeWithDefaultControl( XComponent oDoc, int height,
|
2017-01-16 15:24:56 +01:00
|
|
|
int width, int x, int y, String kind )
|
|
|
|
throws com.sun.star.uno.Exception
|
|
|
|
{
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
Size size = new Size();
|
|
|
|
Point position = new Point();
|
|
|
|
XControlShape oCShape = null;
|
|
|
|
XControlModel aControl = null;
|
|
|
|
|
2017-01-16 15:24:56 +01:00
|
|
|
XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2017-01-16 15:24:56 +01:00
|
|
|
Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape");
|
|
|
|
Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind);
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2017-01-16 15:24:56 +01:00
|
|
|
aControl = UnoRuntime.queryInterface( XControlModel.class, aCon );
|
|
|
|
oCShape = UnoRuntime.queryInterface( XControlShape.class, oInt );
|
|
|
|
size.Height = height;
|
|
|
|
size.Width = width;
|
|
|
|
position.X = x;
|
|
|
|
position.Y = y;
|
|
|
|
oCShape.setSize(size);
|
|
|
|
oCShape.setPosition(position);
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
oCShape.setControl(aControl);
|
|
|
|
|
|
|
|
return oCShape;
|
|
|
|
} // finish createControlShape
|
|
|
|
|
2017-01-16 15:24:56 +01:00
|
|
|
public static XInterface createControl( XComponent oDoc, String kind )
|
|
|
|
throws com.sun.star.uno.Exception
|
|
|
|
{
|
2003-01-27 15:27:53 +00:00
|
|
|
XInterface oControl = null;
|
|
|
|
|
2017-01-16 15:24:56 +01:00
|
|
|
XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2017-01-16 15:24:56 +01:00
|
|
|
oControl = (XInterface) oDocMSF.createInstance(
|
2003-01-27 15:27:53 +00:00
|
|
|
"com.sun.star.form.component."+kind);
|
|
|
|
return oControl;
|
|
|
|
} // finish createControl
|
|
|
|
|
CWS-TOOLING: integrate CWS dba32h
2009-10-12 12:21:44 +0200 msc r276827 : remove warning for issue 102712 because the issue is fixed
2009-10-05 07:14:20 +0200 oj r276658 : #105585# add missing dependency for OOO_UI
2009-10-02 12:50:19 +0200 fs r276632 : #i105505#
If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized.
In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl
call attachResource. This ensures that the model is initialized completely, including firing the necessary
events.
2009-10-02 12:46:12 +0200 fs r276631 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document
2009-10-01 13:09:07 +0200 fs r276596 : do not rely on the name 'Standard' for the one and only form in a document
2009-10-01 12:35:56 +0200 fs r276589 : #i105509# don't rely on default form component names, use indexes
2009-10-01 11:19:18 +0200 fs r276584 : copying the fix for #i105082# into this CWS
2009-10-01 11:13:22 +0200 fs r276583 : improved logs
2009-10-01 11:10:44 +0200 fs r276581 : #i105505#
2009-10-01 08:07:57 +0200 fs r276575 : manual merge of trunk, to allow cwslocalize to run
2009-09-30 22:48:30 +0200 fs r276574 : removed that strange ONLOAD definition
2009-09-30 12:58:18 +0200 fs r276553 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 12:56:45 +0200 fs r276552 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 11:47:45 +0200 fs r276549 : #i105235#
2009-09-29 12:27:40 +0200 fs r276521 : #i105367#
2009-09-28 12:08:17 +0200 oj r276485 : #i105371# export version in manifest.xml as well
2009-09-28 12:07:02 +0200 oj r276484 : #i105371# export version in manifest.xml as well
2009-09-28 09:48:01 +0200 oj r276481 : #i105366# init drivers when not empty
2009-09-25 14:31:27 +0200 fs r276466 : CWS-TOOLING: rebase CWS dba32h to trunk@276429 (milestone: DEV300:m60)
2009-09-24 13:52:54 +0200 fs r276422 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document)
2009-09-24 11:42:03 +0200 fs r276413 : #i105234# proper zoom handling for the nav bar
2009-09-24 11:41:40 +0200 fs r276412 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double
2009-09-23 12:21:22 +0200 oj r276377 : remove dos lineends
2009-09-23 11:44:52 +0200 oj r276376 : #i105216# load config on demand
2009-09-23 11:44:19 +0200 oj r276375 : #i105216# load config on demand
2009-09-23 11:43:35 +0200 oj r276374 : #i105216# load config on demand
2009-09-21 09:13:03 +0200 oj r276307 : #i105158# use Thread support
2009-09-18 13:06:50 +0200 fs r276277 : #i105147#
2009-09-18 11:48:23 +0200 oj r276271 : #i105158# new method for thread safety
2009-09-18 10:42:56 +0200 fs r276266 : CWS-TOOLING: rebase CWS dba32h to trunk@276192 (milestone: DEV300:m59)
2009-09-18 08:30:03 +0200 oj r276263 : #i105016# load correct ldap so
2009-09-17 13:42:31 +0200 oj r276240 : change count of check boxes
2009-09-17 13:32:59 +0200 oj r276239 : revert false to true for currency
2009-09-17 09:14:46 +0200 oj r276220 : #i104901# add patch for every issue
2009-09-17 09:10:29 +0200 oj r276219 : #i104901# add patch for every issue
2009-09-11 13:47:49 +0200 oj r276060 : #i104901# fix for indentity
2009-09-11 12:14:14 +0200 fs r276056 : #i104594# allow to render controls without an SdrPageView
2009-09-11 11:49:31 +0200 fs r276055 : CWS-TOOLING: rebase CWS dba32h to trunk@276043 (milestone: DEV300:m58)
2009-09-10 08:41:40 +0200 oj r276021 : #i104911# export variable-set not for repeating sections
2009-10-14 18:48:09 +00:00
|
|
|
public static XNameContainer getForms ( XDrawPage oDP )
|
|
|
|
{
|
2012-06-27 15:40:17 +02:00
|
|
|
XFormsSupplier oFS = UnoRuntime.queryInterface(
|
2003-01-27 15:27:53 +00:00
|
|
|
XFormsSupplier.class,oDP);
|
|
|
|
return oFS.getForms();
|
|
|
|
} //finish getForms
|
|
|
|
|
2014-08-08 12:44:57 +02:00
|
|
|
private static XIndexContainer getIndexedForms ( XDrawPage oDP )
|
CWS-TOOLING: integrate CWS dba32h
2009-10-12 12:21:44 +0200 msc r276827 : remove warning for issue 102712 because the issue is fixed
2009-10-05 07:14:20 +0200 oj r276658 : #105585# add missing dependency for OOO_UI
2009-10-02 12:50:19 +0200 fs r276632 : #i105505#
If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized.
In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl
call attachResource. This ensures that the model is initialized completely, including firing the necessary
events.
2009-10-02 12:46:12 +0200 fs r276631 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document
2009-10-01 13:09:07 +0200 fs r276596 : do not rely on the name 'Standard' for the one and only form in a document
2009-10-01 12:35:56 +0200 fs r276589 : #i105509# don't rely on default form component names, use indexes
2009-10-01 11:19:18 +0200 fs r276584 : copying the fix for #i105082# into this CWS
2009-10-01 11:13:22 +0200 fs r276583 : improved logs
2009-10-01 11:10:44 +0200 fs r276581 : #i105505#
2009-10-01 08:07:57 +0200 fs r276575 : manual merge of trunk, to allow cwslocalize to run
2009-09-30 22:48:30 +0200 fs r276574 : removed that strange ONLOAD definition
2009-09-30 12:58:18 +0200 fs r276553 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 12:56:45 +0200 fs r276552 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 11:47:45 +0200 fs r276549 : #i105235#
2009-09-29 12:27:40 +0200 fs r276521 : #i105367#
2009-09-28 12:08:17 +0200 oj r276485 : #i105371# export version in manifest.xml as well
2009-09-28 12:07:02 +0200 oj r276484 : #i105371# export version in manifest.xml as well
2009-09-28 09:48:01 +0200 oj r276481 : #i105366# init drivers when not empty
2009-09-25 14:31:27 +0200 fs r276466 : CWS-TOOLING: rebase CWS dba32h to trunk@276429 (milestone: DEV300:m60)
2009-09-24 13:52:54 +0200 fs r276422 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document)
2009-09-24 11:42:03 +0200 fs r276413 : #i105234# proper zoom handling for the nav bar
2009-09-24 11:41:40 +0200 fs r276412 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double
2009-09-23 12:21:22 +0200 oj r276377 : remove dos lineends
2009-09-23 11:44:52 +0200 oj r276376 : #i105216# load config on demand
2009-09-23 11:44:19 +0200 oj r276375 : #i105216# load config on demand
2009-09-23 11:43:35 +0200 oj r276374 : #i105216# load config on demand
2009-09-21 09:13:03 +0200 oj r276307 : #i105158# use Thread support
2009-09-18 13:06:50 +0200 fs r276277 : #i105147#
2009-09-18 11:48:23 +0200 oj r276271 : #i105158# new method for thread safety
2009-09-18 10:42:56 +0200 fs r276266 : CWS-TOOLING: rebase CWS dba32h to trunk@276192 (milestone: DEV300:m59)
2009-09-18 08:30:03 +0200 oj r276263 : #i105016# load correct ldap so
2009-09-17 13:42:31 +0200 oj r276240 : change count of check boxes
2009-09-17 13:32:59 +0200 oj r276239 : revert false to true for currency
2009-09-17 09:14:46 +0200 oj r276220 : #i104901# add patch for every issue
2009-09-17 09:10:29 +0200 oj r276219 : #i104901# add patch for every issue
2009-09-11 13:47:49 +0200 oj r276060 : #i104901# fix for indentity
2009-09-11 12:14:14 +0200 fs r276056 : #i104594# allow to render controls without an SdrPageView
2009-09-11 11:49:31 +0200 fs r276055 : CWS-TOOLING: rebase CWS dba32h to trunk@276043 (milestone: DEV300:m58)
2009-09-10 08:41:40 +0200 oj r276021 : #i104911# export variable-set not for repeating sections
2009-10-14 18:48:09 +00:00
|
|
|
{
|
2012-06-27 15:40:17 +02:00
|
|
|
XFormsSupplier oFS = UnoRuntime.queryInterface(
|
CWS-TOOLING: integrate CWS dba32h
2009-10-12 12:21:44 +0200 msc r276827 : remove warning for issue 102712 because the issue is fixed
2009-10-05 07:14:20 +0200 oj r276658 : #105585# add missing dependency for OOO_UI
2009-10-02 12:50:19 +0200 fs r276632 : #i105505#
If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized.
In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl
call attachResource. This ensures that the model is initialized completely, including firing the necessary
events.
2009-10-02 12:46:12 +0200 fs r276631 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document
2009-10-01 13:09:07 +0200 fs r276596 : do not rely on the name 'Standard' for the one and only form in a document
2009-10-01 12:35:56 +0200 fs r276589 : #i105509# don't rely on default form component names, use indexes
2009-10-01 11:19:18 +0200 fs r276584 : copying the fix for #i105082# into this CWS
2009-10-01 11:13:22 +0200 fs r276583 : improved logs
2009-10-01 11:10:44 +0200 fs r276581 : #i105505#
2009-10-01 08:07:57 +0200 fs r276575 : manual merge of trunk, to allow cwslocalize to run
2009-09-30 22:48:30 +0200 fs r276574 : removed that strange ONLOAD definition
2009-09-30 12:58:18 +0200 fs r276553 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 12:56:45 +0200 fs r276552 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 11:47:45 +0200 fs r276549 : #i105235#
2009-09-29 12:27:40 +0200 fs r276521 : #i105367#
2009-09-28 12:08:17 +0200 oj r276485 : #i105371# export version in manifest.xml as well
2009-09-28 12:07:02 +0200 oj r276484 : #i105371# export version in manifest.xml as well
2009-09-28 09:48:01 +0200 oj r276481 : #i105366# init drivers when not empty
2009-09-25 14:31:27 +0200 fs r276466 : CWS-TOOLING: rebase CWS dba32h to trunk@276429 (milestone: DEV300:m60)
2009-09-24 13:52:54 +0200 fs r276422 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document)
2009-09-24 11:42:03 +0200 fs r276413 : #i105234# proper zoom handling for the nav bar
2009-09-24 11:41:40 +0200 fs r276412 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double
2009-09-23 12:21:22 +0200 oj r276377 : remove dos lineends
2009-09-23 11:44:52 +0200 oj r276376 : #i105216# load config on demand
2009-09-23 11:44:19 +0200 oj r276375 : #i105216# load config on demand
2009-09-23 11:43:35 +0200 oj r276374 : #i105216# load config on demand
2009-09-21 09:13:03 +0200 oj r276307 : #i105158# use Thread support
2009-09-18 13:06:50 +0200 fs r276277 : #i105147#
2009-09-18 11:48:23 +0200 oj r276271 : #i105158# new method for thread safety
2009-09-18 10:42:56 +0200 fs r276266 : CWS-TOOLING: rebase CWS dba32h to trunk@276192 (milestone: DEV300:m59)
2009-09-18 08:30:03 +0200 oj r276263 : #i105016# load correct ldap so
2009-09-17 13:42:31 +0200 oj r276240 : change count of check boxes
2009-09-17 13:32:59 +0200 oj r276239 : revert false to true for currency
2009-09-17 09:14:46 +0200 oj r276220 : #i104901# add patch for every issue
2009-09-17 09:10:29 +0200 oj r276219 : #i104901# add patch for every issue
2009-09-11 13:47:49 +0200 oj r276060 : #i104901# fix for indentity
2009-09-11 12:14:14 +0200 fs r276056 : #i104594# allow to render controls without an SdrPageView
2009-09-11 11:49:31 +0200 fs r276055 : CWS-TOOLING: rebase CWS dba32h to trunk@276043 (milestone: DEV300:m58)
2009-09-10 08:41:40 +0200 oj r276021 : #i104911# export variable-set not for repeating sections
2009-10-14 18:48:09 +00:00
|
|
|
XFormsSupplier.class,oDP);
|
2012-06-27 15:40:17 +02:00
|
|
|
return UnoRuntime.queryInterface( XIndexContainer.class,
|
CWS-TOOLING: integrate CWS dba32h
2009-10-12 12:21:44 +0200 msc r276827 : remove warning for issue 102712 because the issue is fixed
2009-10-05 07:14:20 +0200 oj r276658 : #105585# add missing dependency for OOO_UI
2009-10-02 12:50:19 +0200 fs r276632 : #i105505#
If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized.
In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl
call attachResource. This ensures that the model is initialized completely, including firing the necessary
events.
2009-10-02 12:46:12 +0200 fs r276631 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document
2009-10-01 13:09:07 +0200 fs r276596 : do not rely on the name 'Standard' for the one and only form in a document
2009-10-01 12:35:56 +0200 fs r276589 : #i105509# don't rely on default form component names, use indexes
2009-10-01 11:19:18 +0200 fs r276584 : copying the fix for #i105082# into this CWS
2009-10-01 11:13:22 +0200 fs r276583 : improved logs
2009-10-01 11:10:44 +0200 fs r276581 : #i105505#
2009-10-01 08:07:57 +0200 fs r276575 : manual merge of trunk, to allow cwslocalize to run
2009-09-30 22:48:30 +0200 fs r276574 : removed that strange ONLOAD definition
2009-09-30 12:58:18 +0200 fs r276553 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 12:56:45 +0200 fs r276552 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 11:47:45 +0200 fs r276549 : #i105235#
2009-09-29 12:27:40 +0200 fs r276521 : #i105367#
2009-09-28 12:08:17 +0200 oj r276485 : #i105371# export version in manifest.xml as well
2009-09-28 12:07:02 +0200 oj r276484 : #i105371# export version in manifest.xml as well
2009-09-28 09:48:01 +0200 oj r276481 : #i105366# init drivers when not empty
2009-09-25 14:31:27 +0200 fs r276466 : CWS-TOOLING: rebase CWS dba32h to trunk@276429 (milestone: DEV300:m60)
2009-09-24 13:52:54 +0200 fs r276422 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document)
2009-09-24 11:42:03 +0200 fs r276413 : #i105234# proper zoom handling for the nav bar
2009-09-24 11:41:40 +0200 fs r276412 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double
2009-09-23 12:21:22 +0200 oj r276377 : remove dos lineends
2009-09-23 11:44:52 +0200 oj r276376 : #i105216# load config on demand
2009-09-23 11:44:19 +0200 oj r276375 : #i105216# load config on demand
2009-09-23 11:43:35 +0200 oj r276374 : #i105216# load config on demand
2009-09-21 09:13:03 +0200 oj r276307 : #i105158# use Thread support
2009-09-18 13:06:50 +0200 fs r276277 : #i105147#
2009-09-18 11:48:23 +0200 oj r276271 : #i105158# new method for thread safety
2009-09-18 10:42:56 +0200 fs r276266 : CWS-TOOLING: rebase CWS dba32h to trunk@276192 (milestone: DEV300:m59)
2009-09-18 08:30:03 +0200 oj r276263 : #i105016# load correct ldap so
2009-09-17 13:42:31 +0200 oj r276240 : change count of check boxes
2009-09-17 13:32:59 +0200 oj r276239 : revert false to true for currency
2009-09-17 09:14:46 +0200 oj r276220 : #i104901# add patch for every issue
2009-09-17 09:10:29 +0200 oj r276219 : #i104901# add patch for every issue
2009-09-11 13:47:49 +0200 oj r276060 : #i104901# fix for indentity
2009-09-11 12:14:14 +0200 fs r276056 : #i104594# allow to render controls without an SdrPageView
2009-09-11 11:49:31 +0200 fs r276055 : CWS-TOOLING: rebase CWS dba32h to trunk@276043 (milestone: DEV300:m58)
2009-09-10 08:41:40 +0200 oj r276021 : #i104911# export variable-set not for repeating sections
2009-10-14 18:48:09 +00:00
|
|
|
oFS.getForms() );
|
|
|
|
} //finish getIndexedForms
|
|
|
|
|
2003-01-27 15:27:53 +00:00
|
|
|
public static void insertForm ( XComponent aDoc, XNameContainer Forms,
|
2017-01-16 15:24:56 +01:00
|
|
|
String aName )
|
|
|
|
throws com.sun.star.uno.Exception
|
|
|
|
{
|
|
|
|
XInterface oControl = createControl(aDoc, "Form");
|
|
|
|
XForm oForm = UnoRuntime.queryInterface(XForm.class, oControl);
|
|
|
|
Forms.insertByName(aName,oForm);
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static XControlShape insertControlShape( XComponent oDoc, int height,
|
2017-01-16 15:24:56 +01:00
|
|
|
int width, int x, int y, String kind )
|
|
|
|
throws com.sun.star.uno.Exception
|
|
|
|
{
|
2003-01-27 15:27:53 +00:00
|
|
|
XControlShape aShape = createControlShape(oDoc,height,width,x,y,kind);
|
|
|
|
XDrawPage oDP = DrawTools.getDrawPage(oDoc,0);
|
|
|
|
DrawTools.getShapes(oDP).add(aShape);
|
|
|
|
return aShape;
|
|
|
|
}
|
|
|
|
|
2017-01-16 15:24:56 +01:00
|
|
|
public static XLoadable bindForm( XTextDocument aDoc )
|
|
|
|
throws com.sun.star.uno.Exception
|
|
|
|
{
|
2003-01-27 15:27:53 +00:00
|
|
|
XLoadable formLoader = null;
|
|
|
|
|
2017-01-16 15:24:56 +01:00
|
|
|
Object aForm = FormTools.getIndexedForms(WriterTools.getDrawPage(aDoc)).getByIndex(0);
|
|
|
|
XForm the_form = null;
|
|
|
|
the_form = (XForm) AnyConverter.toObject(new Type(XForm.class), aForm);
|
|
|
|
XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form);
|
|
|
|
formProps.setPropertyValue("DataSourceName","Bibliography");
|
|
|
|
formProps.setPropertyValue("Command","biblio");
|
|
|
|
formProps.setPropertyValue("CommandType",Integer.valueOf(com.sun.star.sdb.CommandType.TABLE));
|
|
|
|
formLoader = UnoRuntime.queryInterface(XLoadable.class, the_form);
|
2003-01-27 15:27:53 +00:00
|
|
|
|
|
|
|
return formLoader;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Binds <code>'Standard'</code> form of <code>aDoc</code> Writer document
|
|
|
|
* to the <code>tableName</code> table of <code>sourceName</code>
|
|
|
|
* Data Source.
|
|
|
|
* @param aDoc Writer document where DB controls are added.
|
|
|
|
* @param sourceName The name of DataSource in the <code>DatabaseContext</code>.
|
|
|
|
* @param tableName The name of the table to which controls are bound.
|
|
|
|
* @return <code>com.sun.star.form.component.DatabaseForm</code> service
|
|
|
|
* implementation which is the bound form inside the document.
|
|
|
|
*/
|
|
|
|
public static XLoadable bindForm( XTextDocument aDoc, String sourceName, String tableName )
|
|
|
|
throws com.sun.star.uno.Exception {
|
|
|
|
|
2003-02-04 07:51:36 +00:00
|
|
|
XForm the_form = (XForm) AnyConverter.toObject(new Type(XForm.class),
|
CWS-TOOLING: integrate CWS dba32h
2009-10-12 12:21:44 +0200 msc r276827 : remove warning for issue 102712 because the issue is fixed
2009-10-05 07:14:20 +0200 oj r276658 : #105585# add missing dependency for OOO_UI
2009-10-02 12:50:19 +0200 fs r276632 : #i105505#
If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized.
In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl
call attachResource. This ensures that the model is initialized completely, including firing the necessary
events.
2009-10-02 12:46:12 +0200 fs r276631 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document
2009-10-01 13:09:07 +0200 fs r276596 : do not rely on the name 'Standard' for the one and only form in a document
2009-10-01 12:35:56 +0200 fs r276589 : #i105509# don't rely on default form component names, use indexes
2009-10-01 11:19:18 +0200 fs r276584 : copying the fix for #i105082# into this CWS
2009-10-01 11:13:22 +0200 fs r276583 : improved logs
2009-10-01 11:10:44 +0200 fs r276581 : #i105505#
2009-10-01 08:07:57 +0200 fs r276575 : manual merge of trunk, to allow cwslocalize to run
2009-09-30 22:48:30 +0200 fs r276574 : removed that strange ONLOAD definition
2009-09-30 12:58:18 +0200 fs r276553 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 12:56:45 +0200 fs r276552 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
2009-09-30 11:47:45 +0200 fs r276549 : #i105235#
2009-09-29 12:27:40 +0200 fs r276521 : #i105367#
2009-09-28 12:08:17 +0200 oj r276485 : #i105371# export version in manifest.xml as well
2009-09-28 12:07:02 +0200 oj r276484 : #i105371# export version in manifest.xml as well
2009-09-28 09:48:01 +0200 oj r276481 : #i105366# init drivers when not empty
2009-09-25 14:31:27 +0200 fs r276466 : CWS-TOOLING: rebase CWS dba32h to trunk@276429 (milestone: DEV300:m60)
2009-09-24 13:52:54 +0200 fs r276422 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document)
2009-09-24 11:42:03 +0200 fs r276413 : #i105234# proper zoom handling for the nav bar
2009-09-24 11:41:40 +0200 fs r276412 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double
2009-09-23 12:21:22 +0200 oj r276377 : remove dos lineends
2009-09-23 11:44:52 +0200 oj r276376 : #i105216# load config on demand
2009-09-23 11:44:19 +0200 oj r276375 : #i105216# load config on demand
2009-09-23 11:43:35 +0200 oj r276374 : #i105216# load config on demand
2009-09-21 09:13:03 +0200 oj r276307 : #i105158# use Thread support
2009-09-18 13:06:50 +0200 fs r276277 : #i105147#
2009-09-18 11:48:23 +0200 oj r276271 : #i105158# new method for thread safety
2009-09-18 10:42:56 +0200 fs r276266 : CWS-TOOLING: rebase CWS dba32h to trunk@276192 (milestone: DEV300:m59)
2009-09-18 08:30:03 +0200 oj r276263 : #i105016# load correct ldap so
2009-09-17 13:42:31 +0200 oj r276240 : change count of check boxes
2009-09-17 13:32:59 +0200 oj r276239 : revert false to true for currency
2009-09-17 09:14:46 +0200 oj r276220 : #i104901# add patch for every issue
2009-09-17 09:10:29 +0200 oj r276219 : #i104901# add patch for every issue
2009-09-11 13:47:49 +0200 oj r276060 : #i104901# fix for indentity
2009-09-11 12:14:14 +0200 fs r276056 : #i104594# allow to render controls without an SdrPageView
2009-09-11 11:49:31 +0200 fs r276055 : CWS-TOOLING: rebase CWS dba32h to trunk@276043 (milestone: DEV300:m58)
2009-09-10 08:41:40 +0200 oj r276021 : #i104911# export variable-set not for repeating sections
2009-10-14 18:48:09 +00:00
|
|
|
FormTools.getIndexedForms(WriterTools.getDrawPage(aDoc)).getByIndex(0));
|
2012-06-27 16:08:28 +02:00
|
|
|
XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form);
|
2003-01-27 15:27:53 +00:00
|
|
|
formProps.setPropertyValue("DataSourceName",sourceName);
|
|
|
|
formProps.setPropertyValue("Command",tableName);
|
2014-08-12 15:09:06 +02:00
|
|
|
formProps.setPropertyValue("CommandType",Integer.valueOf(com.sun.star.sdb.CommandType.TABLE));
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2012-06-27 15:40:17 +02:00
|
|
|
return UnoRuntime.queryInterface(XLoadable.class, the_form);
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Binds the form with the name specified of <code>aDoc</code> Writer document
|
|
|
|
* to the <code>tableName</code> table of <code>sourceName</code>
|
|
|
|
* Data Source.
|
|
|
|
* @param aDoc Writer document where DB controls are added.
|
|
|
|
* @param formName The name of the form to be bound.
|
|
|
|
* @param sourceName The name of DataSource in the <code>DatabaseContext</code>.
|
|
|
|
* @param tableName The name of the table to which controls are bound.
|
|
|
|
* @return <code>com.sun.star.form.component.DatabaseForm</code> service
|
|
|
|
* implementation which is the bound form inside the document.
|
|
|
|
*/
|
|
|
|
public static XLoadable bindForm( XTextDocument aDoc, String formName, String sourceName,
|
|
|
|
String tableName) throws com.sun.star.uno.Exception {
|
|
|
|
|
2003-02-04 07:51:36 +00:00
|
|
|
XForm the_form = (XForm) AnyConverter.toObject(new Type(XForm.class),
|
|
|
|
FormTools.getForms(WriterTools.getDrawPage(aDoc)).getByName(formName));
|
2012-06-27 16:08:28 +02:00
|
|
|
XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form);
|
2003-01-27 15:27:53 +00:00
|
|
|
formProps.setPropertyValue("DataSourceName",sourceName);
|
|
|
|
formProps.setPropertyValue("Command",tableName);
|
2014-08-12 15:09:06 +02:00
|
|
|
formProps.setPropertyValue("CommandType",Integer.valueOf(com.sun.star.sdb.CommandType.TABLE));
|
2003-01-27 15:27:53 +00:00
|
|
|
|
2012-06-27 15:40:17 +02:00
|
|
|
return UnoRuntime.queryInterface(XLoadable.class, the_form);
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
|
|
|
|
2017-01-16 15:24:56 +01:00
|
|
|
public static void switchDesignOf(XMultiServiceFactory xMSF, XTextDocument aDoc)
|
|
|
|
throws com.sun.star.uno.Exception
|
|
|
|
{
|
2003-01-27 15:27:53 +00:00
|
|
|
com.sun.star.frame.XController aController = aDoc.getCurrentController();
|
|
|
|
com.sun.star.frame.XFrame aFrame = aController.getFrame();
|
2012-06-27 15:40:17 +02:00
|
|
|
com.sun.star.frame.XDispatchProvider aDispProv = UnoRuntime.queryInterface(com.sun.star.frame.XDispatchProvider.class,aFrame);
|
2003-01-27 15:27:53 +00:00
|
|
|
com.sun.star.util.URL aURL = new com.sun.star.util.URL();
|
|
|
|
aURL.Complete = ".uno:SwitchControlDesignMode";
|
|
|
|
|
|
|
|
Object instance = xMSF.createInstance("com.sun.star.util.URLTransformer");
|
|
|
|
com.sun.star.util.XURLTransformer atrans =
|
2012-06-27 15:40:17 +02:00
|
|
|
UnoRuntime.queryInterface(
|
|
|
|
com.sun.star.util.XURLTransformer.class,instance);
|
2003-01-27 15:27:53 +00:00
|
|
|
com.sun.star.util.URL[] aURLA = new com.sun.star.util.URL[1];
|
|
|
|
aURLA[0] = aURL;
|
|
|
|
atrans.parseStrict(aURLA);
|
|
|
|
aURL = aURLA[0];
|
|
|
|
|
2012-06-27 16:08:28 +02:00
|
|
|
com.sun.star.frame.XDispatch aDisp = aDispProv.queryDispatch(aURL, "",
|
2003-01-27 15:27:53 +00:00
|
|
|
com.sun.star.frame.FrameSearchFlag.SELF |
|
|
|
|
com.sun.star.frame.FrameSearchFlag.CHILDREN);
|
|
|
|
|
|
|
|
com.sun.star.beans.PropertyValue[] noArgs = new com.sun.star.beans.PropertyValue[0];
|
|
|
|
aDisp.dispatch(aURL, noArgs);
|
2017-01-16 13:38:46 +01:00
|
|
|
util.utils.waitForEventIdle(xMSF); // async dispatch
|
2003-01-27 15:27:53 +00:00
|
|
|
}
|
|
|
|
|
2009-05-07 06:54:56 +00:00
|
|
|
}
|