[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 71 commits - basegfx/test compilerplugins/clang configure.ac drawinglayer/CppunitTest_drawinglayer_border.mk drawinglayer/inc drawinglayer/Library_drawinglayercore.mk drawinglayer/Library_drawinglayer.mk drawinglayer/Module_drawinglayer.mk drawinglayer/source dtrans/source emfio/CppunitTest_emfio_emf_test.mk emfio/Library_emfio.mk filter/Library_pdffilter.mk filter/Library_svgfilter.mk filter/source helpcontent2 include/basegfx include/drawinglayer include/o3tl include/svx include/tools include/vcl o3tl/qa oox/source Repository.mk sc/CppunitTest_sc_ucalc.mk sc/Library_sc.mk sc/source sc/uiconfig sd/CppunitTest_sd_tiledrendering.mk sd/CppunitTest_sd_uimpress.mk sd/inc sd/Library_sd.mk sd/qa sd/source sfx2/Library_sfx.mk svgio/CppunitTest_svgio.mk svgio/Library_svgio.mk svx/CppunitTest_svx_gallery_test.mk svx/CppunitTest_svx_unit.mk svx/Library_svxcore.mk svx/Library_svx.mk svx/qa svx/sdi svx/source sw/CppunitTest_sw_uwriter.mk sw/ Library_sw.mk sw/Library_swui.mk sw/qa sw/source sysui/desktop toolkit/source tools/qa unotools/source vcl/CppunitTest_vcl_graphic_test.mk vcl/Library_vcl.mk vcl/qa vcl/source vcl/unx writerfilter/source xmloff/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 1 21:09:01 UTC 2020


Rebased ref, commits from common ancestor:
commit 8cc2d1f6d7aa461479f514824595ff2419feb65d
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Jun 1 23:04:00 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:16 2020 +0200

    Use "Radius" instead of "Rad" for new properties
    
    Change-Id: Ifd232bccf1519e0ed68195cf4344893175a675e0

diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
index fb9ed922f551..14da2224acf4 100644
--- a/include/svx/strings.hrc
+++ b/include/svx/strings.hrc
@@ -511,10 +511,10 @@
 #define SIP_SA_GRAFINVERT                                   NC_("SIP_SA_GRAFINVERT", "Invert")
 #define SIP_SA_GRAFMODE                                     NC_("SIP_SA_GRAFMODE", "Image mode")
 #define SIP_SA_GRAFCROP                                     NC_("SIP_SA_GRAFCROP", "Crop")
-#define SIP_SA_GLOW_RAD                                     NC_("SIP_SA_GLOW_RAD", "Radius of glow effect")
+#define SIP_SA_GLOW_RADIUS                                  NC_("SIP_SA_GLOW_RADIUS", "Radius of glow effect")
 #define SIP_SA_GLOW_COLOR                                   NC_("SIP_SA_GLOW_COLOR", "Color of glow effect")
 #define SIP_SA_GLOW_TRANSPARENCY                            NC_("SIP_SA_GLOW_TRANSPARENCY", "Transparency of glow effect")
-#define SIP_SA_SOFTEDGE_RAD                                 NC_("SIP_SA_SOFTEDGE_RAD", "Radius of soft edge effect")
+#define SIP_SA_SOFTEDGE_RADIUS                              NC_("SIP_SA_SOFTEDGE_RADIUS", "Radius of soft edge effect")
 #define STR_ObjNameSingulMEDIA                              NC_("STR_ObjNameSingulMEDIA", "Media object")
 #define STR_ObjNamePluralMEDIA                              NC_("STR_ObjNamePluralMEDIA", "Media objects")
 // drawing layer table strings
diff --git a/include/svx/svddef.hxx b/include/svx/svddef.hxx
index 27d90b44165c..30031e20dde2 100644
--- a/include/svx/svddef.hxx
+++ b/include/svx/svddef.hxx
@@ -417,14 +417,14 @@ constexpr TypedWhichId<SvxTextRotateItem> SDRATTR_TABLE_TEXT_ROTATION (SDRATTR_T
 constexpr sal_uInt16                      SDRATTR_TABLE_LAST          (SDRATTR_TABLE_TEXT_ROTATION);
 
 constexpr sal_uInt16                  SDRATTR_GLOW_FIRST (SDRATTR_TABLE_LAST+1);
-constexpr TypedWhichId<SdrMetricItem> SDRATTR_GLOW_RAD   (SDRATTR_GLOW_FIRST+0);
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_GLOW_RADIUS   (SDRATTR_GLOW_FIRST+0);
 constexpr TypedWhichId<XColorItem>    SDRATTR_GLOW_COLOR (SDRATTR_GLOW_FIRST+1);
 constexpr TypedWhichId<SdrPercentItem> SDRATTR_GLOW_TRANSPARENCY(SDRATTR_GLOW_FIRST + 2);
 constexpr sal_uInt16                  SDRATTR_GLOW_LAST  (SDRATTR_GLOW_TRANSPARENCY);
 
 constexpr sal_uInt16                  SDRATTR_SOFTEDGE_FIRST(SDRATTR_GLOW_LAST + 1);
-constexpr TypedWhichId<SdrMetricItem> SDRATTR_SOFTEDGE_RAD(SDRATTR_SOFTEDGE_FIRST + 0);
-constexpr sal_uInt16                  SDRATTR_SOFTEDGE_LAST(SDRATTR_SOFTEDGE_RAD);
+constexpr TypedWhichId<SdrMetricItem> SDRATTR_SOFTEDGE_RADIUS(SDRATTR_SOFTEDGE_FIRST + 0);
+constexpr sal_uInt16                  SDRATTR_SOFTEDGE_LAST(SDRATTR_SOFTEDGE_RADIUS);
 
 constexpr sal_uInt16 SDRATTR_END (SDRATTR_SOFTEDGE_LAST);      /* 1357 */ /* 1333 V4+++*/ /* 1243 V4+++*/  /*1213*/ /*1085*/ /*1040*/ /*Pool V2: 1123,V1: 1065 */
 
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
index 4b3a05c6b5f4..33d47c5bc421 100644
--- a/include/svx/unoshprp.hxx
+++ b/include/svx/unoshprp.hxx
@@ -210,12 +210,12 @@
     { OUString("FontWorkShadowTransparence"),XATTR_FORMTXTSHDWTRANSP,   ::cppu::UnoType<sal_Int16>::get(),            0,  0},
 
 #define GLOW_PROPERTIES \
-    { OUString{"GlowEffectRad"},                  SDRATTR_GLOW_RAD,         ::cppu::UnoType<sal_Int32>::get(),    0,      0, PropertyMoreFlags::METRIC_ITEM}, \
+    { OUString{"GlowEffectRadius"},               SDRATTR_GLOW_RADIUS,         ::cppu::UnoType<sal_Int32>::get(),    0,      0, PropertyMoreFlags::METRIC_ITEM}, \
     { OUString{"GlowEffectColor"},                SDRATTR_GLOW_COLOR,       ::cppu::UnoType<sal_Int32>::get(),    0,      0}, \
     { OUString{"GlowEffectTransparency"},         SDRATTR_GLOW_TRANSPARENCY,::cppu::UnoType<sal_Int16>::get(),    0,      0 },
 
 #define SOFTEDGE_PROPERTIES \
-    { OUString{"SoftEdgeRad"},              SDRATTR_SOFTEDGE_RAD,       cppu::UnoType<sal_Int32>::get(),      0,      0, PropertyMoreFlags::METRIC_ITEM},
+    { OUString{"SoftEdgeRadius"},           SDRATTR_SOFTEDGE_RADIUS,       cppu::UnoType<sal_Int32>::get(),      0,      0, PropertyMoreFlags::METRIC_ITEM},
 
 #define SHADOW_PROPERTIES \
     { OUString(UNO_NAME_SHADOW),            SDRATTR_SHADOW,             cppu::UnoType<bool>::get(),    0,      0}, \
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index d0f243ffabc1..3fedf4dbb761 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1470,7 +1470,7 @@ Reference< XShape > const & Shape::createAndInsert(
         if ( aEffectProperties.maGlow.moGlowRad.has() )
         {
             uno::Reference<beans::XPropertySet> propertySet (mxShape, uno::UNO_QUERY);
-            propertySet->setPropertyValue("GlowEffectRad", makeAny(convertEmuToHmm(aEffectProperties.maGlow.moGlowRad.get())));
+            propertySet->setPropertyValue("GlowEffectRadius", makeAny(convertEmuToHmm(aEffectProperties.maGlow.moGlowRad.get())));
             propertySet->setPropertyValue("GlowEffectColor", makeAny(aEffectProperties.maGlow.moGlowColor.getColor(rGraphicHelper)));
             propertySet->setPropertyValue("GlowEffectTransparency", makeAny(aEffectProperties.maGlow.moGlowColor.getTransparency()));
         }
@@ -1480,7 +1480,7 @@ Reference< XShape > const & Shape::createAndInsert(
         {
             uno::Reference<beans::XPropertySet> propertySet(mxShape, uno::UNO_QUERY);
             propertySet->setPropertyValue(
-                "SoftEdgeRad", makeAny(convertEmuToHmm(aEffectProperties.maSoftEdge.moRad.get())));
+                "SoftEdgeRadius", makeAny(convertEmuToHmm(aEffectProperties.maSoftEdge.moRad.get())));
         }
     }
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 21825902f1a0..fc5807ee61ba 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3746,13 +3746,13 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet )
         if( GetProperty( rXPropSet, "Shadow" ) )
             mAny >>= bHasShadow;
         bool bHasEffects = bHasShadow;
-        if (!bHasEffects && GetProperty(rXPropSet, "GlowEffectRad"))
+        if (!bHasEffects && GetProperty(rXPropSet, "GlowEffectRadius"))
         {
             sal_Int32 rad = 0;
             mAny >>= rad;
             bHasEffects = rad > 0;
         }
-        if (!bHasEffects && GetProperty(rXPropSet, "SoftEdgeRad"))
+        if (!bHasEffects && GetProperty(rXPropSet, "SoftEdgeRadius"))
         {
             sal_Int32 rad = 0;
             mAny >>= rad;
@@ -3862,7 +3862,7 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet )
 void DrawingML::WriteGlowEffect(const Reference< XPropertySet >& rXPropSet)
 {
     sal_Int32 nRad = 0;
-    rXPropSet->getPropertyValue("GlowEffectRad") >>= nRad;
+    rXPropSet->getPropertyValue("GlowEffectRadius") >>= nRad;
     if (!nRad)
         return;
 
@@ -3884,7 +3884,7 @@ void DrawingML::WriteGlowEffect(const Reference< XPropertySet >& rXPropSet)
 void DrawingML::WriteSoftEdgeEffect(const css::uno::Reference<css::beans::XPropertySet>& rXPropSet)
 {
     sal_Int32 nRad = 0;
-    rXPropSet->getPropertyValue("SoftEdgeRad") >>= nRad;
+    rXPropSet->getPropertyValue("SoftEdgeRadius") >>= nRad;
     if (!nRad)
         return;
 
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 667e479107e5..078284f18e39 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -208,7 +208,7 @@ GapwidthSequence
 GenerateVbaEvents
 Geometry3D
 GlowEffect
-GlowEffectRad
+GlowEffectRadius
 GradientName
 HatchName
 Graphic
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index e71a5228c9eb..c6d2f48aedde 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -2855,7 +2855,7 @@ void SdOOXMLExportTest2::testShapeGlowEffect()
     xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
     uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef));
     sal_Int32 nRadius = -1;
-    xShape->getPropertyValue("GlowEffectRad") >>= nRadius;
+    xShape->getPropertyValue("GlowEffectRadius") >>= nRadius;
     CPPUNIT_ASSERT_EQUAL(sal_Int32(388), nRadius); // 139700 EMU = 388.0556 mm/100
     Color nColor;
     xShape->getPropertyValue("GlowEffectColor") >>= nColor;
@@ -2919,7 +2919,7 @@ void SdOOXMLExportTest2::testShapeSoftEdgeEffect()
     xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
     auto xShapeProps(getShapeFromPage(0, 0, xDocShRef));
     sal_Int32 nRadius = -1;
-    xShapeProps->getPropertyValue("SoftEdgeRad") >>= nRadius;
+    xShapeProps->getPropertyValue("SoftEdgeRadius") >>= nRadius;
     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nRadius); // 18 pt
 }
 
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 6711333c866e..a2186fae62af 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -1248,7 +1248,7 @@ void SdExportTest::testGlow()
 
     // Check glow properties
     sal_Int32 nGlowEffectRad = 0;
