Hi,
Maximilian Odendahl wrote:
Hi,
I have two questions regarding the correct use of the
Outliner/EditEngine class.
1) When I copy text from my EditView into writer editwindow, the font
size is extremly small, all other font attributes are correct. I guess
this is an issue with converting between points and twips, but I can't
find the correct combination, this is the relevant part of my code:
...
SvxFontHeightItem Item(12, 100,EE_CHAR_FONTHEIGHT );
Item.SetHeight(12,100,SFX_MAPUNIT_POINT);
As you can see in svx/source/items/textitem.cxx,
SvxFontHeightItem::SetHeight() the unit parameter is only used to detect
SFX_MAPUNIT_RELATIVE. It doesn't convert from point to twip.
.....
I found this code in the WriteRTF() method while creating the
transferable object which I guess explains the small size
long nHeight = ((const SvxFontHeightItem&)rItem).GetHeight();
nHeight = LogicToTwips( nHeight );
Twips => HalfPoints
nHeight /= 10;
rOutput.WriteNumber( nHeight );
}
RTF like .doc use half points as font height unit.
2) Is there an automated way to set the toolbar buttons such as bold,
italic etc based on the current cursor position of my EditEngine,
instead of doing it manually for all the attributes after each cursor
movement?
The connection between editing states and toolbars/menus is done in
shells. These shells (class SfxShell) are pushed on a stack at the
SfxDispatcher (in SwView::SelectShell). Each state/execute combination
is defined in an sdi-file which determines how so called slots are
connected to the shells.
As an example see svx/sdi/svx.sdi
SvxWeightItem Bold SID_ATTR_CHAR_WEIGHT
in sw/sdi/_textsh.sdi this slot (SID_ATTR_CHAR_WEIGHT) is mapped to a
StateMethod GetState() and an ExecuteMethod Execute().
sw/sdi/textsh.sdi connects the BaseText interface to the shell
SwTextShell. In sw/source/ui/shells/textsh1.cxx you'll find the two
methods SwTextShell::GetState() and SwTextShell::Execute().
As the writer frame does both of my questions perfectly, any hint to
this class and relevant source code would be also helpful.
The relevant code in Writer is almost everything in sfx2/sdi/sfx.sdi,
svx/sdi/svx.sdi, sw/sdi/*.sdi, sw/source/ui/shells/*.cxx and
sw/source/ui/uiview/view.cxx SwView::SelectShell().
The dispatcher code is mostly in sfx2/source/control
Regards,
Oliver
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]