Include file error

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Include file error

rashi dhing
This is probably a very basic question but I am getting a compile error
while trying to include the
"interpre.hxx"  in my module which happens to be located in a new directory
in the sc/source/ui  path.
How can I resolve this ?

Many thanks,

Rashi
Reply | Threaded
Open this post in threaded view
|

Re: Include file error

Niklas Nebel
On 07/06/10 16:31, rashi dhing wrote:
> This is probably a very basic question but I am getting a compile error
> while trying to include the
> "interpre.hxx"  in my module which happens to be located in a new directory
> in the sc/source/ui  path.
> How can I resolve this ?

Header files in core/inc should be included only from the core
directory. Using ScInterpreter directly isn't a good idea anyway. Where
formulas are calculated (like validity or conditional formats), we
always use ScFormulaCell.

Niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Include file error

daniel.rentz
In reply to this post by rashi dhing
rashi dhing schrieb:
> This is probably a very basic question but I am getting a compile error
> while trying to include the
> "interpre.hxx"  in my module which happens to be located in a new directory
> in the sc/source/ui  path.
> How can I resolve this ?

There are several existing locations for header files:

sc/inc for usage in entire sc
sc/source/core/inc for headers local to "core"
sc/source/ui/inc for headers local to "ui"
sc/source/filter/inc for headers local to "filter"

Also, headers will be searched in the current directory, so, if you have
abc.hxx and abc.cxx files in the same directory, and in abc.cxx there is
code like
   #include "abc.hxx"
the header file should be found too.

How do you include the header file?


Regards
Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Include file error

rashi dhing
Thanks Niklas and Daniel. I was trying to call "interpre.hxx"
(sc/source/core/inc) from a cxx file in "sc/source/ui/newFolder" .
Wanted to use a certain function of the ScInterpreter class ! Can I give the
whole path "sc/source/core/interpre.hxx"  and use it ?


> There are several existing locations for header files:
>
> sc/inc for usage in entire sc
> sc/source/core/inc for headers local to "core"
> sc/source/ui/inc for headers local to "ui"
> sc/source/filter/inc for headers local to "filter"
>
> Also, headers will be searched in the current directory, so, if you have
> abc.hxx and abc.cxx files in the same directory, and in abc.cxx there is
> code like
>  #include "abc.hxx"
> the header file should be found too.
>
> How do you include the header file?
>
>
> Regards
> Daniel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
" Happiness makes up in height for what it lacks in length." (Robert Frost)
Reply | Threaded
Open this post in threaded view
|

Re: Include file error

Niklas Nebel
On 07/07/10 10:50, rashi dhing wrote:
> Thanks Niklas and Daniel. I was trying to call "interpre.hxx"
> (sc/source/core/inc) from a cxx file in "sc/source/ui/newFolder" .
> Wanted to use a certain function of the ScInterpreter class ! Can I give the
> whole path "sc/source/core/interpre.hxx"  and use it ?

I wouldn't recommend that. If you have a function that can be used
without ScInterpreter, you should move it out of interpre.hxx. If you're
creating an ScInterpreter instance to call your function, better use
ScFormulaCell instead.

Niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Include file error

Eike Rathke
Hi Rashi,

On Wednesday, 2010-07-07 11:09:00 +0200, Niklas Nebel wrote:

> On 07/07/10 10:50, rashi dhing wrote:
>> Wanted to use a certain function of the ScInterpreter class ! Can I give the
>> whole path "sc/source/core/interpre.hxx"  and use it ?
>
> I wouldn't recommend that. If you have a function that can be used  
> without ScInterpreter, you should move it out of interpre.hxx. If you're  
> creating an ScInterpreter instance to call your function, better use  
> ScFormulaCell instead.

The ScInterpreter ctor needs a ScFormulaCell anyway, calling
ScFormulaCell::Interpret() takes care of that. Then use
ScFormulaCell::GetErrCode() to check for error. As it seems you're
expecting a matrix result you may then use ScFormulaCell::GetMatrix(),
note that if the result was not a matrix a NULL pointer is returned and
depending on IsValue() you may use GetValue() or GetString() to obtain
the result.

