Kaydet (Commit) 0644a206 authored tarafından Miklos Vajna's avatar Miklos Vajna

Get rid of copy&paste by moving code from WW8Export to MSWordExportBase

Change-Id: I1a36fb3d20d1e67484668b7ba8feb1c96505af59
üst e63950dc
...@@ -528,66 +528,6 @@ void DocxExport::WritePostitFields() ...@@ -528,66 +528,6 @@ void DocxExport::WritePostitFields()
} }
} }
int DocxExport::CollectGrfsOfBullets()
{
m_vecBulletPic.clear();
if ( pDoc )
{
int nCountRule = pDoc->GetNumRuleTbl().size();
for (int n = 0; n < nCountRule; ++n)
{
const SwNumRule &rRule = *( pDoc->GetNumRuleTbl().at(n) );
sal_uInt16 nLevels = rRule.IsContinusNum() ? 1 : 9;
for (sal_uInt16 nLvl = 0; nLvl < nLevels; ++nLvl)
{
const SwNumFmt &rFmt = rRule.Get(nLvl);
if (SVX_NUM_BITMAP != rFmt.GetNumberingType())
{
continue;
}
const Graphic *pGraf = rFmt.GetBrush()? rFmt.GetBrush()->GetGraphic():0;
if ( pGraf )
{
bool bHas = false;
for (unsigned i = 0; i < m_vecBulletPic.size(); ++i)
{
if (m_vecBulletPic[i]->GetChecksum() == pGraf->GetChecksum())
{
bHas = true;
break;
}
}
if (!bHas)
{
m_vecBulletPic.push_back(pGraf);
}
}
}
}
}
return m_vecBulletPic.size();
}
int DocxExport::GetGrfIndex(const SvxBrushItem& rBrush)
{
int nIndex = -1;
if ( rBrush.GetGraphic() )
{
for (unsigned i = 0; i < m_vecBulletPic.size(); ++i)
{
if (m_vecBulletPic[i]->GetChecksum() == rBrush.GetGraphic()->GetChecksum())
{
nIndex = i;
break;
}
}
}
return nIndex;
}
void DocxExport::BulletDefinitions() void DocxExport::BulletDefinitions()
{ {
for (size_t i = 0; i < m_vecBulletPic.size(); ++i) for (size_t i = 0; i < m_vecBulletPic.size(); ++i)
......
...@@ -85,8 +85,6 @@ class DocxExport : public MSWordExportBase ...@@ -85,8 +85,6 @@ class DocxExport : public MSWordExportBase
DocxSettingsData settings; DocxSettingsData settings;
std::vector<const Graphic*> m_vecBulletPic;
public: public:
DocxExportFilter& GetFilter() { return *m_pFilter; }; DocxExportFilter& GetFilter() { return *m_pFilter; };
...@@ -148,9 +146,6 @@ public: ...@@ -148,9 +146,6 @@ public:
void WriteOutliner(const OutlinerParaObject& rOutliner, sal_uInt8 nTyp); void WriteOutliner(const OutlinerParaObject& rOutliner, sal_uInt8 nTyp);
int CollectGrfsOfBullets();
int GetGrfIndex(const SvxBrushItem& rBrush);
protected: protected:
/// Format-dependant part of the actual export. /// Format-dependant part of the actual export.
virtual void ExportDocument_Impl(); virtual void ExportDocument_Impl();
......
...@@ -1406,7 +1406,7 @@ void WW8Export::AppendBookmark( const rtl::OUString& rName, bool bSkip ) ...@@ -1406,7 +1406,7 @@ void WW8Export::AppendBookmark( const rtl::OUString& rName, bool bSkip )
} }
// #i120928 collect all the graphics of bullets applied to paragraphs // #i120928 collect all the graphics of bullets applied to paragraphs
int WW8Export::CollectGrfsOfBullets() const int MSWordExportBase::CollectGrfsOfBullets()
{ {
m_vecBulletPic.clear(); m_vecBulletPic.clear();
...@@ -1505,8 +1505,8 @@ void WW8Export::OutGrfBullets(const sw::Frame & rFrame) ...@@ -1505,8 +1505,8 @@ void WW8Export::OutGrfBullets(const sw::Frame & rFrame)
Set_UInt8( pArr, nAttrMagicIdx++ ); Set_UInt8( pArr, nAttrMagicIdx++ );
pChpPlc->AppendFkpEntry( Strm().Tell(), static_cast< short >(pArr - aArr), aArr ); pChpPlc->AppendFkpEntry( Strm().Tell(), static_cast< short >(pArr - aArr), aArr );
} }
//Achieve the index position
int WW8Export::GetGrfIndex(const SvxBrushItem& rBrush) int MSWordExportBase::GetGrfIndex(const SvxBrushItem& rBrush)
{ {
int nIndex = -1; int nIndex = -1;
if ( rBrush.GetGraphic() ) if ( rBrush.GetGraphic() )
......
...@@ -747,6 +747,8 @@ public: ...@@ -747,6 +747,8 @@ public:
const SfxPoolItem* HasItem( sal_uInt16 nWhich ) const; const SfxPoolItem* HasItem( sal_uInt16 nWhich ) const;
/// Returns the index of a picture bullet, used in numberings.
int GetGrfIndex(const SvxBrushItem& rBrush);
protected: protected:
/// Format-dependant part of the actual export. /// Format-dependant part of the actual export.
...@@ -784,7 +786,6 @@ protected: ...@@ -784,7 +786,6 @@ protected:
/// Return value indicates if an inherited outline numbering is suppressed. /// Return value indicates if an inherited outline numbering is suppressed.
virtual bool DisallowInheritingOutlineNumbering(const SwFmt &rFmt) = 0; virtual bool DisallowInheritingOutlineNumbering(const SwFmt &rFmt) = 0;
protected:
/// Output SwStartNode /// Output SwStartNode
virtual void OutputStartNode( const SwStartNode& ); virtual void OutputStartNode( const SwStartNode& );
...@@ -823,6 +824,10 @@ protected: ...@@ -823,6 +824,10 @@ protected:
const NfKeywordTable & GetNfKeywordTable(); const NfKeywordTable & GetNfKeywordTable();
/// Populates m_vecBulletPic with all the bullet graphics used by numberings.
int CollectGrfsOfBullets();
std::vector<const Graphic*> m_vecBulletPic; ///< Vector to record all the graphics of bullets
public: public:
MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam ); MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam );
virtual ~MSWordExportBase(); virtual ~MSWordExportBase();
...@@ -912,8 +917,6 @@ public: ...@@ -912,8 +917,6 @@ public:
sal_uInt8 bWrtWW8 : 1; ///< Write WW95 (false) or WW97 (true) file format sal_uInt8 bWrtWW8 : 1; ///< Write WW95 (false) or WW97 (true) file format
mutable std::vector<const Graphic*> m_vecBulletPic; ///< Vector to record all the graphics of bullets
protected: protected:
SwWW8Writer *m_pWriter; ///< Pointer to the writer SwWW8Writer *m_pWriter; ///< Pointer to the writer
WW8AttributeOutput *m_pAttrOutput; ///< Converting attributes to stream data WW8AttributeOutput *m_pAttrOutput; ///< Converting attributes to stream data
...@@ -1009,9 +1012,7 @@ public: ...@@ -1009,9 +1012,7 @@ public:
virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false ); virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false );
virtual void ExportGrfBullet(const SwTxtNode& rNd); virtual void ExportGrfBullet(const SwTxtNode& rNd);
int CollectGrfsOfBullets() const;
void OutGrfBullets(const sw::Frame &rFrame); void OutGrfBullets(const sw::Frame &rFrame);
int GetGrfIndex(const SvxBrushItem& rBrush);
void MoveFieldMarks(sal_uLong nFrom, sal_uLong nTo); void MoveFieldMarks(sal_uLong nFrom, sal_uLong nTo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment