diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-02-08 09:46:50 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-02-10 12:12:02 +0100 |
commit | 9dc25ec68f3342f257ac0b0a6ed2f7165473ed3d (patch) | |
tree | bb36cabedfd3c94455080969d9fa8f6631a244dd /sw | |
parent | 4165dd0f8acb3fe95542056f45e861f4a156807a (diff) |
tdf#91920 sw page gutter margin, from top: add UI
- read from sw::DocumentSettingManager::mbGutterAtTop
- improve the preview widget to take gutter position into account
- also change it when the gutter position widget changes
- write it back to sw::DocumentSettingManager::mbGutterAtTop on
modification
- always check if the dialog's input item set has SID_ATTR_CHAR_GRABBAG,
otherwise do nothing to keep Calc/Impress unchanged
[ And in this branch, fix a silent merge conflict that mis-positioned
labelGutterMargin in the .ui file. ]
(cherry picked from commit 63d3bf99101e2138a21a74a3d717d4f25d3d242f)
Conflicts:
cui/uiconfig/ui/pageformatpage.ui
sw/source/core/doc/DocumentSettingManager.cxx
Change-Id: I05ef864bf7ac18f4c6829d78312044560e6402d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110671
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/app/docst.cxx | 30 | ||||
-rw-r--r-- | sw/source/uibase/app/docstyle.cxx | 2 |
2 files changed, 32 insertions, 0 deletions
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index cb580785e8a8..b2656c925620 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -88,6 +88,7 @@ #include <paratr.hxx> #include <tblafmt.hxx> #include <sfx2/watermarkitem.hxx> +#include <svl/grabbagitem.hxx> #include <SwUndoFmt.hxx> #include <strings.hrc> @@ -616,6 +617,29 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void) if( aTmpSet.GetItemState( m_rDocSh.GetPool().GetTrueWhich( SID_ATTR_FRAMEDIRECTION, false ) , true, &pItem ) == SfxItemState::SET ) SwChartHelper::DoUpdateAllCharts( pDoc ); } + + if (m_nFamily == SfxStyleFamily::Page) + { + const SfxPoolItem* pItem = nullptr; + if (aTmpSet.HasItem(SID_ATTR_CHAR_GRABBAG, &pItem)) + { + const auto& rGrabBagItem = static_cast<const SfxGrabBagItem&>(*pItem); + bool bGutterAtTop{}; + auto it = rGrabBagItem.GetGrabBag().find("GutterAtTop"); + if (it != rGrabBagItem.GetGrabBag().end()) + { + it->second >>= bGutterAtTop; + } + bool bOldGutterAtTop + = pDoc->getIDocumentSettingAccess().get(DocumentSettingId::GUTTER_AT_TOP); + if (bOldGutterAtTop != bGutterAtTop) + { + pDoc->getIDocumentSettingAccess().set(DocumentSettingId::GUTTER_AT_TOP, + bGutterAtTop); + pWrtShell->InvalidateLayout(/*bSizeChanged=*/true); + } + } + } } if(m_bNew) @@ -879,6 +903,12 @@ void SwDocShell::Edit( rSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST)); rSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST)); rSet.Put(SvxPatternListItem(pDrawModel->GetPatternList(), SID_PATTERN_LIST)); + + SfxGrabBagItem aGrabBag(SID_ATTR_CHAR_GRABBAG); + bool bGutterAtTop + = GetDoc()->getIDocumentSettingAccess().get(DocumentSettingId::GUTTER_AT_TOP); + aGrabBag.GetGrabBag()["GutterAtTop"] <<= bGutterAtTop; + rSet.Put(aGrabBag); } if (!bBasic) diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 040178acac86..b21c1d6d8da5 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -69,6 +69,7 @@ #include <svx/xflftrit.hxx> #include <svx/svdmodel.hxx> #include <svx/drawitem.hxx> +#include <editeng/eeitem.hxx> // The Format names in the list of all names have the // following family as their first character: @@ -482,6 +483,7 @@ SwDocStyleSheet::SwDocStyleSheet( SwDoc& rDocument, SID_SWREGISTER_MODE, SID_SWREGISTER_MODE, SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR, SID_ATTR_NUMBERING_RULE, SID_ATTR_NUMBERING_RULE, + SID_ATTR_CHAR_GRABBAG, SID_ATTR_CHAR_GRABBAG, SID_ATTR_AUTO_STYLE_UPDATE, SID_ATTR_AUTO_STYLE_UPDATE, FN_PARAM_FTN_INFO, FN_PARAM_FTN_INFO, FN_COND_COLL, FN_COND_COLL>{}), |