List Info

Thread: Getting document's current text direction while in border dialog




Getting document's current text direction while in border dialog
user name
2007-07-22 12:42:56
Hi everyone,


I'm working on Issue 72804, which requires me to have access
to the 
current text direction while I'm in the Table Border dialog

(svx/source/dialog/border.cxx). How do I get the current
text direction 
from SvxBorderTabPage::FillItemSet? I've tried:


pItem = GetItem( rCoreAttrs, SID_ATTR_FRAMEDIRECTION );

const SvxFrameDirectionItem& rItem = (const
SvxFrameDirectionItem&)*pItem;
printf( "Frame Direction is : %dn",
(rItem.GetValue()));


which must be wrong since I get the same result, even after
I change the 
text dir.


What do I need to change?


Thanks,

Alan

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesw.openoffice.org
For additional commands, e-mail: dev-helpsw.openoffice.org


Re: Getting document's current text direction while in border dialog
user name
2007-07-23 02:19:12
Hi Alan,

On 07/22/07 19:42, Alan Yaniger wrote:
> 
> I'm working on Issue 72804, which requires me to have
access to the 
> current text direction while I'm in the Table Border
dialog 
> (svx/source/dialog/border.cxx). How do I get the
current text direction 
> from SvxBorderTabPage::FillItemSet? I've tried:
> 
> pItem = GetItem( rCoreAttrs, SID_ATTR_FRAMEDIRECTION
);

you have to translate SID_ATTR_FRAMEDIRECTION into the
Writer's 'which' 
range:

nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
const SvxFrameDirectionItem& rItem =
static_cast<bla>(rSet.Get(nWhich));

Hope this helps,

Frank

--
Frank Meies (fme) - OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/Gu
llFOSS

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesw.openoffice.org
For additional commands, e-mail: dev-helpsw.openoffice.org


Re: Getting document's current text direction while in border dialog
user name
2007-07-26 07:51:32
Hi Frank,


Thanks for responding.


I've tried:

    USHORT nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
    const SvxFrameDirectionItem& rItem =
static_cast<const 
SvxFrameDirectionItem&>(rCoreAttrs.Get(nWhich));

    printf( "Frame Direction State is : %dn",
(rItem.GetValue()));


but the result is the same regardless of the text direction
in the 
document. Could I tell you my possibly incorrect
understanding of the 
mechanism used here, and you would be kind enough to correct
my errors? 
The SfxItemSet passed to the function
SvxBorderTabPage::FillItemSet( 
SfxItemSet& rCoreAttrs ) contains a set of key/value
pairs with document 
attributes, with the keys being a subset of the SID_ATTR* as
defined in 
sfxsids.hrc, minus an offset which changes for various
applications. 
Their values would be reflected in the settings I would see
on the 
document's toolbar and in the pages of the Format menu
(Character, 
Paragraph, etc.).  In the border dialog which I am concerned
with now, 
"GetWhich" subtracts the offset from the SID_ATTR*
in order to get the 
key as it appears in the SfxItemSet. GetValue gets the
attribute value 
using this key. Is this understanding incorrect?


Alan


Frank Meies wrote:

> Hi Alan,
>
> On 07/22/07 19:42, Alan Yaniger wrote:
>>
>> I'm working on Issue 72804, which requires me to
have access to the 
>> current text direction while I'm in the Table
Border dialog 
>> (svx/source/dialog/border.cxx). How do I get the
current text 
>> direction from SvxBorderTabPage::FillItemSet? I've
tried:
>>
>> pItem = GetItem( rCoreAttrs,
SID_ATTR_FRAMEDIRECTION );
>
> you have to translate SID_ATTR_FRAMEDIRECTION into the
Writer's 
> 'which' range:
>
> nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
> const SvxFrameDirectionItem& rItem =
static_cast<bla>(rSet.Get(nWhich));
>
> Hope this helps,
>
> Frank
>
> -- 
> Frank Meies (fme) - OpenOffice.org Writer
> OpenOffice.org Engineering at Sun: http://blogs.sun.com/Gu
llFOSS
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribesw.openoffice.org
> For additional commands, e-mail: dev-helpsw.openoffice.org
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesw.openoffice.org
For additional commands, e-mail: dev-helpsw.openoffice.org


