20 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
21 #include <com/sun/star/frame/XModel.hpp>
22 #include <osl/diagnose.h>
40 uno::Reference<document::XDocumentProperties>
48 uno::Reference<document::XDocumentPropertiesSupplier>
const xDPS(
50 return xDPS->getDocumentProperties();
60 uno::Reference<document::XDocumentProperties>
const xDocProps(
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,
101 { XML_TOK_META_STAT_END,
nullptr,
nullptr,
nullptr }
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;
IDocumentStatistics const & getIDocumentStatistics() const
sal_uLong nPara
paragraphs for document statistic: non-empty and non-hidden ones
sal_uLong nCharExcludingSpaces
bool IsStylesOnlyMode() const
ProgressBarHelper * GetProgressBarHelper()
virtual void ExportMeta_() override
bool IsShowProgress() const
#define PROGRESS_BAR_STEP
std::enable_if< std::is_signed< T >::value, bool >::type checked_add(T a, T b, T &result)
ProgressBarHelper * GetProgressBarHelper()
virtual void ExportMeta_()
virtual void SetStatistics(const css::uno::Sequence< css::beans::NamedValue > &i_rStats) override
sal_Int32 GetValue() const
SvXMLImportFlags getImportFlags() const
css::uno::Reference< css::document::XDocumentProperties > GetDocumentProperties() const
virtual const SwDocStat & GetDocStat() const =0
Document - Statistics.
virtual void SetStatistics(const css::uno::Sequence< css::beans::NamedValue > &i_rStats)
const css::uno::Reference< css::frame::XModel > & GetModel() const
void SetValue(sal_Int32 nValue)
void SetReference(sal_Int32 nVal)
virtual void SetDocStat(const SwDocStat &rStat)=0
Set the document statistics.
SvXMLImportContext * CreateMetaContext(const sal_Int32 nElement)
SwDoc * GetDocFromXMLImport(SvXMLImport const &)
bool IsInsertMode() const