Re: [Libreoffice] Location of SfxPoolItem.Type() method

2010-11-24 Thread Andrea Pescetti
Mattias Johnsson wrote:
> On 22 November 2010 21:22, Michael Meeks  wrote:
> > On Sun, 2010-11-21 at 00:21 +1100, Mattias Johnsson wrote:
> >> in this case I'm searching for a specific font size and replacing
> >> it with another.
> >
> >Interesting indeed :-) a new feature for search / replace ?
> 
> Not a new feature, but rather fixing this very odd and specific bug:
> http://qa.openoffice.org/issues/show_bug.cgi?id=115528
> OO doesn't seem to like 14 point font :-P. It's not a particularly
> important bug, but it's proving useful for learning

It's a repeatable freeze so it does have some importance, even though I
indeed chose a very specific example when reporting the bug. You are
right, there is something to learn about Writer from it... it seems that
you need to explicitly set the font size for the attribute to be
correctly detected (probably something related to the so-called
"soft"/"hard" formatting). Anyway, it's now being addressed upstream in
OpenOffice.org.

Regards,
  Andrea.

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] Location of SfxPoolItem.Type() method

2010-11-22 Thread Mattias Johnsson
On 23 November 2010 16:59, David Tardon  wrote:
> On Tue, Nov 23, 2010 at 04:14:01PM +1100, Mattias Johnsson wrote:
>>
>> On a semi-related note, I'm doing a lot of stepping through the search
>> and replace code trying to track the problem down. Because LO seems to
>> be compiled using -O2 and -O3, there's a lot of optimization which
>> means the way the code gets stepped through is often bizarre, and the
>> values of useful variables have been optimized out by the compiler. Is
>> there a simple option for building the LO project using a lower
>> optimization level? I can't seem to find one...
>>
>
> You can either do
>
> nopt=true make
>
> or reconfigure with --enable-debug (debug build only enables assertions
> by default since yesterday, so the amount of output is quite
> manageable).

Thanks!
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] Location of SfxPoolItem.Type() method

2010-11-22 Thread David Tardon
On Tue, Nov 23, 2010 at 04:14:01PM +1100, Mattias Johnsson wrote:
> 
> On a semi-related note, I'm doing a lot of stepping through the search
> and replace code trying to track the problem down. Because LO seems to
> be compiled using -O2 and -O3, there's a lot of optimization which
> means the way the code gets stepped through is often bizarre, and the
> values of useful variables have been optimized out by the compiler. Is
> there a simple option for building the LO project using a lower
> optimization level? I can't seem to find one...
> 

You can either do

nopt=true make

or reconfigure with --enable-debug (debug build only enables assertions
by default since yesterday, so the amount of output is quite
manageable).

D.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] Location of SfxPoolItem.Type() method

2010-11-22 Thread Mattias Johnsson
On 22 November 2010 21:22, Michael Meeks  wrote:
> Hi Mattias,
>
> On Sun, 2010-11-21 at 00:21 +1100, Mattias Johnsson wrote:
>> I've been trying to fix a bug in the search and replace code, and
>> after a bit of hacking have discovered that in findattr.cxx there's a
>> function
>
>        Nice work :-)
>
>> If I'm understanding things correctly, and I may not be, since the
>> search and replace code is quite convoluted, in this case these
>> SfxPoolItems are lists of attributes that one can search and replace
>> for
>
>        Right ...
>
>> in this case I'm searching for a specific font size and replacing
>> it with another.
>
>        Interesting indeed :-) a new feature for search / replace ? So some of

Not a new feature, but rather fixing this very odd and specific bug:
http://qa.openoffice.org/issues/show_bug.cgi?id=115528

OO doesn't seem to like 14 point font :-P. It's not a particularly
important bug, but it's proving useful for learning the internals of
Writer :-)

> these pool items for things like font size are defined in:
>
>        editeng/inc/editeng/fhgtitem.hxx
>
>        as SvxFontHeightItem (I think).

Thanks for the tips!

On a semi-related note, I'm doing a lot of stepping through the search
and replace code trying to track the problem down. Because LO seems to
be compiled using -O2 and -O3, there's a lot of optimization which
means the way the code gets stepped through is often bizarre, and the
values of useful variables have been optimized out by the compiler. Is
there a simple option for building the LO project using a lower
optimization level? I can't seem to find one...

Cheers,
Mattias
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] Location of SfxPoolItem.Type() method

2010-11-22 Thread Michael Meeks
Hi Mattias,

On Sun, 2010-11-21 at 00:21 +1100, Mattias Johnsson wrote:
> I've been trying to fix a bug in the search and replace code, and
> after a bit of hacking have discovered that in findattr.cxx there's a
> function

Nice work :-)

> If I'm understanding things correctly, and I may not be, since the
> search and replace code is quite convoluted, in this case these
> SfxPoolItems are lists of attributes that one can search and replace
> for

Right ...

> in this case I'm searching for a specific font size and replacing
> it with another.

Interesting indeed :-) a new feature for search / replace ? So some of
these pool items for things like font size are defined in:

editeng/inc/editeng/fhgtitem.hxx

as SvxFontHeightItem (I think).

