diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-04-20 12:23:23 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-04-21 10:07:01 +0900 |
commit | 68d06f69b56611bc6c95c1c2e8af400c7985a8fc (patch) | |
tree | 203bf6e9909ad3027eb29a08be183c6895fd41e8 /include | |
parent | a630f4f2e18bed78c1c1e4ef793b4636ce5ebcfc (diff) |
StyleManager & StylePreviewRenderer + common implementation
StyleManager is a new class responsible to handle document styles.
The current implementation has only the responsibility to provide
a implementation of StylePreviewReneder, but the idea is to move
all style related functionallity to this class (and relieve the
SfxObjectShell a bit). CommonStyleMAnager is the common impl.
StylePreviewRenderer is responsible to render a preview of a style.
As styles can be handled differently by each component it is
possible to provide component specific StylePreviewRendered, but
currently only the common one is implemented and used by sw.
Change-Id: Id271485f571a777a3e94f855d3c614a2efc14628
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/StyleManager.hxx | 47 | ||||
-rw-r--r-- | include/sfx2/StylePreviewRenderer.hxx | 53 | ||||
-rw-r--r-- | include/sfx2/objsh.hxx | 12 | ||||
-rw-r--r-- | include/svx/CommonStyleManager.hxx | 41 | ||||
-rw-r--r-- | include/svx/CommonStylePreviewRenderer.hxx | 45 |
5 files changed, 195 insertions, 3 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: */ |