[api-dev] Refreshing data on sections

2008-11-24 Thread Adrien Schiehle

Hi,

I've got a problem with a form I created with OoBase version 3.
Programming language : Basic.

I've created a form wich contains dynamic sections : Sections that can 
target different files (and different sections in these files) in 
function of the current entries. (type and subtype of an equipement)
Those sections contain data store in database. The same filter is used 
outside and inside the sections in order to see what must be shown.


My problem is as follow :
When I load the form, the sections are correctly loaded and contains the 
right datas.
But then, when I change the entry option, the sections change but the 
link to the database seems to be destroy.
I don't understand how we can refresh the link without coming back to 
the previous state of the sections


I've tried things like :
  - oForm.reload()
or
  - oSection.SetPropertyValue(isAutomaticUpdate, True)

But those functions have the side effect that my sections are coming 
back to the previous states.


If someone can help me... you will find bellow the two subs I use to 
change the sections


Thanks in advance,

SCHIEHLE Adrien


Here are the two simple Sub I use to change sections.
##
rem
'LinkSection : Link a subsection of the targetted file to the section
rem
Sub LinkSection(oDoc As Object, aSectionName As String, aLinkRegion As 
String)

   Dim oSection As Object
  
   oSection = oDoc.GetTextSections.GetByName(aSectionName)
  
   If oSection.GetPropertyValue(LinkRegion)  aLinkRegion Then
  
   oSection.SetPropertyValue(LinkRegion, aLinkRegion)
  
   End If
  
  
End Sub



##
rem
'LinkSectionFile : Link a file to the section
rem
Sub LinkSectionFile(oDoc As Object, aSectionName As String, aFileLink As 
String)

   Dim oSection As Object
   Dim vFileLink As New com.sun.star.text.SectionFileLink
  
   oSection = oDoc.GetTextSections.GetByName(aSectionName)
  
'If oSection.GetPropertyValue(FileLink)  aFileLink Then
  
   vFileLink.FileURL = aFileLink

   vFileLink.FilterName = writer8
  
   oSection.SetPropertyValue(FileLink, vFileLink)
 
'   End If
 
End Sub


##

Those subs are called when the entry options change. Depending of the 
change I call only 'LinkSection' or the two subs.


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



[api-dev] Refreshing data on sections

2008-11-24 Thread Lina Kemmel
Return Receipt
   
   Your   [api-dev] Refreshing data on sections
   document:   
   
   wasLina Kemmel/Israel/IBM   
   received
   by: 
   
   at:24/11/2008 14:12:04  
   





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



Re: [api-dev] problem with .uno:InsertField ... it creates Date(fixed)

2008-11-24 Thread [EMAIL PROTECTED]

Thank you very much for the fast answer Juergen ...
I already used the  Uno Api and it worked perfectly =)...

I posted the thread because i found it as an example and i wanted to test
it.. I could not make it work that is why i was looking for an answer...

Thanks a lot..




Juergen Schmidt-3 wrote:
 
 why not using the UNO API instead of the dispatch API. Well it is also 
 an UNO API but i would recommend that you use it with the normal API for 
 text fields. The SDK should provide an example and in the DevGuide 
 (http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/Text_Fields)
  
 you read about the different available field types and concepts.
 
 Juergen
 
 [EMAIL PROTECTED] wrote:
 Hello, 
 
 I am trying to insert through java code a userfield in the List of fields
 (Insert-Fields-Other-Variables(tab)-Userfield) but i get all the time
 when i run the program Date(Fixed)
 The code i am using is the following 
 
 /
 PropertyValue[] properties = new PropertyValue[6];
 
 properties[0] = new PropertyValue();
 properties[0].Name = Type;
 properties[0].Value = 20; 
 properties[1] = new PropertyValue();
 properties[1].Name = SubType;
 properties[1].Value = 1; 
 properties[2] = new PropertyValue();
 properties[2].Name = Name;
 properties[2].Value = someName;
 properties[3] = new PropertyValue();
 properties[3].Name = Content;
 properties[3].Value = someValue;
 properties[4] = new PropertyValue();
 properties[4].Name = Seperator;
 properties[4].Value =  ; 
 properties[5] = new PropertyValue();
 properties[5].Name = Format;
 properties[5].Value = -1; 
 
 XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class,
 this.xComponent); 
 XController xController = xModel.getCurrentController();
 XDispatchProvider xDispatchProvider =
 (XDispatchProvider)UnoRuntime.queryInterface(XDispatchProvider.class,
 xController.getFrame());
 XMultiServiceFactory xMultiServiceManager =
 (XMultiServiceFactory)
 UnoRuntime.queryInterface(XMultiServiceFactory.class,
 mxRemoteContext.getServiceManager()); 
 Object oDispatchHelper = null; 
 try{ 
 oDispatchHelper = xMultiServiceManager.createInstance(
 com.sun.star.frame.DispatchHelper); 
 } catch(com.sun.star.uno.Exception e) {
 if (debug  0) System.out.println(Can't get the Dispatch Handler
 Object...);
 if (debug  1) System.out.println(e); 
 } 
 XDispatchHelper xDispatchHelper = (XDispatchHelper)
 UnoRuntime.queryInterface(XDispatchHelper.class,oDispatchHelper); 
 // Executing the commandURL 
 xDispatchHelper.executeDispatch(xDispatchProvider,
 .uno:InsertField,
 , 0, properties);
 
 
 
 //
 
 Is there something wrong with it?
 
 For the propertyValues i recorded the actions i wanted to produce and
 from
 there i have taken the values for the Type and Subtype... Is there
 somewhere
 all these values listed so i don't need to record???
 
 Many thanks in advance..
 Ciao
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/problem-with-.uno%3AInsertField-...-it-creates-Date%28fixed%29-tp20657945p20675714.html
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]