> but for the life of me I can't find out where the Type() method is defined.

I imagine this is the pre-RTTI type info ;-) I -guess- that it is
generated by the 'TYPEINFO()' macro you see in the SfxPoolItem impl.
cf. tools/inc/tools/rtti.hxx

HTH,

Michael.

-- 
 michael.me...@novell.com  <><, Pseudo Engineer, itinerant idiot

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] Location of SfxPoolItem.Type() method

2010-11-21 Thread David Tardon
On Sun, Nov 21, 2010 at 12:21:08AM +1100, Mattias Johnsson wrote:
> Hello all,
> 
> I've been trying to fix a bug in the search and replace code, and
> after a bit of hacking have discovered that in findattr.cxx there's a
> function
> 
> int CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 )
> {
> ...
> return rItem1 == rItem2;
> }
> 
> In the bugged case this returns true, and in the correctly functioning
> case it returns false. I'm trying to figure out exactly how rItem1 and
> rItem2 differ in the correct case to help me find out what's wrong in
> the bugged case.
> 
> If I'm understanding things correctly, and I may not be, since the
> search and replace code is quite convoluted, in this case these
> SfxPoolItems are lists of attributes that one can search and replace
> for; in this case I'm searching for a specific font size and replacing
> it with another.
> 
> The overloaded comparison operator is defined as
> 
> int SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const
> {
> DBG_CHKTHIS(SfxPoolItem, 0);
> return rCmp.Type() == Type();
> }
> 
> but for the life of me I can't find out where the Type() method is defined.
> 
> Does anyone have any pointers?
> 

The SfxPoolItem::operator== is virtual, so you may actually need to look
at the definition in some derived class.

set print object on
p rItem1
p rItem2

in gdb in the CmpAttr func will tell you the real classes of the items.
Or, alternatively, you can step into the operator.

D.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] Location of SfxPoolItem.Type() method

2010-11-20 Thread Mattias Johnsson
On 21 November 2010 01:04, Miklos Vajna  wrote:
> On Sun, Nov 21, 2010 at 12:21:08AM +1100, Mattias Johnsson 
>  wrote:
>> int SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const
>> {
>>     DBG_CHKTHIS(SfxPoolItem, 0);
>>     return rCmp.Type() == Type();
>> }
>>
>> but for the life of me I can't find out where the Type() method is defined.
>>
>> Does anyone have any pointers?
>
> The SfxPoolItem itself is declared in svl/inc/svl/poolitem.hxx. You can
> see a TYPEINFO(); macro there, which is defined in
> tools/inc/tools/rtti.hxx.
>
> Now if you want the definition of that method, the implementation is in
> source/items/poolitem.cxx, where there is a TYPEINIT0() macro, defined
> in tools/inc/tools/rtti.hxx again.
>
> TYPEINIT0() calls TYPEINIT0_FACTORY(), that calls TYPEINIT_FACTORY(),
> where the real method is defined.
>
> Hope this helps. :)
>

Obviously I was thinking too simplistically :-P

Thanks!
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] Location of SfxPoolItem.Type() method

2010-11-20 Thread Miklos Vajna
On Sun, Nov 21, 2010 at 12:21:08AM +1100, Mattias Johnsson 
 wrote:
> int SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const
> {
> DBG_CHKTHIS(SfxPoolItem, 0);
> return rCmp.Type() == Type();
> }
> 
> but for the life of me I can't find out where the Type() method is defined.
> 
> Does anyone have any pointers?

The SfxPoolItem itself is declared in svl/inc/svl/poolitem.hxx. You can
see a TYPEINFO(); macro there, which is defined in
tools/inc/tools/rtti.hxx.

Now if you want the definition of that method, the implementation is in
source/items/poolitem.cxx, where there is a TYPEINIT0() macro, defined
in tools/inc/tools/rtti.hxx again.

TYPEINIT0() calls TYPEINIT0_FACTORY(), that calls TYPEINIT_FACTORY(),
where the real method is defined.

Hope this helps. :)


pgpXExzPX43JD.pgp
Description: PGP signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] Location of SfxPoolItem.Type() method

2010-11-20 Thread Mattias Johnsson
Hello all,

I've been trying to fix a bug in the search and replace code, and
after a bit of hacking have discovered that in findattr.cxx there's a
function

int CmpAttr( const SfxPoolItem& rItem1, const SfxPoolItem& rItem2 )
{
...
return rItem1 == rItem2;
}

In the bugged case this returns true, and in the correctly functioning
case it returns false. I'm trying to figure out exactly how rItem1 and
rItem2 differ in the correct case to help me find out what's wrong in
the bugged case.

If I'm understanding things correctly, and I may not be, since the
search and replace code is quite convoluted, in this case these
SfxPoolItems are lists of attributes that one can search and replace
for; in this case I'm searching for a specific font size and replacing
it with another.

The overloaded comparison operator is defined as

int SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const
{
DBG_CHKTHIS(SfxPoolItem, 0);
return rCmp.Type() == Type();
}

but for the life of me I can't find out where the Type() method is defined.

Does anyone have any pointers?

Cheers,
Mattias
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice