Re: [api-dev] How to apply Paragraph Style to XTextDocument?

2006-11-13 Thread Bartolomeo Mastromarco

aloizio wrote:
I need to change via OO API the following parameters 


LineSpacing

ParaFirstLineIndent

ParaVertAlignment


  

hi,

this is the code for you:

XStyle xStyle = (XStyle)UnoRuntime.queryInterface (
   XStyle.class, 
this.xMultiServiceFactory.createInstance(

   com.sun.star.style.ParagraphStyle));

XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface (
   XPropertySet.class, xStyle);


//1)
if(lineSpacing.equals(Single))
   {
   
xPropertySet.setPropertyValue(ParaLineNumberCount,Boolean.TRUE);
  
   LineSpacing linespacing = new LineSpacing();

   linespacing.Mode = (short)Lines.Mode;
   linespacing.Height = (short)Lines.Single;
   xPropertySet.setPropertyValue(ParaLineSpacing,linespacing);
   }
   else if(lineSpacing.equals(1.5 lines))
   {
   
xPropertySet.setPropertyValue(ParaLineNumberCount,Boolean.TRUE);

   LineSpacing linespacing = new LineSpacing();
   linespacing.Mode = (short)Lines.Mode;
   linespacing.Height = (short)Lines.halfLine;
   xPropertySet.setPropertyValue(ParaLineSpacing,linespacing);
   }
   else if(lineSpacing.equals(Double))
   {
   
xPropertySet.setPropertyValue(ParaLineNumberCount,Boolean.TRUE);

   LineSpacing linespacing = new LineSpacing();
   linespacing.Mode = (short)Lines.Mode;
   linespacing.Height = (short)Lines.Double;
   xPropertySet.setPropertyValue(ParaLineSpacing,linespacing);
   }


//2)
xPropertySet.setPropertyValue(ParaFirstLineIndent,new 
Integer((int)(value*1000)));


//3)
to you..

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Multiple instances / creating user installations

2006-11-13 Thread Kai Sommerfeld
Hi all,

Tobias Krais wrote:
 Hi API Team,
 
  starting with OOo 2.0.4 you can use the parameter -nofirststartwizard
 to, guess what... suppress the startup wizard.
 
 using htop to watch my OOo bootstrap process I can see, that
 bootstraping OOo from java does not use this option. Is it possible to
 add this option to the standart bootstrap process?
 The simple bootstrap mechanism can be used for both GUI and Non-GUI
Office use cases. There might be cases where the supression of the
wizard is not intended by the caller of bootstrap(). The default
bootstrap mechanism should only use parameters that are always senseful.

 That's why I consider it not a good idea to add the paramter to the
default bootsrap process.

- Kai.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[api-dev] Newbie inserting text where the cursor is (java)

2006-11-13 Thread Alamo Vallejo, Joan

How can I insert text (or anything) at the cursor's position?

I've recovered the cursor position doing this:

mxRemoteServiceManager = getRemoteServiceManager();

Object desktop =
mxRemoteServiceManager.createInstanceWithContext(com.sun.star.frame.Des
ktop, mxRemoteContext);
XDesktop xDesktop = (XDesktop)UnoRuntime.queryInterface(XDesktop.class,
desktop);
XComponent xCurrentComponent = xDesktop.getCurrentComponent();
XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class,
xCurrentComponent);
XController xController = xModel.getCurrentController();
XTextViewCursorSupplier xViewCursorSupplier =
(XTextViewCursorSupplier)UnoRuntime.queryInterface(XTextViewCursorSuppli
er.class, xController); 
XTextViewCursor xViewCursor = xViewCursorSupplier.getViewCursor();

But now, how I manage to write something in that position?

Joan

This e-mail may contain confidential or privileged information. Any unauthorised
copying, use or distribution of this information is strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] UNO Component Bootstrap

2006-11-13 Thread Tobias Krais
Hi Tabish,

 Create a JAR package and make a desktop icon with a commandline like
 this: java -jar myjar.jar
 
 The ant script file will be inside the JAR ? Right now I type ant run to
 run my java code.
 You are saying that by making a jar which will have the ant file inside it
 the ant script will be automatically executed ?

My JAR archive has no ant script inside. Best way is to use the JAR
Packager of your Java IDE. The JAR File will have all the compiled
classes inside and also a META File. That file is generated by your IDE.
Please see also the comment to this snippet:
http://codesnippets.services.openoffice.org/Office/Office.BootstrapOpenOffice.snip

 Also I need the procedure for making an icon and how to attach that icon
 with whatever jar I make.

I can't help you with this. You should ask this in a Java forum, not in
an OOo specific forum.

 If you like this idea, I can post you java code, how you add a menu /
 menu item to your menu.
 
 Yes thats exactly what I want to do.

I attach a java file that will be interesting for you and may be others.
It is free in use and you can copy it.

Greetings, Tobias


package de.twc.oocom.oo;

import java.io.File;
import java.util.Vector;

import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XIndexAccess;
import com.sun.star.container.XIndexContainer;
import com.sun.star.frame.XController;
import com.sun.star.frame.XDispatchHelper;
import com.sun.star.frame.XDispatchProvider;
import com.sun.star.frame.XLayoutManager;
import com.sun.star.frame.XModel;
import com.sun.star.lang.EventObject;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.IndexOutOfBoundsException;
import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.ui.XModuleUIConfigurationManagerSupplier;
import com.sun.star.ui.XUIConfigurationManager;
import com.sun.star.ui.XUIElement;
import com.sun.star.ui.XUIElementSettings;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.util.CloseVetoException;
import com.sun.star.util.XCloseListener;
import com.sun.star.util.XCloseable;


/**
 * @author tobias
 *
 */
public class OOGUILayout {

/**
 * OpenOffice.org representative of the opened file.
 * @see #openFilename
 */
private XComponent xComponent = null; 

/**
 * This variable contains the folder and name of the handled file
 * e.g /tmp/myfile.odt for Linux/Unix or C:\folder\myfile.odt for
 * Windows.
 */
private String openFilename = null;
	
/**
 * Setting to true turns on the debug mode.
 */
private static int debug = 0;

/**
 * Constructor that inherits from OOComNG and sets some parameters.
 * 
 * @param myOpenFilename See [EMAIL PROTECTED] de.twc.oocom.OOComNG#openFilename}. The
 * file that should be opened.
 */
public OOGUILayout(XComponent myXComponent, String filename) {
	this.xComponent = myXComponent;
	this.openFilename = filename;
}

/**
 * This method adds a CloseListener to the opened document.
 */
public void addCloseListener()
{
// initial close listener
XCloseable close = (XCloseable)UnoRuntime.queryInterface(
com.sun.star.util.XCloseable.class, this.xComponent);
final File openFile = new File(this.openFilename);
final long last_modified_old = openFile.lastModified();

close.addCloseListener(new XCloseListener() {
public void queryClosing(EventObject arg0, boolean arg1)
throws CloseVetoException {
long last_modified = openFile.lastModified();
if (last_modified != last_modified_old) {
System.exit(0);
} else {
// XModifiable modi = xComponent.interfaces.getXModifiable();
// System.out.println(modi.isModified());
System.exit(1);
}
}

public void notifyClosing(EventObject arg0) {}

public void disposing(EventObject arg0) {}
});

// wait for closing document
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
if (debug  1)
System.out.println(e);
}
}
}

/**
 * This method retrieves the Layout Manager that is used by a XFrame.
 * 
 * @return Returns the current used LayoutManager. 
 */
public XLayoutManager getLayoutManager()
{
	// Getting the frame the loaded document resides in
XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class,
	this.xComponent);
	XController xController = xModel.getCurrentController();
	
	// Getting the properties of the frame
XPropertySet xps = (XPropertySet)

Re: [api-dev] printing current sheet

2006-11-13 Thread Tobias Krais
Hi Mathias,

 In a calc document i want to place a button with that the user can print
 the actual sheet or rather the defined (and named) print area at the
 sheet. But i can't find the right print options to do that.

please see the code attached. It is free, again.

Greetings, Tobias


package de.twc.oocom.oo;

import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XNameAccess;
import com.sun.star.container.XNameContainer;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.XComponent;
import com.sun.star.sheet.XSpreadsheetDocument;
import com.sun.star.sheet.XSpreadsheets;
import com.sun.star.style.XStyle;
import com.sun.star.style.XStyleFamiliesSupplier;
import com.sun.star.text.XTextDocument;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.view.PrintableState;
import com.sun.star.view.XPrintJobBroadcaster;
import com.sun.star.view.XPrintable;

import de.twc.oocom.oo.calc.OOCalcDoc;
import de.twc.oocom.oo.text.OOTextDoc;
import de.twc.oocom.server.PrintJobListener;

/**
 * @author tobias
 *
 */
public class OOPrint {

/**
 * OpenOffice.org representative of the opened file.
 */
private XComponent xComponent = null; 

	/**
 * Turns on the debug mode: 0 = absolute quiet, 1 = normal, 2 = verbose.
 */
private static int debug = 0;

public OOPrint (XComponent myXComponent) {
	this.xComponent = myXComponent;
}

/**
 * This method sets the printer tray of the loaded Document.
 * 
 * @param myTray The paper tray the printer should use
 * [EMAIL PROTECTED] de.twc.oocom.OOCom#tray1}

 */
public void setPrinterTray(String printerTray)
{
	if (debug  0)
	System.out.print(Setting printer tray  + printerTray +  ... );
try {
	// Get application name of the loaded document
String applicationName = 
		OODocument.getApplicationName(this.xComponent);

// If loaded document is a Text Document
if (applicationName.equals(com.sun.star.text.TextDocument)) {
// Get the text document
	XTextDocument xTextDocument = (XTextDocument)
		UnoRuntime.queryInterface(XTextDocument.class,
		this.xComponent);
		if(xTextDocument == null) {
if (debug  0)
System.out.println(failed.);
			return;
		}
	
	// Get the StyleFamiliesSupplier interface of the document
	XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier)
	UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
	xTextDocument);
	setPrinterTrayHelper(xSupplier,
			OOTextDoc.getXTextDocumentPageStyleName(xTextDocument),
	printerTray);
}
// If loaded Document is Spread Sheet
else if (applicationName.equals(com.sun.star.sheet.SpreadsheetDocument)) {
// Get SpreadSheet Document
XSpreadsheetDocument xSpreadsheetDocument = (XSpreadsheetDocument)
		UnoRuntime.queryInterface(XSpreadsheetDocument.class,
this.xComponent);
if(xSpreadsheetDocument == null) {
	if (debug  0)
	System.out.println(failed.);
	return;
}

// Get the StyleFamiliesSupplier interface of the document
XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier)
UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
xSpreadsheetDocument);

// Get Spreadsheets
XSpreadsheets xSpreadsheets = xSpreadsheetDocument.getSheets();
String[] sheets = xSpreadsheets.getElementNames();

for (int i = 0; i  sheets.length; i++) {
setPrinterTrayHelper(xSupplier,
		OOCalcDoc.getXSpreadsheetPageStyleName(
xSpreadsheets, sheets[i]),
	printerTray);
}
}
else if (applicationName.equals(com.sun.star.text.WebDocument)) {
	
}
else if (applicationName.equals(com.sun.star.text.GlobalDocument)) {
	
}
else if (applicationName.equals(com.sun.star.presentation.PresentationDocument)) {
	
}
else if (applicationName.equals(com.sun.star.drawing.DrawingDocument)) {
	
}
else if (applicationName.equals(com.sun.star.chart.ChartDocument)) {
	
}
else if (applicationName.equals(com.sun.star.formula.FormulaProperties)) {
	
}
else if 

Re: [api-dev] Newbie inserting text where the cursor is (java)

2006-11-13 Thread Tobias Krais
Hi Joan,

 But now, how I manage to write something in that position?

I use the method below to paste text on the position of a bookmark. You
will also find the answer to you question in the developers guide.

Greetings, Tobias

-%-
/**
 * Sets the Cursor to a bookmark position and replaces text on this
position.
 * If the bookmark contains more than at least one char, the text is
 * replaced. Otherwise the text is just inserted.
 *
 * @param bookmarkName Name of the Bookmark the cursor should jump to.
 * @param text The text that is going to be insertet on bookmark position
 */
