summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-05-04 13:32:51 +0200
committerAndras Timar <andras.timar@collabora.com>2021-05-12 10:51:48 +0200
commit538bc642937d9f2e0d11f0451681f2569ff8137a (patch)
treeb8f623e150906f60744b7fbf88615835ddc3dd7f
parent3a72f2f2bbace806e6222ed1ec70ccc413f564c8 (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>
-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 9276ab5524ad..ff4a1c99e21f 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 SfxPoolItem* 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 60156ad6d4f3..af761bd99de4 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 );
}
@@ -58,6 +61,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;
@@ -72,6 +76,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 0520f5c99a24..a48ae29d91f3 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -69,7 +69,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 580aee5ad8bd..c23d894fd4fd 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -163,11 +163,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))