summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sfx2/StyleManager.hxx47
-rw-r--r--include/sfx2/StylePreviewRenderer.hxx53
-rw-r--r--include/sfx2/objsh.hxx12
-rw-r--r--include/svx/CommonStyleManager.hxx41
-rw-r--r--include/svx/CommonStylePreviewRenderer.hxx45
-rw-r--r--sfx2/source/doc/objcont.cxx5
-rw-r--r--svx/Library_svxcore.mk2
-rw-r--r--svx/source/styles/CommonStyleManager.cxx41
-rw-r--r--svx/source/styles/CommonStylePreviewRenderer.cxx209
-rw-r--r--sw/inc/docsh.hxx5
-rw-r--r--sw/source/uibase/app/docsh.cxx5
-rw-r--r--sw/source/uibase/app/docshini.cxx5
12 files changed, 466 insertions, 4 deletions
diff --git a/include/sfx2/StyleManager.hxx b/include/sfx2/StyleManager.hxx
new file mode 100644
index 000000000000..66159f75ec9c
--- /dev/null
+++ b/include/sfx2/StyleManager.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_STYLEMANAGER_HXX
+#define INCLUDED_SFX2_STYLEMANAGER_HXX
+
+#include <sfx2/dllapi.h>
+
+#include <vcl/outdev.hxx>
+
+#include <sfx2/StylePreviewRenderer.hxx>
+#include <rsc/rscsfx.hxx>
+
+#include <sfx2/objsh.hxx>
+
+namespace sfx2
+{
+
+class SFX2_DLLPUBLIC StyleManager
+{
+protected:
+ SfxObjectShell& mrShell;
+
+public:
+ StyleManager(SfxObjectShell& rShell)
+ : mrShell(rShell)
+ {}
+
+ virtual ~StyleManager()
+ {}
+
+ virtual StylePreviewRenderer* CreateStylePreviewRenderer(
+ OutputDevice& /*rOutputDev*/, OUString /*rName*/,
+ SfxStyleFamily /*eFamily*/, long /*nMaxHeight*/ = 32) = 0;
+};
+
+} // end namespace sfx2
+
+#endif //INCLUDED_SFX2_STYLEMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/StylePreviewRenderer.hxx b/include/sfx2/StylePreviewRenderer.hxx
new file mode 100644
index 000000000000..bc77e20792d1
--- /dev/null
+++ b/include/sfx2/StylePreviewRenderer.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SFX2_STYLEPREVIEWRENDERER_HXX
+#define INCLUDED_SFX2_STYLEPREVIEWRENDERER_HXX
+
+#include <sfx2/dllapi.h>
+#include <vcl/outdev.hxx>
+#include <rsc/rscsfx.hxx>
+#include <svl/style.hxx>
+#include <sfx2/objsh.hxx>
+
+namespace sfx2
+{
+
+class SFX2_DLLPUBLIC StylePreviewRenderer
+{
+protected:
+ const SfxObjectShell& mrShell;
+ OutputDevice& mrOutputDev;
+ SfxStyleSheetBase* mpStyle;
+ long mnMaxHeight;
+
+public:
+ StylePreviewRenderer(const SfxObjectShell& rShell,
+ OutputDevice& rOutputDev,
+ SfxStyleSheetBase* pStyle,
+ long nMaxHeight = 32)
+ : mrShell(rShell)
+ , mrOutputDev(rOutputDev)
+ , mpStyle(pStyle)
+ , mnMaxHeight(nMaxHeight)
+ {}
+
+ virtual ~StylePreviewRenderer()
+ {}
+
+ virtual bool recalculate() = 0;
+ virtual Size getRenderSize() = 0;
+ virtual bool render(const Rectangle& aRectangle) = 0;
+};
+
+} // end namespace sfx2
+
+#endif // INCLUDED_SVX_STYLEPREVIEWRENDERER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 152e864dcc8c..041631e3aa01 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -97,6 +97,7 @@ enum class SfxModelFlags;
namespace sfx2
{
class SvLinkSource;
+ class StyleManager;
}
namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
@@ -494,8 +495,14 @@ public:
// Contents
virtual SfxStyleSheetBasePool* GetStyleSheetPool();
- void SetStyleSheetPool(SfxStyleSheetBasePool *pBasePool ) {
- pStyleSheetPool = pBasePool; }
+ void SetStyleSheetPool(SfxStyleSheetBasePool *pBasePool )
+ {
+ pStyleSheetPool = pBasePool;
+ }
+
+ virtual void LoadStyles(SfxObjectShell &rSource);
+
+ virtual sfx2::StyleManager* GetStyleManager();
// Determine the position of the "Automatic" filter in the stylist
void SetAutoStyleFilterIndex(sal_uInt16 nSet);
@@ -510,7 +517,6 @@ public:
virtual std::set<Color> GetDocColors();
- virtual void LoadStyles( SfxObjectShell &rSource );
void ReadNote( INote * );
void UpdateNote( INote * );
diff --git a/include/svx/CommonStyleManager.hxx b/include/svx/CommonStyleManager.hxx
new file mode 100644
index 000000000000..43346aa5dc55
--- /dev/null
+++ b/include/svx/CommonStyleManager.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVX_COMMONSTYLEMANAGER_HXX
+#define INCLUDED_SVX_COMMONSTYLEMANAGER_HXX
+
+#include <sfx2/StyleManager.hxx>
+
+#include <vcl/outdev.hxx>
+#include <svx/svxdllapi.h>
+#include <rsc/rscsfx.hxx>
+
+namespace svx
+{
+
+class SVX_DLLPUBLIC CommonStyleManager : public sfx2::StyleManager
+{
+public:
+ CommonStyleManager(SfxObjectShell& rShell)
+ : StyleManager(rShell)
+ {}
+
+ virtual ~CommonStyleManager()
+ {}
+
+ virtual sfx2::StylePreviewRenderer* CreateStylePreviewRenderer(
+ OutputDevice& rOutputDev, OUString sName,
+ SfxStyleFamily eFamily, long nMaxHeight = 32) SAL_OVERRIDE;
+};
+
+} // end namespace svx
+
+#endif // INCLUDED_SVX_COMMONSTYLEMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/CommonStylePreviewRenderer.hxx b/include/svx/CommonStylePreviewRenderer.hxx
new file mode 100644
index 000000000000..1e7d54e0c6ae
--- /dev/null
+++ b/include/svx/CommonStylePreviewRenderer.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SVX_COMMONSTYLEPREVIEWRENDERER_HXX
+#define INCLUDED_SVX_COMMONSTYLEPREVIEWRENDERER_HXX
+
+#include <vcl/outdev.hxx>
+#include <rsc/rscsfx.hxx>
+#include <editeng/svxfont.hxx>
+#include <svx/svxdllapi.h>
+
+#include <sfx2/StylePreviewRenderer.hxx>
+
+namespace svx
+{
+
+class SVX_DLLPUBLIC CommonStylePreviewRenderer : public sfx2::StylePreviewRenderer
+{
+ SvxFont maFont;
+ Color maFontColor;
+ Color maBackgroundColor;
+ Size maPixelSize;
+ OUString maStyleName;
+
+public:
+ CommonStylePreviewRenderer(const SfxObjectShell& rShell, OutputDevice& rOutputDev,
+ SfxStyleSheetBase* pStyle, long nMaxHeight = 32);
+ virtual ~CommonStylePreviewRenderer();
+
+ virtual bool recalculate() SAL_OVERRIDE;
+ virtual Size getRenderSize() SAL_OVERRIDE;
+ virtual bool render(const Rectangle& aRectangle) SAL_OVERRIDE;
+};
+
+} // end namespace svx
+
+#endif // INCLUDED_SVX_COMMONSTYLEPREVIEWRENDERER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index f48433a1bfe2..d2b4d3c8aacd 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -365,7 +365,10 @@ void SfxObjectShell::LoadStyles
}
}
-
+sfx2::StyleManager* SfxObjectShell::GetStyleManager()
+{
+ return nullptr;
+}
void SfxObjectShell::UpdateFromTemplate_Impl( )
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index ce93cc8e5f96..c73b42f17b8a 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -338,6 +338,8 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/svdraw/svdview \
svx/source/svdraw/svdviter \
svx/source/svdraw/svdxcgv \
+ svx/source/styles/CommonStylePreviewRenderer \
+ svx/source/styles/CommonStyleManager \
svx/source/table/cell \
svx/source/table/cellcursor \
svx/source/table/cellrange \
diff --git a/svx/source/styles/CommonStyleManager.cxx b/svx/source/styles/CommonStyleManager.cxx
new file mode 100644
index 000000000000..4b3b6d1a617a
--- /dev/null
+++ b/svx/source/styles/CommonStyleManager.cxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <svx/CommonStyleManager.hxx>
+#include <svx/CommonStylePreviewRenderer.hxx>
+
+namespace svx
+{
+
+sfx2::StylePreviewRenderer* CommonStyleManager::CreateStylePreviewRenderer(
+ OutputDevice& rOutputDev, OUString sName,
+ SfxStyleFamily eFamily, long nMaxHeight)
+{
+ SfxStyleSheetBasePool* pPool = mrShell.GetStyleSheetPool();
+ if (!pPool)
+ return nullptr;
+
+ pPool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL);
+ SfxStyleSheetBase* pStyle = nullptr;
+ pStyle = pPool->First();
+
+ while (pStyle)
+ {
+ if (sName == pStyle->GetName())
+ return new CommonStylePreviewRenderer(mrShell, rOutputDev, pStyle, nMaxHeight);
+ pStyle = pPool->Next();
+ }
+
+ return nullptr;
+}
+
+} // end svx namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/styles/CommonStylePreviewRenderer.cxx b/svx/source/styles/CommonStylePreviewRenderer.cxx
new file mode 100644
index 000000000000..9ef4ffdc64d2
--- /dev/null
+++ b/svx/source/styles/CommonStylePreviewRenderer.cxx
@@ -0,0 +1,209 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <svx/CommonStylePreviewRenderer.hxx>
+
+#include <sfx2/objsh.hxx>
+#include <svl/style.hxx>
+#include <svl/itemset.hxx>
+
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <svx/xdef.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xcolit.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/charreliefitem.hxx>
+#include <editeng/contouritem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/crossedoutitem.hxx>
+#include <editeng/emphasismarkitem.hxx>
+#include <editeng/flstitem.hxx>
+#include <editeng/lineitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/svxfont.hxx>
+#include <editeng/cmapitem.hxx>
+
+#include <editeng/editids.hrc>
+
+using namespace css;
+
+namespace svx
+{
+
+CommonStylePreviewRenderer::CommonStylePreviewRenderer(
+ const SfxObjectShell& rShell, OutputDevice& rOutputDev,
+ SfxStyleSheetBase* pStyle, long nMaxHeight)
+ : StylePreviewRenderer(rShell, rOutputDev, pStyle, nMaxHeight)
+ , maFont()
+ , maFontColor(COL_AUTO)
+ , maBackgroundColor(COL_AUTO)
+ , maPixelSize()
+ , maStyleName(mpStyle->GetName())
+{
+}
+
+CommonStylePreviewRenderer::~CommonStylePreviewRenderer()
+{}
+
+bool CommonStylePreviewRenderer::recalculate()
+{
+ const SfxItemSet& aItemSet = mpStyle->GetItemSet();
+
+ maFont = SvxFont();
+
+ const SfxPoolItem* pItem;
+
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_WEIGHT)) != nullptr)
+ {
+ maFont.SetWeight(static_cast<const SvxWeightItem*>(pItem)->GetWeight());
+ }
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_POSTURE)) != nullptr)
+ {
+ maFont.SetItalic(static_cast<const SvxPostureItem*>(pItem)->GetPosture());
+ }
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_CONTOUR)) != nullptr)
+ {
+ maFont.SetOutline(static_cast< const SvxContourItem*>(pItem)->GetValue());
+ }
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_SHADOWED)) != nullptr)
+ {
+ maFont.SetShadow(static_cast<const SvxShadowedItem*>(pItem)->GetValue());
+ }
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_RELIEF)) != nullptr)
+ {
+ maFont.SetRelief(static_cast<FontRelief>(static_cast<const SvxCharReliefItem*>(pItem)->GetValue()));
+ }
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_UNDERLINE)) != nullptr)
+ {
+ maFont.SetUnderline(static_cast< const SvxUnderlineItem*>(pItem)->GetLineStyle());
+ }
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_OVERLINE)) != nullptr)
+ {
+ maFont.SetOverline(static_cast<FontUnderline>(static_cast<const SvxOverlineItem*>(pItem)->GetValue()));
+ }
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_STRIKEOUT)) != nullptr)
+ {
+ maFont.SetStrikeout(static_cast<const SvxCrossedOutItem*>(pItem)->GetStrikeout());
+ }
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_CASEMAP)) != nullptr)
+ {
+ maFont.SetCaseMap(static_cast<const SvxCaseMapItem*>(pItem)->GetCaseMap());
+ }
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_EMPHASISMARK)) != nullptr)
+ {
+ maFont.SetEmphasisMark(static_cast<const SvxEmphasisMarkItem*>(pItem)->GetEmphasisMark());
+ }
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_COLOR)) != nullptr)
+ {
+ maFontColor = Color(static_cast<const SvxColorItem*>(pItem)->GetValue());
+ }
+
+ if (mpStyle->GetFamily() == SFX_STYLE_FAMILY_PARA)
+ {
+ if ((pItem = aItemSet.GetItem(XATTR_FILLSTYLE)) != nullptr)
+ {
+ sal_uInt16 aFillStyle = static_cast<const XFillStyleItem*>(pItem)->GetValue();
+ if (aFillStyle == drawing::FillStyle_SOLID)
+ {
+ if ((pItem = aItemSet.GetItem(XATTR_FILLCOLOR)) != nullptr)
+ {
+ maBackgroundColor = Color(static_cast<const XFillColorItem*>(pItem)->GetColorValue());
+ }
+ }
+ }
+ }
+
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_FONT)) != nullptr)
+ {
+ const SvxFontItem* pFontItem = static_cast<const SvxFontItem*>(pItem);
+ maFont.SetName(pFontItem->GetFamilyName());
+ maFont.SetStyleName(pFontItem->GetStyleName());
+ }
+ else
+ {
+ return false;
+ }
+
+ if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_FONTHEIGHT)) != nullptr)
+ {
+ const SvxFontHeightItem* pFontHeightItem = static_cast<const SvxFontHeightItem*>(pItem);
+ Size aFontSize(0, pFontHeightItem->GetHeight());
+ maPixelSize = Size(mrOutputDev.LogicToPixel(aFontSize, mrShell.GetMapUnit()));
+ maFont.SetSize(maPixelSize);
+
+ vcl::Font aOldFont(mrOutputDev.GetFont());
+
+ mrOutputDev.SetFont(maFont);
+ Rectangle aTextRect;
+ mrOutputDev.GetTextBoundRect(aTextRect, mpStyle->GetName());
+ if (aTextRect.Bottom() > mnMaxHeight)
+ {
+ double ratio = double(mnMaxHeight) / aTextRect.Bottom();
+ maPixelSize.Width() *= ratio;
+ maPixelSize.Height() *= ratio;
+ maFont.SetSize(maPixelSize);
+ }
+ mrOutputDev.SetFont(aOldFont);
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+}
+
+Size CommonStylePreviewRenderer::getRenderSize()
+{
+ maPixelSize = maFont.GetTxtSize(&mrOutputDev, maStyleName);
+ if (maPixelSize.Height() > mnMaxHeight)
+ maPixelSize.Height() = mnMaxHeight;
+ return maPixelSize;
+}
+
+bool CommonStylePreviewRenderer::render(const Rectangle& aRectangle)
+{
+ // setup the device & draw
+ vcl::Font aOldFont(mrOutputDev.GetFont());
+ Color aOldColor(mrOutputDev.GetTextColor());
+ Color aOldFillColor(mrOutputDev.GetFillColor());
+
+ if (maBackgroundColor != COL_AUTO)
+ {
+ mrOutputDev.SetFillColor(maBackgroundColor);
+ mrOutputDev.DrawRect(aRectangle);
+ }
+
+ mrOutputDev.SetFont(maFont);
+ if (maFontColor != COL_AUTO)
+ mrOutputDev.SetTextColor(maFontColor);
+
+ Point aFontDrawPosition = aRectangle.TopLeft();
+ if (aRectangle.GetHeight() > maPixelSize.Height())
+ aFontDrawPosition.Y() += ( aRectangle.GetHeight() - maPixelSize.Height() ) / 2;
+
+ mrOutputDev.DrawText(aFontDrawPosition, maStyleName);
+
+ mrOutputDev.SetFillColor(aOldFillColor);
+ mrOutputDev.SetTextColor(aOldColor);
+ mrOutputDev.SetFont(aOldFont);
+
+ return true;
+}
+
+} // end svx namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 704d0667f681..50bfdf3e7e40 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -32,6 +32,8 @@
#define LOK_USE_UNSTABLE_API
#include <LibreOfficeKit/LibreOfficeKitTypes.h>
+#include <sfx2/StyleManager.hxx>
+
class SwDoc;
class SfxDocumentInfoDialog;
class SfxStyleSheetBasePool;
@@ -67,6 +69,8 @@ class SW_DLLPUBLIC SwDocShell
FontList* m_pFontList; ///< Current Fontlist.
bool m_IsInUpdateFontList; ///< prevent nested calls of UpdateFontList
+ std::unique_ptr<sfx2::StyleManager> m_pStyleManager;
+
/** For "historical reasons" nothing can be done without the WrtShell.
Back-pointer on View (again "for historical reasons").
Back-pointer is valid until in Activate a new one is set
@@ -212,6 +216,7 @@ public:
/// For Style PI.
virtual SfxStyleSheetBasePool* GetStyleSheetPool() SAL_OVERRIDE;
+ virtual sfx2::StyleManager* GetStyleManager() SAL_OVERRIDE;
/// Set View for actions via Shell.
void SetView(SwView* pVw);
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index c3641364b557..495412f51b25 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -1064,6 +1064,11 @@ SfxStyleSheetBasePool* SwDocShell::GetStyleSheetPool()
return m_xBasePool.get();
}
+sfx2::StyleManager* SwDocShell::GetStyleManager()
+{
+ return m_pStyleManager.get();
+}
+
void SwDocShell::SetView(SwView* pVw)
{
SetViewShell_Impl(pVw);
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index 8a752cae5c1b..7537d0e0d48c 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -86,6 +86,8 @@
#include <globals.hrc>
#include <unochart.hxx>
+#include <svx/CommonStyleManager.hxx>
+
// text grid
#include <tgrditem.hxx>
#include <boost/scoped_ptr.hpp>
@@ -326,6 +328,7 @@ SwDocShell::SwDocShell( SfxObjectCreateMode const eMode )
, m_pDoc(nullptr)
, m_pFontList(nullptr)
, m_IsInUpdateFontList(false)
+ , m_pStyleManager(new svx::CommonStyleManager(*this))
, m_pView(nullptr)
, m_pWrtShell(nullptr)
, m_pOLEChildList(nullptr)
@@ -342,6 +345,7 @@ SwDocShell::SwDocShell( const SfxModelFlags i_nSfxCreationFlags )
, m_pDoc(nullptr)
, m_pFontList(nullptr)
, m_IsInUpdateFontList(false)
+ , m_pStyleManager(new svx::CommonStyleManager(*this))
, m_pView(nullptr)
, m_pWrtShell(nullptr)
, m_pOLEChildList(nullptr)
@@ -358,6 +362,7 @@ SwDocShell::SwDocShell( SwDoc *const pD, SfxObjectCreateMode const eMode )
, m_pDoc(pD)
, m_pFontList(nullptr)
, m_IsInUpdateFontList(false)
+ , m_pStyleManager(new svx::CommonStyleManager(*this))
, m_pView(nullptr)
, m_pWrtShell(nullptr)
, m_pOLEChildList(nullptr)