public void replaceStringOnBookmark(String bookmarkName, String text) {
try {
// Get text document out the the general document
XTextDocument xTextDocument = (XTextDocument)
UnoRuntime.queryInterface(XTextDocument.class, xComponent);
if (xTextDocument == null) {
if (debug  0)
System.out.println(Document is not a Text Document. + 
 Aborting.);
return;
}

// Get bookmark interface from document
XBookmarksSupplier xBookmarksSupplier = (XBookmarksSupplier)
UnoRuntime.queryInterface(XBookmarksSupplier.class, xComponent);

// Accessing the Bookmarks collection of the document
XNameAccess xNamedBookmarks = xBookmarksSupplier.getBookmarks();

// Find the Bookmark specified in bookmarkName
Object bookmark = null;
try {
bookmark = xNamedBookmarks.getByName(bookmarkName);
} catch (Exception e) {
return;
}
if (bookmark == null) {
return;
}

// Query for XTextContext, the content of the Bookmark
XTextContent xBookmarkContent = (XTextContent)
UnoRuntime.queryInterface(XTextContent.class, bookmark);

// Get the anchor of the bookmark (its XTextRange)
XTextRange xBookmarkRange = xBookmarkContent.getAnchor();

// Set string at bookmark position
xBookmarkRange.setString(text);
} catch (Exception e) {
return;
}
}

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Multiple instances / creating user installations

2006-11-13 Thread Tobias Krais
Hi Kai,

  starting with OOo 2.0.4 you can use the parameter -nofirststartwizard
 to, guess what... suppress the startup wizard.

 using htop to watch my OOo bootstrap process I can see, that
 bootstraping OOo from java does not use this option. Is it possible to
 add this option to the standart bootstrap process?

 The simple bootstrap mechanism can be used for both GUI and Non-GUI
 Office use cases. There might be cases where the supression of the
 wizard is not intended by the caller of bootstrap(). The default
 bootstrap mechanism should only use parameters that are always senseful.

As you wrote the non-GUI use case is neglected in your argumentation. In
my opinion, there should be a solution for this use case, too.

Greetings, Tobias

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [api-dev] Newbie inserting text where the cursor is (java)

2006-11-13 Thread Alamo Vallejo, Joan

Do you mean the TextDocuments.java in the guide? It works fine if you
want to go to the start, then jump some sentences and a few words and
then write. But I'd like to write where the cursor (the blinking one)
is, do you think it's possible? Or... Can anybody tell me where to look
for it?

(Imagine OO embedded into an applet and when you click a button, some
text is inserted where the cursor was)

Joan

-Mensaje original-
De: Tobias Krais [mailto:[EMAIL PROTECTED]
Enviado el: lunes, 13 de noviembre de 2006 13:23
Para: dev@api.openoffice.org
Asunto: Re: [api-dev] Newbie inserting text where the cursor is (java)

Hi Joan,

 But now, how I manage to write something in that position?

I use the method below to paste text on the position of a bookmark. You
will also find the answer to you question in the developers guide.

Greetings, Tobias

-%-
/**
 * Sets the Cursor to a bookmark position and replaces text on this
position.
 * If the bookmark contains more than at least one char, the text is
 * replaced. Otherwise the text is just inserted.
 *
 * @param bookmarkName Name of the Bookmark the cursor should jump to.
 * @param text The text that is going to be insertet on bookmark
position
 */
public void replaceStringOnBookmark(String bookmarkName, String text) {
try {
// Get text document out the the general document
XTextDocument xTextDocument = (XTextDocument)
UnoRuntime.queryInterface(XTextDocument.class,
xComponent);
if (xTextDocument == null) {
if (debug  0)
System.out.println(Document is not a Text
Document. +  Aborting.);
return;
}

// Get bookmark interface from document
XBookmarksSupplier xBookmarksSupplier = (XBookmarksSupplier)
UnoRuntime.queryInterface(XBookmarksSupplier.class,
xComponent);

// Accessing the Bookmarks collection of the document
XNameAccess xNamedBookmarks = xBookmarksSupplier.getBookmarks();

// Find the Bookmark specified in bookmarkName
Object bookmark = null;
try {
bookmark = xNamedBookmarks.getByName(bookmarkName);
} catch (Exception e) {
return;
}
if (bookmark == null) {
return;
}

// Query for XTextContext, the content of the Bookmark
XTextContent xBookmarkContent = (XTextContent)
UnoRuntime.queryInterface(XTextContent.class,
bookmark);

// Get the anchor of the bookmark (its XTextRange)
XTextRange xBookmarkRange = xBookmarkContent.getAnchor();

// Set string at bookmark position
xBookmarkRange.setString(text);
} catch (Exception e) {
return;
}
}

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


This e-mail may contain confidential or privileged information. Any unauthorised
copying, use or distribution of this information is strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Newbie inserting text where the cursor is (java)

2006-11-13 Thread Laurent Godard

Hi


Do you mean the TextDocuments.java in the guide? It works fine if you
want to go to the start, then jump some sentences and a few words and
then write. But I'd like to write where the cursor (the blinking one)
is, do you think it's possible? Or... Can anybody tell me where to look
for it?



instead of playing with a Cursor, play with the ViewCursor object
http://api.openoffice.org/docs/common/ref/com/sun/star/text/XTextViewCursorSupplier.html#getViewCursor

Laurent



--
Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org - 
http://www.indesko.com
Nuxeo Enterprise Content Management  http://www.nuxeo.com - 
http://www.nuxeo.org

Livre Programmation OpenOffice.org, Eyrolles 2004-2006

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] How to apply Paragraph Style to XTextDocument?

2006-11-13 Thread aloizio

Hi Bartolomeo,

