To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=63270
------- Additional comments from [EMAIL PROTECTED] Mon Mar 20 03:01:34 -0800
2006 -------
Ok, i think that i have found where is the problem: xCloseable.close() crash
only when i try to insert an image in the footer..
This is the method that i use:
protected void numeriDiPagina(boolean immaginefooter,CodiceStruct[]
codici,String percorso_img)
{
int i=0,j=0,count=0;
String urllogo_array[]=null;
String style_array[]=null;
String tagcomandi=null;
String comandi[]=null;
String temp_url=null;
int lunghezza=0;
int r=0;
String riduzione=null;
String subtagcomandi=null;
Integer alt,lar;
int newalt=0,newlar=0;
try {
//Vengono contante quante sezioni(keyform) ci sono nell'elenco dei
codici
for (i=0;i<codici.length;i++)
if (codici[i].ultimocodice)
count++;
urllogo_array=new String[count];
style_array=new String[count];
//Estraggo i valori di urllogo per i page_style tranne l'ultimo
for (i=0;i<codici.length;i++)
{
if (codici[i].keyform_succ!=null)
{
urllogo_array[j]=codici[i].urllogo;
if (j<(count-1))
style_array[j+1]=codici[i].keyform_succ;
j=j+1;
}
}
//Assegno l'ultimo urllogo che non viene preso dal ciclo precedente
perchè keyform_succ è nullo
urllogo_array[count-1]=codici[codici.length-1].urllogo;
//Assegno il primo stile
style_array[0]="Standard";
for (i=0;i<count;i++)
{
//Richiedo l'interfaccia per accedere agli stili
XStyleFamiliesSupplier StyleFam = (XStyleFamiliesSupplier)
UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
xTextDocument);
//Tramite l'interfaccia di accesso by Name, richiedo gli stili
della pagina
XNameAccess StyleFamNames = StyleFam.getStyleFamilies();
XNameAccess PageStyles = (XNameAccess)
UnoRuntime.queryInterface(XNameAccess.class,StyleFamNames.getByName("PageStyles"));
XStyle xStyle = (XStyle)
UnoRuntime.queryInterface(XStyle.class,PageStyles.getByName(style_array[i]));
XPropertySet xPropertySetStyle = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xStyle);
//Attivo i footer
xPropertySetStyle.setPropertyValue("FooterIsOn", "TRUE");
//Imposta la distanza del FOOTER dal corpo della pagina
if ( (immaginefooter) && (urllogo_array[i]!=null))
{
xPropertySetStyle.setPropertyValue("FooterBodyDistance",new
Integer(100));
//Per inserire l'immagine nel footer più a destra rispetto alla
linea dei codici
//Ricordarsi di cambiare anche la posizione del TABSTOP
xPropertySetStyle.setPropertyValue("FooterRightMargin",new
Integer(-1000));
}
else
xPropertySetStyle.setPropertyValue("FooterBodyDistance",new
Integer(1000));
//Richiedo l'interfaccia per scrivere nel footer
XText xTextfooter = (XText) UnoRuntime.queryInterface(XText.class,
xPropertySetStyle.getPropertyValue("FooterText"));
TextCursor = xTextfooter.createTextCursor();
//Imposto le proprietà di scrittura (allineamento,colore e
dimensione)
XPropertySet xCursorProps=(XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class,TextCursor);
xCursorProps.setPropertyValue("ParaAdjust",com.sun.star.style.ParagraphAdjust.CENTER);
xCursorProps.setPropertyValue("CharColor",new Integer(0x000000));
xCursorProps.setPropertyValue("CharHeight",new Float(10.0));
if ((immaginefooter) && (urllogo_array[i]!=null))
{
TabStop tb[]=new TabStop[2];
tb[0]=new TabStop();
tb[0].Alignment=com.sun.star.style.TabAlign.CENTER;
tb[1]=new TabStop();
tb[1].Alignment=com.sun.star.style.TabAlign.RIGHT;
tb[0].Position=8750;
tb[1].Position=18500; //All'inizio era 17500
xCursorProps.setPropertyValue("ParaTabStops",tb);
}
//Richiedo l'interfaccia per accedere alla Factory di creazione di
"ogggetti" per il documento
mxDocFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(
XMultiServiceFactory.class, xTextDocument);
//Creo l'istanza per i numeri di pagina
Object
pn=mxDocFactory.createInstance("com.sun.star.text.TextField.PageNumber");
//Richiedo l'interfaccia TextField(per il numero) e quella delle
proprietà del TextField
XTextField xTextField = (XTextField)
UnoRuntime.queryInterface(XTextField.class,pn);
XPropertySet xPropertySetTextField = (XPropertySet)
UnoRuntime.queryInterface(
XPropertySet.class,xTextField);
//Imposto le proprietà del numero
xPropertySetTextField.setPropertyValue("NumberingType",new
Short(NumberingType.ARABIC));
xPropertySetTextField.setPropertyValue("SubType",com.sun.star.text.PageNumberType.CURRENT
);
if ((immaginefooter) && (urllogo_array[i]!=null))
{
xTextfooter.insertString(TextCursor,"\t",false);
xTextfooter.insertTextContent(TextCursor, xTextField, false);
xTextfooter.insertString(TextCursor,"\t",false);
//xTextfooter.insertString(TextCursor,"IMM",false);
//Ottengo il TextRange in cui è contenuta la stringa
//Richiedo l'interfaccia della Factory per creare un'istanza di
un'oggetto grafico
mxDocFactory
=(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class,
xTextDocument);
Object gObject =
mxDocFactory.createInstance("com.sun.star.text.GraphicObject" );
XTextContent
gContent=(XTextContent)UnoRuntime.queryInterface(XTextContent.class, gObject);
XNamed xGOName = (XNamed)UnoRuntime.queryInterface(XNamed.class,
gObject); //AGGIUNTA
String nomeimmagine="ImmagineF";
xGOName.setName(nomeimmagine); //AGGIUNTA
//Richiedo l'interfaccia per accedere alle proprietà
dell'oggetto
XPropertySet ps =
(XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, gObject);
//Lo inserisco come ancorato ad un carattere
ps.setPropertyValue(
"AnchorType",TextContentAnchorType.AS_CHARACTER);
//ps.setPropertyValue("AnchorType",TextContentAnchorType.AT_PARAGRAPH);
//ps.setPropertyValue("SurroundAnchorOnly",new Boolean(true));
ps.setPropertyValue("GraphicURL",percorso_img+urllogo_array[i]);
//Inserisco l'immagine
xTextfooter.insertTextContent(TextCursor,gContent, false);
XTextRange xtrgObject=gContent.getAnchor();
String newurl=new String("");
// Primo oggetto grafico temporaneo.
Object jloShape1 =
mxDocFactory.createInstance("com.sun.star.drawing.GraphicObjectShape");
XShape xGOShape1 =
(XShape)UnoRuntime.queryInterface(XShape.class, jloShape1);
XTextContent xTCShape1 =
(XTextContent)UnoRuntime.queryInterface(XTextContent.class, xGOShape1);
XPropertySet xPSShape1 =
(XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xGOShape1);
// Secondo oggetto grafico temporaneo.
Object jloShape2 =
mxDocFactory.createInstance("com.sun.star.drawing.GraphicObjectShape");
XShape xGOShape2 =
(XShape)UnoRuntime.queryInterface(XShape.class, jloShape2);
XTextContent xTCShape2 =
(XTextContent)UnoRuntime.queryInterface(XTextContent.class, xGOShape2);
XPropertySet xPSShape2 =
(XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xGOShape2);
// Il primo oggetto temporaneo, punta allo stesso url
dell'immagine
xPSShape1.setPropertyValue("GraphicURL",percorso_img+urllogo_array[i]);
// Inserento il primo oggetto temporaneo, OpenOffice crea la sua
Bitmap
xtrgObject.getText().insertTextContent(xtrgObject, xTCShape1,
false);
// Assegna la Bitmap del primo oggetto grafico temporaneo al
secondo oggetto grafico temporaneo
xPSShape2.setPropertyValue("GraphicObjectFillBitmap",
xPSShape1.getPropertyValue("GraphicObjectFillBitmap"));
//Inserendo il secondo oggetto grafico temporaneo, OpenOffice
crea il suo URL interno (e la sua bitmap)
xtrgObject.getText().insertTextContent(xtrgObject, xTCShape2,
false);
// Ora si può eliminare il primo oggetto temporaneo
xtrgObject.getText().removeTextContent(xTCShape1);
// Estraggo l'URL interno dal secondo oggetto temporaneo
newurl = xPSShape2.getPropertyValue("GraphicURL").toString();
// Ed ora lo assegnamo alla immagine
ps.setPropertyValue("GraphicURL", newurl);
// Ora si può eliminare anche il secondo oggetto temporaneo
xtrgObject.getText().removeTextContent(xTCShape2);
}
else
{
//Inserisco il numero
xTextfooter.insertTextContent(TextCursor, xTextField, false);
}
}
}
catch (Exception e)
{
e.printStackTrace(System.out);
}
}
The first part of the method is used to count how many section(and so now many
styles) will be in the final document, then i insert the number of the page in
the center of the footer and with a \t i insert the image in the bottom-right
corner of the page..
If i don't insert the image, all is ok...
The very "fun" thing is that, if i run the program on a Window platform with my
local open_office, there aren't any kind of problem..the method XClose.close()
run correctly, and the office document close correctly (with the right image in
the footer)
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]