sw image anchor type: add style UI for this

A frame style contains RES_ANCHOR, and SwFormatAnchor::m_eAnchorId
already describes an anchor type. This is even exposed on the UNO API as
the AnchorType property and its ODF import/export is also implemented.

Enable UI for this, so that templates can decide the default anchor type
when inserting images. Still keep the "to frame" anchor type disabled as
its meaning is unclear for frame styles.

Change-Id: I5d8ef63af9c8f2efa6485c4ec827ba9aef9b8956
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116990
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Miklos Vajna 2021-06-10 15:11:03 +02:00
parent 71070e7df2
commit 5951da5175

View file

@ -884,8 +884,8 @@ void SwFramePage::Reset( const SfxItemSet *rSet )
if (m_bFormat)
{
// at formats no anchor editing
m_xAnchorFrame->set_sensitive(false);
// at formats no to-fly anchor
m_xAnchorAtFrameRB->set_sensitive(false);
if (rSet->GetItemState(FN_KEEP_ASPECT_RATIO) != SfxItemState::SET)
{
m_xFixedRatioCB->set_sensitive(false);
@ -1047,7 +1047,7 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet)
RndStdIds eAnchorId = GetAnchor();
if ( !m_bFormat )
if ( !m_bFormat || eAnchorId != RndStdIds::FLY_AT_FLY )
{
pOldItem = GetOldItem(*rSet, RES_ANCHOR);
if (m_bNew || !pOldItem || eAnchorId != static_cast<const SwFormatAnchor*>(pOldItem)->GetAnchorId())
@ -2287,7 +2287,7 @@ void SwFramePage::SetFormatUsed(bool bFormatUsed)
{
m_bFormat = bFormatUsed;
if (m_bFormat)
m_xAnchorFrame->hide();
m_xAnchorAtFrameRB->hide();
}
void SwFramePage::EnableVerticalPositioning( bool bEnable )