summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/text
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/com/sun/star/wizards/text')
-rw-r--r--wizards/com/sun/star/wizards/text/TextDocument.java102
-rw-r--r--wizards/com/sun/star/wizards/text/TextFieldHandler.java39
-rw-r--r--wizards/com/sun/star/wizards/text/TextFrameHandler.java5
-rw-r--r--wizards/com/sun/star/wizards/text/TextSectionHandler.java37
-rw-r--r--wizards/com/sun/star/wizards/text/TextStyleHandler.java15
-rw-r--r--wizards/com/sun/star/wizards/text/TextTableHandler.java29
-rw-r--r--wizards/com/sun/star/wizards/text/ViewHandler.java18
7 files changed, 122 insertions, 123 deletions
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.java b/wizards/com/sun/star/wizards/text/TextDocument.java
index 4fe2e9f0d710..6e873c049167 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.java
+++ b/wizards/com/sun/star/wizards/text/TextDocument.java
@@ -74,6 +74,7 @@ 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.Helper.DateUtils;
+import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.document.OfficeDocument;
public class TextDocument
@@ -111,7 +112,7 @@ public class TextDocument
xFrame = OfficeDocument.createNewFrame(xMSF, listener);
xTextDocument = loadAsPreview(_sPreviewURL, true);
- xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);
+ xComponent = UnoRuntime.queryInterface(XComponent.class, xTextDocument);
if (bShowStatusIndicator)
{
@@ -126,10 +127,10 @@ public class TextDocument
this.xMSF = xMSF;
XDesktop xDesktop = Desktop.getDesktop(xMSF);
- XFramesSupplier xFrameSupplier = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop);
+ XFramesSupplier xFrameSupplier = UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop);
xFrame = xFrameSupplier.getActiveFrame();
- xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel());
- xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ xComponent = UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel());
+ xTextDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent);
if (bShowStatusIndicator)
{
@@ -152,7 +153,7 @@ public class TextDocument
{
m_identifier = _identifier;
}
- };
+ }
// creates an instance of TextDocument containing a blank text document
public TextDocument(XMultiServiceFactory xMSF, ModuleIdentifier _moduleIdentifier, boolean bShowStatusIndicator)
@@ -162,19 +163,19 @@ public class TextDocument
try
{
// create the empty document, and set its module identifier
- xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,
+ xTextDocument = UnoRuntime.queryInterface(XTextDocument.class,
xMSF.createInstance("com.sun.star.text.TextDocument"));
- XLoadable xLoadable = (XLoadable) UnoRuntime.queryInterface(XLoadable.class, xTextDocument);
+ XLoadable xLoadable = UnoRuntime.queryInterface(XLoadable.class, xTextDocument);
xLoadable.initNew();
- XModule xModule = (XModule) UnoRuntime.queryInterface(XModule.class,
+ XModule xModule = UnoRuntime.queryInterface(XModule.class,
xTextDocument);
xModule.setIdentifier(_moduleIdentifier.getIdentifier());
// load the document into a blank frame
XDesktop xDesktop = Desktop.getDesktop(xMSF);
- XComponentLoader xLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xDesktop);
+ XComponentLoader xLoader = UnoRuntime.queryInterface(XComponentLoader.class, xDesktop);
PropertyValue[] loadArgs = new PropertyValue[]
{
new PropertyValue("Model", -1, xTextDocument, com.sun.star.beans.PropertyState.DIRECT_VALUE)
@@ -183,7 +184,7 @@ public class TextDocument
// remember some things for later usage
xFrame = xTextDocument.getCurrentController().getFrame();
- xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);
+ xComponent = UnoRuntime.queryInterface(XComponent.class, xTextDocument);
}
catch (Exception e)
{
@@ -203,21 +204,21 @@ public class TextDocument
{
this.xMSF = xMSF;
xFrame = _textDocument.getCurrentController().getFrame();
- xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, _textDocument);
- xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ xComponent = UnoRuntime.queryInterface(XComponent.class, _textDocument);
+ xTextDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent);
//PosSize = xFrame.getComponentWindow().getPosSize();
if (bshowStatusIndicator)
{
- XStatusIndicatorFactory xStatusIndicatorFactory = (XStatusIndicatorFactory) UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
+ XStatusIndicatorFactory xStatusIndicatorFactory = UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
xProgressBar = xStatusIndicatorFactory.createStatusIndicator();
- xProgressBar.start("", 100);
+ xProgressBar.start(PropertyNames.EMPTY_STRING, 100);
xProgressBar.setValue(5);
}
- xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
- xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
- xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+ xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
+ xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
- XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
m_xDocProps = xDocPropsSuppl.getDocumentProperties();
CharLocale = (Locale) Helper.getUnoStructValue((Object) xComponent, "CharLocale");
xText = xTextDocument.getText();
@@ -225,21 +226,21 @@ public class TextDocument
private void init()
{
- xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
- xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
- xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
- XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
+ xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+ XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
m_xDocProps = xDocPropsSuppl.getDocumentProperties();
CharLocale = (Locale) Helper.getUnoStructValue((Object) xComponent, "CharLocale");
- xStorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ xStorable = UnoRuntime.queryInterface(XStorable.class, xTextDocument);
xText = xTextDocument.getText();
}
private void showStatusIndicator()
{
- XStatusIndicatorFactory xStatusIndicatorFactory = (XStatusIndicatorFactory) UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
+ XStatusIndicatorFactory xStatusIndicatorFactory = UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
xProgressBar = xStatusIndicatorFactory.createStatusIndicator();
- xProgressBar.start("", 100);
+ xProgressBar.start(PropertyNames.EMPTY_STRING, 100);
xProgressBar.setValue(5);
}
@@ -248,7 +249,7 @@ public class TextDocument
PropertyValue loadValues[] = new PropertyValue[3];
// open document in the Preview mode
loadValues[0] = new PropertyValue();
- loadValues[0].Name = "ReadOnly";
+ loadValues[0].Name = PropertyNames.READ_ONLY;
loadValues[0].Value = Boolean.TRUE;
loadValues[1] = new PropertyValue();
loadValues[1].Name = "AsTemplate";
@@ -262,7 +263,7 @@ public class TextDocument
{
try
{
- XModifiable xModi = (XModifiable) UnoRuntime.queryInterface(XModifiable.class, xTextDocument);
+ XModifiable xModi = UnoRuntime.queryInterface(XModifiable.class, xTextDocument);
xModi.setModified(false);
}
catch (PropertyVetoException e1)
@@ -273,7 +274,7 @@ public class TextDocument
Object oDoc = OfficeDocument.load(xFrame, sDefaultTemplate, "_self", loadValues);
xTextDocument = (com.sun.star.text.XTextDocument) oDoc;
DocSize = getPageSize();
- xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
ViewHandler myViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
try
@@ -296,12 +297,12 @@ public class TextDocument
{
try
{
- XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier) com.sun.star.uno.UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
+ XStyleFamiliesSupplier xStyleFamiliesSupplier = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
com.sun.star.container.XNameAccess xNameAccess = null;
xNameAccess = xStyleFamiliesSupplier.getStyleFamilies();
com.sun.star.container.XNameContainer xPageStyleCollection = null;
- xPageStyleCollection = (com.sun.star.container.XNameContainer) UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles"));
- XStyle xPageStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName("First Page"));
+ xPageStyleCollection = UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles"));
+ XStyle xPageStyle = UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName("First Page"));
return (Size) Helper.getUnoPropertyValue(xPageStyle, "Size");
}
@@ -321,23 +322,22 @@ public class TextDocument
xFrame = OfficeDocument.createNewFrame(xMSF, listener);
Object oDoc = OfficeDocument.load(xFrame, URL, "_self", xArgs);
xTextDocument = (XTextDocument) oDoc;
- xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);
+ xComponent = UnoRuntime.queryInterface(XComponent.class, xTextDocument);
XWindow xWindow = xFrame.getComponentWindow();
- xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
- xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
- xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+ xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
+ xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
- XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
m_xDocProps = xDocPropsSuppl.getDocumentProperties();
CharLocale = (Locale) Helper.getUnoStructValue((Object) xComponent, "CharLocale");
}
public static XTextCursor createTextCursor(Object oCursorContainer)
{
- XSimpleText xText = (XSimpleText) UnoRuntime.queryInterface(XSimpleText.class, oCursorContainer);
- XTextCursor xTextCursor = xText.createTextCursor();
- return xTextCursor;
+ XSimpleText xText = UnoRuntime.queryInterface(XSimpleText.class, oCursorContainer);
+ return xText.createTextCursor();
}
// Todo: This method is unsecure because the last index is not necessarily the last section
@@ -356,7 +356,7 @@ public class TextDocument
xTextCursor.gotoStart(false);
com.sun.star.wizards.common.Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page");
xTextCursor.setString(ScaleString);
- XTextViewCursorSupplier xViewCursor = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
+ XTextViewCursorSupplier xViewCursor = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
XTextViewCursor xTextViewCursor = xViewCursor.getViewCursor();
xTextViewCursor.gotoStart(false);
int iFirstPos = xTextViewCursor.getPosition().X;
@@ -365,14 +365,14 @@ public class TextDocument
iScale = (iLastPos - iFirstPos) / iScaleLen;
xTextCursor.gotoStart(false);
xTextCursor.gotoEnd(true);
- xTextCursor.setString("");
+ xTextCursor.setString(PropertyNames.EMPTY_STRING);
unlockallControllers();
return iScale;
}
public void unlockallControllers()
{
- while (xTextDocument.hasControllersLocked() == true)
+ while (xTextDocument.hasControllersLocked())
{
xTextDocument.unlockControllers();
}
@@ -380,7 +380,7 @@ public class TextDocument
public void refresh()
{
- XRefreshable xRefreshable = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, xTextDocument);
+ XRefreshable xRefreshable = UnoRuntime.queryInterface(XRefreshable.class, xTextDocument);
xRefreshable.refresh();
}
@@ -396,10 +396,10 @@ public class TextDocument
try
{
Object uD = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.UserProfile/Data", false);
- XNameAccess xNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, uD);
+ XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, uD);
Object gn = xNA.getByName("givenname");
Object sn = xNA.getByName("sn");
- String fullname = (String) gn + " " + (String) sn;
+ String fullname = gn + PropertyNames.SPACE + sn;
Calendar cal = new GregorianCalendar();
int year = cal.get(Calendar.YEAR);
@@ -413,12 +413,12 @@ public class TextDocument
int ff = du.getFormat(NumberFormatIndex.DATE_SYS_DDMMYY);
String myDate = du.format(ff, currentDate);
- XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
XDocumentProperties xDocProps2 = xDocPropsSuppl.getDocumentProperties();
xDocProps2.setAuthor(fullname);
xDocProps2.setModifiedBy(fullname);
String description = xDocProps2.getDescription();
- description = description + " " + TemplateDescription;
+ description = description + PropertyNames.SPACE + TemplateDescription;
description = JavaTools.replaceSubString(description, WizardName, "<wizard_name>");
description = JavaTools.replaceSubString(description, myDate, "<current_date>");
xDocProps2.setDescription(description);
@@ -449,7 +449,7 @@ public class TextDocument
{
try
{
- XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextContent);
+ XTextContent xTextContent = UnoRuntime.queryInterface(XTextContent.class, oTextContent);
xText.removeTextContent(xTextContent);
return true;
}
@@ -469,11 +469,11 @@ public class TextDocument
*/
public static int getPageCount(Object model)
{
- XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, model);
+ XModel xModel = UnoRuntime.queryInterface(XModel.class, model);
XController xController = xModel.getCurrentController();
- XTextViewCursorSupplier xTextVCS = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
+ XTextViewCursorSupplier xTextVCS = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
XTextViewCursor xTextVC = xTextVCS.getViewCursor();
- XPageCursor xPC = (XPageCursor) UnoRuntime.queryInterface(XPageCursor.class, xTextVC);
+ XPageCursor xPC = UnoRuntime.queryInterface(XPageCursor.class, xTextVC);
xPC.jumpToLastPage();
return xPC.getPage();
}
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.java b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
index e25227516058..78de28073f37 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
@@ -65,12 +65,12 @@ public class TextFieldHandler
public TextFieldHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument)
{
this.xMSFDoc = xMSF;
- xTextFieldsSupplier = (XTextFieldsSupplier) UnoRuntime.queryInterface(XTextFieldsSupplier.class, xTextDocument);
+ xTextFieldsSupplier = UnoRuntime.queryInterface(XTextFieldsSupplier.class, xTextDocument);
}
public void refreshTextFields()
{
- XRefreshable xUp = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, xTextFieldsSupplier.getTextFields());
+ XRefreshable xUp = UnoRuntime.queryInterface(XRefreshable.class, xTextFieldsSupplier.getTextFields());
xUp.refresh();
}
@@ -82,21 +82,20 @@ public class TextFieldHandler
Object oTextField = Helper.getUnoPropertyValue(xTextRange, "TextField");
if (com.sun.star.uno.AnyConverter.isVoid(oTextField))
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
else
{
- XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
+ XDependentTextField xDependent = UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
XPropertySet xMaster = xDependent.getTextFieldMaster();
- String UserFieldContent = (String) xMaster.getPropertyValue("Content");
- return UserFieldContent;
+ return (String) xMaster.getPropertyValue("Content");
}
}
catch (com.sun.star.uno.Exception exception)
{
exception.printStackTrace(System.out);
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public void insertUserField(XTextCursor xTextCursor, String FieldName, String FieldTitle)
@@ -104,12 +103,12 @@ public class TextFieldHandler
try
{
XInterface xField = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextField.User");
- XDependentTextField xDepField = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, xField);
- XTextContent xFieldContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xField);
+ XDependentTextField xDepField = UnoRuntime.queryInterface(XDependentTextField.class, xField);
+ XTextContent xFieldContent = UnoRuntime.queryInterface(XTextContent.class, xField);
if (xTextFieldsSupplier.getTextFieldMasters().hasByName("com.sun.star.text.FieldMaster.User." + FieldName))
{
Object oMaster = xTextFieldsSupplier.getTextFieldMasters().getByName("com.sun.star.text.FieldMaster.User." + FieldName);
- XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, oMaster);
+ XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, oMaster);
xComponent.dispose();
}
XPropertySet xPSet = createUserField(FieldName, FieldTitle);
@@ -138,7 +137,7 @@ public class TextFieldHandler
public XPropertySet createUserField(String FieldName, String FieldTitle) throws com.sun.star.uno.Exception
{
Object oMaster = xMSFDoc.createInstance("com.sun.star.text.FieldMaster.User");
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oMaster);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oMaster);
xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, FieldName);
xPSet.setPropertyValue("Content", FieldTitle);
@@ -160,7 +159,7 @@ public class TextFieldHandler
while (xEnum.hasMoreElements())
{
Object oTextField = xEnum.nextElement();
- XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
+ XDependentTextField xDependent = UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
XPropertySet xPropertySet = xDependent.getTextFieldMaster();
if (xPropertySet.getPropertySetInfo().hasPropertyByName(_PropertyName))
{
@@ -235,16 +234,16 @@ public class TextFieldHandler
while (xEnum.hasMoreElements())
{
Object oTextField = xEnum.nextElement();
- XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
+ XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
if (xSI.supportsService("com.sun.star.text.TextField.ExtendedUser"))
{
- XUpdatable xUp = (XUpdatable) UnoRuntime.queryInterface(XUpdatable.class, oTextField);
+ XUpdatable xUp = UnoRuntime.queryInterface(XUpdatable.class, oTextField);
xUp.update();
}
if (xSI.supportsService("com.sun.star.text.TextField.User"))
{
- XUpdatable xUp = (XUpdatable) UnoRuntime.queryInterface(XUpdatable.class, oTextField);
+ XUpdatable xUp = UnoRuntime.queryInterface(XUpdatable.class, oTextField);
xUp.update();
}
}
@@ -270,11 +269,11 @@ public class TextFieldHandler
while (xEnum.hasMoreElements())
{
Object oTextField = xEnum.nextElement();
- XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
+ XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
if (xSI.supportsService("com.sun.star.text.TextField.DateTime"))
{
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTextField);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oTextField);
xPSet.setPropertyValue("IsFixed", Boolean.FALSE);
xPSet.setPropertyValue("DateTimeValue", dt);
}
@@ -294,11 +293,11 @@ public class TextFieldHandler
while (xEnum.hasMoreElements())
{
Object oTextField = xEnum.nextElement();
- XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
+ XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
if (xSI.supportsService("com.sun.star.text.TextField.DateTime"))
{
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTextField);
- xPSet.setPropertyValue("IsFixed", new Boolean(_bSetFixed));
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oTextField);
+ xPSet.setPropertyValue("IsFixed", Boolean.valueOf(_bSetFixed));
}
}
}
diff --git a/wizards/com/sun/star/wizards/text/TextFrameHandler.java b/wizards/com/sun/star/wizards/text/TextFrameHandler.java
index 562444a1ad84..babaf21120e3 100644
--- a/wizards/com/sun/star/wizards/text/TextFrameHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextFrameHandler.java
@@ -39,12 +39,11 @@ public class TextFrameHandler
public static XTextFrame getFrameByName(String sFrameName, XTextDocument xTD) throws NoSuchElementException, WrappedTargetException
{
- XTextFramesSupplier xFrameSupplier = (XTextFramesSupplier) UnoRuntime.queryInterface(XTextFramesSupplier.class, xTD);
+ XTextFramesSupplier xFrameSupplier = UnoRuntime.queryInterface(XTextFramesSupplier.class, xTD);
if (xFrameSupplier.getTextFrames().hasByName(sFrameName))
{
Object oTextFrame = xFrameSupplier.getTextFrames().getByName(sFrameName);
- XTextFrame xTextFrame = (XTextFrame) UnoRuntime.queryInterface(XTextFrame.class, oTextFrame);
- return xTextFrame;
+ return UnoRuntime.queryInterface(XTextFrame.class, oTextFrame);
}
return null;
}
diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.java b/wizards/com/sun/star/wizards/text/TextSectionHandler.java
index 42fd75879c3c..b20d016f8ee8 100644
--- a/wizards/com/sun/star/wizards/text/TextSectionHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.java
@@ -43,6 +43,7 @@ import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.PropertyNames;
public class TextSectionHandler
{
@@ -58,7 +59,7 @@ public class TextSectionHandler
this.xMSFDoc = xMSF;
this.xTextDocument = xTextDocument;
xText = xTextDocument.getText();
- xTextSectionsSupplier = (XTextSectionsSupplier) UnoRuntime.queryInterface(XTextSectionsSupplier.class, xTextDocument);
+ xTextSectionsSupplier = UnoRuntime.queryInterface(XTextSectionsSupplier.class, xTextDocument);
}
public void removeTextSectionbyName(String SectionName)
@@ -66,7 +67,7 @@ public class TextSectionHandler
try
{
XNameAccess xAllTextSections = xTextSectionsSupplier.getTextSections();
- if (xAllTextSections.hasByName(SectionName) == true)
+ if (xAllTextSections.hasByName(SectionName))
{
Object oTextSection = xTextSectionsSupplier.getTextSections().getByName(SectionName);
removeTextSection(oTextSection);
@@ -88,7 +89,7 @@ public class TextSectionHandler
{
try
{
- XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
+ XIndexAccess xAllTextSections = UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
Object oTextSection = xAllTextSections.getByIndex(xAllTextSections.getCount() - 1);
removeTextSection(oTextSection);
}
@@ -102,7 +103,7 @@ public class TextSectionHandler
{
try
{
- XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, _oTextSection);
+ XTextContent xTextContentTextSection = UnoRuntime.queryInterface(XTextContent.class, _oTextSection);
xText.removeTextContent(xTextContentTextSection);
}
catch (Exception exception)
@@ -115,12 +116,12 @@ public class TextSectionHandler
{
try
{
- XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
+ XIndexAccess xAllTextSections = UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
int TextSectionCount = xAllTextSections.getCount();
for (int i = TextSectionCount - 1; i >= 0; i--)
{
- XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i));
- XPropertySet xTextSectionPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection);
+ XTextContent xTextContentTextSection = UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i));
+ XPropertySet xTextSectionPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection);
boolean bRemoveTextSection = (!AnyConverter.toBoolean(xTextSectionPropertySet.getPropertyValue("IsVisible")));
if (bRemoveTextSection)
{
@@ -138,12 +139,12 @@ public class TextSectionHandler
{
try
{
- XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
+ XIndexAccess xAllTextSections = UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
int TextSectionCount = xAllTextSections.getCount();
for (int i = TextSectionCount - 1; i >= 0; i--)
{
- XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i));
- XPropertySet xTextSectionPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection);
+ XTextContent xTextContentTextSection = UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i));
+ XPropertySet xTextSectionPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection);
xText.removeTextContent(xTextContentTextSection);
}
}
@@ -158,10 +159,10 @@ public class TextSectionHandler
try
{
Object oTextSection;
- XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
+ XIndexAccess xAllTextSections = UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
int iSectionCount = xAllTextSections.getCount();
SectionFileLink oSectionLink = new SectionFileLink();
- oSectionLink.FileURL = "";
+ oSectionLink.FileURL = PropertyNames.EMPTY_STRING;
for (int i = 0; i < iSectionCount; i++)
{
oTextSection = xAllTextSections.getByIndex(i);
@@ -170,7 +171,7 @@ public class TextSectionHandler
"FileLink", "LinkRegion"
}, new Object[]
{
- oSectionLink, ""
+ oSectionLink, PropertyNames.EMPTY_STRING
});
}
}
@@ -183,13 +184,13 @@ public class TextSectionHandler
public void breakLinkOfTextSection(Object oTextSection)
{
SectionFileLink oSectionLink = new SectionFileLink();
- oSectionLink.FileURL = "";
+ oSectionLink.FileURL = PropertyNames.EMPTY_STRING;
Helper.setUnoPropertyValues(oTextSection, new String[]
{
"FileLink", "LinkRegion"
}, new Object[]
{
- oSectionLink, ""
+ oSectionLink, PropertyNames.EMPTY_STRING
});
}
@@ -217,7 +218,7 @@ public class TextSectionHandler
{
oSectionLink, SectionName
});
- XNamed xSectionName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextSection);
+ XNamed xSectionName = UnoRuntime.queryInterface(XNamed.class, oTextSection);
String NewSectionName = xSectionName.getName();
if (NewSectionName.compareTo(SectionName) != 0)
{
@@ -251,14 +252,14 @@ public class TextSectionHandler
try
{
Object xTextSection;
- if (xTextSectionsSupplier.getTextSections().hasByName(sectionName) == true)
+ if (xTextSectionsSupplier.getTextSections().hasByName(sectionName))
{
xTextSection = xTextSectionsSupplier.getTextSections().getByName(sectionName);
}
else
{
xTextSection = xMSFDoc.createInstance("com.sun.star.text.TextSection");
- XTextContent xTextContentSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextSection);
+ XTextContent xTextContentSection = UnoRuntime.queryInterface(XTextContent.class, xTextSection);
position.getText().insertTextContent(position, xTextContentSection, false);
}
linkSectiontoTemplate(xTextSection, templateName, sectionName);
diff --git a/wizards/com/sun/star/wizards/text/TextStyleHandler.java b/wizards/com/sun/star/wizards/text/TextStyleHandler.java
index e6c952e65785..e9f6cd737e7d 100644
--- a/wizards/com/sun/star/wizards/text/TextStyleHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextStyleHandler.java
@@ -36,6 +36,7 @@ import com.sun.star.text.XTextDocument;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.PropertyNames;
public class TextStyleHandler
{
@@ -49,21 +50,21 @@ public class TextStyleHandler
{
this.xMSFDoc = xMSF;
this.xTextDocument = xTextDocument;
- xStyleFamiliesSupplier = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
+ xStyleFamiliesSupplier = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
}
public void loadStyleTemplates(String sTemplateUrl, String OptionString)
{
try
{
- XStyleLoader xStyleLoader = (XStyleLoader) UnoRuntime.queryInterface(XStyleLoader.class, xStyleFamiliesSupplier.getStyleFamilies());
+ XStyleLoader xStyleLoader = UnoRuntime.queryInterface(XStyleLoader.class, xStyleFamiliesSupplier.getStyleFamilies());
com.sun.star.beans.PropertyValue[] StyleOptions = xStyleLoader.getStyleLoaderOptions();
- String CurOptionName = "";
+ String CurOptionName = PropertyNames.EMPTY_STRING;
int PropCount = StyleOptions.length;
for (int i = 0; i < PropCount; i++)
{
CurOptionName = StyleOptions[i].Name;
- StyleOptions[i].Value = new Boolean((CurOptionName.compareTo(OptionString) == 0) || (CurOptionName.compareTo("OverwriteStyles") == 0));
+ StyleOptions[i].Value = Boolean.valueOf((CurOptionName.compareTo(OptionString) == 0) || (CurOptionName.compareTo("OverwriteStyles") == 0));
}
xStyleLoader.loadStylesFromURL(sTemplateUrl, StyleOptions);
}
@@ -79,10 +80,10 @@ public class TextStyleHandler
{
XPropertySet xPropertySet = null;
Object oStyleFamily = xStyleFamiliesSupplier.getStyleFamilies().getByName(sStyleFamily);
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oStyleFamily);
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oStyleFamily);
if (xNameAccess.hasByName(sStyleName))
{
- xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xNameAccess.getByName(sStyleName));
+ xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xNameAccess.getByName(sStyleName));
}
return xPropertySet;
}
@@ -97,7 +98,7 @@ public class TextStyleHandler
{
try
{
- _xPropPageStyle.setPropertyValue("IsLandscape", new Boolean(_bIsLandscape));
+ _xPropPageStyle.setPropertyValue("IsLandscape", Boolean.valueOf(_bIsLandscape));
Size aPageSize = (Size) AnyConverter.toObject(Size.class, _xPropPageStyle.getPropertyValue("Size"));
int nPageWidth = aPageSize.Width;
int nPageHeight = aPageSize.Height;
diff --git a/wizards/com/sun/star/wizards/text/TextTableHandler.java b/wizards/com/sun/star/wizards/text/TextTableHandler.java
index d3646a7cfa37..ab7e46a62c0a 100644
--- a/wizards/com/sun/star/wizards/text/TextTableHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextTableHandler.java
@@ -69,9 +69,9 @@ public class TextTableHandler
this.xMSFDoc = xMSF;
this.xTextDocument = xTextDocument;
xText = xTextDocument.getText();
- xTextTablesSupplier = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, xTextDocument);
- xSimpleText = (XSimpleText) UnoRuntime.queryInterface(XSimpleText.class, xTextDocument.getText());
- XNumberFormatsSupplier xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+ xTextTablesSupplier = UnoRuntime.queryInterface(XTextTablesSupplier.class, xTextDocument);
+ xSimpleText = UnoRuntime.queryInterface(XSimpleText.class, xTextDocument.getText());
+ XNumberFormatsSupplier xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
aCharLocale = (Locale) Helper.getUnoStructValue((Object) xTextDocument, "CharLocale");
oNumberFormatter = new NumberFormatter(xNumberFormatsSupplier, aCharLocale);
}
@@ -95,7 +95,7 @@ public class TextTableHandler
if (xAllTextTables.hasByName(_sTableName))
{
Object oTable = xAllTextTables.getByName(_sTableName);
- xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
+ xTextTable = UnoRuntime.queryInterface(XTextTable.class, oTable);
}
}
catch (Exception exception)
@@ -109,11 +109,10 @@ public class TextTableHandler
{
try
{
- XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
+ XIndexAccess xAllTextTables = UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
int MaxIndex = xAllTextTables.getCount() - 1;
Object oTable = xAllTextTables.getByIndex(MaxIndex);
- XTextTable xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
- return xTextTable;
+ return UnoRuntime.queryInterface(XTextTable.class, oTable);
}
catch (Exception exception)
{
@@ -127,7 +126,7 @@ public class TextTableHandler
try
{
com.sun.star.uno.XInterface xTextTable = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextTable");
- XTextContent xTextContentTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextTable);
+ XTextContent xTextContentTable = UnoRuntime.queryInterface(XTextContent.class, xTextTable);
if (xTextCursor == null)
{
xTextCursor = xTextDocument.getText().createTextCursor();
@@ -145,7 +144,7 @@ public class TextTableHandler
{
try
{
- XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
+ XIndexAccess xAllTextTables = UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
int TextTableCount = xAllTextTables.getCount();
for (int i = TextTableCount - 1; i >= 0; i--)
{
@@ -162,7 +161,7 @@ public class TextTableHandler
{
try
{
- XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
+ XIndexAccess xAllTextTables = UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
Object oTextTable = xAllTextTables.getByIndex(xAllTextTables.getCount() - 1);
removeTextTable(oTextTable);
}
@@ -176,7 +175,7 @@ public class TextTableHandler
{
try
{
- XTextContent xTextContentTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTable);
+ XTextContent xTextContentTable = UnoRuntime.queryInterface(XTextContent.class, oTextTable);
xTextDocument.getText().removeTextContent(xTextContentTable);
}
catch (Exception exception)
@@ -190,7 +189,7 @@ public class TextTableHandler
try
{
XNameAccess xAllTextTables = xTextTablesSupplier.getTextTables();
- if (xAllTextTables.hasByName(TableName) == true)
+ if (xAllTextTables.hasByName(TableName))
{
removeTextTable(xAllTextTables.getByName(TableName));
}
@@ -209,7 +208,7 @@ public class TextTableHandler
if (xTextTableNames.hasByName(OldTableName))
{
Object oTextTable = xTextTableNames.getByName(OldTableName);
- XNamed xTextTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextTable);
+ XNamed xTextTableName = UnoRuntime.queryInterface(XNamed.class, oTextTable);
xTextTableName.setName(NewTableName);
}
}
@@ -236,10 +235,10 @@ public class TextTableHandler
{
XFrame xFrame = this.xTextDocument.getCurrentController().getFrame();
int ColCount = xTextTable.getColumns().getCount();
- XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable);
+ XCellRange xCellRange = UnoRuntime.queryInterface(XCellRange.class, xTextTable);
XCellRange xLocCellRange = xCellRange.getCellRangeByPosition(0, 0, ColCount - 1, 1);
short iHoriOrient = AnyConverter.toShort(Helper.getUnoPropertyValue(xTextTable, "HoriOrient"));
- XSelectionSupplier xSelection = (XSelectionSupplier) UnoRuntime.queryInterface(XSelectionSupplier.class, xTextDocument.getCurrentController());
+ XSelectionSupplier xSelection = UnoRuntime.queryInterface(XSelectionSupplier.class, xTextDocument.getCurrentController());
xSelection.select(xLocCellRange);
Desktop.dispatchURL(_xMSF, ".Uno:DistributeColumns", xFrame);
Desktop.dispatchURL(_xMSF, ".Uno:SetOptimalColumnWidth", xFrame);
diff --git a/wizards/com/sun/star/wizards/text/ViewHandler.java b/wizards/com/sun/star/wizards/text/ViewHandler.java
index e29ad10cfbb1..d234f26e2bfe 100644
--- a/wizards/com/sun/star/wizards/text/ViewHandler.java
+++ b/wizards/com/sun/star/wizards/text/ViewHandler.java
@@ -59,26 +59,26 @@ public class ViewHandler
{
this.xMSFDoc = xMSF;
this.xTextDocument = xTextDocument;
- xTextViewCursorSupplier = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
- xViewSettingsSupplier = (XViewSettingsSupplier) UnoRuntime.queryInterface(XViewSettingsSupplier.class, xTextDocument.getCurrentController());
- xStyleFamiliesSupplier = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
+ xTextViewCursorSupplier = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
+ xViewSettingsSupplier = UnoRuntime.queryInterface(XViewSettingsSupplier.class, xTextDocument.getCurrentController());
+ xStyleFamiliesSupplier = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
}
public void selectFirstPage(TextTableHandler oTextTableHandler)
{
try
{
- XPageCursor xPageCursor = (XPageCursor) UnoRuntime.queryInterface(XPageCursor.class, xTextViewCursorSupplier.getViewCursor());
- XTextCursor xViewTextCursor = (XTextCursor) UnoRuntime.queryInterface(XTextCursor.class, xPageCursor);
+ XPageCursor xPageCursor = UnoRuntime.queryInterface(XPageCursor.class, xTextViewCursorSupplier.getViewCursor());
+ XTextCursor xViewTextCursor = UnoRuntime.queryInterface(XTextCursor.class, xPageCursor);
xPageCursor.jumpToFirstPage();
xPageCursor.jumpToStartOfPage();
Helper.setUnoPropertyValue(xPageCursor, "PageDescName", "First Page");
Object oPageStyles = xStyleFamiliesSupplier.getStyleFamilies().getByName("PageStyles");
- XNameAccess xName = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oPageStyles);
+ XNameAccess xName = UnoRuntime.queryInterface(XNameAccess.class, oPageStyles);
Object oPageStyle = xName.getByName("First Page");
- XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
- XTextContent xTextTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xAllTextTables.getByIndex(0));
- XTextRange xRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xTextTable.getAnchor().getText());
+ XIndexAccess xAllTextTables = UnoRuntime.queryInterface(XIndexAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
+ XTextContent xTextTable = UnoRuntime.queryInterface(XTextContent.class, xAllTextTables.getByIndex(0));
+ XTextRange xRange = UnoRuntime.queryInterface(XTextRange.class, xTextTable.getAnchor().getText());
xViewTextCursor.gotoRange(xRange, false);
// if (xPageCursor.getPage() == (short) 1) {
// Helper.setUnoPropertyValue(xTextTable, "PageDescName", "First Page");