summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-09-04 00:14:59 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-09-06 15:44:58 +0200
commit3deacd971b843a752ddf456916209f52c9aa992f (patch)
treed7558c90cd5fc24cc5590b80732c90c7d6be8c01 /sc
parentf4b91fc7230124120cf47f75c5197c5bd0c29c7f (diff)
How the hell did this survive 14 years? Kill it!
No need for a ugly static variable that just causes pain. Change-Id: I751f58a5dcfdeaa7bfd61f32ccbc13eaaf827632
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/docpool.hxx3
-rw-r--r--sc/inc/patattr.hxx3
-rw-r--r--sc/source/core/data/docpool.cxx5
-rw-r--r--sc/source/core/data/document.cxx8
-rw-r--r--sc/source/core/data/patattr.cxx4
-rw-r--r--sc/source/ui/undo/undostyl.cxx2
-rw-r--r--sc/source/ui/unoobj/styleuno.cxx4
-rw-r--r--sc/source/ui/view/formatsh.cxx4
8 files changed, 14 insertions, 19 deletions
diff --git a/sc/inc/docpool.hxx b/sc/inc/docpool.hxx
index db65148a391b..b7334863fe88 100644
--- a/sc/inc/docpool.hxx
+++ b/sc/inc/docpool.hxx
@@ -25,6 +25,7 @@
#include "scdllapi.h"
class ScStyleSheet;
+class ScDocument;
class SC_DLLPUBLIC ScDocumentPool: public SfxItemPool
{
@@ -57,7 +58,7 @@ public:
static void CheckRef( const SfxPoolItem& );
void StyleDeleted( ScStyleSheet* pStyle ); // delete templates(?) in organizer
- void CellStyleCreated( const OUString& rName );
+ void CellStyleCreated( const OUString& rName, ScDocument* pDoc );
virtual bool GetPresentation(
const SfxPoolItem& rItem,
SfxMapUnit ePresentationMetric,
diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 65b189afe103..00d0c98b7730 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -51,7 +51,6 @@ class SC_DLLPUBLIC ScPatternAttr: public SfxSetItem
OUString* pName;
ScStyleSheet* pStyle;
public:
- static ScDocument* pDoc;
ScPatternAttr(SfxItemSet* pItemSet, const OUString& rStyleName);
ScPatternAttr(SfxItemSet* pItemSet, ScStyleSheet* pStyleSheet = NULL);
ScPatternAttr(SfxItemPool* pItemPool);
@@ -113,7 +112,7 @@ public:
void SetStyleSheet(ScStyleSheet* pNewStyle, bool bClearDirectFormat = true);
const ScStyleSheet* GetStyleSheet() const { return pStyle; }
const OUString* GetStyleName() const;
- void UpdateStyleSheet();
+ void UpdateStyleSheet(ScDocument* pDoc);
void StyleToName();
bool IsVisible() const;
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index 6e4a4bd14e7c..f3fa1d807edd 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -67,6 +67,7 @@
#include "attrib.hxx"
#include "patattr.hxx"
#include "globstr.hrc"
+#include "document.hxx"
#include "sc.hrc"
#define SC_MAX_POOLREF (SFX_ITEMS_OLD_MAXREF - 39)
@@ -662,7 +663,7 @@ void ScDocumentPool::StyleDeleted( ScStyleSheet* pStyle )
}
}
-void ScDocumentPool::CellStyleCreated( const OUString& rName )
+void ScDocumentPool::CellStyleCreated( const OUString& rName, ScDocument* pDoc )
{
// If a style was created, don't keep any pattern with its name string in the pool,
// because it would compare equal to a pattern with a pointer to the new style.
@@ -679,7 +680,7 @@ void ScDocumentPool::CellStyleCreated( const OUString& rName )
{
const OUString* pStyleName = pPattern->GetStyleName();
if ( pStyleName && *pStyleName == rName )
- pPattern->UpdateStyleSheet(); // find and store style pointer
+ pPattern->UpdateStyleSheet(pDoc); // find and store style pointer
}
}
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 406f0f10a62c..201415371a77 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -5536,8 +5536,6 @@ void ScDocument::GetNextPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX,
void ScDocument::UpdStlShtPtrsFrmNms()
{
- ScPatternAttr::pDoc = this;
-
ScDocumentPool* pPool = xPoolHelper->GetDocPool();
sal_uInt32 nCount = pPool->GetItemCount2(ATTR_PATTERN);
@@ -5546,15 +5544,13 @@ void ScDocument::UpdStlShtPtrsFrmNms()
{
pPattern = (ScPatternAttr*)pPool->GetItem2(ATTR_PATTERN, i);
if (pPattern)
- pPattern->UpdateStyleSheet();
+ pPattern->UpdateStyleSheet(this);
}
- ((ScPatternAttr&)pPool->GetDefaultItem(ATTR_PATTERN)).UpdateStyleSheet();
+ ((ScPatternAttr&)pPool->GetDefaultItem(ATTR_PATTERN)).UpdateStyleSheet(this);
}
void ScDocument::StylesToNames()
{
- ScPatternAttr::pDoc = this;
-
ScDocumentPool* pPool = xPoolHelper->GetDocPool();
sal_uInt32 nCount = pPool->GetItemCount2(ATTR_PATTERN);
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index bca6a4ba770c..29351ec4bfa9 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -63,8 +63,6 @@
// STATIC DATA -----------------------------------------------------------
-ScDocument* ScPatternAttr::pDoc = NULL;
-
using sc::HMMToTwips;
using sc::TwipsToHMM;
@@ -1141,7 +1139,7 @@ void ScPatternAttr::SetStyleSheet( ScStyleSheet* pNewStyle, bool bClearDirectFor
}
}
-void ScPatternAttr::UpdateStyleSheet()
+void ScPatternAttr::UpdateStyleSheet(ScDocument* pDoc)
{
if (pName)
{
diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx
index f09971fcd820..d84d55abd4c2 100644
--- a/sc/source/ui/undo/undostyl.cxx
+++ b/sc/source/ui/undo/undostyl.cxx
@@ -146,7 +146,7 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName,
pStyle = &pStlPool->Make( aNewName, eStyleFamily, SFXSTYLEBIT_USERDEF );
if ( eStyleFamily == SFX_STYLE_FAMILY_PARA )
- rDoc.GetPool()->CellStyleCreated( aNewName );
+ rDoc.GetPool()->CellStyleCreated( aNewName, &rDoc );
}
if ( pStyle )
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 666e14539c3d..bd88df76eac8 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -696,7 +696,7 @@ void SAL_CALL ScStyleFamilyObj::insertByName( const OUString& aName, const uno::
(void)pStylePool->Make( aNameStr, eFamily, SFXSTYLEBIT_USERDEF );
if ( eFamily == SFX_STYLE_FAMILY_PARA && !rDoc.IsImportingXML() )
- rDoc.GetPool()->CellStyleCreated( aNameStr );
+ rDoc.GetPool()->CellStyleCreated( aNameStr, &rDoc );
pStyleObj->InitDoc( pDocShell, aNameStr ); // Objekt kann benutzt werden
@@ -1143,7 +1143,7 @@ void SAL_CALL ScStyleObj::setName( const OUString& aNewName )
ScDocument& rDoc = pDocShell->GetDocument();
if ( eFamily == SFX_STYLE_FAMILY_PARA && !rDoc.IsImportingXML() )
- rDoc.GetPool()->CellStyleCreated( aString );
+ rDoc.GetPool()->CellStyleCreated( aString, &rDoc );
// Zellvorlagen = 2, Seitenvorlagen = 4
sal_uInt16 nId = ( eFamily == SFX_STYLE_FAMILY_PARA ) ?
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index f7780135fb93..2bdb132ad6cb 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -608,7 +608,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
// Namen zu Style-Pointer
rDoc.UpdStlShtPtrsFrmNms();
else
- rDoc.GetPool()->CellStyleCreated( aStyleName );
+ rDoc.GetPool()->CellStyleCreated( aStyleName, &rDoc );
// Attribute uebernehmen und Style anwenden
pStyleSheet->GetItemSet().Put( aAttrSet );
@@ -905,7 +905,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
pNew->GetLanguage(), ATTR_LANGUAGE_FORMAT ) );
}
- rDoc.GetPool()->CellStyleCreated( pStyleSheet->GetName() );
+ rDoc.GetPool()->CellStyleCreated( pStyleSheet->GetName(), &rDoc );
}
else
{