diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-04-05 15:12:30 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-04-05 15:24:45 +0200 |
commit | 0644a20605965b36fcc983e4c1158820fd858726 (patch) | |
tree | ebf923855239245944a2218870f4cd41dbfc39a7 /sw | |
parent | w:numPicBullet export testcase (diff) | |
download | core-0644a20605965b36fcc983e4c1158820fd858726.tar.gz core-0644a20605965b36fcc983e4c1158820fd858726.zip |
Get rid of copy&paste by moving code from WW8Export to MSWordExportBase
Change-Id: I1a36fb3d20d1e67484668b7ba8feb1c96505af59
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/docxexport.cxx | 60 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.hxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 11 |
4 files changed, 9 insertions, 73 deletions
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 42cb1038a0e1..e7bec6f95d61 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -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() { for (size_t i = 0; i < m_vecBulletPic.size(); ++i) diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 797dd944b8e1..ac5637d09469 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -85,8 +85,6 @@ class DocxExport : public MSWordExportBase DocxSettingsData settings; - std::vector<const Graphic*> m_vecBulletPic; - public: DocxExportFilter& GetFilter() { return *m_pFilter; }; @@ -148,9 +146,6 @@ public: void WriteOutliner(const OutlinerParaObject& rOutliner, sal_uInt8 nTyp); - int CollectGrfsOfBullets(); - int GetGrfIndex(const SvxBrushItem& rBrush); - protected: /// Format-dependant part of the actual export. virtual void ExportDocument_Impl(); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index a666980a9f00..86e3f5757374 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1406,7 +1406,7 @@ void WW8Export::AppendBookmark( const rtl::OUString& rName, bool bSkip ) } // #i120928 collect all the graphics of bullets applied to paragraphs -int WW8Export::CollectGrfsOfBullets() const +int MSWordExportBase::CollectGrfsOfBullets() { m_vecBulletPic.clear(); @@ -1505,8 +1505,8 @@ void WW8Export::OutGrfBullets(const sw::Frame & rFrame) Set_UInt8( pArr, nAttrMagicIdx++ ); 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; if ( rBrush.GetGraphic() ) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index aae74dfc276e..862854575a98 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -747,6 +747,8 @@ public: const SfxPoolItem* HasItem( sal_uInt16 nWhich ) const; + /// Returns the index of a picture bullet, used in numberings. + int GetGrfIndex(const SvxBrushItem& rBrush); protected: /// Format-dependant part of the actual export. @@ -784,7 +786,6 @@ protected: /// Return value indicates if an inherited outline numbering is suppressed. virtual bool DisallowInheritingOutlineNumbering(const SwFmt &rFmt) = 0; -protected: /// Output SwStartNode virtual void OutputStartNode( const SwStartNode& ); @@ -823,6 +824,10 @@ protected: 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: MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam ); virtual ~MSWordExportBase(); @@ -912,8 +917,6 @@ public: 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: SwWW8Writer *m_pWriter; ///< Pointer to the writer WW8AttributeOutput *m_pAttrOutput; ///< Converting attributes to stream data @@ -1009,9 +1012,7 @@ public: virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false ); virtual void ExportGrfBullet(const SwTxtNode& rNd); - int CollectGrfsOfBullets() const; void OutGrfBullets(const sw::Frame &rFrame); - int GetGrfIndex(const SvxBrushItem& rBrush); void MoveFieldMarks(sal_uLong nFrom, sal_uLong nTo); |