Re: Getting document's current text direction while in border dialog
user name
2007-08-02 04:46:17
Hi,
your understanding is almost correct. The items in the
SfxItemSet have 
two numbering ranges. The SID_ATTR_.. or FN_.. values are
so-called 
SlotIds. These ids are the same for all applications. The
WhichIds (in 
sw RES_CHRATR_..., RES_FRMATR_...) are application specific.
But that's 
not the problem here.

The item you get from the ItemSet has been put into the
ItemSet in 
lcl_TableParamToItemSet() in sw/source/ui/shells/tabsh.cxx.
It puts the 
items from the table format. This is usually set as
"from environment" - 
but the actual value of the environment is not available for
you.
This is correct, because this value is used to fill the text
direction 
ListBox in the table option tab page. What you need is an
additional 
item that provides the actual value. To determine the value
you have to 
call SwFEShell::IsTableRightToLeft(); You need to put an
additional 
SfxBoolItem into the ItemSet with a new identifier defined
in 
svx/inc/svx/svxids.hrc and access this item within the
border tab page.
To get it into the ItemSet you have to add the new id to the
range of 
aUiAttrTableRange in tabsh.cxx.

Regards,

Oliver


Alan Yaniger wrote:
> Hi Frank,
> 
> 
> Thanks for responding.
> 
> 
> I've tried:
> 
>    USHORT nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION
);
>    const SvxFrameDirectionItem& rItem =
static_cast<const 
>
SvxFrameDirectionItem&>(rCoreAttrs.Get(nWhich));
> 
>    printf( "Frame Direction State is : %dn",
(rItem.GetValue()));
> 
> 
> but the result is the same regardless of the text
direction in the 
> document. Could I tell you my possibly incorrect
understanding of the 
> mechanism used here, and you would be kind enough to
correct my errors? 
> The SfxItemSet passed to the function
SvxBorderTabPage::FillItemSet( 
> SfxItemSet& rCoreAttrs ) contains a set of
key/value pairs with document 
> attributes, with the keys being a subset of the
SID_ATTR* as defined in 
> sfxsids.hrc, minus an offset which changes for various
applications. 
> Their values would be reflected in the settings I would
see on the 
> document's toolbar and in the pages of the Format menu
(Character, 
> Paragraph, etc.).  In the border dialog which I am
concerned with now, 
> "GetWhich" subtracts the offset from the
SID_ATTR* in order to get the 
> key as it appears in the SfxItemSet. GetValue gets the
attribute value 
> using this key. Is this understanding incorrect?
> 
> 
> Alan
> 
> 
> Frank Meies wrote:
> 
>> Hi Alan,
>>
>> On 07/22/07 19:42, Alan Yaniger wrote:
>>>
>>> I'm working on Issue 72804, which requires me
to have access to the 
>>> current text direction while I'm in the Table
Border dialog 
>>> (svx/source/dialog/border.cxx). How do I get
the current text 
>>> direction from SvxBorderTabPage::FillItemSet?
I've tried:
>>>
>>> pItem = GetItem( rCoreAttrs,
SID_ATTR_FRAMEDIRECTION );
>>
>> you have to translate SID_ATTR_FRAMEDIRECTION into
the Writer's 
>> 'which' range:
>>
>> nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
>> const SvxFrameDirectionItem& rItem =
static_cast<bla>(rSet.Get(nWhich));
>>
>> Hope this helps,
>>
>> Frank
>>
>> -- 
>> Frank Meies (fme) - OpenOffice.org Writer
>> OpenOffice.org Engineering at Sun: http://blogs.sun.com/Gu
llFOSS
>>
>>
------------------------------------------------------------
---------
>> To unsubscribe, e-mail: dev-unsubscribesw.openoffice.org
>> For additional commands, e-mail: dev-helpsw.openoffice.org
>>
> 
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribesw.openoffice.org
> For additional commands, e-mail: dev-helpsw.openoffice.org
> 

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribesw.openoffice.org
For additional commands, e-mail: dev-helpsw.openoffice.org


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )