Hi Daniel / Noel,
Five interesting facts:
* The getValue and setValue is working perfectly fine wrt single Value
OUString or long. Its the third type uno::Sequence<
uno::Sequence<uno::Any> > that is not working :(
* The >>= and <<= is working perfectly fine for uno::Sequence<
uno::Sequence<uno::Any> > in the code sc/..../unoobj/cellsuno.cxx
--function--> getDataArray() (also check
ScRangeToSequence::FillMixedArray ).
* As Noel suggested, there is a possibility that something is going
wrong in "basic" module. "Any" to "OUString" conversion etc.
* One interesting fact is that, I had put printf in the code for
operator overloading ">>=" and "<<="
cppu/..../Any.hxx.
const Type & rType = getCppuType( &value ); //and also
rAny
rtl::OUString aName = rType.getTypeName();
print_oustring(aName); //my local function
and the printf gave proper result :) ie "[ ][ ] any" for both get and
set. I could not veryfy the data part of the
cppu/..../assign.hxx b'se it is bit complex.
* In the getValue() the values are filled properly ? Here is the test
code snippert that I had written before posting the query.
uno::Sequence< uno::Sequence< uno::Any > > aSeq =
xData->getDataArray();
uno::Any test = aSeq[0][0];
print_String_from_any(test); //my local function
aAny <<= aSeq; //Fill the data to Any
//testing the setValue scenario
uno::Sequence< uno::Sequence< uno::Any > > aSeqNew;
if (aAny >>= aSeqNew) {
uno::Any test = aSeqNew[0][0];
print_string_from_any(test); //my local
function
}
else print_error();
works as expected :)
Regards,
Jayant (aZEN_JM)
>>> [EMAIL PROTECTED] 08/25/05 6:20 PM >>>
Hello Jayant Balraj Madavi,
just tried the following which works like specified:
uno::Any a( static_cast<sal_Int32>(42) );
uno::Sequence<uno::Any> seq( &a, 1 );
typedef uno::Sequence< uno::Sequence<uno::Any> > seqseqT;
seqseqT seqseq( &seq, 1 );
uno::Any a2;
a2 <<= seqseq;
seqseqT dest;
bool succ = (a2 >>= dest);
sal_Int32 n = dest[0][0].get<sal_Int32>();
This leads me to the assumption that the Any is not filled with data
at
all in getValue().
regards,
-Daniel
> Hi stephan,
>
> Let me put clear code/query, The actual code is with reference to
the
> VBA interop work that we are doing for OOo
> so if a user writer a VBA script like this on OOo
> Activesheet.Range("A1:A3").value = Activesheet.Range("A4:A5").Value
>
> The above macro breaks down to ==>>
>
> MyClass obj1,obj2;
>
> obj.setValue (obj2.getValue());
>
> //the function getValue and setValue are described below.
> I always get the printf ERROR in the setValue :(
>
> The same function works properly if I directly work with
> [uno::Sequence< uno::Sequence< uno::Any > >] instead of return type
> [uno::Any]
> but I have to use any b'se there are cases when I require return
value
> as [OUString or long etc ..]
>
> //Simple functions
> uno::Any
> MyClass::getValue() throw (::com::sun::star::uno::RuntimeException)
> {
> uno::Any aAny;
>
> uno::Reference< sheet::XCellRangeData>
> xData(mxRange,uno::UNO_QUERY);
> if (xData.is())
> {
> uno::Sequence< uno::Sequence< uno::Any > > aSeq =
> xData->getDataArray();
> aAny <<= aSeq;
> }
>
> return aAny;
> }
>
> void
> MyClass::setValue( const uno::Any& aValue ) throw
> (uno::RuntimeException)
> {
> uno::Sequence< uno::Sequence< uno::Any > > aSeq;
> if ((aValue >>= aSeq)) //FAILING FOR ME
> {
> fprintf(stderr, "Setting the correct Data \n");
> uno::Reference< sheet::XCellRangeData>
> xData(mxRange,uno::UNO_QUERY);
> xData->setDataArray(aSeq);
> }
> else
> fprintf(stderr, "ERROR \n");
>
>
> Sorry for top posting :( My evolution client is not working .
>
> Regards,
> Jayant
>
>>>>[EMAIL PROTECTED] 08/24/05 8:38 PM >>>
>
> Hi Jayant,
>
>
>>Any suggestion ?
>
>
> according to cppu/inc/com/sun/star/uno/Any.hxx the statement (aAny
>>=
>
> aSeq) will be true when aAny could be assigned to aSeq and since you
> just assigned aSec to aAny I'd suppose that the statement will
always
> be
> true in your code.
>
> What do you hope to achieve with the statement in your "setValue"
> method ?
>
> Regards
>
> Stephan
>
>
>
---------------------------------------------------------------------
> 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]