summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/text
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-09-22 12:23:28 +0200
committerNoel Grandin <noel@peralex.com>2014-09-22 14:28:35 +0200
commit04f43cd6a0159da29a0df4bf8e27387156f321e5 (patch)
treeaa323aaab3f91503006113217187f67fc523fe14 /wizards/com/sun/star/wizards/text
parent3c6da8e49a96513eda73656f3f6212f980a74b51 (diff)
84059 - form wizard : files required could not be found
I've essentially unwound most the Java changes I made te wizards module in the last few months. I will revisit my changes at a later date and make them more carefully :-) Change-Id: I9221a825dc8de6edc96d6db07072aefcd1a37107
Diffstat (limited to 'wizards/com/sun/star/wizards/text')
-rw-r--r--wizards/com/sun/star/wizards/text/TextDocument.java184
-rw-r--r--wizards/com/sun/star/wizards/text/TextFieldHandler.java40
-rw-r--r--wizards/com/sun/star/wizards/text/TextSectionHandler.java26
-rw-r--r--wizards/com/sun/star/wizards/text/TextStyleHandler.java2
-rw-r--r--wizards/com/sun/star/wizards/text/TextTableHandler.java40
-rw-r--r--wizards/com/sun/star/wizards/text/ViewHandler.java3
6 files changed, 252 insertions, 43 deletions
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.java b/wizards/com/sun/star/wizards/text/TextDocument.java
index dcb845918676..5ef82e080b1e 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.java
+++ b/wizards/com/sun/star/wizards/text/TextDocument.java
@@ -17,34 +17,54 @@
*/
package com.sun.star.wizards.text;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.document.XDocumentProperties;
import com.sun.star.document.XDocumentPropertiesSupplier;
+import com.sun.star.frame.XController;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XDesktop;
import com.sun.star.frame.XFramesSupplier;
import com.sun.star.frame.XLoadable;
+import com.sun.star.frame.XModel;
import com.sun.star.frame.XModule;
import com.sun.star.frame.XTerminateListener;
import com.sun.star.frame.XStorable;
+import com.sun.star.i18n.NumberFormatIndex;
import com.sun.star.awt.Size;
import com.sun.star.awt.XWindow;
import com.sun.star.awt.XWindowPeer;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.style.XStyle;
import com.sun.star.style.XStyleFamiliesSupplier;
import com.sun.star.task.XStatusIndicatorFactory;
+import com.sun.star.text.XPageCursor;
import com.sun.star.text.XSimpleText;
import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
import com.sun.star.text.XTextCursor;
import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextViewCursor;
+import com.sun.star.text.XTextViewCursorSupplier;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.DateTime;
import com.sun.star.util.XModifiable;
import com.sun.star.util.XNumberFormatsSupplier;
+import com.sun.star.util.XRefreshable;
+import com.sun.star.wizards.common.Configuration;
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;
@@ -53,21 +73,21 @@ public class TextDocument
public XComponent xComponent;
public com.sun.star.text.XTextDocument xTextDocument;
-
- private com.sun.star.document.XDocumentProperties m_xDocProps;
+ public com.sun.star.util.XNumberFormats NumberFormats;
+ public com.sun.star.document.XDocumentProperties m_xDocProps;
public com.sun.star.task.XStatusIndicator xProgressBar;
public com.sun.star.frame.XFrame xFrame;
public XText xText;
public XMultiServiceFactory xMSFDoc;
public XMultiServiceFactory xMSF;
-
+ public com.sun.star.util.XNumberFormatsSupplier xNumberFormatsSupplier;
public com.sun.star.awt.XWindowPeer xWindowPeer;
-
-
-
-
-
-
+ public int PageWidth;
+ public int ScaleWidth;
+ public Size DocSize;
+ public com.sun.star.awt.Rectangle PosSize;
+ public com.sun.star.lang.Locale CharLocale;
+ public XStorable xStorable;
// creates an instance of TextDocument and creates a named frame. No document is actually loaded into this frame.
public TextDocument(XMultiServiceFactory xMSF, XTerminateListener listener, String FrameName)
@@ -93,7 +113,7 @@ public class TextDocument
}
// creates an instance of TextDocument from the desktop's current frame
- public TextDocument(XMultiServiceFactory xMSF, boolean bShowStatusIndicator)
+ public TextDocument(XMultiServiceFactory xMSF, boolean bShowStatusIndicator, XTerminateListener listener)
{
this.xMSF = xMSF;
@@ -115,7 +135,7 @@ public class TextDocument
private String m_identifier;
- private final String getIdentifier()
+ protected final String getIdentifier()
{
return m_identifier;
}
@@ -177,6 +197,7 @@ public class TextDocument
xFrame = _textDocument.getCurrentController().getFrame();
xComponent = UnoRuntime.queryInterface(XComponent.class, _textDocument);
xTextDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ //PosSize = xFrame.getComponentWindow().getPosSize();
if (bshowStatusIndicator)
{
XStatusIndicatorFactory xStatusIndicatorFactory = UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
@@ -186,10 +207,11 @@ public class TextDocument
}
xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
- UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+ xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
m_xDocProps = xDocPropsSuppl.getDocumentProperties();
+ CharLocale = (Locale) Helper.getUnoStructValue(xComponent, "CharLocale");
xText = xTextDocument.getText();
}
@@ -197,10 +219,11 @@ public class TextDocument
{
xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
- UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+ xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
m_xDocProps = xDocPropsSuppl.getDocumentProperties();
- UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ CharLocale = (Locale) Helper.getUnoStructValue(xComponent, "CharLocale");
+ xStorable = UnoRuntime.queryInterface(XStorable.class, xTextDocument);
xText = xTextDocument.getText();
}
@@ -212,7 +235,7 @@ public class TextDocument
xProgressBar.setValue(5);
}
- private XTextDocument loadAsPreview(String sDefaultTemplate, boolean asTemplate)
+ public XTextDocument loadAsPreview(String sDefaultTemplate, boolean asTemplate)
{
PropertyValue loadValues[] = new PropertyValue[3];
// open document in the Preview mode
@@ -241,12 +264,13 @@ public class TextDocument
}
Object oDoc = OfficeDocument.load(xFrame, sDefaultTemplate, "_self", loadValues);
xTextDocument = (com.sun.star.text.XTextDocument) oDoc;
+ DocSize = getPageSize();
xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
- ViewHandler myViewHandler = new ViewHandler(xTextDocument);
+ ViewHandler myViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
try
{
- myViewHandler.setViewSetting("ZoomType", Short.valueOf(com.sun.star.view.DocumentZoomType.ENTIRE_PAGE));
+ myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.ENTIRE_PAGE));
}
catch (Exception e)
{
@@ -294,10 +318,11 @@ public class TextDocument
xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xWindow);
xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
- UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+ xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
m_xDocProps = xDocPropsSuppl.getDocumentProperties();
+ CharLocale = (Locale) Helper.getUnoStructValue(xComponent, "CharLocale");
}
public static XTextCursor createTextCursor(Object oCursorContainer)
@@ -312,7 +337,29 @@ public class TextDocument
// to make it really safe you must acquire the Tablenames before the insertion and after the insertion of the new Table. By comparing the
// two sequences of tablenames you can find out the tablename of the last inserted Table
-
+ // Todo: This method is unsecure because the last index is not necessarily the last section
+ public int getCharWidth(String ScaleString)
+ {
+ int iScale = 200;
+ xTextDocument.lockControllers();
+ int iScaleLen = ScaleString.length();
+ com.sun.star.text.XTextCursor xTextCursor = createTextCursor(xTextDocument.getText());
+ xTextCursor.gotoStart(false);
+ com.sun.star.wizards.common.Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page");
+ xTextCursor.setString(ScaleString);
+ XTextViewCursorSupplier xViewCursor = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
+ XTextViewCursor xTextViewCursor = xViewCursor.getViewCursor();
+ xTextViewCursor.gotoStart(false);
+ int iFirstPos = xTextViewCursor.getPosition().X;
+ xTextViewCursor.gotoEnd(false);
+ int iLastPos = xTextViewCursor.getPosition().X;
+ iScale = (iLastPos - iFirstPos) / iScaleLen;
+ xTextCursor.gotoStart(false);
+ xTextCursor.gotoEnd(true);
+ xTextCursor.setString(PropertyNames.EMPTY_STRING);
+ unlockallControllers();
+ return iScale;
+ }
public void unlockallControllers()
{
@@ -322,13 +369,104 @@ public class TextDocument
}
}
+ public void refresh()
+ {
+ XRefreshable xRefreshable = UnoRuntime.queryInterface(XRefreshable.class, xTextDocument);
+ xRefreshable.refresh();
+ }
+ /**
+ * This method sets the Author of a Wizard-generated template correctly
+ * and adds a explanatory sentence to the template description.
+ * @param WizardName The name of the Wizard.
+ * @param TemplateDescription The old Description which is being appended with another sentence.
+ */
+ public void setWizardTemplateDocInfo(String WizardName, String TemplateDescription)
+ {
+ try
+ {
+ Object uD = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.UserProfile/Data", false);
+ XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, uD);
+ Object gn = xNA.getByName("givenname");
+ Object sn = xNA.getByName("sn");
+ String fullname = gn + PropertyNames.SPACE + sn;
+
+ Calendar cal = new GregorianCalendar();
+ int year = cal.get(Calendar.YEAR);
+ int month = cal.get(Calendar.MONTH);
+ int day = cal.get(Calendar.DAY_OF_MONTH);
+ DateTime currentDate = new DateTime();
+ currentDate.Day = (short) day;
+ currentDate.Month = (short) month;
+ currentDate.Year = (short) year;
+ DateUtils du = new DateUtils(xMSF, this.xTextDocument);
+ int ff = du.getFormat(NumberFormatIndex.DATE_SYS_DDMMYY);
+ String myDate = du.format(ff, currentDate);
+
+ XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentProperties xDocProps2 = xDocPropsSuppl.getDocumentProperties();
+ xDocProps2.setAuthor(fullname);
+ xDocProps2.setModifiedBy(fullname);
+ String description = xDocProps2.getDescription();
+ description = description + PropertyNames.SPACE + TemplateDescription;
+ description = JavaTools.replaceSubString(description, WizardName, "<wizard_name>");
+ description = JavaTools.replaceSubString(description, myDate, "<current_date>");
+ xDocProps2.setDescription(description);
+ }
+ catch (NoSuchElementException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (WrappedTargetException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ /**
+ * removes an arbitrary Object which supports the 'XTextContent' interface
+ * @param oTextContent
+ * @return
+ */
+ public boolean removeTextContent(Object oTextContent)
+ {
+ try
+ {
+ XTextContent xTextContent = UnoRuntime.queryInterface(XTextContent.class, oTextContent);
+ xText.removeTextContent(xTextContent);
+ return true;
+ }
+ catch (NoSuchElementException e)
+ {
+ e.printStackTrace(System.err);
+ return false;
+ }
+ }
-
-
-
-
+ /**
+ * Apparently there is no other way to get the
+ * page count of a text document other than using a cursor and
+ * making it jump to the last page...
+ * @param model the document model.
+ * @return the page count of the document.
+ */
+ public static int getPageCount(Object model)
+ {
+ XModel xModel = UnoRuntime.queryInterface(XModel.class, model);
+ XController xController = xModel.getCurrentController();
+ XTextViewCursorSupplier xTextVCS = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
+ XTextViewCursor xTextVC = xTextVCS.getViewCursor();
+ XPageCursor xPC = UnoRuntime.queryInterface(XPageCursor.class, xTextVC);
+ xPC.jumpToLastPage();
+ return xPC.getPage();
+ }
/* Possible Values for "OptionString" are: "LoadCellStyles", "LoadTextStyles", "LoadFrameStyles",
"LoadPageStyles", "LoadNumberingStyles", "OverwriteStyles" */
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.java b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
index ab6d018f86bc..66c818efc3ef 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
@@ -45,11 +45,13 @@ import com.sun.star.wizards.common.PropertyNames;
public class TextFieldHandler
{
- private XTextFieldsSupplier xTextFieldsSupplier;
+ public XTextFieldsSupplier xTextFieldsSupplier;
private XMultiServiceFactory xMSFDoc;
/**
* Creates a new instance of TextFieldHandler
+ * @param xMSF
+ * @param xTextDocument
*/
public TextFieldHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument)
{
@@ -57,7 +59,7 @@ public class TextFieldHandler
xTextFieldsSupplier = UnoRuntime.queryInterface(XTextFieldsSupplier.class, xTextDocument);
}
- private void refreshTextFields()
+ public void refreshTextFields()
{
XRefreshable xUp = UnoRuntime.queryInterface(XRefreshable.class, xTextFieldsSupplier.getTextFields());
xUp.refresh();
@@ -111,7 +113,7 @@ public class TextFieldHandler
}
}
- private XPropertySet createUserField(String FieldName, String FieldTitle) throws com.sun.star.uno.Exception
+ 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 = UnoRuntime.queryInterface(XPropertySet.class, oMaster);
@@ -281,7 +283,35 @@ public class TextFieldHandler
}
}
+ public void removeUserFieldByContent(String _FieldContent)
+ {
+ XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("Content", _FieldContent, "String");
+ if (xDependentTextFields != null)
+ {
+ for (int i = 0; i < xDependentTextFields.length; i++)
+ {
+ xDependentTextFields[i].dispose();
+ }
+ }
+ }
-
-
+ public void changeExtendedUserFieldContent(short UserDataPart, String _FieldContent)
+ {
+ try
+ {
+ XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("UserDataType", new Short(UserDataPart), "Short");
+ if (xDependentTextFields != null)
+ {
+ for (int i = 0; i < xDependentTextFields.length; i++)
+ {
+ xDependentTextFields[i].getTextFieldMaster().setPropertyValue("Content", _FieldContent);
+ }
+ }
+ refreshTextFields();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.java b/wizards/com/sun/star/wizards/text/TextSectionHandler.java
index ddbe78a3f6c4..bdfea587ec24 100644
--- a/wizards/com/sun/star/wizards/text/TextSectionHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.java
@@ -68,7 +68,11 @@ public class TextSectionHandler
}
}
-
+ public boolean hasTextSectionByName(String SectionName)
+ {
+ com.sun.star.container.XNameAccess xAllTextSections = xTextSectionsSupplier.getTextSections();
+ return xAllTextSections.hasByName(SectionName);
+ }
public void removeLastTextSection()
{
@@ -84,7 +88,7 @@ public class TextSectionHandler
}
}
- private void removeTextSection(Object _oTextSection)
+ public void removeTextSection(Object _oTextSection)
{
try
{
@@ -166,7 +170,18 @@ public class TextSectionHandler
}
}
-
+ public void breakLinkOfTextSection(Object oTextSection)
+ {
+ SectionFileLink oSectionLink = new SectionFileLink();
+ oSectionLink.FileURL = PropertyNames.EMPTY_STRING;
+ Helper.setUnoPropertyValues(oTextSection, new String[]
+ {
+ "FileLink", "LinkRegion"
+ }, new Object[]
+ {
+ oSectionLink, PropertyNames.EMPTY_STRING
+ });
+ }
public void linkSectiontoTemplate(String TemplateName, String SectionName)
{
@@ -181,7 +196,7 @@ public class TextSectionHandler
}
}
- private void linkSectiontoTemplate(Object oTextSection, String TemplateName, String SectionName)
+ public void linkSectiontoTemplate(Object oTextSection, String TemplateName, String SectionName)
{
SectionFileLink oSectionLink = new SectionFileLink();
oSectionLink.FileURL = TemplateName;
@@ -208,6 +223,7 @@ public class TextSectionHandler
{
XTextCursor xTextCursor = xText.createTextCursor();
xText.insertControlCharacter(xTextCursor, ControlCharacter.PARAGRAPH_BREAK, false);
+ // Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page");
xTextCursor.collapseToEnd();
}
XTextCursor xSecondTextCursor = xText.createTextCursor();
@@ -220,7 +236,7 @@ public class TextSectionHandler
}
}
- private void insertTextSection(String sectionName, String templateName, XTextCursor position)
+ public void insertTextSection(String sectionName, String templateName, XTextCursor position)
{
try
{
diff --git a/wizards/com/sun/star/wizards/text/TextStyleHandler.java b/wizards/com/sun/star/wizards/text/TextStyleHandler.java
index c36bdc670ef2..58e8584eb782 100644
--- a/wizards/com/sun/star/wizards/text/TextStyleHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextStyleHandler.java
@@ -34,7 +34,7 @@ public class TextStyleHandler
public XStyleFamiliesSupplier xStyleFamiliesSupplier;
/** Creates a new instance of TextStyleHandler */
- public TextStyleHandler(XTextDocument xTextDocument)
+ public TextStyleHandler(com.sun.star.lang.XMultiServiceFactory xMSF, XTextDocument xTextDocument)
{
xStyleFamiliesSupplier = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
}
diff --git a/wizards/com/sun/star/wizards/text/TextTableHandler.java b/wizards/com/sun/star/wizards/text/TextTableHandler.java
index 1020004ec853..bc37487274ad 100644
--- a/wizards/com/sun/star/wizards/text/TextTableHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextTableHandler.java
@@ -23,6 +23,7 @@ import com.sun.star.container.XNamed;
import com.sun.star.frame.XFrame;
import com.sun.star.lang.Locale;
import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.style.BreakType;
import com.sun.star.table.XCellRange;
import com.sun.star.text.XSimpleText;
import com.sun.star.text.XTextContent;
@@ -32,6 +33,7 @@ import com.sun.star.text.XTextTablesSupplier;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
import com.sun.star.util.XNumberFormatsSupplier;
import com.sun.star.view.XSelectionSupplier;
import com.sun.star.wizards.common.Desktop;
@@ -42,9 +44,9 @@ public class TextTableHandler
{
public XTextTablesSupplier xTextTablesSupplier;
- private XMultiServiceFactory xMSFDoc;
- private XTextDocument xTextDocument;
-
+ public XMultiServiceFactory xMSFDoc;
+ public XTextDocument xTextDocument;
+ public XSimpleText xSimpleText;
private NumberFormatter oNumberFormatter;
private Locale aCharLocale;
@@ -56,7 +58,7 @@ public class TextTableHandler
this.xMSFDoc = xMSF;
this.xTextDocument = xTextDocument;
xTextTablesSupplier = UnoRuntime.queryInterface(XTextTablesSupplier.class, xTextDocument);
- UnoRuntime.queryInterface(XSimpleText.class, xTextDocument.getText());
+ xSimpleText = UnoRuntime.queryInterface(XSimpleText.class, xTextDocument.getText());
XNumberFormatsSupplier xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
aCharLocale = (Locale) Helper.getUnoStructValue(xTextDocument, "CharLocale");
oNumberFormatter = new NumberFormatter(xNumberFormatsSupplier, aCharLocale);
@@ -107,7 +109,24 @@ public class TextTableHandler
}
}
-
+ public void insertTextTable(com.sun.star.text.XTextCursor xTextCursor)
+ {
+ try
+ {
+ com.sun.star.uno.XInterface xTextTable = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextTable");
+ XTextContent xTextContentTable = UnoRuntime.queryInterface(XTextContent.class, xTextTable);
+ if (xTextCursor == null)
+ {
+ xTextCursor = xTextDocument.getText().createTextCursor();
+ xTextCursor.gotoEnd(false);
+ }
+ xTextCursor.getText().insertTextContent(xTextCursor, xTextContentTable, false);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.err);
+ }
+ }
public void removeAllTextTables()
{
@@ -140,7 +159,7 @@ public class TextTableHandler
}
}
- private void removeTextTable(Object oTextTable)
+ public void removeTextTable(Object oTextTable)
{
try
{
@@ -187,7 +206,12 @@ public class TextTableHandler
}
}
-
+ public static BreakType resetBreakTypeofTextTable(Object oTextTable)
+ {
+ BreakType BreakValue = (BreakType) com.sun.star.wizards.common.Helper.getUnoStructValue(oTextTable, "BreakType");
+ Helper.setUnoPropertyValue(oTextTable, "BreakType", BreakType.NONE);
+ return BreakType.NONE;
+ }
public void adjustOptimalTableWidths(XMultiServiceFactory _xMSF, XTextTable xTextTable)
{
@@ -202,7 +226,7 @@ public class TextTableHandler
xSelection.select(xLocCellRange);
Desktop.dispatchURL(_xMSF, ".Uno:DistributeColumns", xFrame);
Desktop.dispatchURL(_xMSF, ".Uno:SetOptimalColumnWidth", xFrame);
- Helper.setUnoPropertyValue(xTextTable, "HoriOrient", Short.valueOf(iHoriOrient));
+ Helper.setUnoPropertyValue(xTextTable, "HoriOrient", new Short(iHoriOrient));
}
catch (Exception exception)
{
diff --git a/wizards/com/sun/star/wizards/text/ViewHandler.java b/wizards/com/sun/star/wizards/text/ViewHandler.java
index 0b3712e00c73..c0a92184b63f 100644
--- a/wizards/com/sun/star/wizards/text/ViewHandler.java
+++ b/wizards/com/sun/star/wizards/text/ViewHandler.java
@@ -23,6 +23,7 @@ import com.sun.star.container.XIndexAccess;
import com.sun.star.container.XNameAccess;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.style.XStyleFamiliesSupplier;
import com.sun.star.text.XPageCursor;
import com.sun.star.text.XTextContent;
@@ -43,7 +44,7 @@ public class ViewHandler
private XViewSettingsSupplier xViewSettingsSupplier;
/** Creates a new instance of View */
- public ViewHandler(XTextDocument xTextDocument)
+ public ViewHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument)
{
xTextViewCursorSupplier = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
xViewSettingsSupplier = UnoRuntime.queryInterface(XViewSettingsSupplier.class, xTextDocument.getCurrentController());