-    CPPUNIT_ASSERT(xShape->getPropertyValue("GlowEffectRad") >>= nGlowEffectRad);
+    CPPUNIT_ASSERT(xShape->getPropertyValue("GlowEffectRadius") >>= nGlowEffectRad);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(529), nGlowEffectRad); // 15 pt = 529.166... mm/100
     sal_Int32 nGlowEffectColor = 0;
     CPPUNIT_ASSERT(xShape->getPropertyValue("GlowEffectColor") >>= nGlowEffectColor);
@@ -1289,7 +1289,7 @@ void SdExportTest::testSoftEdges()
 
     // Check property
     sal_Int32 nRad = 0;
-    CPPUNIT_ASSERT(xShapeProps->getPropertyValue("SoftEdgeRad") >>= nRad);
+    CPPUNIT_ASSERT(xShapeProps->getPropertyValue("SoftEdgeRadius") >>= nRad);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(635), nRad); // 18 pt
 
     // Test ODF element
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 25e19d9c7cc2..70815581ed9f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -3111,7 +3111,7 @@ void SdImportTest::testShapeGlowEffectPPTXImpoer()
 
     uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef));
     sal_Int32 nRadius = -1;
-    xShape->getPropertyValue("GlowEffectRad") >>= nRadius;
+    xShape->getPropertyValue("GlowEffectRadius") >>= nRadius;
     CPPUNIT_ASSERT_EQUAL(sal_Int32(388), nRadius); // 139700 EMU = 388.0556 mm/100
     Color nColor;
     xShape->getPropertyValue("GlowEffectColor") >>= nColor;
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index aedcfda602f4..fcf88f0f0659 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -12307,7 +12307,7 @@ SdrPercentItem GlowTransparency SID_ATTR_GLOW_TRANSPARENCY
     GroupId = SfxGroupId::Document;
 ]
 
-SdrMetricItem SoftEdgeRad SID_ATTR_SOFTEDGE_RADIUS
+SdrMetricItem SoftEdgeRadius SID_ATTR_SOFTEDGE_RADIUS
 
 [
     AutoUpdate = TRUE,
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 1ef622861814..4795be7e147e 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -215,7 +215,7 @@ namespace drawinglayer
 
         attribute::SdrGlowAttribute createNewSdrGlowAttribute(const SfxItemSet& rSet)
         {
-            sal_Int32 nRadius = rSet.Get(SDRATTR_GLOW_RAD).GetValue();
+            sal_Int32 nRadius = rSet.Get(SDRATTR_GLOW_RADIUS).GetValue();
             if (!nRadius)
                 return attribute::SdrGlowAttribute();
             Color aColor(rSet.Get(SDRATTR_GLOW_COLOR).GetColorValue());
@@ -229,7 +229,7 @@ namespace drawinglayer
 
         sal_Int32 getSoftEdgeRadius(const SfxItemSet& rSet)
         {
-            return rSet.Get(SDRATTR_SOFTEDGE_RAD).GetValue();
+            return rSet.Get(SDRATTR_SOFTEDGE_RADIUS).GetValue();
         }
     } // end of anonymous namespace
 } // end of namespace drawinglayer
diff --git a/svx/source/sidebar/glow/GlowPropertyPanel.cxx b/svx/source/sidebar/glow/GlowPropertyPanel.cxx
index 26493c3c250e..acb63e090acc 100644
--- a/svx/source/sidebar/glow/GlowPropertyPanel.cxx
+++ b/svx/source/sidebar/glow/GlowPropertyPanel.cxx
@@ -75,7 +75,7 @@ IMPL_LINK_NOARG(GlowPropertyPanel, ModifyGlowColorHdl, ColorListBox&, void)
 
 IMPL_LINK_NOARG(GlowPropertyPanel, ModifyGlowRadiusHdl, weld::MetricSpinButton&, void)
 {
-    SdrMetricItem aItem(SDRATTR_GLOW_RAD, mxGlowRadius->get_value(FieldUnit::MM_100TH));
+    SdrMetricItem aItem(SDRATTR_GLOW_RADIUS, mxGlowRadius->get_value(FieldUnit::MM_100TH));
     mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_GLOW_RADIUS, SfxCallMode::RECORD, { &aItem });
 }
 
