sw/qa/extras/rtfexport/data/piccrop.rtf        |   74 +++++++++++++++++++++++++
 sw/qa/extras/rtfexport/rtfexport8.cxx          |   25 ++++++++
 writerfilter/source/dmapper/GraphicImport.cxx  |   12 +++-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   10 +++
 writerfilter/source/rtftok/rtfvalue.cxx        |    9 +++
 writerfilter/source/rtftok/rtfvalue.hxx        |    6 ++
 6 files changed, 134 insertions(+), 2 deletions(-)

New commits:
commit 47f50af3f057bac1739b7d17d781c0b1d05faa95
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Feb 13 14:45:25 2024 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue Feb 13 17:06:34 2024 +0100

    tdf#155663 writerfilter: RTF import: don't lose \piccrop*
    
    For DOCX the a:srcRect is imported in oox module in BlipFillContext and
    set on the XShape; obviously that doesn't work for RTF.
    
    The crop was already taken into account in
    RTFDocumentImpl::resolvePict(), but only to set the size of the picture;
    to actually set a crop effect, set shape's "GraphicsCrop" property
    in dmapper::GraphicImport::lcl_attribute().
    
    Change-Id: Ib12853724744542a09b0073fefc42ad32bb2ff19
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163310
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/qa/extras/rtfexport/data/piccrop.rtf 
b/sw/qa/extras/rtfexport/data/piccrop.rtf
new file mode 100644
index 000000000000..4e8a70420575
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/piccrop.rtf
@@ -0,0 +1,74 @@
+{ 
tf1deflang1025nsinsicpg1252\uc1deff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1028
       hemelang1033    hemelangfe1028  hemelangcs1025{onttbl{1bidi swiss
charset0prq2{\*\panose 020b0604020202020204}Arial{\*alt Arial};}
+{14bidi nilcharset136prq2{\*\panose 02010601000101010101}PMingLiU{\*alt 
Arial Unicode MS};}{34bidi romancharset0prq2{\*\panose 
02040503050406030204}Cambria Math;}
+{37bidi swisscharset0prq2{\*\panose 020f0502020204030204}Calibri;}{291
bidi nilcharset136prq2{\*\panose 00000000000000000000}@PMingLiU;}
+{lomajor31500bidi romancharset0prq2{\*\panose 02020603050405020304}Times 
New Roman{\*alt Arial};}{dbmajor31501bidi nilcharset136prq2{\*\panose 
02010601000101010101}PMingLiU{\*alt Arial Unicode MS};}
+{himajor31502bidi swisscharset0prq2{\*\panose 
020f0302020204030204}Calibri Light;}{bimajor31503bidi romancharset0
prq2{\*\panose 02020603050405020304}Times New Roman{\*alt Arial};}
+{lominor31504bidi romancharset0prq2{\*\panose 02020603050405020304}Times 
New Roman{\*alt Arial};}{dbminor31505bidi nilcharset136prq2{\*\panose 
02010601000101010101}PMingLiU{\*alt Arial Unicode MS};}
+{himinor31506bidi swisscharset0prq2{\*\panose 
020f0502020204030204}Calibri;}{biminor31507bidi swisscharset0
prq2{\*\panose 020b0604020202020204}Arial{\*alt Arial};}{302bidi swiss
charset238prq2 Arial CE{\*alt Arial};}
+{303bidi swisscharset204prq2 Arial Cyr{\*alt Arial};}{305bidi swiss
charset161prq2 Arial Greek{\*alt Arial};}{306bidi swisscharset162prq2 
Arial Tur{\*alt Arial};}
+{307bidi swisscharset177prq2 Arial (Hebrew){\*alt Arial};}{308bidi 
swisscharset178prq2 Arial (Arabic){\*alt Arial};}{309bidi swiss
charset186prq2 Arial Baltic{\*alt Arial};}
+{310bidi swisscharset163prq2 Arial (Vietnamese){\*alt Arial};}{632bidi 
romancharset238prq2 Cambria Math CE;}{633bidi romancharset204prq2 
Cambria Math Cyr;}{635bidi romancharset161prq2 Cambria Math Greek;}
+{636bidi romancharset162prq2 Cambria Math Tur;}{639bidi roman
charset186prq2 Cambria Math Baltic;}{640bidi romancharset163prq2 Cambria 
Math (Vietnamese);}{662bidi swisscharset238prq2 Calibri CE;}
+{663bidi swisscharset204prq2 Calibri Cyr;}{665bidi swisscharset161
prq2 Calibri Greek;}{666bidi swisscharset162prq2 Calibri Tur;}{667bidi 
swisscharset177prq2 Calibri (Hebrew);}
+{668bidi swisscharset178prq2 Calibri (Arabic);}{669bidi swiss
charset186prq2 Calibri Baltic;}{670bidi swisscharset163prq2 Calibri 
(Vietnamese);}
+{lomajor31508bidi romancharset238prq2 Times New Roman CE{\*alt 
Arial};}{lomajor31509bidi romancharset204prq2 Times New Roman Cyr{\*alt 
Arial};}
+{lomajor31511bidi romancharset161prq2 Times New Roman Greek{\*alt 
Arial};}{lomajor31512bidi romancharset162prq2 Times New Roman Tur{\*alt 
Arial};}
+{lomajor31513bidi romancharset177prq2 Times New Roman (Hebrew){\*alt 
Arial};}{lomajor31514bidi romancharset178prq2 Times New Roman (Arabic){\*
alt Arial};}
+{lomajor31515bidi romancharset186prq2 Times New Roman Baltic{\*alt 
Arial};}{lomajor31516bidi romancharset163prq2 Times New Roman 
(Vietnamese){\*alt Arial};}{himajor31528bidi swisscharset238prq2 Calibri 
Light CE;}
+{himajor31529bidi swisscharset204prq2 Calibri Light Cyr;}{himajor31531
bidi swisscharset161prq2 Calibri Light Greek;}{himajor31532bidi swiss
charset162prq2 Calibri Light Tur;}
+{himajor31533bidi swisscharset177prq2 Calibri Light (Hebrew);}{himajor
31534bidi swisscharset178prq2 Calibri Light (Arabic);}{himajor31535bidi 
swisscharset186prq2 Calibri Light Baltic;}
+{himajor31536bidi swisscharset163prq2 Calibri Light (Vietnamese);}{
bimajor31538bidi romancharset238prq2 Times New Roman CE{\*alt Arial};}{
bimajor31539bidi romancharset204prq2 Times New Roman Cyr{\*alt Arial};}
+{bimajor31541bidi romancharset161prq2 Times New Roman Greek{\*alt 
Arial};}{bimajor31542bidi romancharset162prq2 Times New Roman Tur{\*alt 
Arial};}
+{bimajor31543bidi romancharset177prq2 Times New Roman (Hebrew){\*alt 
Arial};}{bimajor31544bidi romancharset178prq2 Times New Roman (Arabic){\*
alt Arial};}
+{bimajor31545bidi romancharset186prq2 Times New Roman Baltic{\*alt 
Arial};}{bimajor31546bidi romancharset163prq2 Times New Roman 
(Vietnamese){\*alt Arial};}
+{lominor31548bidi romancharset238prq2 Times New Roman CE{\*alt 
Arial};}{lominor31549bidi romancharset204prq2 Times New Roman Cyr{\*alt 
Arial};}
+{lominor31551bidi romancharset161prq2 Times New Roman Greek{\*alt 
Arial};}{lominor31552bidi romancharset162prq2 Times New Roman Tur{\*alt 
Arial};}
+{lominor31553bidi romancharset177prq2 Times New Roman (Hebrew){\*alt 
Arial};}{lominor31554bidi romancharset178prq2 Times New Roman (Arabic){\*
alt Arial};}
+{lominor31555bidi romancharset186prq2 Times New Roman Baltic{\*alt 
Arial};}{lominor31556bidi romancharset163prq2 Times New Roman 
(Vietnamese){\*alt Arial};}{himinor31568bidi swisscharset238prq2 Calibri 
CE;}
+{himinor31569bidi swisscharset204prq2 Calibri Cyr;}{himinor31571bidi 
swisscharset161prq2 Calibri Greek;}{himinor31572bidi swisscharset162
prq2 Calibri Tur;}
+{himinor31573bidi swisscharset177prq2 Calibri (Hebrew);}{himinor31574
bidi swisscharset178prq2 Calibri (Arabic);}{himinor31575bidi swiss
charset186prq2 Calibri Baltic;}
+{himinor31576bidi swisscharset163prq2 Calibri (Vietnamese);}{biminor
31578bidi swisscharset238prq2 Arial CE{\*alt Arial};}{biminor31579bidi 
swisscharset204prq2 Arial Cyr{\*alt Arial};}
+{biminor31581bidi swisscharset161prq2 Arial Greek{\*alt Arial};}{
biminor31582bidi swisscharset162prq2 Arial Tur{\*alt Arial};}{biminor
31583bidi swisscharset177prq2 Arial (Hebrew){\*alt Arial};}
+{biminor31584bidi swisscharset178prq2 Arial (Arabic){\*alt Arial};}{
biminor31585bidi swisscharset186prq2 Arial Baltic{\*alt Arial};}{biminor
31586bidi swisscharset163prq2 Arial (Vietnamese){\*alt Arial};}
+{292bidi romancharset238prq2 Times New Roman CE{\*alt Arial};}{293bidi 
romancharset204prq2 Times New Roman Cyr{\*alt Arial};}{295bidi roman
charset161prq2 Times New Roman Greek{\*alt Arial};}
+{296bidi romancharset162prq2 Times New Roman Tur{\*alt Arial};}{297
bidi romancharset177prq2 Times New Roman (Hebrew){\*alt Arial};}{298bidi 
romancharset178prq2 Times New Roman (Arabic){\*alt Arial};}
+{299bidi romancharset186prq2 Times New Roman Baltic{\*alt Arial};}{300
bidi romancharset163prq2 Times New Roman (Vietnamese){\*alt Arial};}}{+ 
ed0\green255lue0; ed255\green0lue255; ed255\green0lue0; ed255\green255lue0; 
ed255\green255lue255; ed0\green0lue128; ed0\green128lue128; 
ed0\green128lue0; ed128\green0lue128; ed128\green0lue0; ed128\green128lue0;
+ ed128\green128lue128; ed192\green192lue192;}{\*\defchp 
s22\lochf31506\hichf31506\dbchf31505 }{\*\defpap \ql \li0 
i0\sa160\sl259\slmult1\widctlpar\wrapdefaultspalphaspnumaautodjustright 
in0\lin0\itap0 }
oqfpromote {\stylesheet{
+\ql \li0 i0\sa160\sl259\slmult1\widctlpar\wrapdefaultspalphaspnum
aautodjustright in0\lin0\itap0  tlchcs1 f31507fs22lang1025 \ltrchcs0 
s22\lang1033\langfe1028\loch31506\hichf31506\dbchf31505+\snext0 \sqformat 
\spriority0 Normal;}{\*+  s11     srowd   rftsWidthB3     rpaddl108       
rpaddr108       rpaddfl3        rpaddft3        rpaddfb3        rpaddfr3        
blind0  blindtype3      svertalt        sbrdrt  sbrdrl  sbrdrb  sbrdrr  
sbrdrdgl        sbrdrdgr        sbrdrh  sbrdrv \ql \li0 i0\sa160\sl259\slmult1
+\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0  tlchcs1 
f31507fs22lang1025 \ltrchcs0 s22\lang1033\langfe1028\loch
31506\hichf31506\dbchf31505+Normal Table;}}{\* sidtbl  sid1539605 sid6818220 
sid9513591}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{uthor
 ms}{\operator ms}
+{+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
 
+\widowctrltnbjenddoc rackmoves0      rackformatting1\donotembedsysfont1 
elyonvml0\donotembedlingdata0\grfdocevents0
alidatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1
oxlattoyen
+xpshrtn
oultrlspc\dntblnsbdb
ospaceforul
ormshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1
+\jexpandiewkind1iewscale100\pgbrdrhead\pgbrdrfoot\splytwnine
tnlytwnine\htmautsp
olnhtadjtbl\useltbalnlntblind\lytcalctblwd\lyttblrtgr\lnbrkrule
obrkwrptbl\snaptogridincellllowfieldendsel\wrppunct
+sianbrkrule sidroot1539605
ewtblstyruls
ogrowautofit\usenormstyforlist
oindnmbrtselnbrelev
ocxsptable\indrlsweleven
oafcnsttblfelev\utinl\hwelev\spltpgpar
otcvasp
otbrkcnstfrctbl
otvatxbx\krnprsnet+{\*\wgrffmtfilter 2450}
ofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\headery708
ootery708+\pard\plain \ltrpar\ql \li0 
i0\sa160\sl259\slmult1\widctlpar\wrapdefaultspalphaspnumaautodjustright 
in0\lin0\itap0  tlchcs1 f31507fs22lang1025 \ltrchcs0 
+
s22\lang1033\langfe1028\lochf31506\hichf31506\dbchf31505+{\pict{\*\picprop\shplid1025{\sp{\sn
 shapeType}{\sv 75}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn 
fLockAspectRatio}{\sv 1}}{\sp{\sn fLockPosition}{\sv 0}}{\sp{\sn 
fLockAgainstSelect}{\sv 0}}{\sp{\sn fLockAgainstGrouping}{\sv 0}}
+{\sp{\sn pictureGray}{\sv 0}}{\sp{\sn pictureBiLevel}{\sv 0}}{\sp{\sn 
fFilled}{\sv 0}}{\sp{\sn fLine}{\sv 0}}{\sp{\sn wzName}{\sv Picture 1}}{\sp{\sn 
dhgt}{\sv 251658240}}{\sp{\sn fHidden}{\sv 0}}{\sp{\sn fLayoutInCell}{\sv 1}}}
+\picscalex780\picscaley780\piccropl70\piccropr70\piccropt70\piccropb70\picw503\pich503\picwgoal285\pichgoal285\pngblipliptag-2138324634{\*lipuid
 808bc16643ef1085bdc9d6183a9f49dc}
+89504e470d0a1a0a0000000d4948445200000013000000130806000000725036cc0000000467414d410000d6d8d44f58320000001974455874536f6674776172
+650041646f626520496d616765526561647971c9653c000001694944415478da62fcffff3f03b50040003111a3e8e3646ba26c04082026620ce2bf720cc5c049
+eb57fe076174b50001c4448c41479f3232201bd83b733356f50001c4448c4120806e20360010404cc418c4d1b81dc5c04bdef7192e5d7a8da10f208098883148
+53d312c3c05ea1e518860104101331067171f1613510ddcb0001c4448c4120408c810001c4084ab4f80cfaf6ed13dc6618fffaf5e30c3fea3dc162d6d240fd3a
+560cfcb9471901028809dda0a83f5128068134e6752f02d3203ecc852075e82e040820963b56750c0c5640d700258c8ddd195d1ba7fc87790d64c0f42db71926
+95c6810dcc84a8011be86a69c1605dbf84f1ecd99dffcf425d0e10400c206f22e3e486c9ff41e0ebd78fff416c108d8d0f5587a2172080f0e680ddc74fa04400
+888f0f000410130315014000b160130405f48f1f5fb16ac0250e02000184d53050c0e302f7ef5fc229071040580d03c5200cc87bc4e09443070001c448cd921620c000313009ee012707180000000049454e44ae426082}}{
onshppict
+{\pict\picscalex781\picscaley790\piccropl70\piccropr70\piccropt70\piccropb70\picw503\pich503\picwgoal285\pichgoal285\wmetafile8liptag-2138324634{\*lipuid
 808bc16643ef1085bdc9d6183a9f49dc}
+010009000003370100000000b300000000000400000003010800050000000b0200000000050000000c0214001400030000001e00040000000701040004000000
+070104000800000026060f000600544e505006014b000000410b8600ee0013001300000000001300130000000000280000001300000013000000010001000000
+0000000000000000000000000000000000000000000000000000ffffff000000000c0ffe000c0ffe00000ffe00000ffe00000ffe00000ffe0000effee000ffff
+e0007fffc0003fff80001fff00000ffe000507fe000003fe000c01f6000c00e600000040000000000000b3000000410bc6008800130013000000000013001300
+000000002800000013000000130000000100040000000000000000000000000000000000000000000000000000000000ffffff004ba1f3000078ff00b5baa000
+035dcd006d592c00c3d4d400a2907500f3f7f700eaf0f00000000000000000000000000000000000000000001111111111111111111001011111888666668881
+11100101111187761116778111100801111189a61116a98111100706111181961116918111100100111181961116918111100106111181989198918111100101
+77718117898711817770080123556919787919655320090612355791999197553210010011235579111975532110090811123557919755321110070111112355
+797553211110080111111235575532811110010911111123555326411110024c1111111235321641111009011111111123211441111002031111111112111111111005031111111111111111111005070800000026060f000600544e50500701040000002701ffff030000000000}}}{
 tlchcs1 f31507 
+\ltrchcs0 \insrsid6818220 
+\par }
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx 
b/sw/qa/extras/rtfexport/rtfexport8.cxx
index 6773aba8d44e..c78298cdddd0 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -9,9 +9,10 @@
 
 #include <swmodeltestbase.hxx>
 
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/text/GraphicCrop.hpp>
 #include <com/sun/star/text/XFootnote.hpp>
 #include <com/sun/star/text/XFootnotesSupplier.hpp>
-#include <com/sun/star/awt/FontWeight.hpp>
 #include <com/sun/star/text/XEndnotesSupplier.hpp>
 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
 #include <com/sun/star/text/XTextTablesSupplier.hpp>
@@ -48,6 +49,28 @@ public:
     }
 };
 
+DECLARE_RTFEXPORT_TEST(testTdf155663, "piccrop.rtf")
+{
+    auto const xShape(getShape(1));
+    if (!isExported())
+    {
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(2004), xShape->getSize().Height);
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(2004), xShape->getSize().Width);
+    }
+    else // bit of rounding loss?
+    {
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(2013), xShape->getSize().Height);
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(2013), xShape->getSize().Width);
+    }
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(123), 
getProperty<text::GraphicCrop>(xShape, "GraphicCrop").Top);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+                         getProperty<text::GraphicCrop>(xShape, 
"GraphicCrop").Bottom);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+                         getProperty<text::GraphicCrop>(xShape, 
"GraphicCrop").Left);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(123),
+                         getProperty<text::GraphicCrop>(xShape, 
"GraphicCrop").Right);
+}
+
 DECLARE_RTFEXPORT_TEST(testTdf158586_0, "tdf158586_pageBreak0.rtf")
 {
     // The specified page break must be lost because it is in a text frame
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index fd80491c3265..c11717b4048a 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -275,6 +275,7 @@ public:
     std::optional<sal_Int32> m_oEffectExtentTop;
     std::optional<sal_Int32> m_oEffectExtentRight;
     std::optional<sal_Int32> m_oEffectExtentBottom;
+    std::optional<text::GraphicCrop> m_oCrop;
 
     GraphicImport_Impl(GraphicImportType & rImportType, DomainMapper& rDMapper,
             std::pair<OUString, OUString>& rPositionOffsets,
@@ -834,6 +835,9 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
         case NS_ooxml::LN_CT_WrapSquare_wrapText:
             handleWrapTextValue(rValue.getInt());
             break;
+        case NS_ooxml::LN_CT_BlipFillProperties_srcRect:
+            m_pImpl->m_oCrop.emplace(rValue.getAny().get<text::GraphicCrop>());
+            break;
         case NS_ooxml::LN_shape:
             {
                 uno::Reference< drawing::XShape> xShape;
@@ -896,7 +900,13 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
                             text::GraphicCrop aGraphicCrop( 0, 0, 0, 0 );
                             uno::Reference< beans::XPropertySet > 
xSourceGraphProps( xShape, uno::UNO_QUERY );
                             uno::Any aAny = 
xSourceGraphProps->getPropertyValue("GraphicCrop");
-                            if(aAny >>= aGraphicCrop) {
+                            if (m_pImpl->m_oCrop)
+                            {   // RTF: RTFValue from resolvePict()
+                                xGraphProps->setPropertyValue("GraphicCrop",
+                                        uno::Any(*m_pImpl->m_oCrop));
+                            }
+                            else if (aAny >>= aGraphicCrop)
+                            {   // DOCX: imported in oox BlipFillContext
                                 xGraphProps->setPropertyValue("GraphicCrop",
                                     uno::Any( aGraphicCrop ) );
                             }
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 19fe333e3e0c..ab700ff0dc14 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1070,6 +1070,16 @@ void RTFDocumentImpl::resolvePict(bool const bInline, 
uno::Reference<drawing::XS
     RTFSprms aAttributes;
     // shape attribute
     RTFSprms aPicAttributes;
+    if (m_aStates.top().getPicture().nCropT != 0 || 
m_aStates.top().getPicture().nCropB != 0
+        || m_aStates.top().getPicture().nCropL != 0 || 
m_aStates.top().getPicture().nCropR != 0)
+    {
+        text::GraphicCrop const crop{ m_aStates.top().getPicture().nCropT,
+                                      m_aStates.top().getPicture().nCropB,
+                                      m_aStates.top().getPicture().nCropL,
+                                      m_aStates.top().getPicture().nCropR };
+        auto const pCrop = new RTFValue(crop);
+        aPicAttributes.set(NS_ooxml::LN_CT_BlipFillProperties_srcRect, pCrop);
+    }
     auto pShapeValue = new RTFValue(xShape);
     aPicAttributes.set(NS_ooxml::LN_shape, pShapeValue);
     // pic sprm
diff --git a/writerfilter/source/rtftok/rtfvalue.cxx 
b/writerfilter/source/rtftok/rtfvalue.cxx
index 7a9137f5db4a..6654a3f2eca5 100644
--- a/writerfilter/source/rtftok/rtfvalue.cxx
+++ b/writerfilter/source/rtftok/rtfvalue.cxx
@@ -85,6 +85,11 @@ RTFValue::RTFValue(const RTFPicture& rPicture)
 {
 }
 
+RTFValue::RTFValue(text::GraphicCrop const& rCrop)
+    : m_oCrop(rCrop)
+{
+}
+
 RTFValue::~RTFValue() = default;
 
 int RTFValue::getInt() const { return m_nValue; }
@@ -110,6 +115,10 @@ uno::Any RTFValue::getAny() const
         ret <<= m_xStream;
     else if (m_xObject.is())
         ret <<= m_xObject;
+    else if (m_oCrop)
+    {
+        ret <<= *m_oCrop;
+    }
     else
         ret <<= static_cast<sal_Int32>(m_nValue);
     return ret;
diff --git a/writerfilter/source/rtftok/rtfvalue.hxx 
b/writerfilter/source/rtftok/rtfvalue.hxx
index 4f37a5dcbcec..6c87c61a1d05 100644
--- a/writerfilter/source/rtftok/rtfvalue.hxx
+++ b/writerfilter/source/rtftok/rtfvalue.hxx
@@ -11,6 +11,10 @@
 
 #include <dmapper/resourcemodel.hxx>
 
+#include <com/sun/star/text/GraphicCrop.hpp>
+
+#include <optional>
+
 namespace com::sun::star
 {
 namespace embed
@@ -49,6 +53,7 @@ public:
     explicit RTFValue(css::uno::Reference<css::embed::XEmbeddedObject> 
xObject);
     explicit RTFValue(const RTFShape& aShape);
     explicit RTFValue(const RTFPicture& rPicture);
+    explicit RTFValue(css::text::GraphicCrop const& rCrop);
     ~RTFValue() override;
     void setString(const OUString& sValue);
     int getInt() const override;
@@ -79,6 +84,7 @@ private:
     bool m_bForceString = false;
     mutable tools::SvRef<RTFShape> m_pShape;
     mutable tools::SvRef<RTFPicture> m_pPicture;
+    ::std::optional<css::text::GraphicCrop> m_oCrop;
 };
 } // namespace writerfilter::rtftok
 

Reply via email to