diff options
author | David Tardon <dtardon@redhat.com> | 2013-01-22 10:32:32 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2013-01-22 13:41:24 +0100 |
commit | f8409911be702c988557903e44783e22a8029769 (patch) | |
tree | 430c0dc9ddede9fd45695af303a853ed4f5833ae /svl | |
parent | 24578b804007d8c3201e5ed32b8485e1725c33c1 (diff) |
do not second-guess which classes use a stylesheet
Change-Id: I76b23bcdca2e7394fd5ab67e8341f4cdb46f8a64
Diffstat (limited to 'svl')
-rw-r--r-- | svl/Package_inc.mk | 1 | ||||
-rw-r--r-- | svl/inc/svl/style.hxx | 6 | ||||
-rw-r--r-- | svl/inc/svl/stylesheetuser.hxx | 38 | ||||
-rw-r--r-- | svl/source/items/style.cxx | 5 |
4 files changed, 49 insertions, 1 deletions
diff --git a/svl/Package_inc.mk b/svl/Package_inc.mk index e51821957c63..5ac424db563f 100644 --- a/svl/Package_inc.mk +++ b/svl/Package_inc.mk @@ -97,6 +97,7 @@ $(eval $(call gb_Package_add_file,svl_inc,inc/svl/strmadpt.hxx,svl/strmadpt.hxx) $(eval $(call gb_Package_add_file,svl_inc,inc/svl/style.hrc,svl/style.hrc)) $(eval $(call gb_Package_add_file,svl_inc,inc/svl/style.hxx,svl/style.hxx)) $(eval $(call gb_Package_add_file,svl_inc,inc/svl/stylepool.hxx,svl/stylepool.hxx)) +$(eval $(call gb_Package_add_file,svl_inc,inc/svl/stylesheetuser.hxx,svl/stylesheetuser.hxx)) $(eval $(call gb_Package_add_file,svl_inc,inc/svl/svdde.hxx,svl/svdde.hxx)) $(eval $(call gb_Package_add_file,svl_inc,inc/svl/svl.hrc,svl/svl.hrc)) $(eval $(call gb_Package_add_file,svl_inc,inc/svl/svldllapi.h,svl/svldllapi.h)) diff --git a/svl/inc/svl/style.hxx b/svl/inc/svl/style.hxx index 48557c5457d8..18c0cebcf0fb 100644 --- a/svl/inc/svl/style.hxx +++ b/svl/inc/svl/style.hxx @@ -34,6 +34,7 @@ #include <svl/lstner.hxx> #include <svl/brdcst.hxx> #include <svl/poolitem.hxx> +#include <svl/stylesheetuser.hxx> #include <svl/style.hrc> @@ -267,7 +268,7 @@ public: //========================================================================= class SVL_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase, - public SfxListener, public SfxBroadcaster + public SfxListener, public SfxBroadcaster, public svl::StyleSheetUser { public: TYPEINFO(); @@ -276,6 +277,9 @@ public: SfxStyleSheet( const SfxStyleSheet& ); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + virtual bool isUsedByModel() const; + virtual bool SetParent( const UniString& ); protected: diff --git a/svl/inc/svl/stylesheetuser.hxx b/svl/inc/svl/stylesheetuser.hxx new file mode 100644 index 000000000000..787263ff4a8e --- /dev/null +++ b/svl/inc/svl/stylesheetuser.hxx @@ -0,0 +1,38 @@ +/* -*- 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 SVL_STYLESHEETUSER_HXX_INCLUDED +#define SVL_STYLESHEETUSER_HXX_INCLUDED + +namespace svl +{ + +/** Test whether object that uses a stylesheet is used itself. + + This interface should be implemented by all classes that use + a SfxStyleSheet (and listen on it). It can be queried by the stylesheet + to determine if it is really used. + */ +class StyleSheetUser +{ +public: + /** Test whether this object is used. + + @return true, if the object is used, false otherwise + */ + virtual bool isUsedByModel() const = 0; +protected: + ~StyleSheetUser() {} +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 6df5bfa71b6e..812567cc830d 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -913,6 +913,11 @@ void SfxStyleSheet::Notify(SfxBroadcaster& rBC, const SfxHint& rHint ) Forward(rBC, rHint); } +bool SfxStyleSheet::isUsedByModel() const +{ + return IsUsed(); +} + //////////////////////// SfxStyleSheetPool /////////////////////////////// SfxStyleSheetPool::SfxStyleSheetPool( SfxItemPool const& rSet) |