summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2009-10-20 19:25:59 +0200
committerMichael Stahl <mst@openoffice.org>2009-10-20 19:25:59 +0200
commitd8f58461b789a6a4aa1b8dac97261d03e9b9b0d4 (patch)
treef27c55c3391eae77756223b108b937ee0757d3d6
parent5a6147930a6c122d5d5255a8227297286625a68b (diff)
#i93174#: fix progress bar reference for ODF export
SwDocStat: add a counter for all paragraphs SwDocStat: remove unused SwInternStat member SwPostItField: add GetNumberOfParagraphs() SwDoc::UpdateDocStat(): count paragraphs in SwPostItFields (notes) SwTxtNode::CountWords(): count all paragraphs SwXMLExport::exportDoc(): count paragraphs only once, not twice
-rw-r--r--sw/inc/docstat.hxx11
-rw-r--r--sw/inc/docufld.hxx2
-rw-r--r--sw/source/core/doc/doc.cxx20
-rw-r--r--sw/source/core/doc/docstat.cxx6
-rw-r--r--sw/source/core/fields/docufld.cxx5
-rw-r--r--sw/source/core/txtnode/txtedt.cxx1
-rw-r--r--sw/source/filter/xml/xmlexp.cxx14
-rw-r--r--sw/source/filter/xml/xmlfmte.cxx6
8 files changed, 41 insertions, 24 deletions
diff --git a/sw/inc/docstat.hxx b/sw/inc/docstat.hxx
index 9e03f57d5a97..4575796440bf 100644
--- a/sw/inc/docstat.hxx
+++ b/sw/inc/docstat.hxx
@@ -33,12 +33,6 @@
#include <tools/solar.h>
#include "swdllapi.h"
-///////////////////////////////////////////////////////////////////////////
-// PRODUCT: struct SwInternStat ist nur fuer CORE Interne Statistics und
-// hat nichts in einer ProductVersion zu suchen.
-///////////////////////////////////////////////////////////////////////////
-
-struct SwInternStat;
struct SW_DLLPUBLIC SwDocStat
{
@@ -46,11 +40,14 @@ struct SW_DLLPUBLIC SwDocStat
USHORT nGrf;
USHORT nOLE;
ULONG nPage;
+ /// paragraphs for document statistic: non-empty and non-hidden ones
ULONG nPara;
+ /// all paragraphs, including empty/hidden ones
+ ULONG nAllPara;
ULONG nWord;
ULONG nChar;
BOOL bModified;
- SwInternStat* pInternStat;
+
SwDocStat();
void Reset();
};
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index 88c4e650cfd0..f3e41abf199f 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -548,6 +548,8 @@ public:
const OutlinerParaObject* GetTextObject() const;
void SetTextObject( OutlinerParaObject* pText );
+ sal_uInt32 GetNumberOfParagraphs() const;
+
virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, USHORT nWhich ) const;
virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, USHORT nWhich );
virtual String GetDescription() const;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index edebb9838bee..32d1a7543982 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -106,6 +106,8 @@
#include <SwUndoFmt.hxx>
#include <unocrsr.hxx>
#include <docsh.hxx>
+#include <docufld.hxx>
+
#include <vector>
#include <osl/diagnose.h>
@@ -1066,6 +1068,24 @@ void SwDoc::UpdateDocStat( SwDocStat& rStat )
}
}
+ // #i93174#: notes contain paragraphs that are not nodes
+ {
+ SwFieldType * const pPostits( GetSysFldType(RES_POSTITFLD) );
+ SwClientIter aIter(*pPostits);
+ SwFmtFld const * pFmtFld =
+ static_cast<SwFmtFld const*>(aIter.First( TYPE(SwFmtFld) ));
+ while (pFmtFld)
+ {
+ if (pFmtFld->IsFldInDoc())
+ {
+ SwPostItField const * const pField(
+ static_cast<SwPostItField const*>(pFmtFld->GetFld()));
+ rStat.nAllPara += pField->GetNumberOfParagraphs();
+ }
+ pFmtFld = static_cast<SwFmtFld const*>(aIter.Next());
+ }
+ }
+
rStat.nPage = GetRootFrm() ? GetRootFrm()->GetPageNum() : 0;
rStat.bModified = FALSE;
SetDocStat( rStat );
diff --git a/sw/source/core/doc/docstat.cxx b/sw/source/core/doc/docstat.cxx
index 23e6fe5b055d..04c85a3a8d2a 100644
--- a/sw/source/core/doc/docstat.cxx
+++ b/sw/source/core/doc/docstat.cxx
@@ -45,10 +45,10 @@ SwDocStat::SwDocStat() :
nOLE(0),
nPage(1),
nPara(1),
+ nAllPara(1),
nWord(0),
nChar(0),
- bModified(TRUE),
- pInternStat(0)
+ bModified(TRUE)
{}
/************************************************************************
@@ -62,9 +62,9 @@ void SwDocStat::Reset()
nOLE = 0;
nPage = 1;
nPara = 1;
+ nAllPara= 1;
nWord = 0;
nChar = 0;
bModified = TRUE;
- pInternStat = 0;
}
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index 5f6f97f35b36..9f1b19db95fa 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1870,6 +1870,11 @@ void SwPostItField::SetTextObject( OutlinerParaObject* pText )
mpText = pText;
}
+sal_uInt32 SwPostItField::GetNumberOfParagraphs() const
+{
+ return (mpText) ? mpText->Count() : 1;
+}
+
/*-----------------05.03.98 13:42-------------------
--------------------------------------------------*/
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index b34d013f3264..03efd19df3e8 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1676,6 +1676,7 @@ void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen,
void SwTxtNode::CountWords( SwDocStat& rStat,
xub_StrLen nStt, xub_StrLen nEnd ) const
{
+ ++rStat.nAllPara; // #i93174#: count _all_ paragraphs
if( nStt < nEnd )
{
if ( !IsHidden() )
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 0c2a5cec8f71..cd3c5d1734d4 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -41,13 +41,9 @@
#include <com/sun/star/xforms/XFormsSupplier.hpp>
#include <svx/svdmodel.hxx>
#include <svx/svdpage.hxx>
-#ifndef _XMLGRHLP_HXX
-#ifndef _XMLGRHLP_HXX
#include <svx/xmlgrhlp.hxx>
-#endif
#include <svx/xmleohlp.hxx>
#include <svx/xmlgrhlp.hxx>
-#endif
#include <svx/eeitem.hxx>
#include <svx/svddef.hxx>
#include <xmloff/nmspmap.hxx>
@@ -66,9 +62,7 @@
#include <xmltexte.hxx>
#include <xmlexp.hxx>
#include <sfx2/viewsh.hxx>
-#ifndef _COMPHELPER_PROCESSFACTORYHXX_
#include <comphelper/processfactory.hxx>
-#endif
#include <docary.hxx>
#include <svx/unolingu.hxx>
#include <svx/forbiddencharacterstable.hxx>
@@ -326,13 +320,15 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
// figures given above
// The styles in pDoc also count the default style that never
// gets exported -> subtract one.
- sal_Int32 nRef = 1;
+ sal_Int32 nRef = 1; // meta.xml
nRef += pDoc->GetCharFmts()->Count() - 1;
nRef += pDoc->GetFrmFmts()->Count() - 1;
nRef += pDoc->GetTxtFmtColls()->Count() - 1;
// nRef += pDoc->GetPageDescCnt();
- nRef += aDocStat.nPara;
- pProgress->SetReference( 2*nRef );
+ nRef *= 2; // for the above styles, xmloff will increment by 2!
+ // #i93174#: count all paragraphs for the progress bar
+ nRef += aDocStat.nAllPara; // 1: only content, no autostyle
+ pProgress->SetReference( nRef );
pProgress->SetValue( 0 );
}
}
diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx
index f4a4a676c9a2..8a2586392a30 100644
--- a/sw/source/filter/xml/xmlfmte.cxx
+++ b/sw/source/filter/xml/xmlfmte.cxx
@@ -38,16 +38,11 @@
#include "xmlexpit.hxx"
#include <xmloff/nmspmap.hxx>
#include <xmloff/XMLTextListAutoStylePool.hxx>
-#ifndef _XMLOFF_XMLTEXTMASTERPAGEEXPORT
#include <xmloff/XMLTextMasterPageExport.hxx>
-#endif
-#ifndef _XMLOFF_TXTPRMAP_HXX
#include <xmloff/txtprmap.hxx>
-#endif
#include <xmloff/xmlaustp.hxx>
#include <xmloff/families.hxx>
-#include <xmloff/ProgressBarHelper.hxx>
#include <format.hxx>
#include <fmtpdsc.hxx>
#include <pagedesc.hxx>
@@ -58,6 +53,7 @@
#include "xmlexp.hxx"
#include <SwStyleNameMapper.hxx>
+
using ::rtl::OUString;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::uno;