summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-05-04 13:32:51 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2021-05-10 10:01:17 +0200
commit44784c7428503a5a6588ce23b52fe62404cc2f51 (patch)
treea4758a32c5024185a6cd58ba106c938742bd8c13
parent410d1ff92edaa0cf544ee79e77711c1eb2283b22 (diff)
Fix style previews widget with multiple languages
Broadcast also universal name (English identifier) for styles on change. This allows to select correct style without knowledge about all languages that other users use in other views. Fixes style previews widget in online with multiple sessions in different languages Change-Id: I9b9bcc92d96b5a5482a97a5947f148a638f257d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115093 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115300 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r--include/sfx2/tplpitem.hxx5
-rw-r--r--offapi/com/sun/star/frame/status/Template.idl7
-rw-r--r--sfx2/source/dialog/tplpitem.cxx11
-rw-r--r--svx/source/tbxctrls/StylesPreviewWindow.cxx7
-rw-r--r--sw/source/uibase/app/docst.cxx7
5 files changed, 31 insertions, 6 deletions
diff --git a/include/sfx2/tplpitem.hxx b/include/sfx2/tplpitem.hxx
index 927d67e89625..647e2b8e72bf 100644
--- a/include/sfx2/tplpitem.hxx
+++ b/include/sfx2/tplpitem.hxx
@@ -28,13 +28,16 @@
class SFX2_DLLPUBLIC SfxTemplateItem final : public SfxFlagItem
{
OUString aStyle;
+ OUString aStyleIdentifier;
public:
static SfxPoolItem* CreateDefault();
SfxTemplateItem();
SfxTemplateItem( sal_uInt16 nWhich,
- const OUString &rStyle );
+ const OUString &rStyle,
+ const OUString &rStyleIdentifier = "" );
const OUString& GetStyleName() const { return aStyle; }
+ const OUString& GetStyleIdentifier() const { return aStyleIdentifier; }
virtual SfxTemplateItem* Clone( SfxItemPool *pPool = nullptr ) const override;
virtual bool operator==( const SfxPoolItem& ) const override;
diff --git a/offapi/com/sun/star/frame/status/Template.idl b/offapi/com/sun/star/frame/status/Template.idl
index e9e688eb1363..9bb9402cef89 100644
--- a/offapi/com/sun/star/frame/status/Template.idl
+++ b/offapi/com/sun/star/frame/status/Template.idl
@@ -39,6 +39,13 @@ struct Template
/** specifies a value that is bound to the style name.
*/
long Value;
+
+
+ /** specifies an identifier name in English (only for standard style).
+
+ @since LO 7.2
+ */
+ string StyleNameIdentifier;
};
diff --git a/sfx2/source/dialog/tplpitem.cxx b/sfx2/source/dialog/tplpitem.cxx
index 66f378620acb..11d48584d304 100644
--- a/sfx2/source/dialog/tplpitem.cxx
+++ b/sfx2/source/dialog/tplpitem.cxx
@@ -31,9 +31,11 @@ SfxTemplateItem::SfxTemplateItem() :
SfxTemplateItem::SfxTemplateItem
(
sal_uInt16 nWhichId, // Slot-ID
- const OUString& rStyle // Name of the current Styles
+ const OUString& rStyle, // Name of the current Styles
+ const OUString& rStyleIdentifier // Prog Name of current Style
) : SfxFlagItem( nWhichId, static_cast<sal_uInt16>(SfxStyleSearchBits::All) ),
- aStyle( rStyle )
+ aStyle( rStyle ),
+ aStyleIdentifier( rStyleIdentifier )
{
}
@@ -42,7 +44,8 @@ SfxTemplateItem::SfxTemplateItem
bool SfxTemplateItem::operator==( const SfxPoolItem& rCmp ) const
{
return ( SfxFlagItem::operator==( rCmp ) &&
- aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle );
+ aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle &&
+ aStyleIdentifier == static_cast<const SfxTemplateItem&>(rCmp).aStyleIdentifier );
}
SfxTemplateItem* SfxTemplateItem::Clone( SfxItemPool *) const
@@ -56,6 +59,7 @@ bool SfxTemplateItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
aTemplate.Value = static_cast<sal_uInt16>(GetValue());
aTemplate.StyleName = aStyle;
+ aTemplate.StyleNameIdentifier = aStyleIdentifier;
rVal <<= aTemplate;
return true;
@@ -70,6 +74,7 @@ bool SfxTemplateItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId
{
SetValue( static_cast<SfxStyleSearchBits>(aTemplate.Value) );
aStyle = aTemplate.StyleName;
+ aStyleIdentifier = aTemplate.StyleNameIdentifier;
return true;
}
diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx
index a4b937eb6790..b557aade7ce3 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -71,7 +71,12 @@ void StyleStatusListener::StateChanged(SfxItemState /*eState*/, const SfxPoolIte
{
const SfxTemplateItem* pStateItem = dynamic_cast<const SfxTemplateItem*>(pState);
if (pStateItem)
- m_pPreviewControl->Select(pStateItem->GetStyleName());
+ {
+ if (pStateItem->GetStyleIdentifier().isEmpty())
+ m_pPreviewControl->Select(pStateItem->GetStyleName());
+ else
+ m_pPreviewControl->Select(pStateItem->GetStyleIdentifier());
+ }
}
StylePoolChangeListener::StylePoolChangeListener(StylesPreviewWindow_Base* pPreviewControl)
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 2907b54e6a9e..f2db30a82c98 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -149,11 +149,16 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
case SID_STYLE_FAMILY2:
if(!pShell->IsFrameSelected())
{
+ OUString aProgName;
SwTextFormatColl* pColl = pShell->GetCurTextFormatColl();
if(pColl)
+ {
aName = pColl->GetName();
+ sal_uInt16 nId = pColl->GetPoolFormatId();
+ SwStyleNameMapper::FillProgName(nId, aProgName);
+ }
- SfxTemplateItem aItem(nWhich, aName);
+ SfxTemplateItem aItem(nWhich, aName, aProgName);
SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto;
if (m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE))