I understand..don't you know another method that can i use to insert and Index entry or something similar??

Jürgen Schmidt ha scritto:
Jürgen Schmidt wrote:
Hi Cristian,


Cristian Fonti wrote:
Sorry, but if you don't use the ContentIndexMark, what kind of Index do you use???

ups, sorry i misunderstand you. Now it is clear what you want. I will try it again.

as far as i can remember me it is not possible for index entries. In a content table it is a 1:1 relation between heading and the entry in the content table where you can easily use a link. For index entries it is not necessarily a 1:1 relation - you can have more than one equal index entries and on different pages or even on the same page. Which target should the link have? It would make sense maybe to link the page numbers and this of course makes sense for one entry per page only. Ok you can argue that in the case of two equal index entries on a page the link goes to the first one and it would probably a good default - but it is not implemented.

You can submit a feature request and can hope that a lot of people vote for it. I would assume that the priority won't be high without a high number of votes.

Sorry Juergen



Juergen



Jürgen Schmidt ha scritto:
Cristian Fonti wrote:
First of all thanks..
i try to use the TokenType, but nothing...maybe could be a problem in the code of the Entry??
This is my code:

[CODE]

mxDocFactory = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, xTextDocument); XPropertySet xEntry=(XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, mxDocFactory.createInstance("com.sun.star.text.ContentIndexMark"));
xEntry.setPropertyValue("AlternativeText",titolo_indice);
xEntry.setPropertyValue("Level",new Short ( (short) 1));
XTextContent xEntryContent=(XTextContent) UnoRuntime.queryInterface(XTextContent.class,xEntry);
Text.insertTextContent(TextCursor,xEntryContent,false);

[/CODE]

i have tested your program without the ContentIndexMark and without ...


and this is how i create the TOC:

[CODE]
mxDocFactory = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, xTextDocument); Object contentIndex=mxDocFactory.createInstance("com.sun.star.text.ContentIndex"); XPropertySet xIndex=(XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,
                                                      contentIndex);
XNamed xNamed=(XNamed)UnoRuntime.queryInterface(XNamed.class,contentIndex);
xNamed.setName("INDICE");

... xNamed.setName(), it's not necessary. I run it on a text document where i have inserted several lines (used styles heading1 - heading3) and it works fine for me. I got a content table with hyperlinks to the appropriate heading.

Juergen

xIndex.setPropertyValue("Level",new Short ( (short) 10));
xIndex.setPropertyValue("CreateFromOutline",new Boolean(true));
xIndex.setPropertyValue("IsProtected",new Boolean(false));
XTextContent xIndexContent=(XTextContent)UnoRuntime.queryInterface(XTextContent.class,xIndex); XDocumentIndex xDocIndex=(XDocumentIndex)UnoRuntime.queryInterface(XDocumentIndex.class,xIndex);
xText.insertTextContent(xTextCursor,xIndexContent,false);