You'll have to create the ScFormulaCell instance with the ctor that
takes a preconstructed ScTokenArray* and a BYTE as last parameter and
pass the MM_FORMULA constant there, otherwise the matrix result would be
thrown away and only the top left value survived as cell result.

  Eike

--
 OOo Calc core developer. Number formatter stricken i18n transpositionizer.
 Signature key 0x87F8D412 : 2F58 5236 DB02 F335 8304  7D6C 65C9 F9B5 87F8 D412
 OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
 Please don't send personal mail to the [hidden email] account, which I use for
 mailing lists only and don't read from outside Oracle. Use [hidden email] Thanks.

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Include file error

rashi dhing
Thanks Niklas & Eike. So if I have understood correctly, I need to add my
operation
to the list of functions (add,max etc.) so that when I call the
ScFormulaCell::Interpret,
the formula gets evaluated according to my function. But that requires an
opcode,
which I will have to generate ? Also, my formula follows a different grammar
!!

What If I evalute my formula in a separate function rather than call
interpret and just return
the answer in a matrix. How do I then print the matrix ?

This is tough work. Appreciate all your help !!

Rashi


On Wed, Jul 7, 2010 at 4:31 PM, Eike Rathke <[hidden email]> wrote

>
> The ScInterpreter ctor needs a ScFormulaCell anyway, calling
> ScFormulaCell::Interpret() takes care of that. Then use
> ScFormulaCell::GetErrCode() to check for error. As it seems you're
> expecting a matrix result you may then use ScFormulaCell::GetMatrix(),
> note that if the result was not a matrix a NULL pointer is returned and
> depending on IsValue() you may use GetValue() or GetString() to obtain
> the result.
>
> You'll have to create the ScFormulaCell instance with the ctor that
> takes a preconstructed ScTokenArray* and a BYTE as last parameter and
> pass the MM_FORMULA constant there, otherwise the matrix result would be
> thrown away and only the top left value survived as cell result.
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Include file error

Niklas Nebel-2
On 07/19/10 11:54, rashi dhing wrote:

> Thanks Niklas&  Eike. So if I have understood correctly, I need to add my
> operation
> to the list of functions (add,max etc.) so that when I call the
> ScFormulaCell::Interpret,
> the formula gets evaluated according to my function. But that requires an
> opcode,
> which I will have to generate ? Also, my formula follows a different grammar
> !!
>
> What If I evalute my formula in a separate function rather than call
> interpret and just return
> the answer in a matrix. How do I then print the matrix ?
>
> This is tough work. Appreciate all your help !!

If you don't want to add an OpCode and have your function called by
formula evaluation, ScInterpreter is the wrong place for the function.
Returning a ScMatrix might still be useful, but not necessarily so.

What are you really trying to do? It would help to know that.

Niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Include file error

rashi dhing
Hi Niklas, I have defined a formula that contains deductive clauses which
follow a different grammar and
I have already written the evaluation function, the result of which is a
matrix. I was thinking I could
just call ScInterpreter::PushMatrix which would print the result but again,
my function resides in the "ui"
module which limits access to ScInterpreter. I could define a function in
ScFormulaCell that calls
the pushmatrix function and call that function from my class. I hope i am
making sense.
If opcode is a better option, where do I go and add it ?

-Rashi


On Mon, Jul 19, 2010 at 1:09 PM, Niklas Nebel <[hidden email]>wrote:

>
> If you don't want to add an OpCode and have your function called by formula
> evaluation, ScInterpreter is the wrong place for the function. Returning a
> ScMatrix might still be useful, but not necessarily so.
>
> What are you really trying to do? It would help to know that.
>
>
> Niklas
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Include file error

Niklas Nebel-2
On 07/19/10 12:26, rashi dhing wrote:

> Hi Niklas, I have defined a formula that contains deductive clauses which
> follow a different grammar and
> I have already written the evaluation function, the result of which is a
> matrix. I was thinking I could
> just call ScInterpreter::PushMatrix which would print the result but again,
> my function resides in the "ui"
> module which limits access to ScInterpreter. I could define a function in
> ScFormulaCell that calls
> the pushmatrix function and call that function from my class. I hope i am
> making sense.
> If opcode is a better option, where do I go and add it ?

When and from where is that function called, and what do you want to do
with the results?

Niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Include file error

rashi dhing
I've defined a class which I call the ScDeductive in sc/source/ui/deductive.
I have defined a function "StartEval"
which evaluates the clause( formula ) and returns an array as a result. This
function is called from
"ScInputHandler::DataChanged" . I enter the formula in a cell but I would
like to display the result in a range
on the spreadsheet as the result is an array / matrix.
Can you tell me the right approach to do this !

Thanks,

Rashi

On Mon, Jul 19, 2010 at 4:00 PM, Niklas Nebel <[hidden email]>wrote:

>
> When and from where is that function called, and what do you want to do
> with the results?
>
>
> Niklas
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Include file error

Niklas Nebel-2
On 07/19/10 15:24, rashi dhing wrote:
> I've defined a class which I call the ScDeductive in sc/source/ui/deductive.
> I have defined a function "StartEval"
> which evaluates the clause( formula ) and returns an array as a result. This
> function is called from
> "ScInputHandler::DataChanged" . I enter the formula in a cell but I would
> like to display the result in a range
> on the spreadsheet as the result is an array / matrix.
> Can you tell me the right approach to do this !

Does that mean while a user is editing a cell, you want to put results
into other cells, overwriting the previous content of the cells?

Niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Include file error

rashi dhing
How it works is that the formula contains the range that will be populated
with the result and
only those cells of the range are filled with the result. So the issue of
overwriting previous
content does not apply here as only empty ranges are selected !!

Rashi

On Mon, Jul 19, 2010 at 7:14 PM, Niklas Nebel <[hidden email]>wrote:

>
> Does that mean while a user is editing a cell, you want to put results into
> other cells, overwriting the previous content of the cells?
>
>
> Niklas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
" Happiness makes up in height for what it lacks in length." (Robert Frost)
Reply | Threaded
Open this post in threaded view
|

Re: Include file error

Niklas Nebel-2
On 07/19/10 20:28, rashi dhing wrote:
> How it works is that the formula contains the range that will be populated
> with the result and
> only those cells of the range are filled with the result. So the issue of
> overwriting previous
> content does not apply here as only empty ranges are selected !!

It still seems unusual. Are these formulas supposed to be static, or
should they be updated when other cells change?

Anyway, if you modify cell content from UI code, you have to take care
of repaint, undo, formula updates, and possibly row heights. There's a
method ScDocFunc::SetCellText for a single cell, which handles this, or
you might do something similar to lcl_PutDataArray in cellsuno.cxx.

Niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Include file error

rashi dhing
Right now static would be fine but at a later stage I will want them to
dynamically update when other cells change.
Thanks,

Rashi

On Tue, Jul 20, 2010 at 1:47 PM, Niklas Nebel <[hidden email]>wrote:

>
> It still seems unusual. Are these formulas supposed to be static, or should
> they be updated when other cells change?
>
> Anyway, if you modify cell content from UI code, you have to take care of
> repaint, undo, formula updates, and possibly row heights. There's a method
> ScDocFunc::SetCellText for a single cell, which handles this, or you might
> do something similar to lcl_PutDataArray in cellsuno.cxx.
>
>
> Niklas
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Include file error

Eike Rathke
Hi rashi,

On Tuesday, 2010-07-20 20:09:38 +0300, rashi dhing wrote:

> Right now static would be fine but at a later stage I will want them to
> dynamically update when other cells change.

All change notifications of referenced cells to their dependents is done
based on the RPN token array of the referring formula cell, if your
approach doesn't use a ScFormulaCell and its ScTokenArray to hold the
formula it would need yet something different.

I still wonder what exactly you're trying to accomplish. Could you give
an example of how your formulas would look like, and give us details
what the difference is that you can't use the usual interpreter
approach?

  Eike

--
 OOo Calc core developer. Number formatter stricken i18n transpositionizer.
 Signature key 0x87F8D412 : 2F58 5236 DB02 F335 8304  7D6C 65C9 F9B5 87F8 D412
 OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
 Please don't send personal mail to the [hidden email] account, which I use for
 mailing lists only and don't read from outside Oracle, it will also phase out
 shortly. Use [hidden email] instead. Thanks.

attachment0 (196 bytes) Download Attachment