20#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
21#include <com/sun/star/frame/XModel.hpp>
22#include <osl/diagnose.h>
40uno::Reference<document::XDocumentProperties>
48 uno::Reference<document::XDocumentPropertiesSupplier>
const xDPS(
49 GetModel(), UNO_QUERY_THROW);
50 return xDPS->getDocumentProperties();
58 if (getImportFlags() & SvXMLImportFlags::META)
60 uno::Reference<document::XDocumentProperties>
const xDocProps(
70enum SvXMLTokenMapAttrs
72 XML_TOK_META_STAT_TABLE = 1,
73 XML_TOK_META_STAT_IMAGE = 2,
74 XML_TOK_META_STAT_OLE = 4,
75 XML_TOK_META_STAT_PAGE = 8,
76 XML_TOK_META_STAT_PARA = 16,
77 XML_TOK_META_STAT_WORD = 32,
78 XML_TOK_META_STAT_CHAR = 64,
79 XML_TOK_META_STAT_NON_WHITE_SPACE_CHAR = 128,
84 SvXMLTokenMapAttrs token;
101 { XML_TOK_META_STAT_END,
nullptr,
nullptr,
nullptr }
105 const Sequence< beans::NamedValue > & i_rStats)
110 SvXMLImport::SetStatistics(i_rStats);
115 sal_uInt32 nTokens = 0;
117 for (
const auto& rStat : i_rStats) {
118 for (
struct statistic
const* pStat =
s_stats; pStat->name !=
nullptr;
120 if (rStat.Name.equalsAscii(pStat->name)) {
122 if (rStat.Value >>= val) {
123 if (pStat->target16 !=
nullptr) {
124 aDocStat.*(pStat->target16)
125 = o3tl::narrowing<sal_uInt16> (val);
127 aDocStat.*(pStat->target32)
128 =
static_cast<sal_uInt32
> (val);
130 nTokens |= pStat->token;
132 OSL_FAIL(
"SwXMLImport::SetStatistics: invalid entry");
145 bool bSetFallback =
true;
146 sal_Int32 nProgressReference = sal_Int32();
148 if (nTokens & XML_TOK_META_STAT_PARA)
150 nProgressReference =
static_cast<sal_Int32
>(aDocStat.
nPara);
151 bSetFallback =
false;
153 else if (nTokens & XML_TOK_META_STAT_PAGE)
154 bSetFallback = o3tl::checked_multiply<sal_Int32>(aDocStat.
nPage, 10, nProgressReference);
156 bSetFallback =
o3tl::checked_add(nProgressReference, nProgressReferenceWriggleRoom, nProgressReference);
158 nProgressReference = 250 + nProgressReferenceWriggleRoom;
virtual const SwDocStat & GetDocStat() const =0
Document - Statistics.
virtual void SetDocStat(const SwDocStat &rStat)=0
Set the document statistics.
void SetValue(sal_Int32 nValue)
void SetReference(sal_Int32 nVal)
sal_Int32 GetValue() const
ProgressBarHelper * GetProgressBarHelper()
virtual void ExportMeta_()
IDocumentStatistics const & getIDocumentStatistics() const
bool IsShowProgress() const
virtual void ExportMeta_() override
const SwDoc * getDoc() const
SvXMLImportContext * CreateMetaContext(const sal_Int32 nElement)
css::uno::Reference< css::document::XDocumentProperties > GetDocumentProperties() const
virtual void SetStatistics(const css::uno::Sequence< css::beans::NamedValue > &i_rStats) override
bool IsInsertMode() const
bool IsStylesOnlyMode() const
std::enable_if< std::is_signed< T >::value, bool >::type checked_add(T a, T b, T &result)
sal_uLong nCharExcludingSpaces
sal_uLong nPara
paragraphs for document statistic: non-empty and non-hidden ones
#define PROGRESS_BAR_STEP