diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-25 15:08:36 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-26 09:58:04 -0400 |
commit | f0561d3f3d28506a1351cebdd1bbe8d80b67892f (patch) | |
tree | b73b0433e04c11b3d8820dcb37c5b38860b29e2e /sc/inc | |
parent | 98831752bab7827f1d4d6d121daa1d0a0de805ee (diff) |
Define interfance to get edit engine instance without ugly casting.
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/editsrc.hxx | 20 | ||||
-rw-r--r-- | sc/inc/fielduno.hxx | 18 |
2 files changed, 23 insertions, 15 deletions
diff --git a/sc/inc/editsrc.hxx b/sc/inc/editsrc.hxx index 64c5871b32fb..d3258434244f 100644 --- a/sc/inc/editsrc.hxx +++ b/sc/inc/editsrc.hxx @@ -44,11 +44,19 @@ class ScHeaderFooterTextData; class ScAccessibleTextData; class SdrObject; +class ScEditSource : public SvxEditSource +{ +public: + virtual ScEditEngineDefaulter* GetEditEngine() = 0; +}; + /** - * ScHeaderFooterEditSource with local copy of ScHeaderFooterTextData is - * used by field objects. + * ScHeaderFooterTextObj keeps the authoritative copy of + * ScHeaderFooterTextData that this class holds reference to. It's a + * reference instead of a copy to avoid broadcasting changes to the + * authoritative copy. */ -class ScHeaderFooterEditSource : public SvxEditSource +class ScHeaderFooterEditSource : public ScEditSource { private: ScHeaderFooterTextData& mrTextData; @@ -58,7 +66,7 @@ public: virtual ~ScHeaderFooterEditSource(); // GetEditEngine is needed because the forwarder doesn't have field functions - ScEditEngineDefaulter* GetEditEngine(); + virtual ScEditEngineDefaulter* GetEditEngine(); virtual SvxEditSource* Clone() const; virtual SvxTextForwarder* GetTextForwarder(); @@ -72,7 +80,7 @@ public: * ScCellEditSource with local copy of ScCellTextData is used by * ScCellFieldsObj, ScCellFieldObj. */ -class ScCellEditSource : public SvxEditSource +class ScCellEditSource : public ScEditSource { private: ScCellTextData* pCellTextData; @@ -82,7 +90,7 @@ public: virtual ~ScCellEditSource(); // GetEditEngine is needed because the forwarder doesn't have field functions - ScEditEngineDefaulter* GetEditEngine(); + virtual ScEditEngineDefaulter* GetEditEngine(); virtual SvxEditSource* Clone() const; virtual SvxTextForwarder* GetTextForwarder(); diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx index 395a48b8e1a7..6b535ffff8d4 100644 --- a/sc/inc/fielduno.hxx +++ b/sc/inc/fielduno.hxx @@ -51,7 +51,7 @@ #include <boost/noncopyable.hpp> #include <boost/scoped_ptr.hpp> -class SvxEditSource; +class ScEditSource; class SvxFieldItem; class SvxFieldData; class ScEditFieldObj; @@ -71,7 +71,7 @@ class ScCellFieldsObj : public cppu::WeakImplHelper5< private: ScDocShell* pDocShell; ScAddress aCellPos; - SvxEditSource* pEditSource; + ScEditSource* mpEditSource; /// List of refresh listeners. cppu::OInterfaceContainerHelper* mpRefreshListeners; /// mutex to lock the InterfaceContainerHelper @@ -140,7 +140,7 @@ class ScHeaderFieldsObj : public cppu::WeakImplHelper5< private: ScHeaderFooterTextData& mrData; sal_uInt16 nType; - SvxEditSource* pEditSource; + ScEditSource* mpEditSource; /// List of refresh listeners. cppu::OInterfaceContainerHelper* mpRefreshListeners; @@ -208,7 +208,7 @@ private: const SfxItemPropertySet* pPropSet; com::sun::star::uno::Reference<com::sun::star::text::XTextRange> mpContent; sal_uInt16 nType; - SvxEditSource* mpEditSource; + ScEditSource* mpEditSource; ESelection aSelection; sal_Int16 nFileFormat; // enum SvxFileFormat, valid if not inserted @@ -216,7 +216,7 @@ private: public: ScHeaderFieldObj( const com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rContent, - SvxEditSource* pEditSrc, sal_uInt16 nT, const ESelection& rSel); + ScEditSource* pEditSrc, sal_uInt16 nT, const ESelection& rSel); virtual ~ScHeaderFieldObj(); // called by getImplementation: @@ -225,7 +225,7 @@ public: SvxFieldItem CreateFieldItem(); void InitDoc( const com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rContent, - SvxEditSource* pEditSrc, const ESelection& rSel); + ScEditSource* pEditSrc, const ESelection& rSel); virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) @@ -340,7 +340,7 @@ public: private: const SfxItemPropertySet* pPropSet; - SvxEditSource* pEditSource; + ScEditSource* mpEditSource; ESelection aSelection; FieldType meType; @@ -364,7 +364,7 @@ public: ScEditFieldObj( const com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rContent, - SvxEditSource* pEditSrc, FieldType eType, const ESelection& rSel); + ScEditSource* pEditSrc, FieldType eType, const ESelection& rSel); virtual ~ScEditFieldObj(); void DeleteField(); @@ -372,7 +372,7 @@ public: SvxFieldItem CreateFieldItem(); void InitDoc( const com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rContent, - SvxEditSource* pEditSrc, const ESelection& rSel); + ScEditSource* pEditSrc, const ESelection& rSel); // XTextField virtual ::rtl::OUString SAL_CALL getPresentation( sal_Bool bShowCommand ) |