Thanks for your help. I have another problem I implemented the method below,
but only the first paragraph of the document are changed with the
properties. I need to set all document paragraphs to the properties into the
loop. Why this happens. Could you help me?

  public void testar (XComponent xComponent)
  {

try
{
  XTextDocument xTextDocument = (XTextDocument)
  UnoRuntime.queryInterface(XTextDocument.class, xComponent);

  XText xText = xTextDocument.getText();
  XTextCursor curText = xText.createTextCursor();

// get the XPropertySet interface of cursor.
  XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, curText);

  /*while (eoParagraph.hasMoreElements()) 
  { 
  XPropertySet xCursorProps =
(XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,curText); 
 
xCursorProps.setPropertyValue(CharPosture,com.sun.star.awt.FontSlant.ITALIC); 
  xCursorProps.setPropertyValue(CharWeight,new
Float(com.sun.star.awt.FontWeight.BOLD) ); 
  xCursorProps.setPropertyValue(CharFontName,Arial ); 
  xCursorProps.setPropertyValue(ParaAdjust,ParagraphAdjust.BLOCK); 
  curText.getEnd();
   
  }*/
  // get the XEnumerationAccess interface
  XEnumerationAccess enumText = (XEnumerationAccess)
UnoRuntime.queryInterface(XEnumerationAccess.class, xText);

  // Call the method to get the XEnumeration service
  XEnumeration eoParagraph = enumText.createEnumeration();  
  
  // While there are paragraphs, do things to them
 while (eoParagraph.hasMoreElements()) 
  {
XServiceInfo xInfo = (XServiceInfo) UnoRuntime.queryInterface(
XServiceInfo.class, eoParagraph.nextElement());
XPropertySet xSet = (XPropertySet)UnoRuntime.
 queryInterface(XPropertySet.class, xInfo);

xSet.setPropertyValue(ParaLeftMargin, new Integer(200));
xSet.setPropertyValue(ParaFirstLineIndent, new Integer(2500));
LineSpacing linha = new LineSpacing();
linha.Height = 150;
linha.Mode = LineSpacingMode.PROP;
xSet.setPropertyValue(ParaLineSpacing, linha);
xSet.setPropertyValue(ParaAdjust, ParagraphAdjust.BLOCK);
xSet.setPropertyValue(ParaRightMargin, new Integer(100));
   
 }

  
  } catch (UnknownPropertyException e)
{
  // TODO Auto-generated catch block
  e.printStackTrace();
} catch (PropertyVetoException e)
{
  // TODO Auto-generated catch block
  e.printStackTrace();
} catch (IllegalArgumentException 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();
}
}



Bartolomeo Mastromarco wrote:
 
 aloizio wrote:
 I need to change via OO API the following parameters 

 LineSpacing

 ParaFirstLineIndent

 ParaVertAlignment


   
 hi,
 
 this is the code for you:
 
 XStyle xStyle = (XStyle)UnoRuntime.queryInterface (
 XStyle.class, 
 this.xMultiServiceFactory.createInstance(
 com.sun.star.style.ParagraphStyle));
 
 XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface (
 XPropertySet.class, xStyle);
 
 
 //1)
 if(lineSpacing.equals(Single))
 {
 
 xPropertySet.setPropertyValue(ParaLineNumberCount,Boolean.TRUE);

 LineSpacing linespacing = new LineSpacing();
 linespacing.Mode = (short)Lines.Mode;
 linespacing.Height = (short)Lines.Single;
 xPropertySet.setPropertyValue(ParaLineSpacing,linespacing);
 }
 else if(lineSpacing.equals(1.5 lines))
 {
 
 xPropertySet.setPropertyValue(ParaLineNumberCount,Boolean.TRUE);
 LineSpacing linespacing = new LineSpacing();
 linespacing.Mode = (short)Lines.Mode;
 linespacing.Height = (short)Lines.halfLine;
 xPropertySet.setPropertyValue(ParaLineSpacing,linespacing);
 }
 else if(lineSpacing.equals(Double))
 {
 
 xPropertySet.setPropertyValue(ParaLineNumberCount,Boolean.TRUE);
 LineSpacing linespacing = new LineSpacing();
 linespacing.Mode = (short)Lines.Mode;
 linespacing.Height = (short)Lines.Double;
 xPropertySet.setPropertyValue(ParaLineSpacing,linespacing);
 }
 
 
 //2)
 xPropertySet.setPropertyValue(ParaFirstLineIndent,new 
 Integer((int)(value*1000)));
 
 //3)
 to you..
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 

[api-dev] XP Problem with OpenOffice.org eclipse plugin?

2006-11-13 Thread Alamo Vallejo, Joan

Is there any problem choosing the SDK plugin configuration for Eclipse
in Windows XP? It seems to work on Windows 2000... I'll attach an image
of the error

Joan


This e-mail may contain confidential or privileged information. Any unauthorised
copying, use or distribution of this information is strictly prohibited.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: [api-dev] XP Problem with OpenOffice.org eclipse plugin?

2006-11-13 Thread Cedric Bosdonnat

Alamo Vallejo, Joan a écrit :
Sorry, the attachment didn't seem to work... Here it is: Invalid SDK 
path. And the directory exists!!


Which version of the SDK are you using ?

Cedric

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [api-dev] XP Problem with OpenOffice.org eclipse plugin?

2006-11-13 Thread Alamo Vallejo, Joan

2.0

At least, that's what the install file says:
OOo-SDK_2.0_windows_install_en-US.exe

Joan


-Mensaje original-
De: Cedric Bosdonnat [mailto:[EMAIL PROTECTED]
Enviado el: lunes, 13 de noviembre de 2006 16:56
Para: dev@api.openoffice.org
Asunto: Re: [api-dev] XP Problem with OpenOffice.org eclipse plugin?

Alamo Vallejo, Joan a écrit :
 Sorry, the attachment didn't seem to work... Here it is: Invalid SDK
 path. And the directory exists!!

Which version of the SDK are you using ?

Cedric

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


This e-mail may contain confidential or privileged information. Any unauthorised
copying, use or distribution of this information is strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Multiple instances / creating user installations

2006-11-13 Thread Kai Sommerfeld
Tobias,

Tobias Krais wrote:
 Hi Kai,
 
  starting with OOo 2.0.4 you can use the parameter -nofirststartwizard
 to, guess what... suppress the startup wizard.
 
 using htop to watch my OOo bootstrap process I can see, that
 bootstraping OOo from java does not use this option. Is it possible to
 add this option to the standart bootstrap process?
 
 The simple bootstrap mechanism can be used for both GUI and Non-GUI
 Office use cases. There might be cases where the supression of the
 wizard is not intended by the caller of bootstrap(). The default
 bootstrap mechanism should only use parameters that are always senseful.
 
 As you wrote the non-GUI use case is neglected in your argumentation. In
 my opinion, there should be a solution for this use case, too.
 
 What do you suggest?

- Kai.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] printing current sheet

2006-11-13 Thread Mathias Röllig
Hello Tobias!

Thank you for your answer.

Am 13.11.2006 13:14 schrieb Tobias Krais:
 In a calc document i want to place a button with that the user can print
 the actual sheet or rather the defined (and named) print area at the
 sheet. But i can't find the right print options to do that.

 please see the code attached. It is free, again.

