summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-02-04 16:55:13 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-02-04 18:08:51 +0100
commit97abf85bb152b8a665dff6fd8b65fffea5365dc8 (patch)
treef1e490239090928af9e63c06b48d647c224ddefe
parent10943505162d515f16acfb4d195d171421ff834f (diff)
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
-rw-r--r--sw/inc/IDocumentSettingAccess.hxx1
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx8
-rw-r--r--sw/source/core/inc/DocumentSettingManager.hxx2
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx16
4 files changed, 26 insertions, 1 deletions
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 8273954f4a71..059694ff1ceb 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -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
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index f6c15065a453..e811fd88174c 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -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");
}
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index 17ea950700ce..387be04a4c15 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -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:
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index faa0ef5e7d2b..19dabb9ea6b8 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -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));
}