[api-dev] TextCursor at ViewCursor

2005-01-29 Thread Marc Santhoff
Hi!

Since some people are discussing BASIC issues, I'd like to ask somthing,
too:

In a text document, how can i get a XTextCursor at the current position
of the ViewCursor?

The only way I found until now is to mark from the ViewCursor to the
start of the doc, get the selected text and from that the end and make a
cursor there.

That somewhat complicated and not very intuitive. Hopefully there is a
shorter and more self explaning technique to achieve it...

TIA,
Marc



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




[api-dev] Re: [users] Creating documents programmatically using UNO and MSVC

2005-01-29 Thread G. Roderick Singleton
On Sat, 2005-01-29 at 17:26 +0100, Antonio Leonforte wrote:
 Hi all,
 
  
 
 this is my first post on this list. I have searched for a while for the info
 I need, but I could find nothing helpful. Please let me know it this is not
 the appropriate list to post to.  I would make clear first that I am NOT a
 OpenOffice developer, I just would like to USE OpenOffice to create .doc
 documents programmatically (i.e. by invoking UNO API from a C++
 application).
 
  
 
 I have spent a couple of days compiling UNO IDL and finally succeeded in
 coding a test C++ application, compiling and linking it with MSVC 6.0. My
 problem is that I get a crash the very first invocation of a UNO API class
 method. I checked and the code seems to be ok, maybe I need to set some
 compiler option? Does anyone here have some experience in crating documents
 programmatically within a MSVC application ?
 
  
 
 Thanks in advance.
 
  
 
 Antonio Leonforte
 
 INTEGRA Sisyemi.
 
  
 

Chance are you will get more appropriate and pithy answers from the api
project. I am forwarding this to the most active list this project has
and I recommend you look for most of your answers there. \
-- 
Documentation Co-Lead
PLEASE - keep list traffic on the list.  Email sent directly to me may
be ignored utterly.

Dinna meddle wi' things ye ken nuthin' aboot!
J.Herriot


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



Re: [api-dev] TextCursor at ViewCursor

2005-01-29 Thread Marc Santhoff
Am Sa, den 29.01.2005 schrieb Darragh Sherwin um 18:15:
 Marc,

Hi Darragh,

 Marc Santhoff wrote:
  In a text document, how can i get a XTextCursor at the current position
  of the ViewCursor?
 
 viewCursor = document.getCurrentController().getViewCursor()
 textCursor = document.Text.createTextCursor()
 
 //TextCursors include the TextRange service
 viewCursorRange = viewCursor.getEnd()
 
 textCursor.gotoRange( viewCursorRange )

This works (as expected), but I've been unclear in my question:

In fact I want to have a TextCursor at the same position in the main
text as the ViewCursor. The cause is that A ViewCursor doesn't implement
the optional interface XDodumentInsertable, a TextCursor does.

I think the way I used was lengthly but okay. I can change it using a
smaller step to get a selection and fetch the selections TextRanges end.

This may be worth an issue, it would be nice to have without letting the
cursor jump around...

Thank you very much,
Marc



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



Re: [api-dev] TextCursor at ViewCursor

2005-01-29 Thread Laurent Godard
Hi,

In a text document, how can i get a XTextCursor at the current position
of the ViewCursor?
viewCursor = document.getCurrentController().getViewCursor()
textCursor = document.Text.createTextCursor()
//TextCursors include the TextRange service
viewCursorRange = viewCursor.getEnd()
textCursor.gotoRange( viewCursorRange )
You may try
viewCursor = document.getCurrentController().getViewCursor()
textCursor = document.Text.createTextCursorByRange(viewCursor)
Laurent
--
Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org
Indesko  http://www.indesko.com
Nuxeo CPS  http://www.nuxeo.com - http://www.cps-project.org
Livre Programmation OpenOffice.org, Eyrolles 2004
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


[api-dev] Looking for demo MSVC++ projects controlling OpenOffice in order to programmatically create MSWord-compatible documents

2005-01-29 Thread Antonio Leonforte








Hi all,

this is my first post on this list (I actually have been redirected to this list after having
posted to a more general one). 



I would like to use OpenOffice to create .doc documents
programmatically by invoking UNO API from a C++ application. My dev environment is Win2K, MSVC6.0 and QT. Although Im
developing on Win I would like to keep my code portable, thats why Im
using QT for the GUI and why I would like to use OpenOffice to create my
documents programmatically (rather than controlling MS Word via OLE automation,
as I have already done in the past).



I have to admit I thought
it could have been an easier task. However I have
spent a couple of days compiling UNO IDL and finally succeeded in coding a test
C++ application, compiling and linking it with MSVC 6.0.