This is a good example, but not this that i need.
(I use Basic, but this isn't a problem.)

My workaround is equivalent to this code, where myPages is set by the
button tag. (Ich habe einen Knopf auf der Tabelle, der das Makro auslöst
und in der Zusatzinformation die zu druckende Seite(nnummer) übergibt.)

   // Setting the property Pages so that only the desired pages
   // will be printed.
   PropertyValue[] printOpts = new PropertyValue[1];
   printOpts[0] = new PropertyValue();
   printOpts[0].Name = Pages;
   printOpts[0].Value = myPages;

The problem is, that in the document the tables must not be moved or
deleted, because the print page number will not be right further more.

So the question is: how can i figure out, which print page number has
the actual sheet? Or, how can i figure out, on which print page(s) will
a special print area reside?


greetings
Mathias
-- 
·-· cut here ·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-8·-·

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [api-dev] Newbie inserting text where the cursor is (java)

2006-11-13 Thread Alamo Vallejo, Joan

Thank you all for the help, finally I could do it... But now I'm facing
another problem: I want to insert an input field instead of text. I got
this far:

XMultiServiceFactory mxDocFactory = (XMultiServiceFactory)
UnoRuntime.queryInterface(XMultiServiceFactory.class,xTextDocument);

XTextField xInputUser = (XTextField) UnoRuntime.queryInterface
(XTextField.class, mxDocFactory.createInstance
(com.sun.star.text.TextField.InputUser ) );

xText.insertTextContent ( xViewCursor, xInputUser, false );

Ok, this seems to insert an empty input field. Do you know how to set a
default value or a text in the grey selection that is shown in the
document?

Thx in advance,
Joan

-Mensaje original-
De: Alamo Vallejo, Joan
Enviado el: lunes, 13 de noviembre de 2006 14:12
Para: dev@api.openoffice.org
Asunto: RE: [api-dev] Newbie inserting text where the cursor is (java)


Do you mean the TextDocuments.java in the guide? It works fine if you
want to go to the start, then jump some sentences and a few words and
then write. But I'd like to write where the cursor (the blinking one)
is, do you think it's possible? Or... Can anybody tell me where to look
for it?

(Imagine OO embedded into an applet and when you click a button, some
text is inserted where the cursor was)

Joan

-Mensaje original-
De: Tobias Krais [mailto:[EMAIL PROTECTED]

Enviado el: lunes, 13 de noviembre de 2006 13:23
Para: dev@api.openoffice.org
Asunto: Re: [api-dev] Newbie inserting text where the cursor is (java)

Hi Joan,

 But now, how I manage to write something in that position?

I use the method below to paste text on the position of a bookmark. You
will also find the answer to you question in the developers guide.

Greetings, Tobias

-%-
/**
 * Sets the Cursor to a bookmark position and replaces text on this
position.
 * If the bookmark contains more than at least one char, the text is
 * replaced. Otherwise the text is just inserted.
 *
 * @param bookmarkName Name of the Bookmark the cursor should jump to.
 * @param text The text that is going to be insertet on bookmark
position
 */
public void replaceStringOnBookmark(String bookmarkName, String text) {
try {
// Get text document out the the general document
XTextDocument xTextDocument = (XTextDocument)
UnoRuntime.queryInterface(XTextDocument.class,
xComponent);
if (xTextDocument == null) {
if (debug  0)
System.out.println(Document is not a Text
Document. +  Aborting.);
return;
}


// Get bookmark interface from document
XBookmarksSupplier xBookmarksSupplier = (XBookmarksSupplier)
UnoRuntime.queryInterface(XBookmarksSupplier.class,
xComponent);


// Accessing the Bookmarks collection of the document
XNameAccess xNamedBookmarks = xBookmarksSupplier.getBookmarks();


// Find the Bookmark specified in bookmarkName
Object bookmark = null;
try {
bookmark = xNamedBookmarks.getByName(bookmarkName);
} catch (Exception e) {
return;
}
if (bookmark == null) {
return;
}


// Query for XTextContext, the content of the Bookmark
XTextContent xBookmarkContent = (XTextContent)
UnoRuntime.queryInterface(XTextContent.class,
bookmark);


// Get the anchor of the bookmark (its XTextRange)
XTextRange xBookmarkRange = xBookmarkContent.getAnchor();


// Set string at bookmark position
xBookmarkRange.setString(text);
} catch (Exception e) {
return;
}
}

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


This e-mail may contain confidential or privileged information. Any
unauthorised
copying, use or distribution of this information is strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


This e-mail may contain confidential or privileged information. Any unauthorised
copying, use or distribution of this information is strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[api-dev] How can I select all paragraphs from a Text?

2006-11-13 Thread aloizio

I am trying to select all paragraph into the document. I am using the
following:

  // Get the XParagraphCursor interface of the document cursor
  XParagraphCursor xParaCursor = (XParagraphCursor) 
  UnoRuntime.queryInterface( XParagraphCursor.class, curText );

  // Select all  paragraphs inserted
  xParaCursor. ?? 
-- 
View this message in context: 
http://www.nabble.com/How-can-I-select-all-paragraphs-from-a-Text--tf2624653.html#a7323880
Sent from the openoffice - api dev mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] How can I select all paragraphs from a Text?

2006-11-13 Thread Cor Nouws

Hi Aloizio,

aloizio wrote:


I am trying to select all paragraph into the document. I am using the
following:

  // Get the XParagraphCursor interface of the document cursor
  XParagraphCursor xParaCursor = (XParagraphCursor) 
  UnoRuntime.queryInterface( XParagraphCursor.class, curText );


  // Select all  paragraphs inserted
  xParaCursor. ?? 


I do not work with Java. I know in the Basic libraries under Tools, 
there are some useful examples.
If you stil do not work with the praragraph style ;-) you could create a 
viewcursor at the start, and extend it to the end of the doc. Pls see 
the examples.


Greetings,
Cor

--

Cor Nouws
Arnhem - Netherlands
nl.OpenOffice.org - marketing contact

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] How can I select all paragraphs from a Text?

2006-11-13 Thread aloizio

Hi  