XIndexReplace levelFormat=(XIndexReplace) UnoRuntime.queryInterface(
XIndexReplace.class, xIndex.getPropertyValue("LevelFormat") );
for ( int i=0; i<levelFormat.getCount(); i++ )
{
                  Object oo=levelFormat.getByIndex(i);
PropertyValue[][] propertyvalues = new PropertyValue[8][]; PropertyValue[] propertyvaluesentry = new PropertyValue[2];
                  propertyvalues[0]=propertyvaluesentry;
                  PropertyValue pv=new PropertyValue();
                  pv.Name="TokenType";
                  pv.Value="TokenEntryNumber";
                  propertyvaluesentry[0]=pv;
                  pv=new PropertyValue();
                  pv.Name="CharacterStyleName";
                  pv.Value="";
                  propertyvaluesentry[1]=pv;
propertyvaluesentry = new PropertyValue[2];
                  propertyvalues[1]=propertyvaluesentry;
                  pv=new PropertyValue();
                  pv.Name="TokenType";
                  pv.Value="TokenHyperlinkStart";
                  propertyvaluesentry[0]=pv;
                  pv=new PropertyValue();
                  pv.Name="CharacterStyleName";
                  pv.Value="";
                  propertyvaluesentry[1]=pv;
propertyvaluesentry = new PropertyValue[2];
                  propertyvalues[2]=propertyvaluesentry;
                  pv=new PropertyValue();
                  pv.Name="TokenType";
                  pv.Value="TokenEntryText";
                  propertyvaluesentry[0]=pv;
                  pv=new PropertyValue();
                  pv.Name="CharacterStyleName";
                  pv.Value="";
                  propertyvaluesentry[1]=pv;
propertyvaluesentry = new PropertyValue[2];
                  propertyvalues[3]=propertyvaluesentry;
                  pv=new PropertyValue();
                  pv.Name="TokenType";
                  pv.Value="TokenHyperlinkEnd";
                  propertyvaluesentry[0]=pv;
                  pv=new PropertyValue();
                  pv.Name="CharacterStyleName";
                  pv.Value="";
                  propertyvaluesentry[1]=pv;
propertyvaluesentry = new PropertyValue[4];
                  propertyvalues[4]=propertyvaluesentry;
                  pv=new PropertyValue();
                  pv.Name="TokenType";
                  pv.Value="TokenTabStop";
                  propertyvaluesentry[0]=pv;
                  pv=new PropertyValue();
                  pv.Name="TabStopRightAligned";
                  pv.Value=Boolean.TRUE;
                  propertyvaluesentry[1]=pv;
                  pv=new PropertyValue();
                  pv.Name="TabStopFillCharacter";
                  pv.Value=".";
                  propertyvaluesentry[2]=pv;
                  pv=new PropertyValue();
                  pv.Name="CharacterStyleName";
                  pv.Value="";
                  propertyvaluesentry[3]=pv;

                  propertyvaluesentry = new PropertyValue[2];
                  propertyvalues[5]=propertyvaluesentry;
                  pv=new PropertyValue();
                  pv.Name="TokenType";
                  pv.Value="TokenHyperlinkStart";
                  propertyvaluesentry[0]=pv;
                  pv=new PropertyValue();
                  pv.Name="CharacterStyleName";
                  pv.Value="";
                  propertyvaluesentry[1]=pv;

                  propertyvaluesentry = new PropertyValue[2];
                  propertyvalues[6]=propertyvaluesentry;
                  pv=new PropertyValue();
                  pv.Name="TokenType";
                  pv.Value="TokenPageNumber";
                  propertyvaluesentry[0]=pv;
                  pv=new PropertyValue();
                  pv.Name="CharacterStyleName";
                  pv.Value="";
                  propertyvaluesentry[1]=pv;

                  propertyvaluesentry = new PropertyValue[2];
                  propertyvalues[7]=propertyvaluesentry;
                  pv=new PropertyValue();
                  pv.Name="TokenType";
                  pv.Value="TokenHyperlinkEnd";
                  propertyvaluesentry[0]=pv;
                  pv=new PropertyValue();
                  pv.Name="CharacterStyleName";
                  pv.Value="";
                  propertyvaluesentry[1]=pv;
levelFormat.replaceByIndex ( i, propertyvalues );
}
XPropertySet xIndexProps=(XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,xDocIndex);
xIndexProps.setPropertyValue("Title","INDICE_AGG");
xDocIndex.update();
[/CODE]

Somewhere there is a problem, but i don't know where..



Peter Eberlein ha scritto:
Hi, Cristian,

Cristian Fonti schrieb:
Hi to all,
I see in the developer's guide how create an index in a writer document with the JAVA API. i would add at every page number in the index (or eventually in the title) a hyperlink to the right section..

I think you have to use the PropertyValue struct TokenType with its values TokenHyperlinkStart and ~End, as described in the DevGuide.

I would like to see a code snippet, when you have finished your examples.

Regards

Peter

---------------------------------------------------------------------
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]


---------------------------------------------------------------------
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]


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


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dott. Cristian Fonti
mailto: [EMAIL PROTECTED]
Centro Elaborazione Dati (CED) - Resp. Web Area
SCM Group S.p.a. http://www.scmgroup.com
via Emilia, 77 - 47900 Rimini (RN), Italy
Tel.: +39 0541 700163 Interno: 2163
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to