My problem is that I get a crash the very first
invocation of a UNO API class method. I checked and the code seems to be ok,
maybe I need to set some compiler option? Does anyone here have some experience
in crating documents programmatically within a MSVC application ? Are there some ready-made MSVC demo projects
ready to be compiled and run ?



Thanks in advance.



Antonio Leonforte

INTEGRA Sistemi










Re: [api-dev] Python in 1.9.74

2005-01-29 Thread Andrew Douglas Pitonyak

Ian Laurenson wrote:
I have put together a uno package that contains a Python component. The
component uses the os module. The package installs and runs fine 1.1.4.
In 1.9.74 (for Linux - Mandrake 10.1) I get the following error message
when installing the package via:
Tools  Package Manager...  My Packages (need to select OpenOffice.org
packages and then reselect My Packages for the add button to become
active)  Add... select the file.
(com.sun.star.uno.RuntimeException) { { Message = pythonloader:
couldn't find core lement pythonloader.Loader, Context =
(com.sun.star.uno.XInterface) 0x0 } }
Do I need to package the uno file differently or is there a bug or ...?
The file is available from:
http://qa.openoffice.org/issues/show_bug.cgi?id=41011
Thanks, Ian
 

I have also seen this while trying to install some of Ian's really cool 
and very useful things

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm
Free Info:  http://www.pitonyak.org/oo.php
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


[api-dev] How to create a database in OOo 2.0?

2005-01-29 Thread Andrew Douglas Pitonyak
I am so close, I can smell it, but it does not work. Any comments on the 
steps that I am missing... I think that I need to set default keys and 
that sort of thing...

The following macro tries to create a databsae document...
Sub NewDB
 Dim sDBUrl As String  'URL of a New Database document.
 Dim sTableName As String  'The name of the table to creat.
 Dim oDoc  'The newly created database document.
 Dim oTable'A table in the database.
 Dim oTables
 Dim oDescriptor
 Dim oCols
 Dim sName As String
 sDBUrl = private:factory/sdatabase
 sTableName = Address
 sName = ConvertToURL(C:\OODB\Address01.odb)
 'First, create the database document and set the database type
 oDoc = StarDesktop.loadComponentFromURL(sDBUrl,_blank,0,Array())
 oDoc.Name = sName
 oDoc.URL = sdbc:embedded:hsqldb
 REM Logically, I expect that I can call create instance on the database
 REM document. Unfortunately, this is not correct.
 oTables = oDoc.getTables()
 If (oTables.getCount()  1) Then
   oTable = oTables.createInstance(com.sun.star.sdbcx.Table)
   oCols = oTable.getColumns()
   oDescriptor = oCols.createDataDescriptor()
   oDescriptor.IsNullable = 0
   oDescriptor.Precision = 50
   oDescriptor.Name = LastName
   oDescriptor.Type = 12
   oDescriptor.TypeName = VARCHAR
   oCols.appendByDescriptor(oDescriptor)
   REM I do not have to create a new descriptor, I can use the existing 
one.
   REM This makes things easier if I add similar columns.
   oDescriptor.Name = FirstName
   oCols.appendByDescriptor(oDescriptor)

   oDescriptor.Name = Address
   oDescriptor.IsNullable = 1
   oDescriptor.Precision = 200
   oCols.appendByDescriptor(oDescriptor)
   oDescriptor.Name = City
   oDescriptor.Precision = 50
   oCols.appendByDescriptor(oDescriptor)
   oDescriptor.Name = StateOrProvince
   oCols.appendByDescriptor(oDescriptor)
   oDescriptor.Name = PostalCode
   oDescriptor.Precision = 20
   oCols.appendByDescriptor(oDescriptor)
   oDescriptor.Name = PhoneNumber
   oDescriptor.Precision = 30
   oCols.appendByDescriptor(oDescriptor)
   oDescriptor.Name = FaxNumber
   oCols.appendByDescriptor(oDescriptor)
   oDescriptor.Name = MobileNumber
   oCols.appendByDescriptor(oDescriptor)
   oDescriptor.Name = DateUpdated
   oDescriptor.Precision = 0
   oDescriptor.Type = 91
   oDescriptor.TypeName = DATE
   oCols.appendByDescriptor(oDescriptor)
   oDescriptor.Name = CountryOrRegion
   oDescriptor.Precision = 50
   oDescriptor.Type = 12
   oDescriptor.TypeName = VARCHAR
   oCols.appendByDescriptor(oDescriptor)
   oTables.insertByName(sTableName, oTable)
 End If
 oDoc.store()
End Sub

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm
Free Info:  http://www.pitonyak.org/oo.php
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]