tdf#91920 sw page gutter margin, from top: add doc model & UNO API
Do this per-doc, rather than per-page-desc, because Word doesn't support it per-section, so we would just create interop problems for ourselves with supporting it per-page-desc. Change-Id: Id3c6aac7323deb8d27bab08675ff623f90a63cd9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110423 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -112,6 +112,7 @@ enum class DocumentSettingId
|
||||
PROTECT_FIELDS,
|
||||
HEADER_SPACING_BELOW_LAST_PARA,
|
||||
FRAME_AUTOWIDTH_WITH_MORE_PARA,
|
||||
GUTTER_AT_TOP,
|
||||
};
|
||||
|
||||
/** Provides access to settings of a document
|
||||
|
@@ -99,7 +99,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
|
||||
mbProtectBookmarks(false),
|
||||
mbProtectFields(false),
|
||||
mbHeaderSpacingBelowLastPara(false),
|
||||
mbFrameAutowidthWithMorePara(false)
|
||||
mbFrameAutowidthWithMorePara(false),
|
||||
mbGutterAtTop(false)
|
||||
|
||||
// COMPATIBILITY FLAGS END
|
||||
{
|
||||
@@ -232,6 +233,8 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
|
||||
case DocumentSettingId::PROTECT_FIELDS: return mbProtectFields;
|
||||
case DocumentSettingId::HEADER_SPACING_BELOW_LAST_PARA: return mbHeaderSpacingBelowLastPara;
|
||||
case DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA: return mbFrameAutowidthWithMorePara;
|
||||
case DocumentSettingId::GUTTER_AT_TOP:
|
||||
return mbGutterAtTop;
|
||||
default:
|
||||
OSL_FAIL("Invalid setting id");
|
||||
}
|
||||
@@ -486,6 +489,9 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
|
||||
case DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA:
|
||||
mbFrameAutowidthWithMorePara = value;
|
||||
break;
|
||||
case DocumentSettingId::GUTTER_AT_TOP:
|
||||
mbGutterAtTop = value;
|
||||
break;
|
||||
default:
|
||||
OSL_FAIL("Invalid setting id");
|
||||
}
|
||||
|
@@ -168,6 +168,8 @@ class DocumentSettingManager final :
|
||||
bool mbProtectFields;
|
||||
bool mbHeaderSpacingBelowLastPara;
|
||||
bool mbFrameAutowidthWithMorePara; //tdf#124423
|
||||
/// Gutter position: false means left (not a compatibility setting).
|
||||
bool mbGutterAtTop;
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -146,6 +146,7 @@ enum SwDocumentSettingsPropertyHandles
|
||||
HANDLE_PROTECT_FIELDS,
|
||||
HANDLE_HEADER_SPACING_BELOW_LAST_PARA,
|
||||
HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA,
|
||||
HANDLE_GUTTER_AT_TOP,
|
||||
};
|
||||
|
||||
}
|
||||
@@ -239,6 +240,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
|
||||
{ OUString("ProtectFields"), HANDLE_PROTECT_FIELDS, cppu::UnoType<bool>::get(), 0 },
|
||||
{ OUString("HeaderSpacingBelowLastPara"), HANDLE_HEADER_SPACING_BELOW_LAST_PARA, cppu::UnoType<bool>::get(), 0 },
|
||||
{ OUString("FrameAutowidthWithMorePara"), HANDLE_FRAME_AUTOWIDTH_WITH_MORE_PARA, cppu::UnoType<bool>::get(), 0 },
|
||||
{ OUString("GutterAtTop"), HANDLE_GUTTER_AT_TOP, cppu::UnoType<bool>::get(), 0 },
|
||||
|
||||
/*
|
||||
* As OS said, we don't have a view when we need to set this, so I have to
|
||||
@@ -1000,6 +1002,15 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HANDLE_GUTTER_AT_TOP:
|
||||
{
|
||||
bool bTmp;
|
||||
if (rValue >>= bTmp)
|
||||
{
|
||||
mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::GUTTER_AT_TOP, bTmp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
|
||||
}
|
||||
@@ -1496,6 +1507,11 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
|
||||
DocumentSettingId::FRAME_AUTOWIDTH_WITH_MORE_PARA);
|
||||
}
|
||||
break;
|
||||
case HANDLE_GUTTER_AT_TOP:
|
||||
{
|
||||
rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::GUTTER_AT_TOP);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw UnknownPropertyException(OUString::number(rInfo.mnHandle));
|
||||
}
|
||||
|
Reference in New Issue
Block a user