I am already working with XStyle. See my code below:

  protected void Example (XComponent xComp)
  {
  try
  {


XTextDocument xTextDocument = (XTextDocument)
UnoRuntime.queryInterface(XTextDocument.class, xComp);

XText xText = xTextDocument.getText();
XTextCursor curText = xText.createTextCursor();

  // Go to the end of the document
//curText.gotoEnd( false );
curText.gotoEnd( false );
  
XMultiServiceFactory mxDocFactory = (XMultiServiceFactory)
UnoRuntime
.queryInterface(XMultiServiceFactory.class,xTextDocument); 

  
  // Create a new style from the document's factory
  XStyle xStyle = (XStyle) UnoRuntime.queryInterface( 
  XStyle.class, mxDocFactory.createInstance( 
  com.sun.star.style.ParagraphStyle ) );
  
  // Access the XPropertySet interface of the new style
  XPropertySet xStyleProps = (XPropertySet)
UnoRuntime.queryInterface(
  XPropertySet.class, xStyle );
  
  // Give the new style a light blue background
  xStyleProps.setPropertyValue ( ParaBackColor, new Integer
(13421823));
  xStyleProps.setPropertyValue(ParaLeftMargin, new Integer(200));
  xStyleProps.setPropertyValue(ParaFirstLineIndent, new
Integer(2500));
  xStyleProps.setPropertyValue(ParaLineNumberCount,Boolean.TRUE); 

  LineSpacing linha = new LineSpacing();
  linha.Height = 150;
  linha.Mode = LineSpacingMode.PROP;
  xStyleProps.setPropertyValue(ParaLineSpacing, linha);
  xStyleProps.setPropertyValue(ParaAdjust, ParagraphAdjust.BLOCK);
  xStyleProps.setPropertyValue(ParaRightMargin, new Integer(100));
  
  // Get the StyleFamiliesSupplier interface of the document
  XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier)
  UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
xTextDocument);

  // Use the StyleFamiliesSupplier interface to get the XNameAccess
  // interface of the actual style families
  XNameAccess xFamilies = ( XNameAccess ) UnoRuntime.queryInterface
( 
  XNameAccess.class, xSupplier.getStyleFamilies() );

  // Access the 'ParagraphStyles' Family
  XNameContainer xFamily = (XNameContainer )
UnoRuntime.queryInterface ( 
  XNameContainer.class,
  xFamilies.getByName ( ParagraphStyles ) );

  // Insert the newly created style into the ParagraphStyles family
  xFamily.insertByName ( All-Singing All-Dancing Style, xStyle );

  // Get the XParagraphCursor interface of the document cursor
  XParagraphCursor xParaCursor = (XParagraphCursor) 
  UnoRuntime.queryInterface( XParagraphCursor.class, curText );
  
  curText.gotoEnd ( false );
  xParaCursor.gotoPreviousParagraph ( false );
  xParaCursor.gotoPreviousParagraph ( true );
  xParaCursor.gotoPreviousParagraph ( true );

  
  // Select the first paragraph inserted
  //xParaCursor.gotoPreviousParagraph ( false );
  //xParaCursor.gotoPreviousParagraph ( true );
  
  // Access the property set of the cursor selection
  XPropertySet xCursorProps = (XPropertySet)
UnoRuntime.queryInterface(
  XPropertySet.class, curText ); 

  // Set the style of the cursor selection to our newly created
style
  xCursorProps.setPropertyValue ( ParaStyleName,
  All-Singing All-Dancing Style );

  // Go back to the end
  //curText.gotoEnd ( false );
  curText.gotoEnd(false);
  
  
  // Select the last paragraph in the document
  xParaCursor.gotoNextParagraph ( true );
  
  // And reset it's style to 'Standard' (the programmatic name for
  // the default style)
  xCursorProps.setPropertyValue ( ParaStyleName, All-Singing
All-Dancing Style );
  }
  catch (Exception e) 
  {
  e.printStackTrace();
  }
  }



Cor Nouws wrote:
 
 Hi Aloizio,
 
 aloizio wrote:
 
 I am trying to select all paragraph into the document. I am using the
 following:
 
   // Get the XParagraphCursor interface of the document cursor
   XParagraphCursor xParaCursor = (XParagraphCursor) 
   UnoRuntime.queryInterface( XParagraphCursor.class, curText
 );
 
   // Select all  paragraphs inserted
   xParaCursor. ?? 
 
 I do not work with Java. I know in the Basic libraries under Tools, 
 there are some useful examples.
 If you stil do not work with the praragraph style ;-) you could create a 
 viewcursor at the start, and extend it to the end of the doc. Pls see 
 the examples.
 
 Greetings,
 Cor
 
 -- 
 
 Cor Nouws
 

Re: [api-dev] How can I select all paragraphs from a Text?

2006-11-13 Thread Cor Nouws

Hello,

aloizio wrote:


I am already working with XStyle. See my code below:


Ah, I see.
And what you want to achieve is
- creating a new style,
- set properties,
- apply the style to your whole document?

Greetings,
Cor



  protected void Example (XComponent xComp)
  {
  try
  {


XTextDocument xTextDocument = (XTextDocument)

UnoRuntime.queryInterface(XTextDocument.class, xComp);

XText xText = xTextDocument.getText();
XTextCursor curText = xText.createTextCursor();

  // Go to the end of the document

//curText.gotoEnd( false );
curText.gotoEnd( false );
  
XMultiServiceFactory mxDocFactory = (XMultiServiceFactory)

UnoRuntime
.queryInterface(XMultiServiceFactory.class,xTextDocument); 

  
  // Create a new style from the document's factory
  XStyle xStyle = (XStyle) UnoRuntime.queryInterface( 
  XStyle.class, mxDocFactory.createInstance( 
  com.sun.star.style.ParagraphStyle ) );
  
  // Access the XPropertySet interface of the new style

  XPropertySet xStyleProps = (XPropertySet)
UnoRuntime.queryInterface(
  XPropertySet.class, xStyle );
  
  // Give the new style a light blue background

  xStyleProps.setPropertyValue ( ParaBackColor, new Integer
(13421823));
  xStyleProps.setPropertyValue(ParaLeftMargin, new Integer(200));
  xStyleProps.setPropertyValue(ParaFirstLineIndent, new
Integer(2500));
  xStyleProps.setPropertyValue(ParaLineNumberCount,Boolean.TRUE); 
  LineSpacing linha = new LineSpacing();

  linha.Height = 150;
  linha.Mode = LineSpacingMode.PROP;
  xStyleProps.setPropertyValue(ParaLineSpacing, linha);
  xStyleProps.setPropertyValue(ParaAdjust, ParagraphAdjust.BLOCK);
  xStyleProps.setPropertyValue(ParaRightMargin, new Integer(100));
  
  // Get the StyleFamiliesSupplier interface of the document

  XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier)
  UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
xTextDocument);

  // Use the StyleFamiliesSupplier interface to get the XNameAccess
  // interface of the actual style families
  XNameAccess xFamilies = ( XNameAccess ) UnoRuntime.queryInterface
( 
  XNameAccess.class, xSupplier.getStyleFamilies() );


  // Access the 'ParagraphStyles' Family
  XNameContainer xFamily = (XNameContainer )
