20#include <com/sun/star/text/XTextDocument.hpp>
21#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
22#include <com/sun/star/beans/XPropertySet.hpp>
23#include <com/sun/star/container/XIndexContainer.hpp>
24#include <com/sun/star/xforms/XFormsSupplier.hpp>
25#include <com/sun/star/lang/XMultiServiceFactory.hpp>
28#include <osl/diagnose.h>
84 const uno::Reference< uno::XComponentContext >& rContext,
89 m_bShowProgress( true ),
90 m_bSavedShowChanges( false ),
110 static constexpr OUStringLiteral sAutoTextMode(
u"AutoTextMode");
111 if( rInfoSet->getPropertySetInfo()->hasPropertyByName(
114 Any aAny = rInfoSet->getPropertyValue(sAutoTextMode);
128 if(
getExportFlags() & (SvXMLExportFlags::FONTDECLS|SvXMLExportFlags::STYLES|
129 SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::CONTENT))
149 for(
int j=0; j < nWhichIds; ++j )
151 const sal_uInt16 nWhichId = aWhichIds[j];
155 OSL_ENSURE( pUnknown,
"illegal attribute container item" );
156 if( pUnknown && (pUnknown->GetAttrCount() > 0) )
158 sal_uInt16 nIdx = pUnknown->GetFirstNamespaceIndex();
159 while( USHRT_MAX != nIdx )
162 pUnknown->GetNamespace( nIdx ) );
163 nIdx = pUnknown->GetNextNamespaceIndex( nIdx );
214 if(
getExportFlags() & (SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::CONTENT))
249 SvXMLEmbeddedObjectHelperMode::Write );
257 bool(
getExportFlags() & (SvXMLExportFlags::CONTENT|SvXMLExportFlags::STYLES) );
266 bSaveRedline = ! rInfoSet->getPropertySetInfo()->hasPropertyByName(
276 uno::Reference<drawing::XDrawPageSupplier>
const xDPS(
GetModel(), uno::UNO_QUERY);
294 if (xGraphicStorageHandler)
295 xGraphicStorageHandler->dispose();
296 xGraphicStorageHandler.clear();
297 if( xEmbeddedResolver )
298 xEmbeddedResolver->dispose();
299 xEmbeddedResolver.clear();
301 OSL_ENSURE( !
m_pTableLines,
"there are table columns infos left" );
314 Reference < XDrawPageSupplier > xDPS(
GetModel(), UNO_QUERY );
317 Reference < XShapes > xShapes = xDPS->getDrawPage();
340 PropertyValue *pValue = aProps.getArray();
343 pValue[0].Name =
"Views";
344 pValue[0].Value <<= uno::Reference< container::XIndexContainer >(xBox);
351 OSL_ENSURE( bTwip,
"Map unit for visible area is not in TWIPS!" );
353 pValue[1].Name =
"ViewAreaTop";
356 pValue[2].Name =
"ViewAreaLeft";
359 pValue[3].Name =
"ViewAreaWidth";
362 pValue[4].Name =
"ViewAreaHeight";
372 static constexpr OUStringLiteral sShowChanges(
u"ShowChanges" );
373 if( xInfoSet->getPropertySetInfo()->hasPropertyByName( sShowChanges ) )
375 bShowRedlineChanges = *o3tl::doAccess<bool>(xInfoSet->
380 pValue[5].Name =
"ShowRedlineChanges";
381 pValue[5].Value <<= bShowRedlineChanges;
383 pValue[6].Name =
"InBrowseMode";
389 Reference< XMultiServiceFactory > xFac(
GetModel(), UNO_QUERY );
393 Reference< XPropertySet > xProps( xFac->createInstance(
"com.sun.star.document.Settings"), UNO_QUERY );
397 static const std::initializer_list<std::u16string_view> vOmitFalseValues = {
398 u"DoNotBreakWrappedTables",
410 if (!rInfoSet.is() || !rInfoSet->getPropertySetInfo()->hasPropertyByName(
u"NoEmbDataSet"))
413 Any aAny = rInfoSet->getPropertyValue(
u"NoEmbDataSet");
414 bool bNoEmbDataSet = *o3tl::doAccess<bool>(aAny);
418 Sequence<PropertyValue> aFilteredProps(rProps.getLength());
419 auto aFilteredPropsRange = asNonConstRange(aFilteredProps);
420 sal_Int32 nFilteredPropLen = 0;
421 for (sal_Int32
i = 0;
i < rProps.getLength(); ++
i)
423 if (rProps[
i].
Name ==
"EmbeddedDatabaseName")
425 aFilteredPropsRange[nFilteredPropLen] = rProps[
i];
428 aFilteredProps.realloc(nFilteredPropLen);
429 std::swap(rProps, aFilteredProps);
435 uno::Sequence<beans::PropertyValue> aXFormsSettings;
436 Reference< XFormsSupplier > xXFormsSupp(
GetModel(), UNO_QUERY );
437 Reference< XNameAccess > xXForms;
438 if ( xXFormsSupp.is() )
439 xXForms = xXFormsSupp->getXForms().get();
456 OUStringBuffer sBuffer;
459 sBuffer.makeStringAndClear());
466 Reference<XDrawPageSupplier> xDrawPageSupplier(
GetModel(), UNO_QUERY);
467 if (xDrawPageSupplier.is())
470 Reference<XDrawPage> xPage = xDrawPageSupplier->getDrawPage();
490 Reference<XPropertySet> xPropSet(
GetModel(), UNO_QUERY);
493 Any aAny = xPropSet->getPropertyValue(
"TwoDigitYear" );
494 aAny <<= sal_Int16(1930);
507 Reference < XTextDocument > xTextDoc(
GetModel(), UNO_QUERY );
508 Reference < XText > xText = xTextDoc->getText();
518 Reference < XTextDocument > xTextDoc(
GetModel(), UNO_QUERY );
521 SAL_WARN(
"sw.filter",
"Problem of mismatching filter for export.");
525 Reference < XText > xText = xTextDoc->getText();
527 assert( pText !=
nullptr );
529 assert(
m_pDoc !=
nullptr );
538extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
540 css::uno::Sequence<css::uno::Any>
const &)
542 return cppu::acquire(
new SwXMLExport(context,
"com.sun.star.comp.Writer.XMLExporter",
543 SvXMLExportFlags::ALL));
546extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
548 css::uno::Sequence<css::uno::Any>
const &)
550 return cppu::acquire(
new SwXMLExport(context,
"com.sun.star.comp.Writer.XMLStylesExporter",
551 SvXMLExportFlags::STYLES | SvXMLExportFlags::MASTERSTYLES | SvXMLExportFlags::AUTOSTYLES |
552 SvXMLExportFlags::FONTDECLS));
555extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
557 css::uno::Sequence<css::uno::Any>
const &)
559 return cppu::acquire(
new SwXMLExport(context,
"com.sun.star.comp.Writer.XMLContentExporter",
560 SvXMLExportFlags::SCRIPTS | SvXMLExportFlags::CONTENT | SvXMLExportFlags::AUTOSTYLES |
561 SvXMLExportFlags::FONTDECLS));
564extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
566 css::uno::Sequence<css::uno::Any>
const &)
568 return cppu::acquire(
new SwXMLExport(context,
"com.sun.star.comp.Writer.XMLMetaExporter",
569 SvXMLExportFlags::META));
572extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
574 css::uno::Sequence<css::uno::Any>
const &)
576 return cppu::acquire(
new SwXMLExport(context,
"com.sun.star.comp.Writer.XMLSettingsExporter",
577 SvXMLExportFlags::SETTINGS));
580extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
582 css::uno::Sequence<css::uno::Any>
const &)
584 return cppu::acquire(
new SwXMLExport(context,
"com.sun.star.comp.Writer.XMLOasisExporter",
585 SvXMLExportFlags::ALL | SvXMLExportFlags::OASIS));
588extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
590 css::uno::Sequence<css::uno::Any>
const &)
592 return cppu::acquire(
new SwXMLExport(context,
"com.sun.star.comp.Writer.XMLOasisStylesExporter",
593 SvXMLExportFlags::STYLES | SvXMLExportFlags::MASTERSTYLES | SvXMLExportFlags::AUTOSTYLES |
594 SvXMLExportFlags::FONTDECLS | SvXMLExportFlags::OASIS));
597extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
599 css::uno::Sequence<css::uno::Any>
const &)
601 return cppu::acquire(
new SwXMLExport(context,
"com.sun.star.comp.Writer.XMLOasisContentExporter",
602 SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS |
603 SvXMLExportFlags::FONTDECLS | SvXMLExportFlags::OASIS));
606extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
608 css::uno::Sequence<css::uno::Any>
const &)
610 return cppu::acquire(
new SwXMLExport(context,
"com.sun.star.comp.Writer.XMLOasisMetaExporter",
611 SvXMLExportFlags::META | SvXMLExportFlags::OASIS));
614extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
616 css::uno::Sequence<css::uno::Any>
const &)
618 return cppu::acquire(
new SwXMLExport(context,
"com.sun.star.comp.Writer.XMLOasisSettingsExporter",
619 SvXMLExportFlags::SETTINGS | SvXMLExportFlags::OASIS));
@ ShowInsert
show all inserts
@ GLOBAL_DOCUMENT_SAVE_LINKS
constexpr auto convertTwipToMm100(N n)
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual void UpdateDocStat(bool bCompleteAsync, bool bFields)=0
Updates the internal document's statistics.
virtual const SwDocStat & GetUpdatedDocStat(bool bCompleteAsync, bool bFields)=0
Updates the document statistics if the document has been modified and returns a reference to the resu...
void SetValue(sal_Int32 nValue)
void SetReference(sal_Int32 nVal)
sal_Int32 GetReference() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
SfxItemPool * GetSecondaryPool() const
MapUnit GetMapUnit() const
static rtl::Reference< SvXMLEmbeddedObjectHelper > Create(const css::uno::Reference< css::embed::XStorage > &, ::comphelper::IEmbeddedHelper &rDocPersist, SvXMLEmbeddedObjectHelperMode eCreateMode)
ProgressBarHelper * GetProgressBarHelper()
virtual ErrCode exportDoc(enum ::xmloff::token::XMLTokenEnum eClass=::xmloff::token::XML_TOKEN_INVALID)
rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport()
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
SvXMLExportFlags getExportFlags() const
SvXMLNamespaceMap & GetNamespaceMap_()
const css::uno::Reference< css::frame::XModel > & GetModel() const
virtual sal_Int32 GetDocumentSpecificSettings(::std::vector< SettingsGroup > &_out_rSettings)
rtl::Reference< XMLFontAutoStylePool > const & GetFontAutoStylePool()
virtual void ExportFontDecls_()
SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const
rtl::Reference< SvXMLAutoStylePoolP > const & GetAutoStylePool()
const css::uno::Reference< css::document::XEmbeddedObjectResolver > & GetEmbeddedResolver() const
OUString const & GetImageFilterName() const
const css::uno::Reference< css::beans::XPropertySet > & getExportInfo() const
rtl::Reference< xmloff::OFormLayerXMLExport > const & GetFormExport()
const SvXMLUnitConverter & GetMM100UnitConverter() const
void SetEmbeddedResolver(css::uno::Reference< css::document::XEmbeddedObjectResolver > const &_xEmbeddedResolver)
const css::uno::Reference< css::document::XGraphicStorageHandler > & GetGraphicStorageHandler() const
bool mbSaveLinkedSections
void SetGraphicStorageHandler(css::uno::Reference< css::document::XGraphicStorageHandler > const &rxGraphicStorageHandler)
static rtl::Reference< SvXMLGraphicHelper > Create(const css::uno::Reference< css::embed::XStorage > &rXMLStorage, SvXMLGraphicHelperMode eCreateMode)
sal_uInt16 Add(const OUString &rPrefix, const OUString &rName, sal_uInt16 nKey=XML_NAMESPACE_UNKNOWN)
static void convertPropertySet(css::uno::Sequence< css::beans::PropertyValue > &rProps, const css::uno::Reference< css::beans::XPropertySet > &aProperties, const std::initializer_list< std::u16string_view > *pOmitFalseValues=nullptr)
void SetXMLMeasureUnit(sal_Int16 const eXMLMeasureUnit)
static sal_Int16 GetMeasureUnit(FieldUnit const nFieldUnit)
virtual tools::Rectangle GetVisArea(sal_uInt16 nAspect) const override
const sw::FrameFormats< SwFrameFormat * > * GetFrameFormats() const
const SwCharFormats * GetCharFormats() const
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
IDocumentSettingAccess const & getIDocumentSettingAccess() const
SfxObjectShell * GetPersist() const
const SwTextFormatColls * GetTextFormatColls() const
const SwAttrPool & GetAttrPool() const
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
SwDocShell * GetDocShell()
IDocumentStatistics const & getIDocumentStatistics() const
Helper class to pause starting of threads during existence of an instance of this class.
The root element of a Writer document layout.
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
sal_uInt16 GetPageCount() const
virtual void SetBodyAttributes() override
virtual XMLTextParagraphExport * CreateTextParagraphExport() override
std::unique_ptr< SwXMLTableLinesCache_Impl > m_pTableLines
virtual void ExportContent_() override
virtual ErrCode exportDoc(enum ::xmloff::token::XMLTokenEnum eClass=::xmloff::token::XML_TOKEN_INVALID) override
virtual XMLShapeExport * CreateShapeExport() override
virtual void GetViewSettings(css::uno::Sequence< css::beans::PropertyValue > &aProps) override
SwXMLExport(const css::uno::Reference< css::uno::XComponentContext > &rContext, OUString const &implementationName, SvXMLExportFlags nExportFlags)
const SwDoc * getDoc() const
virtual sal_Int32 GetDocumentSpecificSettings(std::vector< SettingsGroup > &_out_rSettings) override
std::unique_ptr< SvXMLUnitConverter > m_pTwipUnitConverter
virtual void ExportFontDecls_() override
virtual void GetConfigurationSettings(css::uno::Sequence< css::beans::PropertyValue > &aProps) override
virtual ~SwXMLExport() override
const SwDoc * GetDoc() const
void seekShapes(const css::uno::Reference< css::drawing::XShapes > &xShapes) noexcept
static SvXMLExportPropertyMapper * CreateShapeExtPropMapper(SvXMLExport &rExport)
static bool convertBool(bool &rBool, std::u16string_view rString)
constexpr TypedWhichId< SvXMLAttrContainerItem > EE_PARA_XMLATTRIBS(EE_PARA_START+1)
constexpr TypedWhichId< SvXMLAttrContainerItem > EE_CHAR_XMLATTRIBS(EE_CHAR_START+28)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_TXTATR_UNKNOWN_CONTAINER(54)
#define SAL_WARN(area, stream)
constexpr OUStringLiteral implementationName
detail::Optional< bool >::type tryAccess< bool >(css::uno::Any const &any)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
void FixZOrder(uno::Reference< drawing::XShapes > const &xShapes, std::function< unsigned int(uno::Reference< beans::XPropertySet > const &)> const &rGetLayer)
sal_uLong nAllPara
all paragraphs, including empty/hidden ones
constexpr TypedWhichId< SvXMLAttrContainerItem > SDRATTR_XMLATTRIBUTES(SDRATTR_MISC_FIRST+22)
#define ERR_SWG_WRITE_ERROR
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLStylesExporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLOasisContentExporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLOasisSettingsExporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLOasisMetaExporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLOasisStylesExporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLMetaExporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLSettingsExporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLOasisExporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLContentExporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_XMLExporter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
constexpr sal_uInt16 XML_NAMESPACE_OFFICE_EXT
constexpr sal_uInt16 XML_NAMESPACE_TEXT
constexpr sal_uInt16 XML_NAMESPACE_TABLE