From 93067f37cf22aa119db5878c4345fea500cbbb42 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 7 Sep 2015 16:36:24 +0200 Subject: tdf#91383: sw: prevent style preview from actually creating styles The dialog/sidebar should not actually create styles that don't exist yet, because it messes up Undo and the (unused) styles are then unnecessarily exported to documents. Due to Writer's ... unusual SwDocStyleSheet class this is a bit tricky. Add a new function GetItemSetForPreview() and use it from the style preview code. The implementation does not use FillPhysical so will temporarily create and then delete any non-existing styles. Skip page and numbering styles for now since they don't have a useful preview. (regression from ca95307638207db5d662059aa61594151a13e927) Change-Id: Id6ee30ea467fc24c991547a4c23a9ce14fdd86c7 --- include/svl/style.hxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/svl') diff --git a/include/svl/style.hxx b/include/svl/style.hxx index dafa95ecf30b..3451312bfd53 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -139,6 +139,11 @@ public: virtual void SetHelpId( const OUString& r, sal_uLong nId ); virtual SfxItemSet& GetItemSet(); + /// Due to writer's usual lack of sanity this is a separate function for + /// preview only; it shall not create the style in case it does not exist. + /// If the style has parents, it is _not_ required that the returned item + /// set has parents (i.e. use it for display purposes only). + virtual std::unique_ptr GetItemSetForPreview(); }; /* Class to iterate and search on a SfxStyleSheetBasePool */ -- cgit