summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2024-02-20 13:25:41 +0100
committerAndras Timar <andras.timar@collabora.com>2024-03-07 13:54:18 +0100
commit060851706f280386e4b968ad6b53c6e1cbc48ab6 (patch)
tree6f70beea9e5539f3890be2f4d18309ae557968b4 /sw
parent9703fddea1058cb6018a5e693f03909d2b37315c (diff)
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 <michael.stahl@allotropia.de> (cherry picked from commit 8b191a6566065438417665af32fa30f8346ad4df) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163831
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx12
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx11
2 files changed, 19 insertions, 4 deletions
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 <frozen/bits/defines.h>
#include <frozen/bits/elsa_std.h>
#include <frozen/unordered_map.h>
+#include <IDocumentDeviceAccess.hxx>
+#include <sfx2/printer.hxx>
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<FastAttributeList> 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 <formatflysplit.hxx>
#include <fmtwrapinfluenceonobjpos.hxx>
#include "rtfexport.hxx"
+#include <IDocumentDeviceAccess.hxx>
+#include <sfx2/printer.hxx>
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<sal_Int32>(nPaperSource));
+ m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_BINSXN);
+ m_aSectionBreaks.append(static_cast<sal_Int32>(nPaperSource));
}
void RtfAttributeOutput::FormatFirstLineIndent(SvxFirstLineIndentItem const& rFirstLine)