UnoRuntime.queryInterface ( 
  XNameContainer.class,

  xFamilies.getByName ( ParagraphStyles ) );

  // Insert the newly created style into the ParagraphStyles family
  xFamily.insertByName ( All-Singing All-Dancing Style, xStyle );

  // Get the XParagraphCursor interface of the document cursor
  XParagraphCursor xParaCursor = (XParagraphCursor) 
  UnoRuntime.queryInterface( XParagraphCursor.class, curText );
  
  curText.gotoEnd ( false );

  xParaCursor.gotoPreviousParagraph ( false );
  xParaCursor.gotoPreviousParagraph ( true );
  xParaCursor.gotoPreviousParagraph ( true );

  
  // Select the first paragraph inserted

  //xParaCursor.gotoPreviousParagraph ( false );
  //xParaCursor.gotoPreviousParagraph ( true );
  
  // Access the property set of the cursor selection

  XPropertySet xCursorProps = (XPropertySet)
UnoRuntime.queryInterface(
  XPropertySet.class, curText ); 


  // Set the style of the cursor selection to our newly created
style
  xCursorProps.setPropertyValue ( ParaStyleName,
  All-Singing All-Dancing Style );

  // Go back to the end
  //curText.gotoEnd ( false );
  curText.gotoEnd(false);
  
  
  // Select the last paragraph in the document

  xParaCursor.gotoNextParagraph ( true );
  
  // And reset it's style to 'Standard' (the programmatic name for

  // the default style)
  xCursorProps.setPropertyValue ( ParaStyleName, All-Singing
All-Dancing Style );
  }
  catch (Exception e) 
  {

  e.printStackTrace();
  }
  }



Cor Nouws wrote:


Hi Aloizio,

aloizio wrote:



I am trying to select all paragraph into the document. I am using the
following:

 // Get the XParagraphCursor interface of the document cursor
 XParagraphCursor xParaCursor = (XParagraphCursor) 
 UnoRuntime.queryInterface( XParagraphCursor.class, curText

);

 // Select all  paragraphs inserted
 xParaCursor. ?? 


I do not work with Java. I know in the Basic libraries under Tools, 
there are some useful examples.
If you stil do not work with the 

Re: [api-dev] How can I select all paragraphs from a Text?

2006-11-13 Thread aloizio

Yes, only this.



Cor Nouws wrote:
 
 Hello,
 
 aloizio wrote:
 
 I am already working with XStyle. See my code below:
 
 Ah, I see.
 And what you want to achieve is
 - creating a new style,
 - set properties,
 - apply the style to your whole document?
 
 Greetings,
 Cor
 
 
   protected void Example (XComponent xComp)
   {
   try
   {
 
 
 XTextDocument xTextDocument = (XTextDocument)
 UnoRuntime.queryInterface(XTextDocument.class, xComp);
 
 XText xText = xTextDocument.getText();
 XTextCursor curText = xText.createTextCursor();
 
   // Go to the end of the document
 //curText.gotoEnd( false );
 curText.gotoEnd( false );
   
 XMultiServiceFactory mxDocFactory = (XMultiServiceFactory)
 UnoRuntime
 .queryInterface(XMultiServiceFactory.class,xTextDocument); 
 
   
   // Create a new style from the document's factory
   XStyle xStyle = (XStyle) UnoRuntime.queryInterface( 
   XStyle.class, mxDocFactory.createInstance( 
   com.sun.star.style.ParagraphStyle ) );
   
   // Access the XPropertySet interface of the new style
   XPropertySet xStyleProps = (XPropertySet)
 UnoRuntime.queryInterface(
   XPropertySet.class, xStyle );
   
   // Give the new style a light blue background
   xStyleProps.setPropertyValue ( ParaBackColor, new Integer
 (13421823));
   xStyleProps.setPropertyValue(ParaLeftMargin, new
 Integer(200));
   xStyleProps.setPropertyValue(ParaFirstLineIndent, new
 Integer(2500));
  
 xStyleProps.setPropertyValue(ParaLineNumberCount,Boolean.TRUE); 
   LineSpacing linha = new LineSpacing();
   linha.Height = 150;
   linha.Mode = LineSpacingMode.PROP;
   xStyleProps.setPropertyValue(ParaLineSpacing, linha);
   xStyleProps.setPropertyValue(ParaAdjust,
 ParagraphAdjust.BLOCK);
   xStyleProps.setPropertyValue(ParaRightMargin, new
 Integer(100));
   
   // Get the StyleFamiliesSupplier interface of the document
   XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier)
   UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
 xTextDocument);
 
   // Use the StyleFamiliesSupplier interface to get the
 XNameAccess
   // interface of the actual style families
   XNameAccess xFamilies = ( XNameAccess )
 UnoRuntime.queryInterface
 ( 
   XNameAccess.class, xSupplier.getStyleFamilies() );
 
   // Access the 'ParagraphStyles' Family
   XNameContainer xFamily = (XNameContainer )
 UnoRuntime.queryInterface ( 
   XNameContainer.class,
   xFamilies.getByName ( ParagraphStyles ) );
 
   // Insert the newly created style into the ParagraphStyles
 family
   xFamily.insertByName ( All-Singing All-Dancing Style, xStyle
 );
 
   // Get the XParagraphCursor interface of the document cursor
   XParagraphCursor xParaCursor = (XParagraphCursor) 
   UnoRuntime.queryInterface( XParagraphCursor.class, curText
 );
   
   curText.gotoEnd ( false );
   xParaCursor.gotoPreviousParagraph ( false );
   xParaCursor.gotoPreviousParagraph ( true );
   xParaCursor.gotoPreviousParagraph ( true );
 
   
   // Select the first paragraph inserted
   //xParaCursor.gotoPreviousParagraph ( false );
   //xParaCursor.gotoPreviousParagraph ( true );
   
   // Access the property set of the cursor selection
   XPropertySet xCursorProps = (XPropertySet)
 UnoRuntime.queryInterface(
   XPropertySet.class, curText ); 
 
   // Set the style of the cursor selection to our newly created
 style
   xCursorProps.setPropertyValue ( ParaStyleName,
   All-Singing All-Dancing Style
 );
 
   // Go back to the end
   //curText.gotoEnd ( false );
   curText.gotoEnd(false);
   
   
   // Select the last paragraph in the document
   xParaCursor.gotoNextParagraph ( true );
   
   // And reset it's style to 'Standard' (the programmatic name
 for
   // the default style)
   xCursorProps.setPropertyValue ( ParaStyleName, All-Singing
 All-Dancing Style );
   }
   catch (Exception e) 
   {
   e.printStackTrace();
   }
   }
 
 
 
 Cor Nouws wrote:
 