diff --git a/svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx b/svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx
index 66faf7815cca..35511498fe44 100644
--- a/svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx
+++ b/svx/source/sidebar/softedge/SoftEdgePropertyPanel.cxx
@@ -49,7 +49,7 @@ void SoftEdgePropertyPanel::Initialize()
 
 IMPL_LINK_NOARG(SoftEdgePropertyPanel, ModifySoftEdgeRadiusHdl, weld::MetricSpinButton&, void)
 {
-    SdrMetricItem aItem(SDRATTR_SOFTEDGE_RAD, mxSoftEdgeRadius->get_value(FieldUnit::MM_100TH));
+    SdrMetricItem aItem(SDRATTR_SOFTEDGE_RADIUS, mxSoftEdgeRadius->get_value(FieldUnit::MM_100TH));
     mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_SOFTEDGE_RADIUS, SfxCallMode::RECORD,
                                              { &aItem });
 }
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index d0dd36a4d1a5..69034cb4b43f 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -329,11 +329,11 @@ SdrItemPool::SdrItemPool(
     rPoolDefaults[ SDRATTR_TABLE_BORDER_BLTR - SDRATTR_START ] = new SvxLineItem( SDRATTR_TABLE_BORDER_BLTR );
     rPoolDefaults[ SDRATTR_TABLE_TEXT_ROTATION - SDRATTR_START ] = new SvxTextRotateItem(0, SDRATTR_TABLE_TEXT_ROTATION);
 
-    rPoolDefaults[ SDRATTR_GLOW_RAD - SDRATTR_START ] = new SdrMetricItem(SDRATTR_GLOW_RAD, 0);
+    rPoolDefaults[ SDRATTR_GLOW_RADIUS - SDRATTR_START ] = new SdrMetricItem(SDRATTR_GLOW_RADIUS, 0);
     rPoolDefaults[ SDRATTR_GLOW_COLOR - SDRATTR_START ] = new XColorItem(SDRATTR_GLOW_COLOR, aNullCol);
     rPoolDefaults[ SDRATTR_GLOW_TRANSPARENCY - SDRATTR_START ] = new SdrPercentItem(SDRATTR_GLOW_TRANSPARENCY, 0);
 
-    rPoolDefaults[SDRATTR_SOFTEDGE_RAD - SDRATTR_START] = new SdrMetricItem(SDRATTR_SOFTEDGE_RAD, 0);
+    rPoolDefaults[SDRATTR_SOFTEDGE_RADIUS - SDRATTR_START] = new SdrMetricItem(SDRATTR_SOFTEDGE_RADIUS, 0);
 
     // set own ItemInfos
     mpLocalItemInfos[SDRATTR_SHADOW-SDRATTR_START]._nSID=SID_ATTR_FILL_SHADOW;
@@ -349,11 +349,11 @@ SdrItemPool::SdrItemPool(
     mpLocalItemInfos[SDRATTR_TABLE_BORDER_TLBR - SDRATTR_START ]._nSID = SID_ATTR_BORDER_DIAG_TLBR;
     mpLocalItemInfos[SDRATTR_TABLE_BORDER_BLTR - SDRATTR_START ]._nSID = SID_ATTR_BORDER_DIAG_BLTR;
 
-    mpLocalItemInfos[SDRATTR_GLOW_RAD - SDRATTR_START]._nSID = SID_ATTR_GLOW_RADIUS;
+    mpLocalItemInfos[SDRATTR_GLOW_RADIUS - SDRATTR_START]._nSID = SID_ATTR_GLOW_RADIUS;
     mpLocalItemInfos[SDRATTR_GLOW_COLOR - SDRATTR_START]._nSID = SID_ATTR_GLOW_COLOR;
     mpLocalItemInfos[SDRATTR_GLOW_TRANSPARENCY - SDRATTR_START]._nSID = SID_ATTR_GLOW_TRANSPARENCY;
 
-    mpLocalItemInfos[SDRATTR_SOFTEDGE_RAD - SDRATTR_START]._nSID = SID_ATTR_SOFTEDGE_RADIUS;
+    mpLocalItemInfos[SDRATTR_SOFTEDGE_RADIUS - SDRATTR_START]._nSID = SID_ATTR_SOFTEDGE_RADIUS;
 
     // it's my own creation level, set Defaults and ItemInfos
     SetDefaults(mpLocalPoolDefaults);
@@ -461,11 +461,11 @@ OUString SdrItemPool::GetItemName(sal_uInt16 nWhich)
         case SDRATTR_SHADOW3D          : pResId = SIP_SA_SHADOW3D;break;
         case SDRATTR_SHADOWPERSP       : pResId = SIP_SA_SHADOWPERSP;break;
 
-        case SDRATTR_GLOW_RAD          : pResId = SIP_SA_GLOW_RAD;break;
+        case SDRATTR_GLOW_RADIUS       : pResId = SIP_SA_GLOW_RADIUS;break;
         case SDRATTR_GLOW_COLOR        : pResId = SIP_SA_GLOW_COLOR;break;
         case SDRATTR_GLOW_TRANSPARENCY : pResId = SIP_SA_GLOW_TRANSPARENCY;break;
 
-        case SDRATTR_SOFTEDGE_RAD      : pResId = SIP_SA_SOFTEDGE_RAD; break;
+        case SDRATTR_SOFTEDGE_RADIUS   : pResId = SIP_SA_SOFTEDGE_RADIUS; break;
 
         case SDRATTR_CAPTIONTYPE      : pResId = SIP_SA_CAPTIONTYPE;break;
         case SDRATTR_CAPTIONFIXEDANGLE: pResId = SIP_SA_CAPTIONFIXEDANGLE;break;
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index c9725c2a5ca8..d55c2cec6b6a 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -153,12 +153,12 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
     GMAP( "ShadowTransparence",             XML_NAMESPACE_DRAW, XML_SHADOW_OPACITY, XML_TYPE_NEG_PERCENT, 0 ),
 
     // glow attributes
-    GMAPV( "GlowEffectRad",                    XML_NAMESPACE_LO_EXT, XML_GLOW_RADIUS,          XML_TYPE_MEASURE  , 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV( "GlowEffectRadius",                 XML_NAMESPACE_LO_EXT, XML_GLOW_RADIUS,          XML_TYPE_MEASURE  , 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
     GMAPV( "GlowEffectColor",                  XML_NAMESPACE_LO_EXT, XML_GLOW_COLOR,           XML_TYPE_COLOR    , 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
     GMAPV( "GlowEffectTransparency",           XML_NAMESPACE_LO_EXT, XML_GLOW_TRANSPARENCY,    XML_TYPE_PERCENT16, 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
 
     // soft edge attributes
-    GMAPV( "SoftEdgeRad",                   XML_NAMESPACE_LO_EXT, XML_SOFTEDGE_RADIUS,      XML_TYPE_MEASURE          , 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
+    GMAPV( "SoftEdgeRadius",                XML_NAMESPACE_LO_EXT, XML_SOFTEDGE_RADIUS,      XML_TYPE_MEASURE          , 0, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED),
 
     // graphic attributes
     GMAP( "GraphicColorMode",               XML_NAMESPACE_DRAW, XML_COLOR_MODE,             XML_TYPE_COLOR_MODE, 0 ), // exists in SW, too, with same property name
commit bf92b220647490e908609a271c08384926989609
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Jun 1 16:03:34 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:16 2020 +0200

    lok: add "Remove" param to .uno:ChangeTabStop
    
    Change-Id: Ic6b71c0bb6177eb10f5be4197d77c5db5f5884a0

diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index 5b7c1f0a9b6b..8d0c608b6751 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -537,12 +537,13 @@ class SvxSetItem;
 #define SID_TABSTOP_ADD_OR_CHANGE                       ( SID_SVX_START + 581 )
 #define SID_TABSTOP_ATTR_INDEX                          ( SID_SVX_START + 582 )
 #define SID_TABSTOP_ATTR_POSITION                       ( SID_SVX_START + 583 )
-#define SID_PARAGRAPH_FIRST_LINE_INDENT                 ( SID_SVX_START + 584 )
-#define SID_PARAGRAPH_LEFT_INDENT                       ( SID_SVX_START + 585 )
-#define SID_PARAGRAPH_RIGHT_INDENT                      ( SID_SVX_START + 586 )
+#define SID_TABSTOP_ATTR_REMOVE                         ( SID_SVX_START + 584 )
 
 // CAUTION! Range <587 .. 587> used by EditEngine (!)
 
+#define SID_PARAGRAPH_FIRST_LINE_INDENT                 ( SID_SVX_START + 588 )
+#define SID_PARAGRAPH_LEFT_INDENT                       ( SID_SVX_START + 589 )
+#define SID_PARAGRAPH_RIGHT_INDENT                      ( SID_SVX_START + 590 )
 
 // CAUTION! Range <591 .. 591> used by EditEngine (!)
 
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index c36e1771afd7..aedcfda602f4 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -7211,7 +7211,8 @@ SfxVoidItem RulerChangeState SID_RULER_CHANGE_STATE
 
 SfxVoidItem ChangeTabStop SID_TABSTOP_ADD_OR_CHANGE
     (SfxInt32Item Index SID_TABSTOP_ATTR_INDEX,
-     SfxInt32Item Position SID_TABSTOP_ATTR_POSITION)
+     SfxInt32Item Position SID_TABSTOP_ATTR_POSITION,
+     SfxBoolItem  Remove SID_TABSTOP_ATTR_REMOVE)
 [
     AutoUpdate = FALSE,
     FastCall = TRUE,
@@ -7221,7 +7222,6 @@ SfxVoidItem ChangeTabStop SID_TABSTOP_ADD_OR_CHANGE
     RecordAbsolute = FALSE,
     RecordPerSet;
 
-
     AccelConfig = FALSE,
     MenuConfig = FALSE,
     ToolBoxConfig = FALSE,
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 0c2995e0b56d..b7f6e02dcc09 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -655,8 +655,12 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
         {
             const auto aIndexItem = static_cast<const SfxInt32Item&>(pReqArgs->Get(SID_TABSTOP_ATTR_INDEX));
             const auto aPositionItem = static_cast<const SfxInt32Item&>(pReqArgs->Get(SID_TABSTOP_ATTR_POSITION));
+            const auto aRemoveItem = static_cast<const SfxBoolItem&>(pReqArgs->Get(SID_TABSTOP_ATTR_REMOVE));
             const sal_Int32 nIndex = aIndexItem.GetValue();
             const sal_Int32 nPosition = aPositionItem.GetValue();
+            const bool bRemove = aRemoveItem.GetValue();
+
+
 
             SfxItemSet aItemSet(GetPool(), svl::Items<RES_PARATR_TABSTOP, RES_PARATR_TABSTOP>{});
             rSh.GetCurAttr(aItemSet);
@@ -680,12 +684,14 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
                 {
                     SvxTabStop aTabStop = aTabStopItem.At(nIndex);
                     aTabStopItem.Remove(nIndex);
-                    aTabStop.GetTabPos() = nPosition;
-                    aTabStopItem.Insert(aTabStop);
-
-                    SvxTabStop aSwTabStop(0, SvxTabAdjust::Default);
-                    aTabStopItem.Insert(aSwTabStop);
+                    if (!bRemove)
+                    {
+                        aTabStop.GetTabPos() = nPosition;
+                        aTabStopItem.Insert(aTabStop);
 
+                        SvxTabStop aSwTabStop(0, SvxTabAdjust::Default);
+                        aTabStopItem.Insert(aSwTabStop);
+                    }
                     const SvxTabStopItem& rDefaultTabs = rSh.GetDefault(RES_PARATR_TABSTOP);
                     MakeDefTabs(GetTabDist(rDefaultTabs), aTabStopItem);
                 }
commit d949ad3901583919dcc43218935860f298cfc889
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 21:59:34 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:16 2020 +0200

    sd: allow to change the search string between searches
    
    Before this was missing, so even with a different search string,
    it still searched using the old string, which was a bug.
    
    Change-Id: I1655cb421e216e30ae593aabd3ead3a2d5c06299

diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 584d7b253994..065c53df7f1a 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -827,13 +827,19 @@ bool SdOutliner::SearchAndReplaceOnce(std::vector<sd::SearchSelection>* pSelecti
 
             if (mpImpl->mbCurrentIsVectorGraphic)
             {
+                OUString const & rString = mpSearchItem->GetSearchString();
                 bool bBackwards = mpSearchItem->GetBackward();
 
-                bool bResult = false;
-                if (bBackwards)
-                    bResult = mpImpl->mpVectorGraphicSearch->previous();
-                else
-                    bResult = mpImpl->mpVectorGraphicSearch->next();
+                SearchStartPosition eSearchStartPosition = bBackwards ? SearchStartPosition::End : SearchStartPosition::Begin;
+                bool bResult = mpImpl->mpVectorGraphicSearch->search(rString, eSearchStartPosition);
+
+                if (bResult)
+                {
+                    if (bBackwards)
+                        bResult = mpImpl->mpVectorGraphicSearch->previous();
+                    else
+                        bResult = mpImpl->mpVectorGraphicSearch->next();
+                }
 
                 if (bResult)
                 {
commit fbf2b95498d59ce40e2d67ca8296a1461e29592d
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 14:03:36 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:16 2020 +0200

    vcl: VectorGraphicSearch - support changing search string
    
    Initial implementation only allowed to set the search string once.
    This change allows to change the search string and still retain
    the last position of a found string, so the search continues
    from this positon forward or backwards. This mimicks how we search
    through the GUI (which is the main use for this functionallity
    anyway).
    
    Change-Id: I8a7aee4b6b6525f483f105feaa1f83c4a0ad9594

diff --git a/include/vcl/VectorGraphicSearch.hxx b/include/vcl/VectorGraphicSearch.hxx
index 2dc8cca3b76a..c9faaa51f1c9 100644
--- a/include/vcl/VectorGraphicSearch.hxx
+++ b/include/vcl/VectorGraphicSearch.hxx
@@ -32,8 +32,7 @@ private:
     std::unique_ptr<Implementation> mpImplementation;
     Graphic maGraphic;
 
-    bool searchPDF(std::shared_ptr<VectorGraphicData> const& rData, OUString const& rSearchString,
-                   SearchStartPosition eStartPosition);
+    bool searchPDF(std::shared_ptr<VectorGraphicData> const& rData);
 
 public:
     VectorGraphicSearch(Graphic const& rGraphic);
diff --git a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
index 5f65b4ba7e3d..8dbdcac0e2e1 100644
--- a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
+++ b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
@@ -27,10 +27,12 @@ class VectorGraphicSearchTest : public test::BootstrapFixtureBase
 
     void test();
     void testNextPrevious();
+    void testSearchStringChange();
 
     CPPUNIT_TEST_SUITE(VectorGraphicSearchTest);
     CPPUNIT_TEST(test);
     CPPUNIT_TEST(testNextPrevious);
+    CPPUNIT_TEST(testSearchStringChange);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -160,6 +162,37 @@ void VectorGraphicSearchTest::testNextPrevious()
     }
 }
 
+void VectorGraphicSearchTest::testSearchStringChange()
+{
+    OUString aURL = getFullUrl("Pangram.pdf");
+    SvFileStream aStream(aURL, StreamMode::READ);
+    GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
+    Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream);
+    aGraphic.makeAvailable();
+
+    VectorGraphicSearch aSearch(aGraphic);
+
+    // Set search to "lazy"
+    CPPUNIT_ASSERT_EQUAL(true, aSearch.search("lazy"));
+
+    CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+    CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+
+    CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+    CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+
+    // Change search to "fox"
+    CPPUNIT_ASSERT_EQUAL(true, aSearch.search("fox"));
+
+    CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+    CPPUNIT_ASSERT_EQUAL(822, aSearch.index());
+
+    // Change search to "Quick"
+    CPPUNIT_ASSERT_EQUAL(true, aSearch.search("Quick"));
+    CPPUNIT_ASSERT_EQUAL(true, aSearch.previous());
+    CPPUNIT_ASSERT_EQUAL(784, aSearch.index());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(VectorGraphicSearchTest);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index 8c88aafb2217..b64302dfb8d4 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -56,18 +56,18 @@ private:
 
 public:
     sal_Int32 mnPageIndex;
+    int mnCurrentIndex;
     OUString maSearchString;
     SearchStartPosition meStartPosition;
 
-    SearchContext(FPDF_DOCUMENT pPdfDocument, sal_Int32 nPageIndex, OUString const& rSearchString,
-                  SearchStartPosition eStartPosition)
+    SearchContext(FPDF_DOCUMENT pPdfDocument, sal_Int32 nPageIndex)
         : mpPdfDocument(pPdfDocument)
         , mpPage(nullptr)
         , mpTextPage(nullptr)
         , mpSearchHandle(nullptr)
         , mnPageIndex(nPageIndex)
-        , maSearchString(rSearchString)
-        , meStartPosition(eStartPosition)
+        , mnCurrentIndex(-1)
+        , meStartPosition(SearchStartPosition::Begin)
     {
     }
 
@@ -96,13 +96,30 @@ public:
         return aSize;
     }
 
-    bool initialize()
+    bool initialize(OUString const& rSearchString, SearchStartPosition eStartPosition)
     {
         if (!mpPdfDocument)
             return false;
+
+        if (rSearchString == maSearchString)
+            return true;
+
+        if (mpSearchHandle)
+            FPDFText_FindClose(mpSearchHandle);
+
+        if (mpTextPage)
+            FPDFText_ClosePage(mpTextPage);
+
+        if (mpPage)
+            FPDF_ClosePage(mpPage);
+
+        maSearchString = rSearchString;
+        meStartPosition = eStartPosition;
+
         mpPage = FPDF_LoadPage(mpPdfDocument, mnPageIndex);
         if (!mpPage)
             return false;
+
         mpTextPage = FPDFText_LoadPage(mpPage);
         if (!mpTextPage)
             return false;
@@ -112,6 +129,9 @@ public:
         // Index where to start to search. -1 => at the end
         int nStartIndex = meStartPosition == SearchStartPosition::End ? -1 : 0;
 
+        if (mnCurrentIndex >= 0)
+            nStartIndex = mnCurrentIndex;
+
         // FPDF_MATCHCASE, FPDF_MATCHWHOLEWORD, FPDF_CONSECUTIVE
         // FPDF_MATCHCASE - If not set, it will not match case by default.
         // FPDF_MATCHWHOLEWORD - If not set, it will not match the whole word by default.
@@ -125,15 +145,21 @@ public:
 
     bool next()
     {
-        if (mpSearchHandle)
-            return FPDFText_FindNext(mpSearchHandle);
+        if (mpSearchHandle && FPDFText_FindNext(mpSearchHandle))
+        {
+            mnCurrentIndex = index();
+            return true;
+        }
         return false;
     }
 
     bool previous()
     {
-        if (mpSearchHandle)
-            return FPDFText_FindPrev(mpSearchHandle);
+        if (mpSearchHandle && FPDFText_FindPrev(mpSearchHandle))
+        {
+            mnCurrentIndex = index();
+            return true;
+        }
         return false;
     }
 
@@ -200,22 +226,24 @@ VectorGraphicSearch::~VectorGraphicSearch() { mpImplementation.reset(); }
 
 bool VectorGraphicSearch::search(OUString const& rSearchString, SearchStartPosition eStartPosition)
 {
-    auto pData = maGraphic.getVectorGraphicData();
-
-    if (pData && pData->getVectorGraphicDataType() == VectorGraphicDataType::Pdf)
+    if (!mpImplementation->mpSearchContext)
     {
-        return searchPDF(pData, rSearchString, eStartPosition);
+        auto pData = maGraphic.getVectorGraphicData();
+
+        if (pData && pData->getVectorGraphicDataType() == VectorGraphicDataType::Pdf)
+        {
+            if (searchPDF(pData))
+            {
+                return mpImplementation->mpSearchContext->initialize(rSearchString, eStartPosition);
+            }
+        }
+        return false;
     }
-    return false;
+    return mpImplementation->mpSearchContext->initialize(rSearchString, eStartPosition);
 }
 
-bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rData,
-                                    OUString const& rSearchString,
-                                    SearchStartPosition eStartPosition)
+bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rData)
 {
-    if (rSearchString.isEmpty())
-        return false;
-
     mpImplementation->mpPdfDocument
         = FPDF_LoadMemDocument(rData->getVectorGraphicDataArray().getConstArray(),
                                rData->getVectorGraphicDataArrayLength(), /*password=*/nullptr);
@@ -247,10 +275,9 @@ bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rD
 
     sal_Int32 nPageIndex = std::max(rData->getPageIndex(), sal_Int32(0));
 
-    mpImplementation->mpSearchContext.reset(new SearchContext(
-        mpImplementation->mpPdfDocument, nPageIndex, rSearchString, eStartPosition));
-
-    return mpImplementation->mpSearchContext->initialize();
+    mpImplementation->mpSearchContext.reset(
+        new SearchContext(mpImplementation->mpPdfDocument, nPageIndex));
+    return true;
 }
 
 basegfx::B2DSize VectorGraphicSearch::pageSize()
commit 92af11b097f903b4ff3c089bef41762798f6c2d0
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 13:28:36 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:16 2020 +0200

    sd: add support to search backwards in PDF search
    
    Change-Id: I2c7f75d16a430dcfa892d28fb6b4f64118705ad2

diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index 2c1e1c0426a3..8c2a41eeca9e 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -56,6 +56,7 @@ public:
     void testSearchInPDFNonExisting();
     void testSearchInPDF();
     void testSearchInPDFInMultiplePages();
+    void testSearchInPDFInMultiplePagesBackwards();
     void testSearchIn2MixedObjects();
     void testSearchIn6MixedObjects();
 
@@ -69,6 +70,7 @@ public:
     CPPUNIT_TEST(testSearchInPDFNonExisting);
     CPPUNIT_TEST(testSearchInPDF);
     CPPUNIT_TEST(testSearchInPDFInMultiplePages);
+    CPPUNIT_TEST(testSearchInPDFInMultiplePagesBackwards);
     CPPUNIT_TEST(testSearchIn2MixedObjects);
     CPPUNIT_TEST(testSearchIn6MixedObjects);
     CPPUNIT_TEST_SUITE_END();
@@ -123,14 +125,14 @@ LOKitSearchTest::createDoc(const char* pName, const uno::Sequence<beans::Propert
 
 namespace
 {
-void lcl_search(const OUString& rKey, bool bFindAll = false)
+void lcl_search(const OUString& rKey, bool bFindAll = false, bool bBackwards = false)
 {
     Scheduler::ProcessEventsToIdle();
     SvxSearchCmd eSearch = bFindAll ? SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND;
 
     uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({
         { "SearchItem.SearchString", uno::makeAny(rKey) },
-        { "SearchItem.Backward", uno::makeAny(false) },
+        { "SearchItem.Backward", uno::makeAny(bBackwards) },
         { "SearchItem.Command", uno::makeAny(sal_uInt16(eSearch)) },
     }));
 
@@ -422,6 +424,104 @@ void LOKitSearchTest::testSearchInPDFInMultiplePages()
                          mpCallbackRecorder->m_aSearchResultSelection[0]);
 }
 
+void LOKitSearchTest::testSearchInPDFInMultiplePagesBackwards()
+{
+    SdXImpressDocument* pXImpressDocument = createDoc("PDFSearch.pdf");
+    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+    CPPUNIT_ASSERT(pViewShell);
+    mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase());
+
+    SdPage* pPage = pViewShell->GetActualPage();
+    CPPUNIT_ASSERT(pPage);
+
+    {
+        SdrObject* pObject = pPage->GetObj(0);
+        CPPUNIT_ASSERT(pObject);
+
+        SdrGrafObj* pGraphicObject = dynamic_cast<SdrGrafObj*>(pObject);
+        CPPUNIT_ASSERT(pGraphicObject);
+
+        Graphic aGraphic = pGraphicObject->GetGraphic();
+        auto const& pVectorGraphicData = aGraphic.getVectorGraphicData();
+        CPPUNIT_ASSERT(pVectorGraphicData);
+        CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
+                             pVectorGraphicData->getVectorGraphicDataType());
+    }
+
+    // Expected for backwards search is:
+    // - Start with Page 1
+    //   + search backwards through objects
+    //   + inside objects search backwards through text
+    // - Switch to Page 2
+    //   + search backwards through objects
+    //   + inside objects search backwards through text
+
+    // Search for "him"
+    lcl_search("him", /*FindAll*/ false, /*Backwards*/ true);
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]);
+    CPPUNIT_ASSERT_EQUAL(OString("5592, 5038, 1100, 499"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+
+    // Search for "him"
+    lcl_search("him", /*FindAll*/ false, /*Backwards*/ true);
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]);
+    CPPUNIT_ASSERT_EQUAL(OString("9463, 3382, 1099, 499"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+
+    // Search for "him"
+    lcl_search("him", /*FindAll*/ false, /*Backwards*/ true);
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(3, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]);
+    CPPUNIT_ASSERT_EQUAL(OString("5592, 2964, 1100, 499"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+
+    // Search for "him"
+    lcl_search("him", /*FindAll*/ false, /*Backwards*/ true);
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(4, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]);
+    CPPUNIT_ASSERT_EQUAL(OString("9463, 1308, 1099, 499"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+
+    // Search for "him" - back to start
+    lcl_search("him", /*FindAll*/ false, /*Backwards*/ true);
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(5, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]);
+    CPPUNIT_ASSERT_EQUAL(OString("5592, 5038, 1100, 499"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+}
+
 // Test searching in document with mixed objects.
 // We have 2 objects: 1. Text Object, 2. Graphic Object with PDF
 void LOKitSearchTest::testSearchIn2MixedObjects()
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index bc3a4e8d8821..584d7b253994 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -827,7 +827,15 @@ bool SdOutliner::SearchAndReplaceOnce(std::vector<sd::SearchSelection>* pSelecti
 
             if (mpImpl->mbCurrentIsVectorGraphic)
             {
-                if (mpImpl->mpVectorGraphicSearch->next())
+                bool bBackwards = mpSearchItem->GetBackward();
+
+                bool bResult = false;
+                if (bBackwards)
+                    bResult = mpImpl->mpVectorGraphicSearch->previous();
+                else
+                    bResult = mpImpl->mpVectorGraphicSearch->next();
+
+                if (bResult)
                 {
                     nMatchCount = 1;
 
@@ -1228,12 +1236,19 @@ void SdOutliner::ProvideNextTextObject()
                     // contains a vector graphic
                     auto* pGraphicObject = static_cast<SdrGrafObj*>(mpObj);
                     OUString const & rString = mpSearchItem->GetSearchString();
+                    bool bBackwards = mpSearchItem->GetBackward();
+                    SearchStartPosition eSearchStartPosition = bBackwards ? SearchStartPosition::End : SearchStartPosition::Begin;
 
                     mpImpl->mpVectorGraphicSearch = std::make_unique<VectorGraphicSearch>(pGraphicObject->GetGraphic());
 
-                    bool bResult = mpImpl->mpVectorGraphicSearch->search(rString);
+                    bool bResult = mpImpl->mpVectorGraphicSearch->search(rString, eSearchStartPosition);
                     if (bResult)
-                        bResult = mpImpl->mpVectorGraphicSearch->next();
+                    {
+                        if (bBackwards)
+                            bResult = mpImpl->mpVectorGraphicSearch->previous();
+                        else
+                            bResult = mpImpl->mpVectorGraphicSearch->next();
+                    }
 
                     if (bResult)
                     {
commit 2f0737cc0e927869f56e019d6eb5566617ddd6b4
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 12:17:05 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:16 2020 +0200

    sd: add test to search inside PDF in multiple pages
    
    Change-Id: I246508a22a4e324bae1bb10c6e292790c04da4c0

diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index ec9f7d95c5da..2c1e1c0426a3 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -55,6 +55,7 @@ public:
     void testDontSearchInMasterPages();
     void testSearchInPDFNonExisting();
     void testSearchInPDF();
+    void testSearchInPDFInMultiplePages();
     void testSearchIn2MixedObjects();
     void testSearchIn6MixedObjects();
 
@@ -67,6 +68,7 @@ public:
     CPPUNIT_TEST(testDontSearchInMasterPages);
     CPPUNIT_TEST(testSearchInPDFNonExisting);
     CPPUNIT_TEST(testSearchInPDF);
+    CPPUNIT_TEST(testSearchInPDFInMultiplePages);
     CPPUNIT_TEST(testSearchIn2MixedObjects);
     CPPUNIT_TEST(testSearchIn6MixedObjects);
     CPPUNIT_TEST_SUITE_END();
@@ -330,6 +332,96 @@ void LOKitSearchTest::testSearchInPDF()
                          mpCallbackRecorder->m_aSelection[0]);
 }
 
+void LOKitSearchTest::testSearchInPDFInMultiplePages()
+{
+    SdXImpressDocument* pXImpressDocument = createDoc("PDFSearch.pdf");
+    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+    CPPUNIT_ASSERT(pViewShell);
+    mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase());
+
+    SdPage* pPage = pViewShell->GetActualPage();
+    CPPUNIT_ASSERT(pPage);
+
+    {
+        SdrObject* pObject = pPage->GetObj(0);
+        CPPUNIT_ASSERT(pObject);
+
+        SdrGrafObj* pGraphicObject = dynamic_cast<SdrGrafObj*>(pObject);
+        CPPUNIT_ASSERT(pGraphicObject);
+
+        Graphic aGraphic = pGraphicObject->GetGraphic();
+        auto const& pVectorGraphicData = aGraphic.getVectorGraphicData();
+        CPPUNIT_ASSERT(pVectorGraphicData);
+        CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
+                             pVectorGraphicData->getVectorGraphicDataType());
+    }
+
+    // Search for "him"
+    lcl_search("him");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]);
+    CPPUNIT_ASSERT_EQUAL(OString("9463, 3382, 1099, 499"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+
+    // Search for "him"
+    lcl_search("him");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]);
+    CPPUNIT_ASSERT_EQUAL(OString("5592, 5038, 1100, 499"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+
+    // Search for "him"
+    lcl_search("him");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(3, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]);
+    CPPUNIT_ASSERT_EQUAL(OString("9463, 1308, 1099, 499"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+
+    // Search for "him"
+    lcl_search("him");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(4, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_aSearchResultPart[0]);
+    CPPUNIT_ASSERT_EQUAL(OString("5592, 2964, 1100, 499"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+
+    // Search for "him" - back to start
+    lcl_search("him");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(5, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(0, mpCallbackRecorder->m_aSearchResultPart[0]);
+    CPPUNIT_ASSERT_EQUAL(OString("9463, 3382, 1099, 499"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+}
+
 // Test searching in document with mixed objects.
 // We have 2 objects: 1. Text Object, 2. Graphic Object with PDF
 void LOKitSearchTest::testSearchIn2MixedObjects()
commit cd38d49cc0b0669f5ee52a56a22f29ef5ad280a5
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 12:13:59 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:15 2020 +0200

    vcl: use HAVE_FEATURE_PDFIUM in VectorGraphicSearch impl.
    
    Change-Id: Id6c30e8f1c5bdb0481b0c7d4680554e3e8caa323

diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index b1d6d17acf55..8c88aafb2217 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -10,6 +10,10 @@
 
 #include <vcl/VectorGraphicSearch.hxx>
 
+#include <config_features.h>
+
+#if HAVE_FEATURE_PDFIUM
+
 #include <vcl/filter/PDFiumLibrary.hxx>
 
 #include <sal/config.h>
@@ -286,4 +290,41 @@ std::vector<basegfx::B2DRectangle> VectorGraphicSearch::getTextRectangles()
     return std::vector<basegfx::B2DRectangle>();
 }
 
+#else // !HAVE_FEATURE_PDFIUM
+
+VectorGraphicSearch::VectorGraphicSearch(Graphic const& rGraphic)
+    : maGraphic(rGraphic)
+{
+}
+
+VectorGraphicSearch::~VectorGraphicSearch() {}
+
+bool VectorGraphicSearch::search(OUString const& /*rSearchString*/,
+                                 SearchStartPosition /*eStartPosition*/)
+{
+    return false;
+}
+
+bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& /*rData*/,
+                                    OUString const& /*rSearchString*/,
+                                    SearchStartPosition /*eStartPosition*/)
+{
+    return false;
+}
+
+basegfx::B2DSize VectorGraphicSearch::pageSize() { return basegfx::B2DSize(); }
+
+bool VectorGraphicSearch::next() { return false; }
+
+bool VectorGraphicSearch::previous() { return false; }
+
+int VectorGraphicSearch::index() { return -1; }
+
+std::vector<basegfx::B2DRectangle> VectorGraphicSearch::getTextRectangles()
+{
+    return std::vector<basegfx::B2DRectangle>();
+}
+
+#endif // HAVE_FEATURE_PDFIUM
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d5206846e56784eb97639f4f67af586dde162262
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 12:02:39 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:15 2020 +0200

    vcl: VectorGraphicSearch - move SearchContext into Implementation
    
    Change-Id: I3bbf085fd8b8b66a56e364168c1e70b4ce986467

diff --git a/include/vcl/VectorGraphicSearch.hxx b/include/vcl/VectorGraphicSearch.hxx
index b67c63a844d8..2dc8cca3b76a 100644
--- a/include/vcl/VectorGraphicSearch.hxx
+++ b/include/vcl/VectorGraphicSearch.hxx
@@ -19,8 +19,6 @@
 
 #include <memory>
 
-class SearchContext;
-
 enum class SearchStartPosition
 {
     Begin,
@@ -33,7 +31,6 @@ private:
     class Implementation;
     std::unique_ptr<Implementation> mpImplementation;
     Graphic maGraphic;
-    std::unique_ptr<SearchContext> mpSearchContext;
 
     bool searchPDF(std::shared_ptr<VectorGraphicData> const& rData, OUString const& rSearchString,
                    SearchStartPosition eStartPosition);
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index e8f7484320e3..b1d6d17acf55 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -17,12 +17,16 @@
 #include <fpdf_doc.h>
 #include <fpdf_text.h>
 
+class SearchContext;
+
 class VectorGraphicSearch::Implementation
 {
 public:
     std::shared_ptr<vcl::pdf::PDFium> mpPDFium;
     FPDF_DOCUMENT mpPdfDocument;
 
+    std::unique_ptr<SearchContext> mpSearchContext;
+
     Implementation()
         : mpPDFium(vcl::pdf::PDFiumLibrary::get())
         , mpPdfDocument(nullptr)
@@ -31,6 +35,8 @@ public:
 
     ~Implementation()
     {
+        mpSearchContext.reset();
+
         if (mpPdfDocument)
             FPDF_CloseDocument(mpPdfDocument);
     }
@@ -186,11 +192,7 @@ VectorGraphicSearch::VectorGraphicSearch(Graphic const& rGraphic)
 {
 }
 
-VectorGraphicSearch::~VectorGraphicSearch()
-{
-    mpSearchContext.reset();
-    mpImplementation.reset();
-}
+VectorGraphicSearch::~VectorGraphicSearch() { mpImplementation.reset(); }
 
 bool VectorGraphicSearch::search(OUString const& rSearchString, SearchStartPosition eStartPosition)
 {
@@ -241,45 +243,45 @@ bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rD
 
     sal_Int32 nPageIndex = std::max(rData->getPageIndex(), sal_Int32(0));
 
-    mpSearchContext.reset(new SearchContext(mpImplementation->mpPdfDocument, nPageIndex,
-                                            rSearchString, eStartPosition));
+    mpImplementation->mpSearchContext.reset(new SearchContext(
+        mpImplementation->mpPdfDocument, nPageIndex, rSearchString, eStartPosition));
 
-    return mpSearchContext->initialize();
+    return mpImplementation->mpSearchContext->initialize();
 }
 
 basegfx::B2DSize VectorGraphicSearch::pageSize()
 {
     basegfx::B2DSize aSize;
-    if (mpSearchContext)
-        aSize = mpSearchContext->getPageSize();
+    if (mpImplementation->mpSearchContext)
+        aSize = mpImplementation->mpSearchContext->getPageSize();
     return aSize;
 }
 
 bool VectorGraphicSearch::next()
 {
-    if (mpSearchContext)
-        return mpSearchContext->next();
+    if (mpImplementation->mpSearchContext)
+        return mpImplementation->mpSearchContext->next();
     return false;
 }
 
 bool VectorGraphicSearch::previous()
 {
-    if (mpSearchContext)
-        return mpSearchContext->previous();
+    if (mpImplementation->mpSearchContext)
+        return mpImplementation->mpSearchContext->previous();
     return false;
 }
 
 int VectorGraphicSearch::index()
 {
-    if (mpSearchContext)
-        return mpSearchContext->index();
+    if (mpImplementation->mpSearchContext)
+        return mpImplementation->mpSearchContext->index();
     return -1;
 }
 
 std::vector<basegfx::B2DRectangle> VectorGraphicSearch::getTextRectangles()
 {
-    if (mpSearchContext)
-        return mpSearchContext->getTextRectangles();
+    if (mpImplementation->mpSearchContext)
+        return mpImplementation->mpSearchContext->getTextRectangles();
 
     return std::vector<basegfx::B2DRectangle>();
 }
commit 2bb9d6e60d3af538d3c36e43b14b44e51cc78862
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 11:50:20 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:15 2020 +0200

    pdfium: only init pdfium library one and destroy on LO exit
    
    With more and more usage of PDFium, it is hard to keep track of
    the life-time of the PDFium library, so it can happen that a
    FPDF_DestroyLibrary happens when we still have another instance
    where PDFium is still use. The result of this is a crash. To
    prevent this, just initialize the library once and delete, when
    on LO exit.
    
    This can be improved in the future to only keep the library
    active when in actual use.
    
    Change-Id: I5c7e5de7f8b97d10efb394c67c7a61b976c8d57c

diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
new file mode 100644
index 000000000000..bc7912c17e81
--- /dev/null
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <config_features.h>
+
+#if HAVE_FEATURE_PDFIUM
+
+#include <memory>
+#include <rtl/instance.hxx>
+#include <vcl/dllapi.h>
+
+namespace vcl::pdf
+{
+class VCL_DLLPUBLIC PDFium final
+{
+private:
+    PDFium(const PDFium&) = delete;
+    PDFium& operator=(const PDFium&) = delete;
+
+public:
+    PDFium();
+    ~PDFium();
+};
+
+struct PDFiumLibrary : public rtl::StaticWithInit<std::shared_ptr<PDFium>, PDFiumLibrary>
+{
+    std::shared_ptr<PDFium> operator()() { return std::make_shared<PDFium>(); }
+};
+
+} // namespace vcl::pdf
+
+#endif // HAVE_FEATURE_PDFIUM
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/inc/svdpdf.hxx b/svx/source/inc/svdpdf.hxx
index 9b48eb1d30c5..1f02b2151594 100644
--- a/svx/source/inc/svdpdf.hxx
+++ b/svx/source/inc/svdpdf.hxx
@@ -42,6 +42,8 @@
 #include <postwin.h>
 #include <fpdfview.h>
 
+#include <vcl/filter/PDFiumLibrary.hxx>
+
 // Forward Declarations
 
 class SfxItemSet;
@@ -100,6 +102,8 @@ class SVXCORE_DLLPUBLIC ImpSdrPdfImport final
     tools::Rectangle PointsToLogic(double left, double right, double top, double bottom) const;
     Point PointsToLogic(double x, double y) const;
 
+    std::shared_ptr<vcl::pdf::PDFium> mpPDFium;
+
     // check for clip and evtl. fill maClip
     void checkClip();
     bool isClip() const;
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 5cd0c0765a29..188651be386c 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -116,6 +116,7 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools:
     , mnPageCount(0)
     , mdPageWidthPts(0)
     , mdPageHeightPts(0)
+    , mpPDFium(vcl::pdf::PDFiumLibrary::get())
 {
     mpVD->EnableOutput(false);
     mpVD->SetLineColor();
@@ -129,13 +130,6 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools:
                                               svl::Items<EE_ITEMS_START, EE_ITEMS_END>{});
     checkClip();
 
-    FPDF_LIBRARY_CONFIG aConfig;
-    aConfig.version = 2;
-    aConfig.m_pUserFontPaths = nullptr;
-    aConfig.m_pIsolate = nullptr;
-    aConfig.m_v8EmbedderSlot = 0;
-    FPDF_InitLibraryWithConfig(&aConfig);
-
     // Load the buffer using pdfium.
     auto const& rVectorGraphicData = rGraphic.getVectorGraphicData();
     mpPdfDocument = FPDF_LoadMemDocument(
@@ -170,11 +164,7 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools:
     mnPageCount = FPDF_GetPageCount(mpPdfDocument);
 }
 
-ImpSdrPdfImport::~ImpSdrPdfImport()
-{
-    FPDF_CloseDocument(mpPdfDocument);
-    FPDF_DestroyLibrary();
-}
+ImpSdrPdfImport::~ImpSdrPdfImport() { FPDF_CloseDocument(mpPdfDocument); }
 
 void ImpSdrPdfImport::DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport,
                                 int nPageIndex)
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index b1422157df0e..50d6513be8b0 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -319,6 +319,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/pdf/ResourceDict \
     vcl/source/pdf/Matrix3 \
     vcl/source/pdf/XmpMetadata \
+    vcl/source/pdf/PDFiumLibrary \
     vcl/source/graphic/GraphicID \
     vcl/source/graphic/GraphicLoader \
     vcl/source/graphic/GraphicObject \
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 789b82ae42e6..45eb62921bcb 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -43,6 +43,8 @@
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <unotools/streamwrap.hxx>
 
+#include <vcl/filter/PDFiumLibrary.hxx>
+
 using namespace ::com::sun::star;
 
 static std::ostream& operator<<(std::ostream& rStrm, const Color& rColor)
@@ -87,6 +89,7 @@ class PdfExportTest : public test::BootstrapFixture, public unotest::MacrosTest
     SvMemoryStream maMemory;
     // Export the document as PDF, then parse it with PDFium.
     DocumentHolder exportAndParse(const OUString& rURL, const utl::MediaDescriptor& rDescriptor);
+    std::shared_ptr<vcl::pdf::PDFium> mpPDFium;
 
 public:
     PdfExportTest();
@@ -225,18 +228,11 @@ void PdfExportTest::setUp()
 
     mxDesktop.set(frame::Desktop::create(mxComponentContext));
 
-    FPDF_LIBRARY_CONFIG config;
-    config.version = 2;
-    config.m_pUserFontPaths = nullptr;
-    config.m_pIsolate = nullptr;
-    config.m_v8EmbedderSlot = 0;
-    FPDF_InitLibraryWithConfig(&config);
+    mpPDFium = vcl::pdf::PDFiumLibrary::get();
 }
 
 void PdfExportTest::tearDown()
 {
-    FPDF_DestroyLibrary();
-
     if (mxComponent.is())
         mxComponent->dispose();
 
@@ -2061,14 +2057,6 @@ void PdfExportTest::testPdfImageResourceInlineXObjectRef()
     aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export");
     xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
 
-    // Init pdfium, vcl::ImportPDF() calls FPDF_DestroyLibrary after our setUp().
-    FPDF_LIBRARY_CONFIG config;
-    config.version = 2;
-    config.m_pUserFontPaths = nullptr;
-    config.m_pIsolate = nullptr;
-    config.m_v8EmbedderSlot = 0;
-    FPDF_InitLibraryWithConfig(&config);
-
     // Parse the export result.
     SvFileStream aFile(maTempFile.GetURL(), StreamMode::READ);
     maMemory.WriteStream(aFile);
diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index 1df96ad46e72..2a7e7ce04198 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -21,6 +21,8 @@
 #include <bitmapwriteaccess.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 
+#include <vcl/filter/PDFiumLibrary.hxx>
+
 using namespace com::sun::star;
 
 namespace
@@ -82,12 +84,7 @@ bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream)
     else
     {
         // Downconvert to PDF-1.6.
-        FPDF_LIBRARY_CONFIG aConfig;
-        aConfig.version = 2;
-        aConfig.m_pUserFontPaths = nullptr;
-        aConfig.m_pIsolate = nullptr;
-        aConfig.m_v8EmbedderSlot = 0;
-        FPDF_InitLibraryWithConfig(&aConfig);
+        auto pPdfium = vcl::pdf::PDFiumLibrary::get();
 
         // Read input into a buffer.
         SvMemoryStream aInBuffer;
@@ -108,7 +105,6 @@ bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream)
             return false;
 
         FPDF_CloseDocument(pPdfDocument);
-        FPDF_DestroyLibrary();
 
         aWriter.m_aStream.Seek(STREAM_SEEK_TO_BEGIN);
         rOutStream.WriteStream(aWriter.m_aStream);
@@ -152,12 +148,7 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<Bitmap>& rBi
                         const size_t nFirstPage, int nPages, const double fResolutionDPI)
 {
 #if HAVE_FEATURE_PDFIUM
-    FPDF_LIBRARY_CONFIG aConfig;
-    aConfig.version = 2;
-    aConfig.m_pUserFontPaths = nullptr;
-    aConfig.m_pIsolate = nullptr;
-    aConfig.m_v8EmbedderSlot = 0;
-    FPDF_InitLibraryWithConfig(&aConfig);
+    auto pPdfium = vcl::pdf::PDFiumLibrary::get();
 
     // Load the buffer using pdfium.
     FPDF_DOCUMENT pPdfDocument = FPDF_LoadMemDocument(pBuffer, nSize, /*password=*/nullptr);
@@ -207,7 +198,6 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<Bitmap>& rBi
     }
 
     FPDF_CloseDocument(pPdfDocument);
-    FPDF_DestroyLibrary();
 
     return rBitmaps.size();
 #else
@@ -254,12 +244,7 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<std::pair<Graphic, Si
     auto pGfxLink = std::make_shared<GfxLink>(std::move(pGraphicContent), nGraphicContentSize,
                                               GfxLinkType::NativePdf);
 
-    FPDF_LIBRARY_CONFIG aConfig;
-    aConfig.version = 2;
-    aConfig.m_pUserFontPaths = nullptr;
-    aConfig.m_pIsolate = nullptr;
-    aConfig.m_v8EmbedderSlot = 0;
-    FPDF_InitLibraryWithConfig(&aConfig);
+    auto pPdfium = vcl::pdf::PDFiumLibrary::get();
 
     // Load the buffer using pdfium.
     FPDF_DOCUMENT pPdfDocument
@@ -298,7 +283,6 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<std::pair<Graphic, Si
     }
 
     FPDF_CloseDocument(pPdfDocument);
-    FPDF_DestroyLibrary();
 
     return rGraphics.size();
 #else
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index fc7c9257e1f8..e8f7484320e3 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -10,6 +10,8 @@
 
 #include <vcl/VectorGraphicSearch.hxx>
 
+#include <vcl/filter/PDFiumLibrary.hxx>
+
 #include <sal/config.h>
 
 #include <fpdf_doc.h>
@@ -18,10 +20,12 @@
 class VectorGraphicSearch::Implementation
 {
 public:
+    std::shared_ptr<vcl::pdf::PDFium> mpPDFium;
     FPDF_DOCUMENT mpPdfDocument;
 
     Implementation()
-        : mpPdfDocument(nullptr)
+        : mpPDFium(vcl::pdf::PDFiumLibrary::get())
+        , mpPdfDocument(nullptr)
     {
     }
 
@@ -180,19 +184,12 @@ VectorGraphicSearch::VectorGraphicSearch(Graphic const& rGraphic)
     : mpImplementation(std::make_unique<VectorGraphicSearch::Implementation>())
     , maGraphic(rGraphic)
 {
-    FPDF_LIBRARY_CONFIG aConfig;
-    aConfig.version = 2;
-    aConfig.m_pUserFontPaths = nullptr;
-    aConfig.m_pIsolate = nullptr;
-    aConfig.m_v8EmbedderSlot = 0;
-    FPDF_InitLibraryWithConfig(&aConfig);
 }
 
 VectorGraphicSearch::~VectorGraphicSearch()
 {
     mpSearchContext.reset();
     mpImplementation.reset();
-    FPDF_DestroyLibrary();
 }
 
 bool VectorGraphicSearch::search(OUString const& rSearchString, SearchStartPosition eStartPosition)
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
new file mode 100644
index 000000000000..604807524bf9
--- /dev/null
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <config_features.h>
+
+#if HAVE_FEATURE_PDFIUM
+
+#include <vcl/filter/PDFiumLibrary.hxx>
+#include <fpdf_doc.h>
+
+namespace vcl::pdf
+{
+PDFium::PDFium()
+{
+    FPDF_LIBRARY_CONFIG aConfig;
+    aConfig.version = 2;
+    aConfig.m_pUserFontPaths = nullptr;
+    aConfig.m_pIsolate = nullptr;
+    aConfig.m_v8EmbedderSlot = 0;
+    FPDF_InitLibraryWithConfig(&aConfig);
+}
+
+PDFium::~PDFium() { FPDF_DestroyLibrary(); }
+
+} // end vcl::pdf
+
+#endif // HAVE_FEATURE_PDFIUM
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 44f98fa198d4d5489f1cf2eb2efa8667a1481bf1
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 10:05:17 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:15 2020 +0200

    sd: rename testSearchInMixedObject(2) to more descriptive name
    
    testSearchInMixedObject -> testSearchIn2MixedObjects
    testSearchInMixedObject2 -> testSearchIn6MixedObjects
    
    Change-Id: Ifba20df38fd33bb86b072ba79085d123c914f916

diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index 7786bc1f1dae..ec9f7d95c5da 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -55,8 +55,8 @@ public:
     void testDontSearchInMasterPages();
     void testSearchInPDFNonExisting();
     void testSearchInPDF();
-    void testSearchInMixedObject();
-    void testSearchInMixedObject2();
+    void testSearchIn2MixedObjects();
+    void testSearchIn6MixedObjects();
 
     CPPUNIT_TEST_SUITE(LOKitSearchTest);
     CPPUNIT_TEST(testSearch);
@@ -67,8 +67,8 @@ public:
     CPPUNIT_TEST(testDontSearchInMasterPages);
     CPPUNIT_TEST(testSearchInPDFNonExisting);
     CPPUNIT_TEST(testSearchInPDF);
-    CPPUNIT_TEST(testSearchInMixedObject);
-    CPPUNIT_TEST(testSearchInMixedObject2);
+    CPPUNIT_TEST(testSearchIn2MixedObjects);
+    CPPUNIT_TEST(testSearchIn6MixedObjects);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -332,7 +332,7 @@ void LOKitSearchTest::testSearchInPDF()
 
 // Test searching in document with mixed objects.
 // We have 2 objects: 1. Text Object, 2. Graphic Object with PDF
-void LOKitSearchTest::testSearchInMixedObject()
+void LOKitSearchTest::testSearchIn2MixedObjects()
 {
     SdXImpressDocument* pXImpressDocument = createDoc("MixedTest1.odg");
     sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
@@ -417,7 +417,7 @@ void LOKitSearchTest::testSearchInMixedObject()
 }
 
 // Test searching in document with mixed objects. We have 6 objects.
-void LOKitSearchTest::testSearchInMixedObject2()
+void LOKitSearchTest::testSearchIn6MixedObjects()
 {
     SdXImpressDocument* pXImpressDocument = createDoc("MixedTest2.odg");
     sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
commit d8e3939721c4e43231fd7fac6e6730eb5e972017
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 09:58:26 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:14 2020 +0200

    sd: PDF search - reset mpVectorGraphicSearch at more places
    
    and simplify the case when the search doesn't find a match in
    the vector graphic.
    
    Change-Id: I3e086e8e36f8a578711eed6d4dcca65c0c4c6268

diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 0bea27890a84..bc3a4e8d8821 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1160,6 +1160,7 @@ void SdOutliner::ProvideNextTextObject()
     mbFoundObject = false;
 
     // reset the vector search
+    mpImpl->mbCurrentIsVectorGraphic = false;
     mpImpl->mpVectorGraphicSearch.reset();
 
     mpView->UnmarkAllObj (mpView->GetSdrPageView());
@@ -1195,6 +1196,7 @@ void SdOutliner::ProvideNextTextObject()
             bool bForbiddenPage = comphelper::LibreOfficeKit::isActive() && (maCurrentPosition.mePageKind != PageKind::Standard || maCurrentPosition.meEditMode != EditMode::Page);
 
             mpImpl->mbCurrentIsVectorGraphic = false;
+            mpImpl->mpVectorGraphicSearch.reset();
 
             if (!bForbiddenPage)
             {
@@ -1228,34 +1230,30 @@ void SdOutliner::ProvideNextTextObject()
                     OUString const & rString = mpSearchItem->GetSearchString();
 
                     mpImpl->mpVectorGraphicSearch = std::make_unique<VectorGraphicSearch>(pGraphicObject->GetGraphic());
-                    if (mpImpl->mpVectorGraphicSearch->search(rString))
+
+                    bool bResult = mpImpl->mpVectorGraphicSearch->search(rString);
+                    if (bResult)
+                        bResult = mpImpl->mpVectorGraphicSearch->next();
+
+                    if (bResult)
                     {
-                        bool bResult = mpImpl->mpVectorGraphicSearch->next();
-                        if (bResult)
-                        {
-                            mpObj = SetObject(maCurrentPosition);
+                        mpObj = SetObject(maCurrentPosition);
 
-                            mbStringFound = true;
-                            mbMatchMayExist = true;
-                            mbFoundObject = true;
+                        mbStringFound = true;
+                        mbMatchMayExist = true;
+                        mbFoundObject = true;
 
-                            SdrPageView* pPageView = mpView->GetSdrPageView();
-                            mpView->UnmarkAllObj(pPageView);
+                        SdrPageView* pPageView = mpView->GetSdrPageView();
+                        mpView->UnmarkAllObj(pPageView);
 
-                            std::vector<basegfx::B2DRectangle> aSubSelections;
-                            basegfx::B2DRectangle aSubSelection = getPDFSelection(mpImpl->mpVectorGraphicSearch, mpObj);
-                            if (!aSubSelection.isEmpty())
-                                aSubSelections.push_back(aSubSelection);
+                        std::vector<basegfx::B2DRectangle> aSubSelections;
+                        basegfx::B2DRectangle aSubSelection = getPDFSelection(mpImpl->mpVectorGraphicSearch, mpObj);
+                        if (!aSubSelection.isEmpty())
+                            aSubSelections.push_back(aSubSelection);
 
-                            mpView->MarkObj(mpObj, pPageView, false, false, aSubSelections);
+                        mpView->MarkObj(mpObj, pPageView, false, false, aSubSelections);
 
-                            mpDrawDocument->GetDocSh()->SetWaitCursor( false );
-                        }
-                        else
-                        {
-                            mpImpl->mbCurrentIsVectorGraphic = false;
-                            mpImpl->mpVectorGraphicSearch.reset();
-                        }
+                        mpDrawDocument->GetDocSh()->SetWaitCursor( false );
                     }
                     else
                     {
@@ -1288,6 +1286,9 @@ void SdOutliner::ProvideNextTextObject()
         }
         else
         {
+            mpImpl->mbCurrentIsVectorGraphic = false;
+            mpImpl->mpVectorGraphicSearch.reset();
+
             if (meMode == SEARCH)
                 // Instead of doing a full-blown SetObject(), which would do the same -- but would also possibly switch pages.
                 mbStringFound = false;
commit e832c28d169d011b9c0b9eb7c007422233880d32
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 31 09:51:33 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:14 2020 +0200

    vcl: VectorGraphicSearch - clean-up SearchContext member vars.
    
    Change-Id: I1740be5ed1b47235da3794fa46e3533b17ca1fb8

diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index 76e8c59404a9..fc7c9257e1f8 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -34,26 +34,26 @@ public:
 
 class SearchContext
 {
-public:
-    bool bInitialized = false;
-
+private:
     FPDF_DOCUMENT mpPdfDocument;
-    sal_Int32 mnPageIndex;
     FPDF_PAGE mpPage;
     FPDF_TEXTPAGE mpTextPage;
+    FPDF_SCHHANDLE mpSearchHandle;
+
+public:
+    sal_Int32 mnPageIndex;
     OUString maSearchString;
     SearchStartPosition meStartPosition;
-    FPDF_SCHHANDLE mpSearchHandle;
 
     SearchContext(FPDF_DOCUMENT pPdfDocument, sal_Int32 nPageIndex, OUString const& rSearchString,
                   SearchStartPosition eStartPosition)
         : mpPdfDocument(pPdfDocument)
-        , mnPageIndex(nPageIndex)
         , mpPage(nullptr)
         , mpTextPage(nullptr)
+        , mpSearchHandle(nullptr)
+        , mnPageIndex(nPageIndex)
         , maSearchString(rSearchString)
         , meStartPosition(eStartPosition)
-        , mpSearchHandle(nullptr)
     {
     }
 
commit 0d7812982b5efdf7a967fe71e93b554f429cb45a
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat May 30 19:30:44 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:14 2020 +0200

    sd: Add another test of searching with mixed objects
    
    This is to make sure that we switch between different objects
    during the search correctly.
    
    Change-Id: I18aa5b251cbaadd3a9cb15a04ec1a1e5f267d2e3

diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index 24037a0780ba..7786bc1f1dae 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -56,6 +56,7 @@ public:
     void testSearchInPDFNonExisting();
     void testSearchInPDF();
     void testSearchInMixedObject();
+    void testSearchInMixedObject2();
 
     CPPUNIT_TEST_SUITE(LOKitSearchTest);
     CPPUNIT_TEST(testSearch);
@@ -67,6 +68,7 @@ public:
     CPPUNIT_TEST(testSearchInPDFNonExisting);
     CPPUNIT_TEST(testSearchInPDF);
     CPPUNIT_TEST(testSearchInMixedObject);
+    CPPUNIT_TEST(testSearchInMixedObject2);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -134,6 +136,15 @@ void lcl_search(const OUString& rKey, bool bFindAll = false)
     Scheduler::ProcessEventsToIdle();
 }
 
+SdrObject* lclGetSelectedObject(sd::ViewShell* pViewShell)
+{
+    SdrView* pSdrView = pViewShell->GetView();
+    const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+    CPPUNIT_ASSERT_EQUAL(size_t(1), rMarkList.GetMarkCount());
+    SdrObject* pObject = rMarkList.GetMark(0)->GetMarkedSdrObj();
+    return pObject;
+}
+
 } // end anonymous namespace
 
 void LOKitSearchTest::testSearch()
@@ -319,6 +330,8 @@ void LOKitSearchTest::testSearchInPDF()
                          mpCallbackRecorder->m_aSelection[0]);
 }
 
+// Test searching in document with mixed objects.
+// We have 2 objects: 1. Text Object, 2. Graphic Object with PDF
 void LOKitSearchTest::testSearchInMixedObject()
 {
     SdXImpressDocument* pXImpressDocument = createDoc("MixedTest1.odg");
@@ -334,7 +347,7 @@ void LOKitSearchTest::testSearchInMixedObject()
     SdPage* pPage = pViewShell->GetActualPage();
     CPPUNIT_ASSERT(pPage);
 
-    // Check page hase 2 objects only
+    // Check page has 2 objects only
     CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->GetObjCount());
 
     // Check Object 1
@@ -403,6 +416,170 @@ void LOKitSearchTest::testSearchInMixedObject()
                          mpCallbackRecorder->m_aSearchResultSelection[0]);
 }
 
+// Test searching in document with mixed objects. We have 6 objects.
+void LOKitSearchTest::testSearchInMixedObject2()
+{
+    SdXImpressDocument* pXImpressDocument = createDoc("MixedTest2.odg");
+    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+    CPPUNIT_ASSERT(pViewShell);
+    SdDrawDocument* pDocument = pXImpressDocument->GetDocShell()->GetDoc();
+    CPPUNIT_ASSERT(pDocument);
+    mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase());
+
+    // Check we have one page
+    CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pDocument->GetSdPageCount(PageKind::Standard));
+
+    SdPage* pPage = pViewShell->GetActualPage();
+    CPPUNIT_ASSERT(pPage);
+
+    // Check page has 6 objects only
+    CPPUNIT_ASSERT_EQUAL(size_t(6), pPage->GetObjCount());
+
+    // Check we have the right objects that we expect
+
+    // Check Object 1
+    {
+        SdrObject* pObject = pPage->GetObj(0);
+        CPPUNIT_ASSERT(pObject);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(OBJ_TEXT), pObject->GetObjIdentifier());
+    }
+
+    // Check Object 2
+    {
+        SdrObject* pObject = pPage->GetObj(1);
+        CPPUNIT_ASSERT(pObject);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(OBJ_GRAF), pObject->GetObjIdentifier());
+        SdrGrafObj* pGraphicObject = dynamic_cast<SdrGrafObj*>(pObject);
+        CPPUNIT_ASSERT(pGraphicObject);
+        auto const& pVectorGraphicData = pGraphicObject->GetGraphic().getVectorGraphicData();
+        CPPUNIT_ASSERT(pVectorGraphicData);
+        CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
+                             pVectorGraphicData->getVectorGraphicDataType());
+    }
+
+    // Check Object 3
+    {
+        SdrObject* pObject = pPage->GetObj(2);
+        CPPUNIT_ASSERT(pObject);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(OBJ_CUSTOMSHAPE), pObject->GetObjIdentifier());
+    }
+
+    // Check Object 4
+    {
+        SdrObject* pObject = pPage->GetObj(3);
+        CPPUNIT_ASSERT(pObject);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(OBJ_CUSTOMSHAPE), pObject->GetObjIdentifier());
+    }
+
+    // Check Object 5
+    {
+        SdrObject* pObject = pPage->GetObj(4);
+        CPPUNIT_ASSERT(pObject);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(OBJ_GRAF), pObject->GetObjIdentifier());
+        SdrGrafObj* pGraphicObject = dynamic_cast<SdrGrafObj*>(pObject);
+        CPPUNIT_ASSERT(pGraphicObject);
+        auto const& pVectorGraphicData = pGraphicObject->GetGraphic().getVectorGraphicData();
+        CPPUNIT_ASSERT(pVectorGraphicData);
+        CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Svg,
+                             pVectorGraphicData->getVectorGraphicDataType());
+    }
+
+    // Check Object 6
+    {
+        SdrObject* pObject = pPage->GetObj(5);
+        CPPUNIT_ASSERT(pObject);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(OBJ_GRAF), pObject->GetObjIdentifier());
+        SdrGrafObj* pGraphicObject = dynamic_cast<SdrGrafObj*>(pObject);
+        CPPUNIT_ASSERT(pGraphicObject);
+        auto const& pVectorGraphicData = pGraphicObject->GetGraphic().getVectorGraphicData();
+        CPPUNIT_ASSERT(pVectorGraphicData);
+        CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
+                             pVectorGraphicData->getVectorGraphicDataType());
+    }
+
+    // Search "ABC" which is in all objects (2 times in Object 3)
+
+    // Object 1
+    lcl_search("ABC");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+    CPPUNIT_ASSERT_EQUAL(pPage->GetObj(0), lclGetSelectedObject(pViewShell));
+
+    // Object 2
+    lcl_search("ABC");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+    CPPUNIT_ASSERT_EQUAL(pPage->GetObj(1), lclGetSelectedObject(pViewShell));
+
+    // Object 3
+    lcl_search("ABC");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(3, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+    CPPUNIT_ASSERT_EQUAL(pPage->GetObj(2), lclGetSelectedObject(pViewShell));
+
+    // Object 3 again
+    lcl_search("ABC");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(4, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+    CPPUNIT_ASSERT_EQUAL(pPage->GetObj(2), lclGetSelectedObject(pViewShell));
+
+    // Object 4
+    lcl_search("ABC");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(5, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+    CPPUNIT_ASSERT_EQUAL(pPage->GetObj(3), lclGetSelectedObject(pViewShell));
+
+    // Object 5
+    lcl_search("ABC");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(6, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+    CPPUNIT_ASSERT_EQUAL(pPage->GetObj(4), lclGetSelectedObject(pViewShell));
+
+    // Object 6
+    lcl_search("ABC");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(7, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+    CPPUNIT_ASSERT_EQUAL(pPage->GetObj(5), lclGetSelectedObject(pViewShell));
+
+    // Loop to Object 1 again
+    lcl_search("ABC");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(8, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+    CPPUNIT_ASSERT_EQUAL(pPage->GetObj(0), lclGetSelectedObject(pViewShell));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(LOKitSearchTest);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/qa/unit/tiledrendering/data/MixedTest2.odg b/sd/qa/unit/tiledrendering/data/MixedTest2.odg
new file mode 100644
index 000000000000..2709707c1ba6
Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/MixedTest2.odg differ
commit 035c06ace2a6e4729c00e1f138d1b10c558723f4
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat May 30 15:47:35 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:14 2020 +0200

    sd: fix issue when PDF search doesn't send a search result + test
    
    This fixes the issue when PDF search doesn't send the search
    result, because of premature exit.
    
    Also add test which reproduces this issue and tests the behavior
    of searching in multiple objects.
    
    Change-Id: I3a676eeac36bde88c67e90a49583444b8595a346

diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index 8d8b11e43fa1..24037a0780ba 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -55,6 +55,7 @@ public:
     void testDontSearchInMasterPages();
     void testSearchInPDFNonExisting();
     void testSearchInPDF();
+    void testSearchInMixedObject();
 
     CPPUNIT_TEST_SUITE(LOKitSearchTest);
     CPPUNIT_TEST(testSearch);
@@ -65,6 +66,7 @@ public:
     CPPUNIT_TEST(testDontSearchInMasterPages);
     CPPUNIT_TEST(testSearchInPDFNonExisting);
     CPPUNIT_TEST(testSearchInPDF);
+    CPPUNIT_TEST(testSearchInMixedObject);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -317,6 +319,90 @@ void LOKitSearchTest::testSearchInPDF()
                          mpCallbackRecorder->m_aSelection[0]);
 }
 
+void LOKitSearchTest::testSearchInMixedObject()
+{
+    SdXImpressDocument* pXImpressDocument = createDoc("MixedTest1.odg");
+    sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+    CPPUNIT_ASSERT(pViewShell);
+    SdDrawDocument* pDocument = pXImpressDocument->GetDocShell()->GetDoc();
+    CPPUNIT_ASSERT(pDocument);
+    mpCallbackRecorder->registerCallbacksFor(pViewShell->GetViewShellBase());
+
+    // Check we have one page
+    CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pDocument->GetSdPageCount(PageKind::Standard));
+
+    SdPage* pPage = pViewShell->GetActualPage();
+    CPPUNIT_ASSERT(pPage);
+
+    // Check page hase 2 objects only
+    CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->GetObjCount());
+
+    // Check Object 1
+    {
+        SdrObject* pObject = pPage->GetObj(0);
+        CPPUNIT_ASSERT(pObject);
+
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(OBJ_TEXT), pObject->GetObjIdentifier());
+    }
+
+    // Check Object 2
+    {
+        SdrObject* pObject = pPage->GetObj(1);
+        CPPUNIT_ASSERT(pObject);
+
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(OBJ_GRAF), pObject->GetObjIdentifier());
+
+        SdrGrafObj* pGraphicObject = dynamic_cast<SdrGrafObj*>(pObject);
+        CPPUNIT_ASSERT(pGraphicObject);
+
+        Graphic aGraphic = pGraphicObject->GetGraphic();
+        auto const& pVectorGraphicData = aGraphic.getVectorGraphicData();
+        CPPUNIT_ASSERT(pVectorGraphicData);
+
+        CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
+                             pVectorGraphicData->getVectorGraphicDataType());
+    }
+
+    // Let's try to search now
+
+    lcl_search("ABC");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(OString("3546, 3174, 738, 402"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+
+    // Search next
+
+    lcl_search("ABC");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(OString("8412, 6385, 519, 174"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+
+    // Search next again - we should get the first object again
+
+    lcl_search("ABC");
+
+    CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(3, mpCallbackRecorder->m_nSearchResultCount);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultPart.size());
+
+    CPPUNIT_ASSERT_EQUAL(OString("3546, 3174, 738, 402"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(LOKitSearchTest);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/qa/unit/tiledrendering/data/MixedTest1.odg b/sd/qa/unit/tiledrendering/data/MixedTest1.odg
new file mode 100644
index 000000000000..db952318c735
Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/MixedTest1.odg differ
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 50b2794973be..0bea27890a84 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -872,7 +872,7 @@ bool SdOutliner::SearchAndReplaceOnce(std::vector<sd::SearchSelection>* pSelecti
             {
                 ProvideNextTextObject ();
 
-                if (!mbEndOfSearch)
+                if (!mbEndOfSearch && !mpImpl->mbCurrentIsVectorGraphic)
                 {
                     // Remember the current position as the last one with a
                     // text object.
commit dd0f79c098491a75b4406340728c2b5e64ff602e
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat May 30 13:10:04 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:14 2020 +0200

    sd: improve the test for LOKit search in PDF graphic
    
    Record how many times we het the search result back, so we can
    be sure that the search happend and don't just read the old
    values. Assert the search result selection rectangles and text
    selection rectangles.
    
    Add tools:Rectangle support for CPPUnit into sdmodeltestbase.hxx
    
    Change-Id: I0b22d2d2f66abdc0dd0d5ac13a1bfebaa470749a

diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index 6469eba789fe..a0feaae81912 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -483,6 +483,22 @@ template<> struct assertion_traits<Color>
     }
 };
 
+template<> struct assertion_traits<tools::Rectangle>
+{
+    static bool equal( const tools::Rectangle& r1, const tools::Rectangle& r2 )
+    {
+        return r1 == r2;
+    }
+
+    static std::string toString( const tools::Rectangle& r)
+    {
+        OStringStream ost;
+        ost << "Rect P: [" << long(r.Top()) << ", " << long(r.Left()) << "]"
+            << "S: [" << long(r.GetWidth()) << ", " << long(r.GetHeight()) << "]";
+        return ost.str();
+    }
+};
+
 CPPUNIT_NS_END
 
 #endif
diff --git a/sd/qa/unit/tiledrendering/CallbackRecorder.hxx b/sd/qa/unit/tiledrendering/CallbackRecorder.hxx
index fc5117cce6dc..7e6c8a42d07d 100644
--- a/sd/qa/unit/tiledrendering/CallbackRecorder.hxx
+++ b/sd/qa/unit/tiledrendering/CallbackRecorder.hxx
@@ -51,6 +51,7 @@ struct CallbackRecorder
         , m_nPart(0)
         , m_nSelectionBeforeSearchResult(0)
         , m_nSelectionAfterSearchResult(0)
+        , m_nSearchResultCount(0)
     {
     }
 
@@ -62,6 +63,7 @@ struct CallbackRecorder
     std::vector<int> m_aSearchResultPart;
     int m_nSelectionBeforeSearchResult;
     int m_nSelectionAfterSearchResult;
+    int m_nSearchResultCount;
     /// For document size changed callback.
     osl::Condition m_aDocumentSizeCondition;
 
@@ -115,6 +117,7 @@ struct CallbackRecorder
             break;
             case LOK_CALLBACK_SEARCH_RESULT_SELECTION:
             {
+                m_nSearchResultCount++;
                 m_aSearchResultSelection.clear();
                 m_aSearchResultPart.clear();
                 boost::property_tree::ptree aTree;
diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index 33257f12d4ab..8d8b11e43fa1 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -292,21 +292,29 @@ void LOKitSearchTest::testSearchInPDF()
     CPPUNIT_ASSERT_EQUAL(VectorGraphicDataType::Pdf,
                          pVectorGraphicData->getVectorGraphicDataType());
 
+    // Search
     lcl_search("ABC");
 
     CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(1, mpCallbackRecorder->m_nSearchResultCount);
 
     CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(OString("3763, 1331, 1432, 483"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(3763, 1331), Size(1433, 484)),
+                         mpCallbackRecorder->m_aSelection[0]);
 
-    CPPUNIT_ASSERT_EQUAL(long(3763), mpCallbackRecorder->m_aSelection[0].Left());
-    CPPUNIT_ASSERT_EQUAL(long(1331), mpCallbackRecorder->m_aSelection[0].Top());
-    CPPUNIT_ASSERT_EQUAL(long(1433), mpCallbackRecorder->m_aSelection[0].GetWidth());
-    CPPUNIT_ASSERT_EQUAL(long(484), mpCallbackRecorder->m_aSelection[0].GetHeight());
-
+    // Search again - same result
     lcl_search("ABC");
+
     CPPUNIT_ASSERT_EQUAL(true, mpCallbackRecorder->m_bFound);
+    CPPUNIT_ASSERT_EQUAL(2, mpCallbackRecorder->m_nSearchResultCount);
 
     CPPUNIT_ASSERT_EQUAL(size_t(1), mpCallbackRecorder->m_aSearchResultSelection.size());
+    CPPUNIT_ASSERT_EQUAL(OString("3763, 1331, 1432, 483"),
+                         mpCallbackRecorder->m_aSearchResultSelection[0]);
+    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(3763, 1331), Size(1433, 484)),
+                         mpCallbackRecorder->m_aSelection[0]);
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(LOKitSearchTest);
commit 9fda3a32b29550fa4de45f0eab2bb7a1f74280fe
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri May 29 23:52:50 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Jun 1 23:08:13 2020 +0200

    vcl: add search start position support for VectorGraphicSearch
    
    By default we start at the begin of the page, but with this change
    make it possible to start at the end. This makes it possible to
    search in the backwards direction (set the start position at to
    the end and search with "previous").
    
    Change-Id: I78fb1461b86bf9eab2f91c3b9a81cbb5c6557332

diff --git a/include/vcl/VectorGraphicSearch.hxx b/include/vcl/VectorGraphicSearch.hxx
index a00c212ad61c..b67c63a844d8 100644
--- a/include/vcl/VectorGraphicSearch.hxx
+++ b/include/vcl/VectorGraphicSearch.hxx
@@ -21,6 +21,12 @@
 
 class SearchContext;
 
+enum class SearchStartPosition
+{
+    Begin,
+    End
+};
+
 class VCL_DLLPUBLIC VectorGraphicSearch final
 {
 private:
@@ -29,12 +35,14 @@ private:
     Graphic maGraphic;
     std::unique_ptr<SearchContext> mpSearchContext;
 
-    bool searchPDF(std::shared_ptr<VectorGraphicData> const& rData, OUString const& rSearchString);
+    bool searchPDF(std::shared_ptr<VectorGraphicData> const& rData, OUString const& rSearchString,
+                   SearchStartPosition eStartPosition);
 
 public:
     VectorGraphicSearch(Graphic const& rGraphic);
     ~VectorGraphicSearch();
-    bool search(OUString const& rSearchString);
+    bool search(OUString const& rSearchString,
+                SearchStartPosition eStartPosition = SearchStartPosition::Begin);
     basegfx::B2DSize pageSize();
     bool next();
     bool previous();
diff --git a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
index 7962c23f4e8f..5f65b4ba7e3d 100644
--- a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
+++ b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
@@ -93,32 +93,71 @@ void VectorGraphicSearchTest::testNextPrevious()
     Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream);
     aGraphic.makeAvailable();
 
-    VectorGraphicSearch aSearch(aGraphic);
-    CPPUNIT_ASSERT_EQUAL(true, aSearch.search("lazy"));
+    { // Start from the beginning of the page
+        VectorGraphicSearch aSearch(aGraphic);
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.search("lazy"));
 
-    // next - first match found
-    CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
-    CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+        // no previous - we are at the begin
+        CPPUNIT_ASSERT_EQUAL(false, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(0, aSearch.index()); // nothing was yet found, so it is 0
 
-    // next - second match found
-    CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
-    CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+        // next - first position found
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
 
-    // next - not found, index unchanged
-    CPPUNIT_ASSERT_EQUAL(false, aSearch.next());
-    CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+        // next - second position found
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
 
-    // previous - first match
-    CPPUNIT_ASSERT_EQUAL(true, aSearch.previous());
-    CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+        // next - not found, index unchanged
+        CPPUNIT_ASSERT_EQUAL(false, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
 
-    // previous - not found, index unchanged
-    CPPUNIT_ASSERT_EQUAL(false, aSearch.previous());
-    CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+        // previous - first position
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
 
-    // next - second match found
-    CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
-    CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+        // previous - not found, index unchanged
+        CPPUNIT_ASSERT_EQUAL(false, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+
+        // next - second position found
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+    }
+
+    { // Start from the end of the page
+        VectorGraphicSearch aSearch(aGraphic);
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.search("lazy", SearchStartPosition::End));
+
+        // no next - we are at the end
+        CPPUNIT_ASSERT_EQUAL(false, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(0, aSearch.index()); // nothing was yet found, so it is 0
+
+        // previous - second position found
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+
+        // previous - first position found
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+
+        // previous - not found, index unchanged
+        CPPUNIT_ASSERT_EQUAL(false, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+
+        // next - second position
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+
+        // next - not found, index unchanged
+        CPPUNIT_ASSERT_EQUAL(false, aSearch.next());
+        CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+
+        // previous - first match found
+        CPPUNIT_ASSERT_EQUAL(true, aSearch.previous());
+        CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+    }
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(VectorGraphicSearchTest);
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index dd37c9fc98cf..76e8c59404a9 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -42,14 +42,17 @@ public:
     FPDF_PAGE mpPage;
     FPDF_TEXTPAGE mpTextPage;
     OUString maSearchString;
+    SearchStartPosition meStartPosition;
     FPDF_SCHHANDLE mpSearchHandle;
 
-    SearchContext(FPDF_DOCUMENT pPdfDocument, sal_Int32 nPageIndex, OUString const& rSearchString)
+    SearchContext(FPDF_DOCUMENT pPdfDocument, sal_Int32 nPageIndex, OUString const& rSearchString,
+                  SearchStartPosition eStartPosition)
         : mpPdfDocument(pPdfDocument)
         , mnPageIndex(nPageIndex)
         , mpPage(nullptr)
         , mpTextPage(nullptr)
         , maSearchString(rSearchString)
+        , meStartPosition(eStartPosition)
         , mpSearchHandle(nullptr)
     {
     }
@@ -91,7 +94,17 @@ public:

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list