[Libreoffice-commits] core.git: sw/inc sw/source
Jan-Marek Glogowski
glogow at fbihome.de
Thu Jan 22 01:12:19 PST 2015
sw/inc/docary.hxx | 162 +++++++++++++++++++------------------
sw/source/core/doc/doc.cxx | 12 --
sw/source/core/doc/docfmt.cxx | 36 --------
sw/source/core/doc/docnew.cxx | 68 +--------------
sw/source/core/docnode/section.cxx | 17 ---
sw/source/core/fields/fldbas.cxx | 12 --
sw/source/core/tox/tox.cxx | 12 --
sw/source/core/undo/unattr.cxx | 16 +--
sw/source/core/undo/undobj1.cxx | 4
9 files changed, 103 insertions(+), 236 deletions(-)
New commits:
commit 89f01955e2594bfba6f1d148b7a48dfe3aff5e60
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Tue Nov 11 16:52:48 2014 +0100
Merge common code of sw format lists
Moves the common code of Fmt based lists and simple vector lists
into two intermediate template classes, of which one provides
the SwFmtsBase interface.
Change-Id: If963c19293584654a3d17438221e3fca8bdfd4f9
Reviewed-on: https://gerrit.libreoffice.org/13448
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index bd96c3c..4f40a22 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -25,10 +25,6 @@
#include <algorithm>
#include <o3tl/sorted_vector.hxx>
-class SwFieldType;
-class SwTOXType;
-class SwUndo;
-class SwNumRule;
class SwRangeRedline;
class SwExtraRedline;
class SwUnoCrsr;
@@ -47,6 +43,9 @@ namespace com { namespace sun { namespace star { namespace i18n {
#include <fmtcol.hxx>
#include <frmfmt.hxx>
#include <section.hxx>
+#include <fldbas.hxx>
+#include <tox.hxx>
+#include <numrule.hxx>
/** provides some methods for generic operations on lists that contain
SwFmt* subclasses. */
@@ -54,114 +53,127 @@ class SwFmtsBase
{
public:
virtual size_t GetFmtCount() const = 0;
- virtual const SwFmt* GetFmt(size_t idx) const = 0;
- virtual SwFmt* GetFmt(size_t idx) = 0;
- virtual ~SwFmtsBase() = 0;
+ virtual SwFmt* GetFmt(size_t idx) const = 0;
+ virtual ~SwFmtsBase() {};
};
-class SwGrfFmtColls : public SwFmtsBase
+template<typename Value>
+class SwVectorModifyBase : public std::vector<Value>
{
+public:
+ typedef typename std::vector<Value>::const_iterator const_iterator;
+
+protected:
+ enum class DestructorPolicy {
+ KeepElements,
+ FreeElements,
+ };
+
private:
- std::vector<SwGrfFmtColl*> mvColls;
+ const DestructorPolicy mPolicy;
+
+protected:
+ // default destructor deletes all contained elements
+ SwVectorModifyBase(DestructorPolicy policy = DestructorPolicy::FreeElements)
+ : mPolicy(policy) {}
public:
- virtual size_t GetFmtCount() const SAL_OVERRIDE { return size(); }
- virtual const SwGrfFmtColl* GetFmt(size_t idx) const SAL_OVERRIDE { return operator[](idx); }
- virtual SwGrfFmtColl* GetFmt(size_t idx) SAL_OVERRIDE { return operator[](idx); }
- size_t size() const { return mvColls.size(); }
- SwGrfFmtColl *operator[](size_t idx) const { return mvColls[idx]; }
- void push_back(SwGrfFmtColl* pColl) { mvColls.push_back(pColl); }
- void DeleteAndDestroy(int nStartIdx, int nEndIdx);
- sal_uInt16 GetPos(const SwGrfFmtColl* pFmt) const;
- /// free's any remaining child objects
- virtual ~SwGrfFmtColls() {}
+ using std::vector<Value>::begin;
+ using std::vector<Value>::end;
+
+ // free any remaining child objects based on mPolicy
+ virtual ~SwVectorModifyBase()
+ {
+ if (mPolicy == DestructorPolicy::FreeElements)
+ for(const_iterator it = begin(); it != end(); ++it)
+ delete *it;
+ }
+
+ void DeleteAndDestroy(int aStartIdx, int aEndIdx)
+ {
+ if (aEndIdx < aStartIdx)
+ return;
+ for (const_iterator it = begin() + aStartIdx;
+ it != begin() + aEndIdx; ++it)
+ delete *it;
+ this->erase( begin() + aStartIdx, begin() + aEndIdx);
+ }
+
+ sal_uInt16 GetPos(Value const& p) const
+ {
+ const_iterator const it = std::find(begin(), end(), p);
+ return it == end() ? USHRT_MAX : it - begin();
+ }
+
+ bool Contains(Value const& p) const
+ { return std::find(begin(), end(), p) != end(); }
+
+ void dumpAsXml(xmlTextWriterPtr) const {};
};
-/// stupid base class to work around MSVC dllexport mess
-class SAL_DLLPUBLIC_TEMPLATE SwFrmFmts_Base : public std::vector<SwFrmFmt*> {};
+template<typename Value>
+class SwFmtsModifyBase : public SwVectorModifyBase<Value>, public SwFmtsBase
+{
+protected:
+ SwFmtsModifyBase(typename SwVectorModifyBase<Value>::DestructorPolicy
+ policy = SwVectorModifyBase<Value>::DestructorPolicy::FreeElements)
+ : SwVectorModifyBase<Value>(policy) {}
+
+public:
+ virtual size_t GetFmtCount() const SAL_OVERRIDE
+ { return std::vector<Value>::size(); }
+
+ virtual Value GetFmt(size_t idx) const SAL_OVERRIDE
+ { return std::vector<Value>::operator[](idx); }
+
+ inline sal_uInt16 GetPos(const SwFmt *p) const
+ { return SwVectorModifyBase<Value>::GetPos( static_cast<Value>( const_cast<SwFmt*>( p ) ) ); }
+ inline bool Contains(const SwFmt *p) const
+ { return SwVectorModifyBase<Value>::Contains( static_cast<Value>( const_cast<SwFmt*>( p ) ) ); }
+};
+
+class SwGrfFmtColls : public SwFmtsModifyBase<SwGrfFmtColl*>
+{
+public:
+ SwGrfFmtColls() : SwFmtsModifyBase( DestructorPolicy::KeepElements ) {}
+};
/// Specific frame formats (frames, DrawObjects).
-class SW_DLLPUBLIC SwFrmFmts : public SwFrmFmts_Base, public SwFmtsBase
+class SW_DLLPUBLIC SwFrmFmts : public SwFmtsModifyBase<SwFrmFmt*>
{
public:
- virtual size_t GetFmtCount() const SAL_OVERRIDE { return size(); }
- virtual const SwFrmFmt* GetFmt(size_t idx) const SAL_OVERRIDE { return operator[](idx); }
- virtual SwFrmFmt* GetFmt(size_t idx) SAL_OVERRIDE { return operator[](idx); }
- sal_uInt16 GetPos(const SwFrmFmt* pFmt) const;
- bool Contains(const SwFrmFmt* pFmt) const;
void dumpAsXml(xmlTextWriterPtr w, const char* pName) const;
- /// free's any remaining child objects
- virtual ~SwFrmFmts();
};
-class SwCharFmts : public std::vector<SwCharFmt*>, public SwFmtsBase
+class SwCharFmts : public SwFmtsModifyBase<SwCharFmt*>
{
public:
- virtual size_t GetFmtCount() const SAL_OVERRIDE { return size(); }
- virtual const SwCharFmt* GetFmt(size_t idx) const SAL_OVERRIDE { return operator[](idx); }
- virtual SwCharFmt* GetFmt(size_t idx) SAL_OVERRIDE { return operator[](idx); }
- sal_uInt16 GetPos(const SwCharFmt* pFmt) const;
- bool Contains(const SwCharFmt* pFmt) const;
void dumpAsXml(xmlTextWriterPtr w) const;
- /// free's any remaining child objects
- virtual ~SwCharFmts();
};
-class SwTxtFmtColls : public std::vector<SwTxtFmtColl*>, public SwFmtsBase
+class SwTxtFmtColls : public SwFmtsModifyBase<SwTxtFmtColl*>
{
public:
- virtual size_t GetFmtCount() const SAL_OVERRIDE { return size(); }
- virtual const SwTxtFmtColl* GetFmt(size_t idx) const SAL_OVERRIDE { return operator[](idx); }
- virtual SwTxtFmtColl* GetFmt(size_t idx) SAL_OVERRIDE { return operator[](idx); }
- sal_uInt16 GetPos(const SwTxtFmtColl* pFmt) const;
+ SwTxtFmtColls() : SwFmtsModifyBase( DestructorPolicy::KeepElements ) {}
void dumpAsXml(xmlTextWriterPtr w) const;
- virtual ~SwTxtFmtColls() {}
};
/// Array of Undo-history.
-class SW_DLLPUBLIC SwSectionFmts : public std::vector<SwSectionFmt*>, public SwFmtsBase
+class SW_DLLPUBLIC SwSectionFmts : public SwFmtsModifyBase<SwSectionFmt*>
{
public:
- virtual size_t GetFmtCount() const SAL_OVERRIDE { return size(); }
- virtual const SwSectionFmt* GetFmt(size_t idx) const SAL_OVERRIDE { return operator[](idx); }
- virtual SwSectionFmt* GetFmt(size_t idx) SAL_OVERRIDE { return operator[](idx); }
- sal_uInt16 GetPos(const SwSectionFmt* pFmt) const;
- bool Contains(const SwSectionFmt* pFmt) const;
void dumpAsXml(xmlTextWriterPtr w) const;
- /// free's any remaining child objects
- virtual ~SwSectionFmts();
};
-class SwFldTypes : public std::vector<SwFieldType*> {
+class SwFldTypes : public SwVectorModifyBase<SwFieldType*> {
public:
- /// the destructor will free all objects still in the vector
- ~SwFldTypes();
- sal_uInt16 GetPos(const SwFieldType* pFieldType) const;
void dumpAsXml(xmlTextWriterPtr w) const;
};
-class SwTOXTypes {
-private:
- typedef std::vector<SwTOXType*> _SwTOXTypes;
- _SwTOXTypes items;
-public:
- /// the destructor will free all objects still in the vector
- ~SwTOXTypes();
- sal_uInt16 GetPos(const SwTOXType* pTOXType) const;
- size_t size() const { return items.size(); };
- SwTOXType* operator[] (size_t n) { return items[n]; };
- const SwTOXType* operator[] (size_t n) const { return items[n]; };
- void push_back ( SwTOXType* value) { items.push_back(value); };
- void clear() { items.clear(); };
- _SwTOXTypes::const_iterator begin() const { return items.begin(); };
- _SwTOXTypes::const_iterator end() const { return items.end(); };
-};
+class SwTOXTypes : public SwVectorModifyBase<SwTOXType*> {};
-class SW_DLLPUBLIC SwNumRuleTbl : public std::vector<SwNumRule*> {
+class SW_DLLPUBLIC SwNumRuleTbl : public SwVectorModifyBase<SwNumRule*> {
public:
- /// the destructor will free all objects still in the vector
- ~SwNumRuleTbl();
- sal_uInt16 GetPos(const SwNumRule* pRule) const;
void dumpAsXml(xmlTextWriterPtr w) const;
};
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index c81800b..034c122 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1731,16 +1731,4 @@ SwDoc::GetVbaEventProcessor()
return mxVbaEvents;
}
-sal_uInt16 SwNumRuleTbl::GetPos(const SwNumRule* pRule) const
-{
- const_iterator it = std::find(begin(), end(), pRule);
- return it == end() ? USHRT_MAX : it - begin();
-}
-
-SwNumRuleTbl::~SwNumRuleTbl()
-{
- for(const_iterator it = begin(); it != end(); ++it)
- delete *it;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index d965a05..68c28ea 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -2008,40 +2008,4 @@ namespace docfunc
}
}
-SwFmtsBase::~SwFmtsBase() {}
-
-sal_uInt16 SwFrmFmts::GetPos(const SwFrmFmt* p) const
-{
- const_iterator it = std::find(begin(), end(), p);
- return it == end() ? USHRT_MAX : it - begin();
-}
-
-bool SwFrmFmts::Contains(const SwFrmFmt* p) const
-{
- return std::find(begin(), end(), p) != end();
-}
-
-SwFrmFmts::~SwFrmFmts()
-{
- for(const_iterator it = begin(); it != end(); ++it)
- delete *it;
-}
-
-sal_uInt16 SwCharFmts::GetPos(const SwCharFmt* p) const
-{
- const_iterator it = std::find(begin(), end(), p);
- return it == end() ? USHRT_MAX : it - begin();
-}
-
-bool SwCharFmts::Contains(const SwCharFmt* p) const
-{
- return std::find(begin(), end(), p) != end();
-}
-
-SwCharFmts::~SwCharFmts()
-{
- for(const_iterator it = begin(); it != end(); ++it)
- delete *it;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 54e486a..c2f56aa3 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -377,36 +377,6 @@ SwDoc::SwDoc()
getIDocumentState().ResetModified();
}
-static void DeleteAndDestroy(SwFrmFmts& rFmts, int aStartIdx, int aEndIdx)
-{
- if (aEndIdx < aStartIdx)
- return;
- for( SwFrmFmts::const_iterator it = rFmts.begin() + aStartIdx;
- it != rFmts.begin() + aEndIdx; ++it )
- delete *it;
- rFmts.erase( rFmts.begin() + aStartIdx, rFmts.begin() + aEndIdx);
-}
-
-static void DeleteAndDestroy(SwTxtFmtColls& rFmts, int aStartIdx, int aEndIdx)
-{
- if (aEndIdx < aStartIdx)
- return;
- for( SwTxtFmtColls::const_iterator it = rFmts.begin() + aStartIdx;
- it != rFmts.begin() + aEndIdx; ++it )
- delete *it;
- rFmts.erase( rFmts.begin() + aStartIdx, rFmts.begin() + aEndIdx);
-}
-
-static void DeleteAndDestroy(SwCharFmts& rFmts, int aStartIdx, int aEndIdx)
-{
- if (aEndIdx < aStartIdx)
- return;
- for( SwCharFmts::const_iterator it = rFmts.begin() + aStartIdx;
- it != rFmts.begin() + aEndIdx; ++it )
- delete *it;
- rFmts.erase( rFmts.begin() + aStartIdx, rFmts.begin() + aEndIdx);
-}
-
/**
* Speciality: a member of the class SwDoc is located at
* position 0 in the array of the Format and GDI objects.
@@ -539,8 +509,8 @@ SwDoc::~SwDoc()
// array, we should delete it as the last. With this we avoid
// reparenting the Formats all the time!
if( 2 < mpTxtFmtCollTbl->size() )
- DeleteAndDestroy(*mpTxtFmtCollTbl, 2, mpTxtFmtCollTbl->size());
- DeleteAndDestroy(*mpTxtFmtCollTbl, 1, mpTxtFmtCollTbl->size());
+ mpTxtFmtCollTbl->DeleteAndDestroy(2, mpTxtFmtCollTbl->size());
+ mpTxtFmtCollTbl->DeleteAndDestroy(1, mpTxtFmtCollTbl->size());
delete mpTxtFmtCollTbl;
OSL_ENSURE( mpDfltGrfFmtColl == (*mpGrfFmtCollTbl)[0],
@@ -570,7 +540,7 @@ SwDoc::~SwDoc()
// All Flys need to be destroyed before the Drawing Model,
// because Flys can still contain DrawContacts, when no
// Layout could be constructed due to a read error.
- DeleteAndDestroy( *mpSpzFrmFmtTbl, 0, mpSpzFrmFmtTbl->size() );
+ mpSpzFrmFmtTbl->DeleteAndDestroy( 0, mpSpzFrmFmtTbl->size() );
// Only now destroy the Model, the drawing objects - which are also
// contained in the Undo - need to remove their attributes from the
@@ -732,20 +702,20 @@ void SwDoc::ClearDoc()
// array, we should delete it as the last. With this we avoid
// reparenting the Formats all the time!
if( 2 < mpTxtFmtCollTbl->size() )
- DeleteAndDestroy(*mpTxtFmtCollTbl, 2, mpTxtFmtCollTbl->size());
- DeleteAndDestroy(*mpTxtFmtCollTbl, 1, mpTxtFmtCollTbl->size());
+ mpTxtFmtCollTbl->DeleteAndDestroy(2, mpTxtFmtCollTbl->size());
+ mpTxtFmtCollTbl->DeleteAndDestroy(1, mpTxtFmtCollTbl->size());
mpGrfFmtCollTbl->DeleteAndDestroy(1, mpGrfFmtCollTbl->size());
- DeleteAndDestroy(*mpCharFmtTbl, 1, mpCharFmtTbl->size());
+ mpCharFmtTbl->DeleteAndDestroy(1, mpCharFmtTbl->size());
if( getIDocumentLayoutAccess().GetCurrentViewShell() )
{
// search the FrameFormat of the root frm. This is not allowed to delete
mpFrmFmtTbl->erase( std::find( mpFrmFmtTbl->begin(), mpFrmFmtTbl->end(), getIDocumentLayoutAccess().GetCurrentViewShell()->GetLayout()->GetFmt() ) );
- DeleteAndDestroy(*mpFrmFmtTbl, 1, mpFrmFmtTbl->size());
+ mpFrmFmtTbl->DeleteAndDestroy(1, mpFrmFmtTbl->size());
mpFrmFmtTbl->push_back( getIDocumentLayoutAccess().GetCurrentViewShell()->GetLayout()->GetFmt() );
}
else
- DeleteAndDestroy(*mpFrmFmtTbl, 1, mpFrmFmtTbl->size());
+ mpFrmFmtTbl->DeleteAndDestroy(1, mpFrmFmtTbl->size());
mxForbiddenCharsTable.clear();
@@ -1156,26 +1126,4 @@ else
return aStartAppendIndex;
}
-sal_uInt16 SwTxtFmtColls::GetPos(const SwTxtFmtColl* p) const
-{
- const_iterator it = std::find(begin(), end(), p);
- return it == end() ? USHRT_MAX : it - begin();
-}
-
-void SwGrfFmtColls::DeleteAndDestroy(int nStartIdx, int nEndIdx)
-{
- if (nEndIdx < nStartIdx)
- return;
- for( std::vector<SwGrfFmtColl*>::const_iterator it = mvColls.begin() + nStartIdx;
- it != mvColls.begin() + nEndIdx; ++it )
- delete *it;
- mvColls.erase( mvColls.begin() + nStartIdx, mvColls.begin() + nEndIdx);
-}
-
-sal_uInt16 SwGrfFmtColls::GetPos(const SwGrfFmtColl* p) const
-{
- std::vector<SwGrfFmtColl*>::const_iterator it = std::find(mvColls.begin(), mvColls.end(), p);
- return it == mvColls.end() ? USHRT_MAX : it - mvColls.begin();
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 89349a1..e1a90b7 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -1589,21 +1589,4 @@ bool SwIntrnlSectRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd,
pSttNd->EndOfSectionIndex() < nEndNd;
}
-sal_uInt16 SwSectionFmts::GetPos(const SwSectionFmt* p) const
-{
- const_iterator it = std::find(begin(), end(), p);
- return it == end() ? USHRT_MAX : it - begin();
-}
-
-bool SwSectionFmts::Contains(const SwSectionFmt* p) const
-{
- return std::find(begin(), end(), p) != end();
-}
-
-SwSectionFmts::~SwSectionFmts()
-{
- for(const_iterator it = begin(); it != end(); ++it)
- delete *it;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index cf40aaf..f9114ac 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -747,16 +747,4 @@ bool SwField::IsClickable() const
return false;
}
-sal_uInt16 SwFldTypes::GetPos(const SwFieldType* pFieldType) const
-{
- const_iterator it = std::find(begin(), end(), pFieldType);
- return it == end() ? USHRT_MAX : it - begin();
-}
-
-SwFldTypes::~SwFldTypes()
-{
- for(const_iterator it = begin(); it != end(); ++it)
- delete *it;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 146ce53..63faef1 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -858,16 +858,4 @@ const SwFormTokens& SwForm::GetPattern(sal_uInt16 nLevel) const
return aPattern[nLevel];
}
-sal_uInt16 SwTOXTypes::GetPos(const SwTOXType* pTOXType) const
-{
- _SwTOXTypes::const_iterator it = std::find(items.begin(), items.end(), pTOXType);
- return it == items.end() ? USHRT_MAX : it - items.begin();
-}
-
-SwTOXTypes::~SwTOXTypes()
-{
- for(_SwTOXTypes::const_iterator it = items.begin(); it != items.end(); ++it)
- delete *it;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index f0d36ce..9069ffd 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -150,7 +150,7 @@ void SwUndoFmtAttr::Init()
else if ( RES_FRMFMT == m_nFmtWhich )
{
SwDoc* pDoc = m_pFmt->GetDoc();
- if ( pDoc->GetTblFrmFmts()->Contains(static_cast<const SwFrmFmt*>(m_pFmt)))
+ if ( pDoc->GetTblFrmFmts()->Contains( m_pFmt ))
{
// Table Format: save table position, table formats are volatile!
SwTable * pTbl = SwIterator<SwTable,SwFmt>::FirstElement( *m_pFmt );
@@ -160,7 +160,7 @@ void SwUndoFmtAttr::Init()
->FindTableNode()->GetIndex();
}
}
- else if ( pDoc->GetSections().Contains(static_cast<const SwSectionFmt*>(m_pFmt)))
+ else if ( pDoc->GetSections().Contains( m_pFmt ))
{
m_nNodeIndex = m_pFmt->GetCntnt().GetCntntIdx()->GetIndex();
}
@@ -237,8 +237,7 @@ bool SwUndoFmtAttr::IsFmtInDoc( SwDoc* pDoc )
switch ( m_nFmtWhich )
{
case RES_TXTFMTCOLL:
- nPos = pDoc->GetTxtFmtColls()->GetPos(
- static_cast<const SwTxtFmtColl*>(m_pFmt) );
+ nPos = pDoc->GetTxtFmtColls()->GetPos( m_pFmt );
break;
case RES_GRFFMTCOLL:
@@ -247,8 +246,7 @@ bool SwUndoFmtAttr::IsFmtInDoc( SwDoc* pDoc )
break;
case RES_CHRFMT:
- nPos = pDoc->GetCharFmts()->GetPos(
- static_cast<SwCharFmt*>(m_pFmt) );
+ nPos = pDoc->GetCharFmts()->GetPos( m_pFmt );
break;
case RES_FRMFMT:
@@ -289,12 +287,10 @@ bool SwUndoFmtAttr::IsFmtInDoc( SwDoc* pDoc )
// no break!
case RES_DRAWFRMFMT:
case RES_FLYFRMFMT:
- nPos = pDoc->GetSpzFrmFmts()->GetPos(
- static_cast<const SwFrmFmt*>(m_pFmt) );
+ nPos = pDoc->GetSpzFrmFmts()->GetPos( m_pFmt );
if ( USHRT_MAX == nPos )
{
- nPos = pDoc->GetFrmFmts()->GetPos(
- static_cast<const SwFrmFmt*>(m_pFmt) );
+ nPos = pDoc->GetFrmFmts()->GetPos( m_pFmt );
}
break;
}
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index 2c5485d7..d44c2a1 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -537,7 +537,7 @@ void SwUndoSetFlyFmt::UndoImpl(::sw::UndoRedoContext & rContext)
SwDoc & rDoc = rContext.GetDoc();
// Is the new Format still existent?
- if( USHRT_MAX != rDoc.GetFrmFmts()->GetPos( (const SwFrmFmt*)pOldFmt ) )
+ if( USHRT_MAX != rDoc.GetFrmFmts()->GetPos( pOldFmt ) )
{
if( bAnchorChgd )
pFrmFmt->DelFrms();
@@ -610,7 +610,7 @@ void SwUndoSetFlyFmt::RedoImpl(::sw::UndoRedoContext & rContext)
SwDoc & rDoc = rContext.GetDoc();
// Is the new Format still existent?
- if( USHRT_MAX != rDoc.GetFrmFmts()->GetPos( (const SwFrmFmt*)pNewFmt ) )
+ if( USHRT_MAX != rDoc.GetFrmFmts()->GetPos( pNewFmt ) )
{
if( bAnchorChgd )
More information about the Libreoffice-commits
mailing list