From 060851706f280386e4b968ad6b53c6e1cbc48ab6 Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Tue, 20 Feb 2024 13:25:41 +0100 Subject: tdf#159793 Save printer paper tray in RTF and DOCX Saves the paper tray id as w:paperSrc w:first and w:other in docx and \binfsxn and \binsxn in RTF Change-Id: I79004f54aba3b6609d7921afacf815726f7f2678 Change-Id: Ie3c11fffa6a133250b7db69b4e845bccaa8e2280 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163654 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 8b191a6566065438417665af32fa30f8346ad4df) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163831 --- sw/source/filter/ww8/docxattributeoutput.cxx | 12 ++++++++++-- sw/source/filter/ww8/rtfattributeoutput.cxx | 11 +++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'sw') diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 3b5d57fc27b2..9b8c4dbceb2b 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -161,6 +161,8 @@ #include #include #include +#include +#include using ::editeng::SvxBorderLine; @@ -9143,9 +9145,15 @@ void DocxAttributeOutput::FormatFrameSize( const SwFormatFrameSize& rSize ) } } -void DocxAttributeOutput::FormatPaperBin( const SvxPaperBinItem& ) +void DocxAttributeOutput::FormatPaperBin(const SvxPaperBinItem& rPaperBin) { - SAL_INFO("sw.ww8", "TODO DocxAttributeOutput::FormatPaperBin()" ); + sal_Int8 nPaperBin = rPaperBin.GetValue(); + rtl::Reference attrList = FastSerializerHelper::createAttrList( ); + SfxPrinter* pPrinter = m_rExport.m_rDoc.getIDocumentDeviceAccess().getPrinter(true); + sal_Int16 nPaperSource = pPrinter->GetSourceIndexByPaperBin(nPaperBin); + attrList->add( FSNS( XML_w, XML_first ), OString::number(nPaperSource) ); + attrList->add( FSNS( XML_w, XML_other ), OString::number(nPaperSource) ); + m_pSerializer->singleElementNS( XML_w, XML_paperSrc, attrList ); } void DocxAttributeOutput::FormatFirstLineIndent(SvxFirstLineIndentItem const& rFirstLine) diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 26203291d6e5..57a4bdf23147 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -94,6 +94,8 @@ #include #include #include "rtfexport.hxx" +#include +#include using namespace ::com::sun::star; using namespace sw::util; @@ -3329,9 +3331,14 @@ void RtfAttributeOutput::FormatFrameSize(const SwFormatFrameSize& rSize) } } -void RtfAttributeOutput::FormatPaperBin(const SvxPaperBinItem& /*rItem*/) +void RtfAttributeOutput::FormatPaperBin(const SvxPaperBinItem& rItem) { - SAL_INFO("sw.rtf", "TODO: " << __func__); + SfxPrinter* pPrinter = m_rExport.m_rDoc.getIDocumentDeviceAccess().getPrinter(true); + sal_Int16 nPaperSource = pPrinter->GetSourceIndexByPaperBin(rItem.GetValue()); + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_BINFSXN); + m_aSectionBreaks.append(static_cast(nPaperSource)); + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_BINSXN); + m_aSectionBreaks.append(static_cast(nPaperSource)); } void RtfAttributeOutput::FormatFirstLineIndent(SvxFirstLineIndentItem const& rFirstLine) -- cgit