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 : %d\n", (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/GullFOSS

---------------------------------------------------------------------
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]

Reply via email to