summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-24 11:00:10 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-26 09:58:00 -0400
commit0809ccec5cee9f65461f7b551ffd686d2ff4281c (patch)
tree3765b411400c652996853f8e26ef8635c6ac9487 /sc
parent1e6268e50d94eac41743ee23efc1b5dc4bd176bd (diff)
Merged ScSharedCellEditSource with ScCellEditSource.
Again, this inheritance makes no sense.
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/editsrc.hxx45
-rw-r--r--sc/inc/textuno.hxx6
-rw-r--r--sc/source/ui/inc/AccessibleText.hxx8
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx26
-rw-r--r--sc/source/ui/unoobj/editsrc.cxx46
-rw-r--r--sc/source/ui/unoobj/textuno.cxx4
6 files changed, 50 insertions, 85 deletions
diff --git a/sc/inc/editsrc.hxx b/sc/inc/editsrc.hxx
index 150e83ddba21..20de06cb99af 100644
--- a/sc/inc/editsrc.hxx
+++ b/sc/inc/editsrc.hxx
@@ -80,45 +80,34 @@ public:
virtual void UpdateData();
};
-
-// Data (incl. EditEngine) for cell EditSource is now shared in ScCellTextData
-
-class ScSharedCellEditSource : public SvxEditSource
+/**
+ * Data (incl. EditEngine) for cell EditSource is now shared in
+ * ScCellTextData.
+ *
+ * ScCellEditSource with local copy of ScCellTextData is used by
+ * ScCellFieldsObj, ScCellFieldObj.
+ */
+class ScCellEditSource : public SvxEditSource
{
private:
- ScCellTextData* pCellTextData;
-
-protected:
- ScCellTextData* GetCellTextData() const { return pCellTextData; } // for ScCellEditSource
+ ScCellTextData* pCellTextData;
public:
- ScSharedCellEditSource( ScCellTextData* pData );
- virtual ~ScSharedCellEditSource();
+ ScCellEditSource(ScDocShell* pDocSh, const ScAddress& rP);
+ virtual ~ScCellEditSource();
// GetEditEngine is needed because the forwarder doesn't have field functions
- ScEditEngineDefaulter* GetEditEngine();
-
- virtual SvxEditSource* Clone() const;
- virtual SvxTextForwarder* GetTextForwarder();
+ ScEditEngineDefaulter* GetEditEngine();
- virtual void UpdateData();
+ virtual SvxEditSource* Clone() const;
+ virtual SvxTextForwarder* GetTextForwarder();
- void SetDoUpdateData(sal_Bool bValue);
- sal_Bool IsDirty() const;
-};
+ virtual void UpdateData();
-// ScCellEditSource with local copy of ScCellTextData is used by ScCellFieldsObj, ScCellFieldObj
-
-class ScCellEditSource : public ScSharedCellEditSource
-{
-public:
- ScCellEditSource( ScDocShell* pDocSh, const ScAddress& rP );
- virtual ~ScCellEditSource();
-
- virtual SvxEditSource* Clone() const;
+ void SetDoUpdateData(bool bValue);
+ bool IsDirty() const;
};
-
class ScAnnotationEditSource : public SvxEditSource, public SfxListener
{
private:
diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx
index 17d6d77a9a7f..5dccc865cbc0 100644
--- a/sc/inc/textuno.hxx
+++ b/sc/inc/textuno.hxx
@@ -49,7 +49,7 @@ class ScDocShell;
class ScAddress;
class ScCellObj;
class ScSimpleEditSource;
-class ScSharedCellEditSource;
+class ScCellEditSource;
class ScEditEngineDefaulter;
class ScFieldEditEngine;
@@ -376,7 +376,7 @@ protected:
ScAddress aCellPos;
ScFieldEditEngine* pEditEngine;
SvxEditEngineForwarder* pForwarder;
- ScSharedCellEditSource* pOriginalSource;
+ ScCellEditSource* pOriginalSource;
sal_Bool bDataValid;
sal_Bool bInUpdate;
sal_Bool bDirty;
@@ -396,7 +396,7 @@ public:
void UpdateData();
ScFieldEditEngine* GetEditEngine() { GetTextForwarder(); return pEditEngine; }
- ScSharedCellEditSource* GetOriginalSource(); // used as argument for SvxUnoText ctor
+ ScCellEditSource* GetOriginalSource(); // used as argument for SvxUnoText ctor
// used for ScCellEditSource:
ScDocShell* GetDocShell() const { return pDocShell; }
diff --git a/sc/source/ui/inc/AccessibleText.hxx b/sc/source/ui/inc/AccessibleText.hxx
index 43d3c1aba20d..8453f08480ce 100644
--- a/sc/source/ui/inc/AccessibleText.hxx
+++ b/sc/source/ui/inc/AccessibleText.hxx
@@ -72,7 +72,7 @@ private:
mutable SfxBroadcaster maBroadcaster;
// prevent the using of this method of the base class
- ScSharedCellEditSource* GetOriginalSource() { return NULL; }
+ ScCellEditSource* GetOriginalSource() { return NULL; }
};
@@ -125,7 +125,7 @@ private:
ScAccessibleCell* mpAccessibleCell;
// prevent the using of this method of the base class
- ScSharedCellEditSource* GetOriginalSource() { return NULL; }
+ ScCellEditSource* GetOriginalSource() { return NULL; }
using ScAccessibleCellBaseTextData::GetDocShell;
ScDocShell* GetDocShell(ScTabViewShell* pViewShell);
@@ -209,7 +209,7 @@ private:
ScPreviewShell* mpViewShell;
// prevent the using of this method of the base class
- ScSharedCellEditSource* GetOriginalSource() { return NULL; }
+ ScCellEditSource* GetOriginalSource() { return NULL; }
using ScAccessibleCellBaseTextData::GetDocShell;
ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
@@ -241,7 +241,7 @@ private:
sal_Bool mbRowHeader;
// prevent the using of this method of the base class
- ScSharedCellEditSource* GetOriginalSource() { return NULL; }
+ ScCellEditSource* GetOriginalSource() { return NULL; }
using ScAccessibleCellBaseTextData::GetDocShell;
ScDocShell* GetDocShell(ScPreviewShell* pViewShell);
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 90fee597de6d..f466a9a3628c 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -994,7 +994,7 @@ ScSubTotalFunc lcl_SummaryToSubTotal( sheet::GeneralFunction eSummary )
namespace {
template<typename BorderLineType>
-const ::editeng::SvxBorderLine* lcl_getBorderLine(
+const ::editeng::SvxBorderLine* lcl_getBorderLine(
::editeng::SvxBorderLine& rLine, const BorderLineType& rStruct )
{
// Convert from 1/100mm to Twips.
@@ -1008,13 +1008,13 @@ const ::editeng::SvxBorderLine* lcl_getBorderLine(
}
}
-const ::editeng::SvxBorderLine* ScHelperFunctions::GetBorderLine(
+const ::editeng::SvxBorderLine* ScHelperFunctions::GetBorderLine(
::editeng::SvxBorderLine& rLine, const table::BorderLine& rStruct )
{
return lcl_getBorderLine( rLine, rStruct);
}
-const ::editeng::SvxBorderLine* ScHelperFunctions::GetBorderLine(
+const ::editeng::SvxBorderLine* ScHelperFunctions::GetBorderLine(
::editeng::SvxBorderLine& rLine, const table::BorderLine2& rStruct )
{
return lcl_getBorderLine( rLine, rStruct);
@@ -6124,8 +6124,8 @@ SvxUnoText& ScCellObj::GetUnoText()
pUnoText->acquire();
if (nActionLockCount)
{
- ScSharedCellEditSource* pEditSource =
- static_cast<ScSharedCellEditSource*> (pUnoText->GetEditSource());
+ ScCellEditSource* pEditSource =
+ static_cast<ScCellEditSource*> (pUnoText->GetEditSource());
if (pEditSource)
pEditSource->SetDoUpdateData(false);
}
@@ -6832,8 +6832,8 @@ void SAL_CALL ScCellObj::addActionLock() throw(uno::RuntimeException)
{
if (pUnoText)
{
- ScSharedCellEditSource* pEditSource =
- static_cast<ScSharedCellEditSource*> (pUnoText->GetEditSource());
+ ScCellEditSource* pEditSource =
+ static_cast<ScCellEditSource*> (pUnoText->GetEditSource());
if (pEditSource)
pEditSource->SetDoUpdateData(false);
}
@@ -6851,8 +6851,8 @@ void SAL_CALL ScCellObj::removeActionLock() throw(uno::RuntimeException)
{
if (pUnoText)
{
- ScSharedCellEditSource* pEditSource =
- static_cast<ScSharedCellEditSource*> (pUnoText->GetEditSource());
+ ScCellEditSource* pEditSource =
+ static_cast<ScCellEditSource*> (pUnoText->GetEditSource());
if (pEditSource)
{
pEditSource->SetDoUpdateData(sal_True);
@@ -6869,8 +6869,8 @@ void SAL_CALL ScCellObj::setActionLocks( sal_Int16 nLock ) throw(uno::RuntimeExc
SolarMutexGuard aGuard;
if (pUnoText)
{
- ScSharedCellEditSource* pEditSource =
- static_cast<ScSharedCellEditSource*> (pUnoText->GetEditSource());
+ ScCellEditSource* pEditSource =
+ static_cast<ScCellEditSource*> (pUnoText->GetEditSource());
if (pEditSource)
{
pEditSource->SetDoUpdateData(nLock == 0);
@@ -6887,8 +6887,8 @@ sal_Int16 SAL_CALL ScCellObj::resetActionLocks() throw(uno::RuntimeException)
sal_uInt16 nRet(nActionLockCount);
if (pUnoText)
{
- ScSharedCellEditSource* pEditSource =
- static_cast<ScSharedCellEditSource*> (pUnoText->GetEditSource());
+ ScCellEditSource* pEditSource =
+ static_cast<ScCellEditSource*> (pUnoText->GetEditSource());
if (pEditSource)
{
pEditSource->SetDoUpdateData(sal_True);
diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx
index af6bad4d4d06..d1a41659158f 100644
--- a/sc/source/ui/unoobj/editsrc.cxx
+++ b/sc/source/ui/unoobj/editsrc.cxx
@@ -102,70 +102,46 @@ void ScHeaderFooterEditSource::UpdateData()
//------------------------------------------------------------------------
-ScSharedCellEditSource::ScSharedCellEditSource( ScCellTextData* pData ) :
- pCellTextData( pData )
-{
- // pCellTextData is part of the ScCellTextObj.
- // Text range and cursor keep a reference to their parent text, so the text object is
- // always alive and the CellTextData is valid as long as there are children.
-}
+ScCellEditSource::ScCellEditSource(ScDocShell* pDocSh, const ScAddress& rP) :
+ pCellTextData(new ScCellTextData(pDocSh, rP)) {}
-ScSharedCellEditSource::~ScSharedCellEditSource()
+ScCellEditSource::~ScCellEditSource()
{
+ delete pCellTextData;
}
-SvxEditSource* ScSharedCellEditSource::Clone() const
+SvxEditSource* ScCellEditSource::Clone() const
{
- return new ScSharedCellEditSource( pCellTextData );
+ return new ScCellEditSource(pCellTextData->GetDocShell(), pCellTextData->GetCellPos());
}
-SvxTextForwarder* ScSharedCellEditSource::GetTextForwarder()
+SvxTextForwarder* ScCellEditSource::GetTextForwarder()
{
return pCellTextData->GetTextForwarder();
}
-void ScSharedCellEditSource::UpdateData()
+void ScCellEditSource::UpdateData()
{
pCellTextData->UpdateData();
}
-void ScSharedCellEditSource::SetDoUpdateData(sal_Bool bValue)
+void ScCellEditSource::SetDoUpdateData(bool bValue)
{
pCellTextData->SetDoUpdate(bValue);
}
-sal_Bool ScSharedCellEditSource::IsDirty() const
+bool ScCellEditSource::IsDirty() const
{
return pCellTextData->IsDirty();
}
-ScEditEngineDefaulter* ScSharedCellEditSource::GetEditEngine()
+ScEditEngineDefaulter* ScCellEditSource::GetEditEngine()
{
return pCellTextData->GetEditEngine();
}
//------------------------------------------------------------------------
-// each ScCellEditSource object has its own ScCellTextData
-
-ScCellEditSource::ScCellEditSource( ScDocShell* pDocSh, const ScAddress& rP ) :
- ScSharedCellEditSource( new ScCellTextData( pDocSh, rP ) )
-{
-}
-
-ScCellEditSource::~ScCellEditSource()
-{
- delete GetCellTextData(); // not accessed in ScSharedCellEditSource dtor
-}
-
-SvxEditSource* ScCellEditSource::Clone() const
-{
- const ScCellTextData* pData = GetCellTextData();
- return new ScCellEditSource( pData->GetDocShell(), pData->GetCellPos() );
-}
-
-//------------------------------------------------------------------------
-
ScAnnotationEditSource::ScAnnotationEditSource(ScDocShell* pDocSh, const ScAddress& rP) :
pDocShell( pDocSh ),
aCellPos( rP ),
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 1fb1f522b29f..b333f142648d 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -1001,10 +1001,10 @@ ScCellTextData::~ScCellTextData()
delete pOriginalSource;
}
-ScSharedCellEditSource* ScCellTextData::GetOriginalSource()
+ScCellEditSource* ScCellTextData::GetOriginalSource()
{
if (!pOriginalSource)
- pOriginalSource = new ScSharedCellEditSource( this );
+ pOriginalSource = new ScCellEditSource(pDocShell, aCellPos);
return pOriginalSource;
}