Hi Aloizio,

aloizio wrote:


I am trying to select all paragraph into the document. I am using the
following:

  // Get the XParagraphCursor interface of the document cursor
  XParagraphCursor xParaCursor = (XParagraphCursor) 
  UnoRuntime.queryInterface( XParagraphCursor.class, curText
);

  // Select all  paragraphs inserted
  

Re: [api-dev] How can I select all paragraphs from a Text?

2006-11-13 Thread Cor Nouws

aloizio wrote:


Ah, I see.
And what you want to achieve is
- creating a new style,
- set properties,
- apply the style to your whole document?



Yes, only this.



And could it be a possibility to change the already applied style?



--

Cor Nouws
Arnhem - Netherlands
nl.OpenOffice.org - marketing contact

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: [api-dev] printing current sheet

2006-11-13 Thread Marc Santhoff
Am Montag, den 13.11.2006, 17:48 +0100 schrieb Mathias Röllig:

 So the question is: how can i figure out, which print page number has
 the actual sheet? Or, how can i figure out, on which print page(s) will
 a special print area reside?

You can't, OO.o does not allow to do so. This should be worth an RFE (if
not already written).

As a workaround you can:

- try to use the print preview (not tested, would be an interesting
solution)

- use the PrintAreas of the calc doc:
  - store old print areas - Sheet.getPrintAreas()
  - set a new one for the used range of the sheet you want to print,
maybe adapt scaling to 100%
  - print
  - restore old print areas

Have fun,
Marc


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] printing current sheet

2006-11-13 Thread Mathias Röllig
Hello Marc!

Am 14.11.2006 00:09 schrieb Marc Santhoff:
 So the question is: how can i figure out, which print page number has
 the actual sheet? Or, how can i figure out, on which print page(s) will
 a special print area reside?

 You can't, OO.o does not allow to do so. This should be worth an RFE (if
 not already written).

That I already imagined. :-(


 - try to use the print preview (not tested, would be an interesting
 solution)

 - use the PrintAreas of the calc doc:
   - store old print areas - Sheet.getPrintAreas()
   - set a new one for the used range of the sheet you want to print,
 maybe adapt scaling to 100%
   - print
   - restore old print areas

I also imagined that it could be a solution if i define no print areas
and only set one with the print job.

Thank you.

Greetings, Mathias
-- 
·-· cut here ·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-8·-·

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Multiple instances / creating user installations

2006-11-13 Thread Tobias Krais
Good morning Kai,

 As you wrote the non-GUI use case is neglected in your argumentation. In
 my opinion, there should be a solution for this use case, too.

  What do you suggest?

Good question. My aim is, to allow bootstrapping a completly new
installed OOo, without any graphic interruptions. E.g. I wrote a
converter and it would be very harmful if it does not work without
klicking through the FirstStartWizard.

To reach this aim, there are some possible solutions. Some might not
work, because I don't know the code or the architecture behind.

1. If OOo is bootstrapped and a document is opened in hidden mode -
don't show any wizard. Show the wizard next time when OOo is opened visible.

2. Allow bootstrapping with a PropertyValue, where I can change the
behaviour myself.

May be someone knows even a third solution. Kai, what do you think about it?

Greetings, Tobias

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Document title

2006-11-13 Thread Andreas Schlüns

Paolo Mantovani schrieb:


Hi Bernard,

Alle 19:37, domenica 12 novembre 2006, Bernard Marcelly ha scritto:

Bonjour Paolo

There is a solution, using getArgs() from the document. 


Please note: The property Title of the list of arguments of a model
isnt better (means more stable) then using the Title property of the 
frame.


E.g. database documents (more over her sub documents a'la formulars, 
designs etcpp.) wont support this argument currently (not in every 
situation).


That's why I've started to refactor the whole title feature.
As Mathias mentioned: cws[titles01] is your friend.

Regards
Andreas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Server inside a Protocol Handler

2006-11-13 Thread Andreas Schlüns

Tabish F. Mufti schrieb:


You can avoid these problems, if you write your protocol handler as a
multi-instance service.


So how can I write a multi-instance service ?


The difference between multi-instance and one instance service 
(singleton) will be made on creation time.


Every java service must have a statuc function called 
__getServiceFactory(). Here you decide, if you return a factory 
creating new instances of your classes every time ... or if you create 
one singleton of your service only and return always the same instance.


Please read the devlopers guide:
http://api.openoffice.org/docs/DevelopersGuide/Components/Components.xhtml;
especialy chapter 4.5 Simple Component in Java.




I you wish to access your server everytimes a menu / toolbar item is
clicked ... you have to implement your ProtocolHandler / Job as
singleton.


I need to access my server from the menu/toolbar as well as through the
ooimpress slide, it'll probably be some button placed on every slide on
which click event I want to contact the server. So would it work for both
cases ?




Yes; that's possible. You need:

a) a singleton UNO service implementing your server
b) a multi UNO service as ProtocolHandler

What's happen then ?

Every times you click into the menu/toolbar a new instance of your
ProtocolHandler will be created. These ProtocolHandler internaly will 
create the server (as UNO service!). But everytimes you will get the 
same server instance (because it's a singleton). So the ProcotolHandler 
can work on these server and if the dispatch() call was finished the 
ProtocolHandler can die. The server will stay alive (because it's hold 
alive by UNO and the factory).


So you will have 1 Server and N ProtocolHandler.

Please note: the server will live for the whole time the office runs.
So the server must be informed in case the office will shutdown.
The best way is to implement the interface com.sun.star.lang.XComponent 
on the server. UNO will call it's dispose() method then. So the server 
knows when the office will die.


BUT: You shouldnt make expensive things inside this dispose() call.
Because if this call reach you most parts of the office was already
released. If you whish to have a more featured environment on shutdown 
you must register your server as listener on the right places.


The communication between your ProtocolHandler services and your UNO 
service implementation can use UNO interfaces only. Two solutions are 
possible:


i) You design zour own set own interfaces and methods using IDL files.
ii) You recylce existing interfaces of the namespace com.sun.star .-)
E.g. the XDispatch API seams to be flexible enough to implement every 
communication between two objects .-))


Hopefully this helps you a little bit.
Regards
Andreas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]