summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2020-11-21 19:43:16 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-11-26 09:08:55 +0100
commit04df1e271b64109631c6746f2e735dfc4f5b7d3a (patch)
tree4676918b0b24434ae756d6c01b87d726ef398aa3
parentb2f4e18f63457d11a783db939729450ddbe9d594 (diff)
tdf#131920 sw UI Char highlight: editing via Para-style highlight tab
Modify character highlight using paragraph style dialog's new "Highlight" tab. Extends 5.0 commit 15931deb7e4689cd885ff05439bab381f0478b2f to also work in the para-style dialog. Prior to 4.4, the background tab supported char background but that was lost when the area tab replaced it, and therefore there was no capability at the time of 5.0. This highlight tab didn't exist until 5.1: author Zolnai Tamás on 2015-06-16 22:25:38 +0200 commit 9874db206eed84616e4e232b1b56c7b7532166a0 tdf#90072: No character background (highlight) tab in paragraph styles dialog Background Tab was replaced with Area Tab on Paragraph Style Dialog. With that we lost the opportunity to set character background color. So bring back the Background tab as Highlighting. Change-Id: I916a91ea4f2ce77a8c501ecea5fd25811c5c3cd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106323 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/source/uibase/app/docst.cxx6
-rw-r--r--sw/source/uibase/inc/uitool.hxx6
-rw-r--r--sw/source/uibase/utlui/uitool.cxx11
3 files changed, 19 insertions, 4 deletions
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index b19c7df81ddd..f61a05d4dc10 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -576,6 +576,7 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void)
if( SfxStyleFamily::Para == m_nFamily )
{
SfxItemSet aSet( *m_pDlg->GetOutputItemSet() );
+ ::ConvertAttrGenToChar(aSet, m_xTmp->GetItemSet(), /*bIsPara=*/true);
::SfxToSwPageDescAttr( *pWrtShell, aSet );
// reset indent attributes at paragraph style, if a list style
// will be applied and no indent attributes will be applied.
@@ -849,6 +850,8 @@ void SwDocShell::Edit(
::SwToSfxPageDescAttr( rSet );
// merge list level indent attributes into the item set if needed
xTmp->MergeIndentAttrsOfListStyle( rSet );
+
+ ::ConvertAttrCharToGen(xTmp->GetItemSet(), /*bIsPara=*/true);
}
else if( SfxStyleFamily::Char == nFamily )
{
@@ -1006,7 +1009,10 @@ void SwDocShell::Edit(
GetWrtShell()->StartAllAction();
if( SfxStyleFamily::Para == nFamily )
+ {
::SfxToSwPageDescAttr( *GetWrtShell(), xTmp->GetItemSet() );
+ ::ConvertAttrGenToChar(xTmp->GetItemSet(), xTmp->GetItemSet(), /*bIsPara=*/true);
+ }
else
{
::ConvertAttrGenToChar(xTmp->GetItemSet(), xTmp->GetItemSet());
diff --git a/sw/source/uibase/inc/uitool.hxx b/sw/source/uibase/inc/uitool.hxx
index ac782d806d28..ba8bf7093d54 100644
--- a/sw/source/uibase/inc/uitool.hxx
+++ b/sw/source/uibase/inc/uitool.hxx
@@ -44,8 +44,9 @@ SW_DLLPUBLIC void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh);
* Convert character specific attributes to general ones used by tab pages.
*
* @param[in,out] rSet the set in which character attributes are stored
+ * @param[in] bIsPara is called by a paragraph style
**/
-SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet& rSet);
+SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet& rSet, bool bPara = false);
/**
* Convert general attributes to the corresponding character attributes.
@@ -53,8 +54,9 @@ SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet& rSet);
*
* @param[in,out] rSet the set in which character attributes are stored
* @param[in] rOrigSet original itemset used as input for the dialog
+ * @param[in] bIsPara is called by a paragraph style
**/
-SW_DLLPUBLIC void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet);
+SW_DLLPUBLIC void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet, bool bPara = false);
/**
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx
index f8871b8f3c28..c55acb7241f0 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -101,7 +101,7 @@ void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh)
rSet.Put(*aBoxInfo);
}
-void ConvertAttrCharToGen(SfxItemSet& rSet)
+void ConvertAttrCharToGen(SfxItemSet& rSet, bool bIsPara)
{
// Background / highlight
{
@@ -118,6 +118,9 @@ void ConvertAttrCharToGen(SfxItemSet& rSet)
}
}
+ if ( bIsPara )
+ return;
+
// Tell dialogs to use character-specific slots/whichIds
// tdf#126684: We use RES_PARATR_GRABBAG, because RES_CHRATR_GRABBAG may be overwritten later in
// SwDocStyleSheet::GetItemSet when applying attributes from char format
@@ -135,7 +138,7 @@ void ConvertAttrCharToGen(SfxItemSet& rSet)
rSet.Put(aGrabBag);
}
-void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet)
+void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet, bool bIsPara)
{
// Background / highlighting
const SfxPoolItem *pTmpItem;
@@ -158,6 +161,10 @@ void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet)
rSet.Put( aGrabBag );
}
}
+
+ if ( bIsPara )
+ return;
+
rSet.ClearItem( RES_BACKGROUND );
if (SfxItemState::SET == rOrigSet.GetItemState(RES_PARATR_GRABBAG, false, &pTmpItem))