LibreOffice Module writerfilter (master) 1
OOXMLDocumentImpl.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
21
22#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
23#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
24#include <com/sun/star/xml/sax/SAXException.hpp>
25#include <com/sun/star/xml/dom/DocumentBuilder.hpp>
26#include <com/sun/star/graphic/GraphicMapper.hpp>
27#include <ooxml/resourceids.hxx>
30#include "OOXMLStreamImpl.hxx"
31#include "OOXMLDocumentImpl.hxx"
34#include "OOXMLPropertySet.hxx"
35
36#include <sal/log.hxx>
38#include <svx/dialmgr.hxx>
39#include <svx/strings.hrc>
44
45#include <iostream>
46#include <sfx2/objsh.hxx>
47#include <utility>
48
49// this extern variable is declared in OOXMLStreamImpl.hxx
50OUString customTarget;
52using namespace ::com::sun::star;
53namespace writerfilter::ooxml
54{
55
57 : mpStream(std::move(pStream))
58 , mxStatusIndicator(std::move(xStatusIndicator))
59 , mnXNoteId(0)
60 , mbIsSubstream(false)
61 , mbSkipImages(bSkipImages)
62 , mnPercentSize(0)
63 , mnProgressLastPos(0)
64 , mnProgressCurrentPos(0)
65 , mnProgressEndPos(0)
66 , m_rBaseURL(utl::MediaDescriptor(rDescriptor).getUnpackedValueOrDefault("DocumentBaseURL", OUString()))
67 , maMediaDescriptor(rDescriptor)
68 , mxGraphicMapper(graphic::GraphicMapper::create(mpStream->getContext()))
69{
71}
72
74{
75}
76
79{
81 try
82 {
84 }
85 catch (uno::Exception const&)
86 {
87 TOOLS_INFO_EXCEPTION("writerfilter.ooxml", "resolveFastSubStream: exception while "
88 "resolving stream " << nType);
89 return;
90 }
91 OOXMLStream::Pointer_t savedStream = mpStream;
92 mpStream = pStream;
93
94 uno::Reference<xml::sax::XFastParser> xParser(mpStream->getFastParser());
95
96 if (xParser.is())
97 {
100 new OOXMLFastDocumentHandler(xContext, &rStreamHandler, this, mnXNoteId);
101
102 uno::Reference<xml::sax::XFastTokenHandler> xTokenHandler(mpStream->getFastTokenHandler());
103
104 xParser->setFastDocumentHandler(pDocHandler);
105 xParser->setTokenHandler(xTokenHandler);
106
107 uno::Reference<io::XInputStream> xInputStream = mpStream->getDocumentStream();
108
109 if (xInputStream.is())
110 {
111 struct xml::sax::InputSource oInputSource;
112 oInputSource.aInputStream = xInputStream;
113 xParser->parseStream(oInputSource);
114
115 xInputStream->closeInput();
116 }
117 }
118
119 mpStream = savedStream;
120}
121
124 sal_uInt32 nId)
125{
126 rStream.substream(nId, pStream);
127}
128
130{
132
134 try
135 {
137 }
138 catch (uno::Exception const&)
139 {
140 TOOLS_INFO_EXCEPTION("writerfilter.ooxml", "importSubStream: exception while "
141 "importing stream " << nType);
142 return xRet;
143 }
144
145 uno::Reference<io::XInputStream> xInputStream = pStream->getDocumentStream();
146 if (xInputStream.is())
147 {
148 try
149 {
150 uno::Reference<uno::XComponentContext> xContext(mpStream->getContext());
151 uno::Reference<xml::dom::XDocumentBuilder> xDomBuilder(xml::dom::DocumentBuilder::create(xContext));
152 xRet = xDomBuilder->parse(xInputStream);
153 }
154 catch (uno::Exception const&)
155 {
156 TOOLS_INFO_EXCEPTION("writerfilter.ooxml", "importSubStream: exception while "
157 "parsing stream " << nType);
158 return xRet;
159 }
160 }
161
163 {
165 }
166 else if (OOXMLStream::CHARTS == nType)
167 {
169 }
170
171 return xRet;
172}
173
174
176{
179 try
180 {
181 cStream = OOXMLDocumentFactory::createStream(pStream, nType);
182 }
183 catch (uno::Exception const&)
184 {
185 TOOLS_WARN_EXCEPTION("writerfilter.ooxml", "importSubStreamRelations: exception while "
186 "importing stream " << nType);
187 return;
188 }
189
190 uno::Reference<io::XInputStream> xcpInputStream = cStream->getDocumentStream();
191
192 if (!xcpInputStream.is())
193 return;
194
195 // importing itemprops files for item.xml from customXml.
197 {
198 try
199 {
200 uno::Reference<uno::XComponentContext> xcpContext(pStream->getContext());
201 uno::Reference<xml::dom::XDocumentBuilder> xDomBuilder(xml::dom::DocumentBuilder::create(xcpContext));
202 xRelation = xDomBuilder->parse(xcpInputStream);
203 }
204 catch (uno::Exception const&)
205 {
206 TOOLS_WARN_EXCEPTION("writerfilter.ooxml", "importSubStream: exception while "
207 "parsing stream " << nType);
208 mxCustomXmlProsDom = xRelation;
209 }
210
211 if(xRelation.is())
212 {
213 mxCustomXmlProsDom = xRelation;
214 }
215 }
217 {
218 mxEmbeddings = xcpInputStream;
219 }
220 else if(OOXMLStream::CHARTS == nType)
221 {
223 }
224
225
226}
227
228void OOXMLDocumentImpl::setXNoteId(const sal_Int32 nId)
229{
230 mnXNoteId = nId;
231}
232
234{
235 return mnXNoteId;
236}
237
238const OUString & OOXMLDocumentImpl::getTarget() const
239{
240 return mpStream->getTarget();
241}
242
245{
248
249 OOXMLDocumentImpl * pTemp;
250 // Do not pass status indicator to sub-streams: they are typically marginal in size, so we just track the main document for now.
252 pTemp->setModel(mxModel);
253 pTemp->setDrawPage(mxDrawPage);
254 pTemp->mbIsSubstream = true;
255 return pRet;
256}
257
260{
261 OOXMLStream::Pointer_t pStream =
263 // See above, no status indicator for the note stream, either.
265 pDocument->setXNoteId(nId);
266 pDocument->setModel(getModel());
267 pDocument->setDrawPage(getDrawPage());
268
270}
271
273 Id aType,
274 const sal_Int32 nNoteId)
275{
278
279 Id nId;
280 switch (aType)
281 {
282 case NS_ooxml::LN_Value_doc_ST_FtnEdn_separator:
283 case NS_ooxml::LN_Value_doc_ST_FtnEdn_continuationSeparator:
284 nId = aType;
285 break;
286 default:
287 nId = NS_ooxml::LN_footnote;
288 break;
289 }
290
292}
293
295 Id aType,
296 const sal_Int32 nNoteId)
297{
298 if (!mpXEndnoteStream)
300
301 Id nId;
302 switch (aType)
303 {
304 case NS_ooxml::LN_Value_doc_ST_FtnEdn_separator:
305 case NS_ooxml::LN_Value_doc_ST_FtnEdn_continuationSeparator:
306 nId = aType;
307 break;
308 default:
309 nId = NS_ooxml::LN_endnote;
310 break;
311 }
312
314}
315
317{
319}
320
322 const sal_Int32 nId)
323{
325 {
328 }
329
332
333 resolveFastSubStreamWithId(rStream, pStream, NS_ooxml::LN_annotation);
334}
335
337(const OUString & rId)
338{
341
343 (new OOXMLBinaryObjectReference(pStream));
344
345 OOXMLValue::Pointer_t pPayloadValue(new OOXMLBinaryValue(pPicture));
346
348
349 pBlipSet->add(NS_ooxml::LN_payload, pPayloadValue, OOXMLProperty::ATTRIBUTE);
350
351 OOXMLValue::Pointer_t pBlipValue(new OOXMLPropertySetValue(pBlipSet));
352
353 OOXMLPropertySet * pProps = new OOXMLPropertySet;
354
355 pProps->add(NS_ooxml::LN_blip, pBlipValue, OOXMLProperty::ATTRIBUTE);
356
357 return pProps;
358}
359
361 const OUString & rId)
362{
364
365 rStream.props(pProps.get());
366}
367
368OUString OOXMLDocumentImpl::getTargetForId(const OUString & rId)
369{
370 return mpStream->getTargetForId(rId);
371}
372
374 const sal_Int32 type,
375 const OUString & rId)
376{
378 getSubStream(rId);
379 switch (type)
380 {
381 case NS_ooxml::LN_Value_ST_HdrFtr_even:
382 resolveFastSubStreamWithId(rStream, pStream, NS_ooxml::LN_headerl);
383 break;
384 case NS_ooxml::LN_Value_ST_HdrFtr_default: // here we assume that default is right, but not necessarily true :-(
385 resolveFastSubStreamWithId(rStream, pStream, NS_ooxml::LN_headerr);
386 break;
387 case NS_ooxml::LN_Value_ST_HdrFtr_first:
388 resolveFastSubStreamWithId(rStream, pStream, NS_ooxml::LN_headerf);
389 break;
390 default:
391 break;
392 }
393}
394
396 const sal_Int32 type,
397 const OUString & rId)
398{
400 getSubStream(rId);
401
402 switch (type)
403 {
404 case NS_ooxml::LN_Value_ST_HdrFtr_even:
405 resolveFastSubStreamWithId(rStream, pStream, NS_ooxml::LN_footerl);
406 break;
407 case NS_ooxml::LN_Value_ST_HdrFtr_default: // here we assume that default is right, but not necessarily true :-(
408 resolveFastSubStreamWithId(rStream, pStream, NS_ooxml::LN_footerr);
409 break;
410 case NS_ooxml::LN_Value_ST_HdrFtr_first:
411 resolveFastSubStreamWithId(rStream, pStream, NS_ooxml::LN_footerf);
412 break;
413 default:
414 break;
415 }
416}
417
418namespace {
419// Ensures that the indicator is reset after exiting OOXMLDocumentImpl::resolve
420class StatusIndicatorGuard{
421public:
422 explicit StatusIndicatorGuard(css::uno::Reference<css::task::XStatusIndicator> xStatusIndicator)
423 :mxStatusIndicator(std::move(xStatusIndicator))
424 {
425 }
426
427 ~StatusIndicatorGuard()
428 {
429 if (mxStatusIndicator.is())
430 mxStatusIndicator->end();
431 }
432
433private:
434 css::uno::Reference<css::task::XStatusIndicator> mxStatusIndicator;
435};
436}
437
439{
440 StatusIndicatorGuard aStatusIndicatorGuard(mxStatusIndicator);
441
442 if (utl::MediaDescriptor(maMediaDescriptor).getUnpackedValueOrDefault("ReadGlossaries", false))
443 {
445 return;
446 }
447
448 uno::Reference<xml::sax::XFastParser> xParser(mpStream->getFastParser());
449
450 if (mxModel.is())
451 {
452 uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxModel, uno::UNO_QUERY);
453 uno::Reference<document::XDocumentProperties> xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties();
454 comphelper::SequenceAsHashMap aMap(xDocumentProperties->getDocumentStatistics());
455 if (aMap.find("ParagraphCount") != aMap.end())
456 {
457 sal_Int32 nValue;
458 if (aMap["ParagraphCount"] >>= nValue)
459 {
460 if (mxStatusIndicator.is())
461 {
462 // We want to care about the progress if we know the estimated paragraph count and we have given a status indicator as well.
463 // Set the end position only here, so later it's enough to check if that is non-zero in incrementProgress().
465 OUString aDocLoad(SvxResId(RID_SVXSTR_DOC_LOAD));
466 mxStatusIndicator->start(aDocLoad, mnProgressEndPos);
468 }
469 }
470 }
471 }
472
473 if (!xParser.is())
474 return;
475
476 uno::Reference<uno::XComponentContext> xContext(mpStream->getContext());
477
478 rStream.setDocumentReference(this);
479
481 new OOXMLFastDocumentHandler(xContext, &rStream, this, mnXNoteId);
482 pDocHandler->setIsSubstream( mbIsSubstream );
483 uno::Reference < xml::sax::XFastTokenHandler > xTokenHandler(mpStream->getFastTokenHandler());
484
488 // Convert the oox::Theme to the draw page
489 {
490 auto pThemePtr = getTheme();
491 if (pThemePtr)
492 pThemePtr->addTheme(getDrawPage());
493 }
495 if (mxGlossaryDocDom.is())
496 resolveGlossaryStream(rStream);
497
499
500 // Custom xml's are handled as part of grab bag.
501 resolveCustomXmlStream(rStream);
502
506
507 xParser->setFastDocumentHandler( pDocHandler );
508 xParser->setTokenHandler( xTokenHandler );
509
510 xml::sax::InputSource aParserInput;
511 aParserInput.sSystemId = mpStream->getTarget();
512 aParserInput.aInputStream = mpStream->getDocumentStream();
513 try
514 {
515 xParser->parseStream(aParserInput);
516 }
517 catch (xml::sax::SAXException const& rErr)
518 {
519 // don't silently swallow these - handlers may not have been executed,
520 // and the domain mapper is likely in an inconsistent state
521 // In case user chooses to try to continue loading, don't ask again for this file
523 if (!rShell
525 Concat2View("SAXException: " + rErr.Message)))
526 throw;
527 }
528 catch (uno::RuntimeException const&)
529 {
530 throw;
531 }
532 // note: cannot throw anything other than SAXException out of here?
533 catch (uno::Exception const&)
534 {
535 css::uno::Any anyEx = cppu::getCaughtException();
536 SAL_WARN("writerfilter.ooxml", "OOXMLDocumentImpl::resolve(): " << exceptionToString(anyEx));
537 throw lang::WrappedTargetRuntimeException("", nullptr, anyEx);
538 }
539 catch (...)
540 {
541 SAL_WARN("writerfilter.ooxml",
542 "OOXMLDocumentImpl::resolve(): non-UNO exception");
543 }
544}
545
547{
549 // 1) If we know the end
550 // 2) We progressed enough that updating makes sense
551 // 3) We did not reach the end yet (possible in case the doc stat is misleading)
553 {
555 if (mxStatusIndicator.is())
557 }
558}
559
561{
562 // Resolving all item[n].xml files from CustomXml folder.
564 xRelationshipAccess.set(dynamic_cast<OOXMLStreamImpl&>(*mpStream).accessDocumentStream(), uno::UNO_QUERY);
565 if (!xRelationshipAccess.is())
566 return;
567
568 static const char sCustomType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml";
569 static const char sCustomTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/customXml";
570 bool bFound = false;
571 const uno::Sequence<uno::Sequence< beans::StringPair>> aSeqs = xRelationshipAccess->getAllRelationships();
572 std::vector<uno::Reference<xml::dom::XDocument>> aCustomXmlDomList;
573 std::vector<uno::Reference<xml::dom::XDocument>> aCustomXmlDomPropsList;
574 for (const uno::Sequence<beans::StringPair>& aSeq : aSeqs)
575 {
576 for (const beans::StringPair& aPair : aSeq)
577 {
578 // Need to resolve only customxml files from document relationships.
579 // Skipping other files.
580 if (aPair.Second == sCustomType ||
581 aPair.Second == sCustomTypeStrict)
582 bFound = true;
583 else if (aPair.First == "Target" && bFound)
584 {
585 // Adding value to extern variable customTarget. It will be used in ooxmlstreamimpl
586 // to ensure customxml target is visited in lcl_getTarget.
587 customTarget = aPair.Second;
588 }
589 }
590
591 if (bFound)
592 {
594 // This will add all item[n].xml with its relationship file i.e itemprops.xml to
595 // grabbag list.
596 if (mxCustomXmlProsDom.is() && customXmlTemp.is())
597 {
598 aCustomXmlDomList.push_back(customXmlTemp);
599 aCustomXmlDomPropsList.push_back(mxCustomXmlProsDom);
601 }
602
603 bFound = false;
604 }
605 }
606
609}
610
611namespace
612{
613const char sSettingsType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings";
614const char sStylesType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles";
615const char sFonttableType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable";
616const char sWebSettings[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings";
617const char sSettingsTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/settings";
618const char sStylesTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/styles";
619const char sFonttableTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/fontTable";
620const char sWebSettingsStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/webSettings";
621
622constexpr OUStringLiteral sId = u"Id";
623constexpr OUStringLiteral sType = u"Type";
624constexpr OUStringLiteral sTarget = u"Target";
625constexpr OUStringLiteral sTargetMode = u"TargetMode";
626constexpr OUStringLiteral sContentType = u"_contentType";
627constexpr OUStringLiteral sRelDom = u"_relDom";
628constexpr OUStringLiteral sSettingsContentType = u"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml";
629constexpr OUStringLiteral sStylesContentType = u"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";
630constexpr OUStringLiteral sWebsettingsContentType = u"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml";
631constexpr OUStringLiteral sFonttableContentType = u"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml";
632}
633
634// See DocxExport::WriteGlossary
636{
638 try
639 {
641 }
642 catch (uno::Exception const&)
643 {
644 TOOLS_INFO_EXCEPTION("writerfilter.ooxml", "resolveGlossaryStream: exception while "
645 "createStream for glossary" << OOXMLStream::GLOSSARY);
646 return;
647 }
649 xRelationshipAccess.set(dynamic_cast<OOXMLStreamImpl&>(*pStream).accessDocumentStream(), uno::UNO_QUERY);
650 if (!xRelationshipAccess.is())
651 return;
652
653
654 const uno::Sequence< uno::Sequence< beans::StringPair > >aSeqs = xRelationshipAccess->getAllRelationships();
655 std::vector< uno::Sequence<beans::NamedValue> > aGlossaryDomList;
656 for (const uno::Sequence< beans::StringPair >& aSeq : aSeqs)
657 {
659 for (const auto& [name, value] : aSeq)
660 aRelDefinition.put(name, value);
661
662 const OUString gType = aRelDefinition.getOrDefault(sType, OUString{});
664 if (gType == sSettingsType || gType == sSettingsTypeStrict)
665 {
667 aRelDefinition.put(sContentType, sSettingsContentType);
668 }
669 else if (gType == sStylesType || gType == sStylesTypeStrict)
670 {
672 aRelDefinition.put(sContentType, sStylesContentType);
673 }
674 else if (gType == sWebSettings || gType == sWebSettingsStrict)
675 {
677 aRelDefinition.put(sContentType, sWebsettingsContentType);
678 }
679 else if (gType == sFonttableType || gType == sFonttableTypeStrict)
680 {
682 aRelDefinition.put(sContentType, sFonttableContentType);
683 }
684 else if (aRelDefinition.getOrDefault(sTargetMode, OUString{}) != "External")
685 {
686 // Some internal relation, but we don't create a DOM for it here yet?
687 SAL_WARN("writerfilter.ooxml", "Unknown type of glossary internal relation: "
688 "Id=\"" + aRelDefinition.getOrDefault<OUString>(sId, {}) + "\" "
689 "Type=\"" + gType + "\" "
690 "Target=\"" + aRelDefinition.getOrDefault<OUString>(sTarget, {}) + "\"");
691 continue;
692 }
693
695 {
696 try
697 {
698 auto gStream = OOXMLDocumentFactory::createStream(pStream, nType);
699 uno::Reference xInputStream = gStream->getDocumentStream();
700 uno::Reference xContext(pStream->getContext());
701 uno::Reference xDomBuilder(xml::dom::DocumentBuilder::create(xContext));
702 uno::Reference xDom = xDomBuilder->parse(xInputStream);
703 aRelDefinition.put(sRelDom, xDom);
704 }
705 catch (uno::Exception const&)
706 {
707 TOOLS_INFO_EXCEPTION("writerfilter.ooxml", "importSubStream: exception while "
708 "parsing stream of Type" << nType);
709 }
710 }
711 aGlossaryDomList.push_back(aRelDefinition.getNamedValues());
712 }
714}
715
717{
719 xRelationshipAccess.set(dynamic_cast<OOXMLStreamImpl&>(*pStream).accessDocumentStream(), uno::UNO_QUERY);
720 if (xRelationshipAccess.is())
721 {
722 static constexpr OUStringLiteral sChartType(u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart");
723 static constexpr OUStringLiteral sChartTypeStrict(u"http://purl.oclc.org/ooxml/officeDocument/relationships/chart");
724 static constexpr OUStringLiteral sFootersType(u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer");
725 static constexpr OUStringLiteral sFootersTypeStrict(u"http://purl.oclc.org/ooxml/officeDocument/relationships/footer");
726 static constexpr OUStringLiteral sHeaderType(u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header");
727 static constexpr OUStringLiteral sHeaderTypeStrict(u"http://purl.oclc.org/ooxml/officeDocument/relationships/header");
728
729 bool bFound = false;
730 bool bHeaderFooterFound = false;
732 const uno::Sequence< uno::Sequence< beans::StringPair > >aSeqs = xRelationshipAccess->getAllRelationships();
733 for (const uno::Sequence< beans::StringPair >& aSeq : aSeqs)
734 {
735 for (const beans::StringPair& aPair : aSeq)
736 {
737 if (aPair.Second == sChartType ||
738 aPair.Second == sChartTypeStrict)
739 {
740 bFound = true;
741 }
742 else if(aPair.Second == sFootersType ||
743 aPair.Second == sFootersTypeStrict)
744 {
745 bHeaderFooterFound = true;
746 streamType = OOXMLStream::FOOTER;
747 }
748 else if(aPair.Second == sHeaderType ||
749 aPair.Second == sHeaderTypeStrict)
750 {
751 bHeaderFooterFound = true;
752 streamType = OOXMLStream::HEADER;
753 }
754 else if(aPair.First == "Target" && ( bFound || bHeaderFooterFound ))
755 {
756 // Adding value to extern variable customTarget. It will be used in ooxmlstreamimpl
757 // to ensure chart.xml target is visited in lcl_getTarget.
758 customTarget = aPair.Second;
759 }
760 }
761 if( bFound || bHeaderFooterFound)
762 {
763 if(bFound)
764 {
766 }
767 if(bHeaderFooterFound)
768 {
769 try
770 {
772 if (Stream)
774 }
775 catch (uno::Exception const&)
776 {
777 TOOLS_INFO_EXCEPTION("writerfilter.ooxml", "resolveEmbeddingsStream: can't find header/footer whilst "
778 "resolving stream " << streamType);
779 return;
780 }
781 }
782
783 beans::PropertyValue embeddingsTemp;
784 // This will add all .xlsx and .bin to grabbag list.
785 if(bFound && mxEmbeddings.is())
786 {
787 embeddingsTemp.Name = embeddingsTarget;
788 embeddingsTemp.Value <<= mxEmbeddings;
789 m_aEmbeddings.push_back(embeddingsTemp);
790 mxEmbeddings.clear();
791 }
792 bFound = false;
793 bHeaderFooterFound = false;
794 }
795 }
796 }
797 if (!m_aEmbeddings.empty())
799}
800
802{
803 return mxGlossaryDocDom;
804}
805
807{
808 return mxGlossaryDomList;
809}
810
812{
814
815 return pStream->getDocumentStream();
816}
817
819{
820 mxModel.set(xModel);
821}
822
824{
825 return mxModel;
826}
827
829{
830 mxDrawPage.set(xDrawPage);
831}
832
834{
835 return mxDrawPage;
836}
837
839{
840 return maMediaDescriptor;
841}
842
844{
845 if (!maShapeContexts.empty())
846 maShapeContexts.top() = xContext;
847}
848
850{
851 if (!maShapeContexts.empty())
852 return maShapeContexts.top();
853 else
854 return {};
855}
856
858{
859 maShapeContexts.push({});
860}
861
863{
864 if (!maShapeContexts.empty())
865 maShapeContexts.pop();
866}
867
869{
870 return mxThemeDom;
871}
872
874{
875 return mxCustomXmlDomList;
876}
877
879{
881}
882
884{
885 return mxEmbeddingsList;
886}
887
889{
892 return mxShapeFilterBase;
893}
894
896{
899 return mxThemeFilterBase;
900}
901
904(const OOXMLStream::Pointer_t& pStream,
905 const uno::Reference<task::XStatusIndicator>& xStatusIndicator,
906 bool mbSkipImages, const uno::Sequence<beans::PropertyValue>& rDescriptor)
907{
908 return new OOXMLDocumentImpl(pStream, xStatusIndicator, mbSkipImages, rDescriptor);
909}
910
911}
912
913/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sType
OUString customTarget
css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator
OUString embeddingsTarget
bool IsContinueImportOnFilterExceptions(std::u16string_view aErrMessage)
static SfxObjectShell * GetShellFromComponent(const css::uno::Reference< css::uno::XInterface > &xComp)
bool put(const OUString &_rValueName, const VALUE_TYPE &_rValue)
css::uno::Sequence< css::beans::NamedValue > getNamedValues() const
VALUE_TYPE getOrDefault(const OUString &_rValueName, const VALUE_TYPE &_rDefault) const
T * get() const
tools::SvRef< Reference< T > > Pointer_t
Pointer to reference.
Handler for a stream.
virtual void props(writerfilter::Reference< Properties >::Pointer_t ref)=0
Receives properties of the current run of text.
virtual void setDocumentReference(writerfilter::ooxml::OOXMLDocument *pDocument)=0
virtual void substream(Id name, writerfilter::Reference< Stream >::Pointer_t ref)=0
Receives a substream.
static OOXMLStream::Pointer_t createStream(const css::uno::Reference< css::uno::XComponentContext > &rContext, const css::uno::Reference< css::io::XInputStream > &rStream, bool bRepairStorage)
static OOXMLDocument * createDocument(const OOXMLStream::Pointer_t &pStream, const css::uno::Reference< css::task::XStatusIndicator > &xStatusIndicator, bool bSkipImage, const css::uno::Sequence< css::beans::PropertyValue > &rDescriptor)
virtual css::uno::Reference< css::frame::XModel > getModel() override
rtl::Reference< oox::drawingml::ThemeFilterBase > mxThemeFilterBase
css::uno::Reference< css::io::XInputStream > mxEmbeddings
css::uno::Sequence< css::uno::Sequence< css::beans::NamedValue > > mxGlossaryDomList
writerfilter::Reference< Stream >::Pointer_t getXNoteStream(OOXMLStream::StreamType_t nType, const sal_Int32 nNoteId)
css::uno::Reference< css::frame::XModel > mxModel
virtual void resolveFootnote(Stream &rStream, Id aType, const sal_Int32 nNoteId) override
Resolves a footnote to a stream handler.
virtual void setShapeContext(rtl::Reference< oox::shape::ShapeContextHandler > xContext) override
virtual void resolvePicture(Stream &rStream, const OUString &rId) override
Resolves a picture to a stream handler.
writerfilter::Reference< Stream >::Pointer_t mpXFootnoteStream
virtual void resolveHeader(Stream &rStream, const sal_Int32 type, const OUString &rId) override
Resolves a header to a stream handler.
writerfilter::Reference< Stream >::Pointer_t getSubStream(const OUString &rId)
const css::uno::Sequence< css::beans::PropertyValue > & getMediaDescriptor() const
virtual void resolveEndnote(Stream &rStream, Id aType, const sal_Int32 nNoteId) override
Resolves an endnote to a stream handler.
virtual css::uno::Sequence< css::beans::PropertyValue > getEmbeddingsList() override
OOXMLPropertySet * getPicturePropSet(const OUString &rId)
virtual rtl::Reference< oox::shape::ShapeContextHandler > getShapeContext() override
virtual sal_Int32 getXNoteId() const override
css::uno::Reference< css::xml::dom::XDocument > importSubStream(OOXMLStream::StreamType_t nType)
virtual css::uno::Reference< css::io::XInputStream > getInputStreamForId(const OUString &rId) override
static void resolveFastSubStreamWithId(Stream &rStream, const writerfilter::Reference< Stream >::Pointer_t &pStream, sal_uInt32 nId)
void popShapeContext() override
Pop context of a previously pushed drawingML shape.
css::uno::Reference< css::xml::dom::XDocument > mxGlossaryDocDom
sal_Int32 mnProgressLastPos
Position progress when it was last updated, possibly not after every paragraph in case of large docum...
virtual css::uno::Sequence< css::uno::Reference< css::xml::dom::XDocument > > getCustomXmlDomPropsList() override
css::uno::Sequence< css::beans::PropertyValue > maMediaDescriptor
virtual void setDrawPage(css::uno::Reference< css::drawing::XDrawPage > xDrawPage) override
virtual OUString getTargetForId(const OUString &rId) override
Returns target URL from relationships for a given id.
virtual void resolve(Stream &rStream) override
Resolves this document to a stream handler.
css::uno::Sequence< css::uno::Reference< css::xml::dom::XDocument > > mxCustomXmlDomPropsList
virtual const oox::drawingml::ThemePtr & getTheme() const override
const rtl::Reference< oox::shape::ShapeFilterBase > & getShapeFilterBase()
sal_Int32 mnProgressEndPos
End position, i.e. the estimated number of paragraphs.
virtual void resolveFooter(Stream &rStream, const sal_Int32 type, const OUString &rId) override
Resolves a footer to a stream handler.
virtual css::uno::Sequence< css::uno::Reference< css::xml::dom::XDocument > > getCustomXmlDomList() override
css::uno::Reference< css::drawing::XDrawPage > mxDrawPage
OOXMLDocumentImpl(OOXMLStream::Pointer_t pStream, css::uno::Reference< css::task::XStatusIndicator > xStatusIndicator, bool bSkipImages, const css::uno::Sequence< css::beans::PropertyValue > &rDescriptor)
virtual void setXNoteId(const sal_Int32 nId) override
void resolveFastSubStream(Stream &rStream, OOXMLStream::StreamType_t nType)
void importSubStreamRelations(const OOXMLStream::Pointer_t &pStream, OOXMLStream::StreamType_t nType)
sal_Int32 mnProgressCurrentPos
Current position progress, updated after every paragraph.
virtual void setModel(css::uno::Reference< css::frame::XModel > xModel) override
void resolveCommentsExtendedStream(Stream &rStream)
writerfilter::Reference< Stream >::Pointer_t mpXEndnoteStream
std::vector< css::beans::PropertyValue > m_aEmbeddings
css::uno::Reference< css::xml::dom::XDocument > mxCustomXmlProsDom
const rtl::Reference< oox::drawingml::ThemeFilterBase > & getThemeFilterBase()
virtual css::uno::Sequence< css::uno::Sequence< css::beans::NamedValue > > getGlossaryDomList() override
sal_Int32 mnPercentSize
How many paragraphs equal to 1 percent?
virtual css::uno::Reference< css::drawing::XDrawPage > getDrawPage() override
css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator
css::uno::Sequence< css::uno::Reference< css::xml::dom::XDocument > > mxCustomXmlDomList
void pushShapeContext() override
Push context of drawingML shapes, so nested shapes are handled separately.
virtual css::uno::Reference< css::xml::dom::XDocument > getThemeDom() override
virtual const OUString & getTarget() const override
css::uno::Sequence< css::beans::PropertyValue > mxEmbeddingsList
virtual void resolveComment(Stream &rStream, const sal_Int32 nId) override
Resolves a comment to a stream handler.
std::stack< rtl::Reference< oox::shape::ShapeContextHandler > > maShapeContexts
Stack of shape contexts, 1 element for VML, 1 element / nesting level for drawingML.
void resolveEmbeddingsStream(const OOXMLStream::Pointer_t &pStream)
css::uno::Reference< css::xml::dom::XDocument > mxThemeDom
rtl::Reference< oox::shape::ShapeFilterBase > mxShapeFilterBase
virtual css::uno::Reference< css::xml::dom::XDocument > getGlossaryDocDom() override
void add(const OOXMLProperty::Pointer_t &pProperty)
const css::uno::Reference< css::io::XStream > & accessDocumentStream()
Any value
OString exceptionToString(const css::uno::Any &caught)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define TOOLS_INFO_EXCEPTION(area, stream)
SVXCORE_DLLPUBLIC OUString SvxResId(TranslateId aId)
float u
sal_Int16 nValue
const char * name
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
Any SAL_CALL getCaughtException()
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)
HashMap_OWString_Interface aMap
sal_Int16 nId
QPRO_FUNC_TYPE nType
sal_uInt32 Id
Reference< XModel > xModel
ResultType type
OUString sId