[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 291 commits - accessibility/source android/mobile-config.py basctl/source basegfx/source basic/source binaryurp/source bin/check-missing-unittests.py canvas/source chart2/qa chart2/source chart2/workbench codemaker/source comphelper/source compilerplugins/clang config_host/config_skia.h.in config_host.mk.in configmgr/qa configmgr/source configure.ac connectivity/source cppuhelper/source cui/inc cui/source cui/uiconfig dbaccess/source desktop/inc desktop/source desktop/test desktop/uiconfig download.lst drawinglayer/CppunitTest_drawinglayer_border.mk drawinglayer/inc drawinglayer/Library_drawinglayercore.mk drawinglayer/Library_drawinglayer.mk drawinglayer/Module_drawinglayer.mk drawinglayer/qa drawinglayer/source dtrans/source dtrans/test editeng/source embedserv/source emfio/CppunitTest_emfio_emf_test.mk emfio/Library_emfio.mk extensions/uiconfig external/box2d external/icu external/Module_external.mk external/skia extras/Custom Target_tplpresnt.mk extras/source filter/Library_pdffilter.mk filter/Library_svgfilter.mk filter/source fpicker/source framework/qa framework/source helpcontent2 i18npool/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_dark_svg icon-themes/breeze_svg icon-themes/colibre icon-themes/colibre_svg icon-themes/elementary icon-themes/elementary_svg icon-themes/sifr icon-themes/sifr_dark icon-themes/sifr_dark_svg icon-themes/sifr_svg icon-themes/sukapura icon-themes/sukapura_svg include/basegfx include/comphelper include/drawinglayer include/editeng include/filter include/jvmfwk include/sax include/sfx2 include/svtools include/svx include/toolkit include/tools include/unotools include/vcl include/xmloff instsetoo_native/CustomTarget_setup.mk instsetoo_native/util jvmfwk/inc jvmfwk/plugins jvmfwk/source librelogo/source Makefile.fetch Makefile.in officecfg/registry oox/source package/source pyuno/source reportdesign/source RepositoryExternal.mk Repository.mk sax/source sc/CppunitTest_sc_ucalc.mk schema/libreoffice schema/odf1.3 sc/Library_sc.mk sc/qa scripting/source sc/sdi sc/source sc/uiconfig sd/CppunitTest_sd_uimpress.mk sd/Library_sd.mk sd/qa sd/sdi sd/source sd/uiconfig sfx2/Library_sfx.mk sfx2/source sfx2/uiconfig solenv/bin solenv/clang-format starmath/inc starmath/source stoc/test svgio/CppunitTest_svgio.mk svgio/Library_svgio.mk svl/source svtools/source svx/CppunitTest_svx_unit.mk svx/inc svx/Library_svxcore.mk svx/Library_svx.mk svx/qa svx/sdi svx/source svx/uiconfig svx/UIConfig_svx.mk sw/CppunitTest_sw_uwriter.mk sw/inc sw/Library_sw.mk sw/Library_swui.mk sw/qa sw/sdi sw/source sw/uiconfig sysui/desktop testtools/source toolkit/inc toolkit/source ucb/source uitest/ui_logger_dsl unotools/source uui/source vcl/CppunitTest_vcl_graphic_test.mk vcl/Executable_fodtfuzzer.mk vcl/Executable_vcldemo.mk vcl/inc vcl/jsdialog vcl/Library_vcl.mk vcl/qa vcl/README.vars vcl/skia vcl/source vcl/uiconfig vcl/unx vcl/win vcl/workben writerfilter/Cppun itTest_writerfilter_dmapper.mk writerfilter/inc writerfilter/qa writerfilter/source xmloff/CppunitTest_xmloff_style.mk xmloff/inc xmloff/Module_xmloff.mk xmloff/qa xmloff/source xmloff/util xmlsecurity/inc xmlsecurity/qa xmlsecurity/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 20 19:31:15 UTC 2020
Rebased ref, commits from common ancestor:
commit d59c34056326312ab05cb19280a6130363f58cae
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed May 20 21:15:59 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:29:22 2020 +0200
vcl: change bitmap::loadFromName to be like BitmapEx const.
Change-Id: Icb055c55b261514a91d76ce2dcb74862152fca56
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx
index 9323bffb8e2a..49fa66d8aba5 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -46,11 +46,20 @@ namespace vcl::bitmap
BitmapEx loadFromName(const OUString& rFileName, const ImageLoadFlags eFlags)
{
+ bool bSuccess;
+ OUString aIconTheme;
BitmapEx aBitmapEx;
+ try
+ {
+ aIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme();
+ ImageTree::get().loadImage(rFileName, aIconTheme, aBitmapEx, true, eFlags);
+ }
+ catch (...)
+ {
+ bSuccess = false;
+ }
- OUString aIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme();
-
- ImageTree::get().loadImage(rFileName, aIconTheme, aBitmapEx, true, eFlags);
+ SAL_WARN_IF(!bSuccess, "vcl", "vcl::bitmap::loadFromName : could not load image " << rFileName << " via icon theme " << aIconTheme);
return aBitmapEx;
}
commit 0166deb315fd7d7de8e092bb009cbff211748aef
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed May 20 21:14:44 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:29:22 2020 +0200
remove commented code
Change-Id: Ief714e8905f9e79da8457bb33ce84b8f6d6bd30e
diff --git a/svx/source/svdraw/svdoutl.cxx b/svx/source/svdraw/svdoutl.cxx
index 62aa7622c825..fed5e1c82f25 100644
--- a/svx/source/svdraw/svdoutl.cxx
+++ b/svx/source/svdraw/svdoutl.cxx
@@ -27,7 +27,6 @@
SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, OutlinerMode nMode )
: Outliner( pItemPool, nMode ),
- //mpPaintInfoRec( NULL )
mpVisualizedPage(nullptr)
{
}
commit c3558e1548279d620917f9a934eed54d43edec35
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed May 20 21:12:19 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:29:21 2020 +0200
sd: FuSearch - prefix member vars
Change-Id: I6048962a5db43b7ff9a9d20398484d7082648840
diff --git a/sd/source/ui/func/fusearch.cxx b/sd/source/ui/func/fusearch.cxx
index 817d357fa25b..9d12624c57bd 100644
--- a/sd/source/ui/func/fusearch.cxx
+++ b/sd/source/ui/func/fusearch.cxx
@@ -52,8 +52,8 @@ FuSearch::FuSearch (
SdDrawDocument* pDoc,
SfxRequest& rReq )
: FuPoor(pViewSh, pWin, pView, pDoc, rReq),
- pSdOutliner(nullptr),
- bOwnOutliner(false)
+ m_pSdOutliner(nullptr),
+ m_bOwnOutliner(false)
{
}
@@ -70,17 +70,17 @@ void FuSearch::DoExecute( SfxRequest& )
if ( dynamic_cast< const DrawViewShell *>( mpViewShell ) != nullptr )
{
- bOwnOutliner = true;
- pSdOutliner = new SdOutliner( mpDoc, OutlinerMode::TextObject );
+ m_bOwnOutliner = true;
+ m_pSdOutliner = new SdOutliner( mpDoc, OutlinerMode::TextObject );
}
else if ( dynamic_cast< const OutlineViewShell *>( mpViewShell ) != nullptr )
{
- bOwnOutliner = false;
- pSdOutliner = mpDoc->GetOutliner();
+ m_bOwnOutliner = false;
+ m_pSdOutliner = mpDoc->GetOutliner();
}
- if (pSdOutliner)
- pSdOutliner->PrepareSpelling();
+ if (m_pSdOutliner)
+ m_pSdOutliner->PrepareSpelling();
}
FuSearch::~FuSearch()
@@ -88,11 +88,11 @@ FuSearch::~FuSearch()
if ( ! mpDocSh->IsInDestruction() && mpDocSh->GetViewShell()!=nullptr)
mpDocSh->GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SidArraySpell );
- if (pSdOutliner)
- pSdOutliner->EndSpelling();
+ if (m_pSdOutliner)
+ m_pSdOutliner->EndSpelling();
- if (bOwnOutliner)
- delete pSdOutliner;
+ if (m_bOwnOutliner)
+ delete m_pSdOutliner;
}
void FuSearch::SearchAndReplace( const SvxSearchItem* pSearchItem )
@@ -105,32 +105,32 @@ void FuSearch::SearchAndReplace( const SvxSearchItem* pSearchItem )
if (pViewShell == nullptr)
return;
- if ( pSdOutliner && dynamic_cast< const DrawViewShell *>( pViewShell ) != nullptr && !bOwnOutliner )
+ if (m_pSdOutliner && dynamic_cast<const DrawViewShell*>(pViewShell) && !m_bOwnOutliner)
{
- pSdOutliner->EndSpelling();
+ m_pSdOutliner->EndSpelling();
- bOwnOutliner = true;
- pSdOutliner = new SdOutliner( mpDoc, OutlinerMode::TextObject );
- pSdOutliner->PrepareSpelling();
+ m_bOwnOutliner = true;
+ m_pSdOutliner = new SdOutliner(mpDoc, OutlinerMode::TextObject);
+ m_pSdOutliner->PrepareSpelling();
}
- else if ( pSdOutliner && dynamic_cast< const OutlineViewShell *>( pViewShell ) != nullptr && bOwnOutliner )
+ else if (m_pSdOutliner && dynamic_cast<const OutlineViewShell*>(pViewShell) && m_bOwnOutliner)
{
- pSdOutliner->EndSpelling();
- delete pSdOutliner;
+ m_pSdOutliner->EndSpelling();
+ delete m_pSdOutliner;
- bOwnOutliner = false;
- pSdOutliner = mpDoc->GetOutliner();
- pSdOutliner->PrepareSpelling();
+ m_bOwnOutliner = false;
+ m_pSdOutliner = mpDoc->GetOutliner();
+ m_pSdOutliner->PrepareSpelling();
}
- if (pSdOutliner)
+ if (m_pSdOutliner)
{
- bool bEndSpelling = pSdOutliner->StartSearchAndReplace(pSearchItem);
+ bool bEndSpelling = m_pSdOutliner->StartSearchAndReplace(pSearchItem);
if (bEndSpelling)
{
- pSdOutliner->EndSpelling();
- pSdOutliner->PrepareSpelling();
+ m_pSdOutliner->EndSpelling();
+ m_pSdOutliner->PrepareSpelling();
}
}
}
diff --git a/sd/source/ui/inc/fusearch.hxx b/sd/source/ui/inc/fusearch.hxx
index 98351a25734b..310e42a5d9f3 100644
--- a/sd/source/ui/inc/fusearch.hxx
+++ b/sd/source/ui/inc/fusearch.hxx
@@ -39,8 +39,8 @@ public:
private:
virtual ~FuSearch() override;
- SdOutliner* pSdOutliner;
- bool bOwnOutliner;
+ SdOutliner* m_pSdOutliner;
+ bool m_bOwnOutliner;
FuSearch (
ViewShell* pViewSh,
commit 40bbd551e2142190a1ab009589b2752c0c85253c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed May 20 10:35:16 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:29:21 2020 +0200
vcl: optimize jpeg files for Exif checking
11kb -> 700b
Change-Id: Idbd1cb84de081975fed71cb6575779c53f958523
diff --git a/vcl/qa/cppunit/data/Exif1.jpg b/vcl/qa/cppunit/data/Exif1.jpg
index e2aace2daafb..a81425e7587f 100644
Binary files a/vcl/qa/cppunit/data/Exif1.jpg and b/vcl/qa/cppunit/data/Exif1.jpg differ
diff --git a/vcl/qa/cppunit/data/Exif1_090CW.jpg b/vcl/qa/cppunit/data/Exif1_090CW.jpg
index dd13dba4c9e0..bb8a81a163f3 100644
Binary files a/vcl/qa/cppunit/data/Exif1_090CW.jpg and b/vcl/qa/cppunit/data/Exif1_090CW.jpg differ
diff --git a/vcl/qa/cppunit/data/Exif1_180.jpg b/vcl/qa/cppunit/data/Exif1_180.jpg
index ba4dfc3796a9..b18b70f1398c 100644
Binary files a/vcl/qa/cppunit/data/Exif1_180.jpg and b/vcl/qa/cppunit/data/Exif1_180.jpg differ
diff --git a/vcl/qa/cppunit/data/Exif1_270CW.jpg b/vcl/qa/cppunit/data/Exif1_270CW.jpg
index 7f7cdfb909bb..f10764114d95 100644
Binary files a/vcl/qa/cppunit/data/Exif1_270CW.jpg and b/vcl/qa/cppunit/data/Exif1_270CW.jpg differ
commit b3cd0d19fdc6f2188855c8e23e3b99987ad3336b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 17 20:32:49 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:29:21 2020 +0200
vcl: VectorGraphicSearch return text rectangles in 100th mm
Change-Id: I12e7ad10dc3ed68d20d94713acece1361da27e81
diff --git a/include/vcl/VectorGraphicSearch.hxx b/include/vcl/VectorGraphicSearch.hxx
index 41c7745d0cf5..5420e161448b 100644
--- a/include/vcl/VectorGraphicSearch.hxx
+++ b/include/vcl/VectorGraphicSearch.hxx
@@ -15,6 +15,7 @@
#include <vcl/dllapi.h>
#include <basegfx/range/b2drectangle.hxx>
+#include <basegfx/vector/b2dsize.hxx>
#include <memory>
@@ -34,6 +35,7 @@ public:
VectorGraphicSearch(Graphic const& rGraphic);
~VectorGraphicSearch();
bool search(OUString const& rSearchString);
+ basegfx::B2DSize pageSize();
bool next();
int index();
std::vector<basegfx::B2DRectangle> getTextRectangles();
diff --git a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
index 112748d23bbe..01022a3fe225 100644
--- a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
+++ b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
@@ -44,28 +44,41 @@ void VectorGraphicSearchTest::test()
CPPUNIT_ASSERT_EQUAL(true, aSearch.search("lazy"));
CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+
+ basegfx::B2DSize aSize = aSearch.pageSize();
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(21590.00, aSize.getX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(27940.00, aSize.getY(), 1E-2);
+
auto aRectangles = aSearch.getTextRectangles();
CPPUNIT_ASSERT_EQUAL(size_t(4), aRectangles.size());
- CPPUNIT_ASSERT_DOUBLES_EQUAL(229.00, aRectangles[0].getMinX(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(231.85, aRectangles[0].getMaxX(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(724.10, aRectangles[0].getMinY(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(732.42, aRectangles[0].getMaxY(), 1E-2);
-
- CPPUNIT_ASSERT_DOUBLES_EQUAL(232.47, aRectangles[1].getMinX(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(237.22, aRectangles[1].getMaxX(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(723.99, aRectangles[1].getMinY(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(729.72, aRectangles[1].getMaxY(), 1E-2);
-
- CPPUNIT_ASSERT_DOUBLES_EQUAL(237.68, aRectangles[2].getMinX(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(242.35, aRectangles[2].getMaxX(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(724.09, aRectangles[2].getMinY(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(729.60, aRectangles[2].getMaxY(), 1E-2);
-
- CPPUNIT_ASSERT_DOUBLES_EQUAL(242.81, aRectangles[3].getMinX(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(248.61, aRectangles[3].getMaxX(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(721.51, aRectangles[3].getMinY(), 1E-2);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(729.60, aRectangles[3].getMaxY(), 1E-2);
+ // Check first and last
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(8078.61, aRectangles[0].getMinX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(8179.36, aRectangles[0].getMaxX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(2101.56, aRectangles[0].getMinY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(2395.36, aRectangles[0].getMaxY(), 1E-2);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(8565.86, aRectangles[3].getMinX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(8770.76, aRectangles[3].getMaxX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(2201.05, aRectangles[3].getMinY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(2486.37, aRectangles[3].getMaxY(), 1E-2);
+
+ CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+ CPPUNIT_ASSERT_EQUAL(817, aSearch.index());
+
+ aRectangles = aSearch.getTextRectangles();
+ CPPUNIT_ASSERT_EQUAL(size_t(4), aRectangles.size());
+
+ // Check first and last
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(6562.23, aRectangles[0].getMinX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(6662.98, aRectangles[0].getMaxX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(5996.23, aRectangles[0].getMinY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(6290.02, aRectangles[0].getMaxY(), 1E-2);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(7049.48, aRectangles[3].getMinX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(7254.38, aRectangles[3].getMaxX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(6095.71, aRectangles[3].getMinY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(6381.04, aRectangles[3].getMaxY(), 1E-2);
}
CPPUNIT_TEST_SUITE_REGISTRATION(VectorGraphicSearchTest);
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index 8e90145cbecb..56c00efa172a 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -64,6 +64,21 @@ public:
FPDF_ClosePage(mpPage);
}
+ basegfx::B2DSize getPageSize()
+ {
+ basegfx::B2DSize aSize;
+ if (!mpPdfDocument)
+ return aSize;
+
+ FS_SIZEF aPDFSize;
+ if (FPDF_GetPageSizeByIndexF(mpPdfDocument, mnPageIndex, &aPDFSize))
+ {
+ aSize = basegfx::B2DSize(convertPointToMm100(aPDFSize.width),
+ convertPointToMm100(aPDFSize.height));
+ }
+ return aSize;
+ }
+
bool initialize()
{
if (!mpPdfDocument)
@@ -117,6 +132,8 @@ public:
if (nSize <= 0)
return aRectangles;
+ double fPageHeight = getPageSize().getY();
+
for (int nCount = 0; nCount < nSize; nCount++)
{
double left = 0.0;
@@ -126,6 +143,11 @@ public:
if (FPDFText_GetCharBox(mpTextPage, nIndex + nCount, &left, &right, &bottom, &top))
{
+ left = convertPointToMm100(left);
+ right = convertPointToMm100(right);
+ top = fPageHeight - convertPointToMm100(top);
+ bottom = fPageHeight - convertPointToMm100(bottom);
+
aRectangles.emplace_back(left, bottom, right, top);
}
}
@@ -207,6 +229,14 @@ bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rD
return mpSearchContext->initialize();
}
+basegfx::B2DSize VectorGraphicSearch::pageSize()
+{
+ basegfx::B2DSize aSize;
+ if (mpSearchContext)
+ aSize = mpSearchContext->getPageSize();
+ return aSize;
+}
+
bool VectorGraphicSearch::next()
{
if (mpSearchContext)
commit bd52df472c9ba38a1afe23f275ddc19ccae51e87
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun May 17 20:12:33 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:29:18 2020 +0200
vcl: add conversion point to 100th mm for double values
Integer conversion throws away percision, which is problematic
when we work with floating point values.
Change-Id: Ib34e46bd59aa67e933d49bc800e96cc6426414e5
diff --git a/include/tools/UnitConversion.hxx b/include/tools/UnitConversion.hxx
index e59077d8a5fa..2093db6181d9 100644
--- a/include/tools/UnitConversion.hxx
+++ b/include/tools/UnitConversion.hxx
@@ -15,13 +15,18 @@ constexpr sal_Int64 convertTwipToMm100(sal_Int64 n)
return (n >= 0) ? (n * 127 + 36) / 72 : (n * 127 - 36) / 72;
}
-constexpr sal_Int64 convertPointToMm100(sal_Int64 n) { return convertTwipToMm100(n * 20); }
-
constexpr sal_Int64 convertMm100ToTwip(sal_Int64 n)
{
return (n >= 0) ? (n * 72 + 63) / 127 : (n * 72 - 63) / 127;
}
+constexpr sal_Int64 convertPointToMm100(sal_Int64 nNumber)
+{
+ return convertTwipToMm100(nNumber * 20);
+}
+
+constexpr double convertPointToMm100(double fNumber) { return fNumber * 35.27777777778; }
+
// Convert PPT's "master unit" (1/576 inch) to twips
constexpr sal_Int64 convertMasterUnitToTwip(sal_Int64 n) { return n * 2540.0 / 576.0; }
commit b36bc3539c98fe290c180d5b11ad702ce00c16fa
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat May 16 19:49:40 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:26:46 2020 +0200
svx: move LOKit specifics out of SetMarkHandles into own method
The SdrMarkView::SetMarkHandles method is too big because it
also hosts the LOKit sending of callbacks, so move that into
it's own method. Would be a good idea to split even more and
move into own class in a future commit.
Change-Id: I7e6389bfa98f22c44863c6eddc840692a7f22605
diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx
index 1f98236fafb5..49d39f06fb8d 100644
--- a/include/svx/svdmrkv.hxx
+++ b/include/svx/svdmrkv.hxx
@@ -141,6 +141,8 @@ private:
SVX_DLLPRIVATE void ImpSetPointsRects() const;
void UndirtyMrkPnt() const;
+ void SetMarkHandlesForLOKit(tools::Rectangle const & rRect, SfxViewShell* pOtherShell);
+
protected:
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
virtual void ModelHasChanged() override; // Is called by the PaintView
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 1de49a696469..3e28a3956391 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -665,6 +665,258 @@ OUString lcl_getDragParameterString( const OUString& rCID )
}
} // anonymous namespace
+void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, SfxViewShell* pOtherShell)
+{
+ SfxViewShell* pViewShell = GetSfxViewShell();
+
+ tools::Rectangle aSelection(rRect);
+ bool bIsChart = false;
+
+ if (!rRect.IsEmpty())
+ {
+ sal_uInt32 nTotalPaintWindows = this->PaintWindowCount();
+ if (nTotalPaintWindows == 1)
+ {
+ const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice());
+ if (pWin && pWin->IsChart())
+ {
+ bIsChart = true;
+ const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj();
+ if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
+ {
+ Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
+ Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
+ aSelection.Move(aLogicOffset.getX(), aLogicOffset.getY());
+ }
+ }
+ }
+ }
+
+ if (!aSelection.IsEmpty())
+ {
+ // In case the map mode is in 100th MM, then need to convert the coordinates over to twips for LOK.
+ if (mpMarkedPV)
+ {
+ if (OutputDevice* pOutputDevice = mpMarkedPV->GetView().GetFirstOutputDevice())
+ {
+ if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
+ aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+ }
+ }
+
+ // hide the text selection too
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "");
+ }
+
+ {
+ OString sSelectionText;
+ boost::property_tree::ptree aTableJsonTree;
+ bool bTableSelection = false;
+
+ if (mpMarkedObj && mpMarkedObj->GetObjIdentifier() == OBJ_TABLE)
+ {
+ auto& rTableObject = dynamic_cast<sdr::table::SdrTableObj&>(*mpMarkedObj);
+ bTableSelection = rTableObject.createTableEdgesJson(aTableJsonTree);
+ }
+ if (GetMarkedObjectCount())
+ {
+ SdrMark* pM = GetSdrMarkByIndex(0);
+ SdrObject* pO = pM->GetMarkedSdrObj();
+ long nRotAngle = pO->GetRotateAngle();
+ // true if we are dealing with a RotGrfFlyFrame
+ // (SwVirtFlyDrawObj with a SwGrfNode)
+ bool bWriterGraphic = pO->HasLimitedRotation();
+
+ if (bWriterGraphic)
+ {
+ nRotAngle *= 10;
+ }
+
+ OStringBuffer aExtraInfo;
+
+ aExtraInfo.append("{\"id\":\"");
+ aExtraInfo.append(OString::number(reinterpret_cast<sal_IntPtr>(pO)));
+ aExtraInfo.append("\",\"type\":");
+ aExtraInfo.append(OString::number(pO->GetObjIdentifier()));
+
+ if (bWriterGraphic)
+ {
+ aExtraInfo.append(", \"isWriterGraphic\": true");
+ }
+ else if (bIsChart)
+ {
+ LokChartHelper aChartHelper(pViewShell);
+ css::uno::Reference<css::frame::XController>& xChartController = aChartHelper.GetXController();
+ css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier( xChartController, uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ {
+ uno::Any aSel = xSelectionSupplier->getSelection();
+ OUString aValue;
+ if (aSel >>= aValue)
+ {
+ OString aObjectCID(aValue.getStr(), aValue.getLength(), osl_getThreadTextEncoding());
+ const std::vector<OString> aProps{"Draggable", "Resizable", "Rotatable"};
+ for (const auto& rProp: aProps)
+ {
+ sal_Int32 nPos = aObjectCID.indexOf(rProp);
+ if (nPos == -1) continue;
+ nPos += rProp.getLength() + 1; // '='
+ if (aExtraInfo.getLength() > 2) // != "{ "
+ aExtraInfo.append(", ");
+ aExtraInfo.append("\"is");
+ aExtraInfo.append(rProp);
+ aExtraInfo.append("\": ");
+ aExtraInfo.append(OString::boolean(aObjectCID[nPos] == '1'));
+ }
+
+ OUString sDragMethod = lcl_getDragMethodServiceName(aValue);
+ if (sDragMethod == "PieSegmentDragging")
+ {
+ // old initial offset inside the CID returned by xSelectionSupplier->getSelection()
+ // after a pie segment dragging; using SdrObject::GetName for getting a CID with the updated offset
+ aValue = pO->GetName();
+ OUString sDragParameters = lcl_getDragParameterString(aValue);
+ if (!sDragParameters.isEmpty())
+ {
+ aExtraInfo.append(", \"dragInfo\": { ");
+ aExtraInfo.append("\"dragMethod\": \"");
+ aExtraInfo.append(sDragMethod.toUtf8());
+ aExtraInfo.append("\"");
+
+ OUString sParam;
+ sal_Int32 nStartIndex = 0;
+ std::array<int, 5> aDragParameters;
+ for (auto& rParam : aDragParameters)
+ {
+ sParam = sDragParameters.getToken(0, ',', nStartIndex);
+ if (sParam.isEmpty())
+ break;
+ rParam = sParam.toInt32();
+ }
+
+ // initial offset in %
+ if (aDragParameters[0] < 0)
+ aDragParameters[0] = 0;
+ else if (aDragParameters[0] > 100)
+ aDragParameters[0] = 100;
+
+ aExtraInfo.append(", \"initialOffset\": ");
+ aExtraInfo.append(OString::number(aDragParameters[0]));
+
+ // drag direction constraint
+ Point aMinPos(aDragParameters[1], aDragParameters[2]);
+ Point aMaxPos(aDragParameters[3], aDragParameters[4]);
+ Point aDragDirection = aMaxPos - aMinPos;
+ aDragDirection = OutputDevice::LogicToLogic(aDragDirection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
+
+ aExtraInfo.append(", \"dragDirection\": [");
+ aExtraInfo.append(aDragDirection.toString());
+ aExtraInfo.append("]");
+
+ // polygon approximating the pie segment or donut segment
+ if (pO->GetObjIdentifier() == OBJ_PATHFILL)
+ {
+ const basegfx::B2DPolyPolygon aPolyPolygon(pO->TakeXorPoly());
+ if (aPolyPolygon.count() == 1)
+ {
+ const basegfx::B2DPolygon aPolygon = aPolyPolygon.getB2DPolygon(0);
+ if (sal_uInt32 nPolySize = aPolygon.count())
+ {
+ const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice());
+ const vcl::Window* pViewShellWindow = pViewShell->GetEditWindowForActiveOLEObj();
+ if (pWin && pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
+ {
+ // in the following code escaping sequences used inside raw literal strings
+ // are for making them understandable by the JSON parser
+
+ Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
+ Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
+ OString sPolygonElem("<polygon points=\\\"");
+ for (sal_uInt32 nIndex = 0; nIndex < nPolySize; ++nIndex)
+ {
+ const basegfx::B2DPoint aB2Point = aPolygon.getB2DPoint(nIndex);
+ Point aPoint(aB2Point.getX(), aB2Point.getY());
+ aPoint.Move(aLogicOffset.getX(), aLogicOffset.getY());
+ if (nIndex > 0)
+ sPolygonElem += " ";
+ sPolygonElem += aPoint.toString();
+ }
+ sPolygonElem += R"elem(\" style=\"stroke: none; fill: rgb(114,159,207); fill-opacity: 0.8\"/>)elem";
+
+ aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
+
+ OString sSVGElem = R"elem(<svg version=\"1.2\" width=\")elem" +
+ OString::number(aSelection.GetWidth() / 100.0) +
+ R"elem(mm\" height=\")elem" +
+ OString::number(aSelection.GetHeight() / 100.0) +
+ R"elem(mm\" viewBox=\")elem" +
+ aSelection.toString() +
+ R"elem(\" preserveAspectRatio=\"xMidYMid\" xmlns=\"http://www.w3.org/2000/svg\">)elem";
+
+ aExtraInfo.append(", \"svg\": \"");
+ aExtraInfo.append(sSVGElem);
+ aExtraInfo.append("\\n ");
+ aExtraInfo.append(sPolygonElem);
+ aExtraInfo.append("\\n</svg>");
+ aExtraInfo.append("\""); // svg
+ }
+ }
+ }
+ }
+ aExtraInfo.append("}"); // dragInfo
+ }
+ }
+ }
+ }
+ }
+ aExtraInfo.append("}");
+
+ sSelectionText = aSelection.toString() +
+ ", " + OString::number(nRotAngle);
+ if (!aExtraInfo.isEmpty())
+ {
+ sSelectionText += ", " + aExtraInfo.makeStringAndClear();
+ }
+ }
+
+ if (sSelectionText.isEmpty())
+ sSelectionText = "EMPTY";
+
+ if (bTableSelection)
+ {
+ boost::property_tree::ptree aTableRectangle;
+ aTableRectangle.put("x", aSelection.Left());
+ aTableRectangle.put("y", aSelection.Top());
+ aTableRectangle.put("width", aSelection.GetWidth());
+ aTableRectangle.put("height", aSelection.GetHeight());
+ aTableJsonTree.push_back(std::make_pair("rectangle", aTableRectangle));
+
+ std::stringstream aStream;
+ boost::property_tree::write_json(aStream, aTableJsonTree);
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, aStream.str().c_str());
+ }
+ else
+ {
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, "{}");
+ }
+
+ if (pOtherShell)
+ {
+ // Another shell wants to know about our existing
+ // selection.
+ if (pViewShell != pOtherShell)
+ SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelectionText);
+ }
+ else
+ {
+ // We have a new selection, so both pViewShell and the
+ // other views want to know about it.
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelectionText.getStr());
+ SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelectionText);
+ }
+ }
+}
+
void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
{
// remember old focus handle values to search for it again
@@ -774,252 +1026,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
if (bTiledRendering && pViewShell)
{
- tools::Rectangle aSelection(aRect);
- bool bIsChart = false;
-
- if (!aRect.IsEmpty())
- {
- sal_uInt32 nTotalPaintWindows = this->PaintWindowCount();
- if (nTotalPaintWindows == 1)
- {
- const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice());
- if (pWin && pWin->IsChart())
- {
- bIsChart = true;
- const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj();
- if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
- {
- Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
- Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
- aSelection.Move(aLogicOffset.getX(), aLogicOffset.getY());
- }
- }
- }
- }
-
- if (!aSelection.IsEmpty())
- {
- // In case the map mode is in 100th MM, then need to convert the coordinates over to twips for LOK.
- if (mpMarkedPV)
- {
- if (OutputDevice* pOutputDevice = mpMarkedPV->GetView().GetFirstOutputDevice())
- {
- if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
- }
- }
-
- // hide the text selection too
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "");
- }
-
- {
- OString sSelectionText;
- boost::property_tree::ptree aTableJsonTree;
- bool bTableSelection = false;
-
- if (mpMarkedObj && mpMarkedObj->GetObjIdentifier() == OBJ_TABLE)
- {
- auto& rTableObject = dynamic_cast<sdr::table::SdrTableObj&>(*mpMarkedObj);
- bTableSelection = rTableObject.createTableEdgesJson(aTableJsonTree);
- }
- if (GetMarkedObjectCount())
- {
- SdrMark* pM = GetSdrMarkByIndex(0);
- SdrObject* pO = pM->GetMarkedSdrObj();
- long nRotAngle = pO->GetRotateAngle();
- // true if we are dealing with a RotGrfFlyFrame
- // (SwVirtFlyDrawObj with a SwGrfNode)
- bool bWriterGraphic = pO->HasLimitedRotation();
-
- if (bWriterGraphic)
- {
- nRotAngle *= 10;
- }
-
- OStringBuffer aExtraInfo;
-
- aExtraInfo.append("{\"id\":\"");
- aExtraInfo.append(OString::number(reinterpret_cast<sal_IntPtr>(pO)));
- aExtraInfo.append("\",\"type\":");
- aExtraInfo.append(OString::number(pO->GetObjIdentifier()));
-
- if (bWriterGraphic)
- {
- aExtraInfo.append(", \"isWriterGraphic\": true");
- }
- else if (bIsChart)
- {
- LokChartHelper aChartHelper(pViewShell);
- css::uno::Reference<css::frame::XController>& xChartController = aChartHelper.GetXController();
- css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier( xChartController, uno::UNO_QUERY);
- if (xSelectionSupplier.is())
- {
- uno::Any aSel = xSelectionSupplier->getSelection();
- OUString aValue;
- if (aSel >>= aValue)
- {
- OString aObjectCID(aValue.getStr(), aValue.getLength(), osl_getThreadTextEncoding());
- const std::vector<OString> aProps{"Draggable", "Resizable", "Rotatable"};
- for (const auto& rProp: aProps)
- {
- sal_Int32 nPos = aObjectCID.indexOf(rProp);
- if (nPos == -1) continue;
- nPos += rProp.getLength() + 1; // '='
- if (aExtraInfo.getLength() > 2) // != "{ "
- aExtraInfo.append(", ");
- aExtraInfo.append("\"is");
- aExtraInfo.append(rProp);
- aExtraInfo.append("\": ");
- aExtraInfo.append(OString::boolean(aObjectCID[nPos] == '1'));
- }
-
- OUString sDragMethod = lcl_getDragMethodServiceName(aValue);
- if (sDragMethod == "PieSegmentDragging")
- {
- // old initial offset inside the CID returned by xSelectionSupplier->getSelection()
- // after a pie segment dragging; using SdrObject::GetName for getting a CID with the updated offset
- aValue = pO->GetName();
- OUString sDragParameters = lcl_getDragParameterString(aValue);
- if (!sDragParameters.isEmpty())
- {
- aExtraInfo.append(", \"dragInfo\": { ");
- aExtraInfo.append("\"dragMethod\": \"");
- aExtraInfo.append(sDragMethod.toUtf8());
- aExtraInfo.append("\"");
-
- OUString sParam;
- sal_Int32 nStartIndex = 0;
- std::array<int, 5> aDragParameters;
- for (auto& rParam : aDragParameters)
- {
- sParam = sDragParameters.getToken(0, ',', nStartIndex);
- if (sParam.isEmpty())
- break;
- rParam = sParam.toInt32();
- }
-
- // initial offset in %
- if (aDragParameters[0] < 0)
- aDragParameters[0] = 0;
- else if (aDragParameters[0] > 100)
- aDragParameters[0] = 100;
-
- aExtraInfo.append(", \"initialOffset\": ");
- aExtraInfo.append(OString::number(aDragParameters[0]));
-
- // drag direction constraint
- Point aMinPos(aDragParameters[1], aDragParameters[2]);
- Point aMaxPos(aDragParameters[3], aDragParameters[4]);
- Point aDragDirection = aMaxPos - aMinPos;
- aDragDirection = OutputDevice::LogicToLogic(aDragDirection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
-
- aExtraInfo.append(", \"dragDirection\": [");
- aExtraInfo.append(aDragDirection.toString());
- aExtraInfo.append("]");
-
- // polygon approximating the pie segment or donut segment
- if (pO->GetObjIdentifier() == OBJ_PATHFILL)
- {
- const basegfx::B2DPolyPolygon aPolyPolygon(pO->TakeXorPoly());
- if (aPolyPolygon.count() == 1)
- {
- const basegfx::B2DPolygon aPolygon = aPolyPolygon.getB2DPolygon(0);
- if (sal_uInt32 nPolySize = aPolygon.count())
- {
- const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice());
- const vcl::Window* pViewShellWindow = pViewShell->GetEditWindowForActiveOLEObj();
- if (pWin && pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
- {
- // in the following code escaping sequences used inside raw literal strings
- // are for making them understandable by the JSON parser
-
- Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
- Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
- OString sPolygonElem("<polygon points=\\\"");
- for (sal_uInt32 nIndex = 0; nIndex < nPolySize; ++nIndex)
- {
- const basegfx::B2DPoint aB2Point = aPolygon.getB2DPoint(nIndex);
- Point aPoint(aB2Point.getX(), aB2Point.getY());
- aPoint.Move(aLogicOffset.getX(), aLogicOffset.getY());
- if (nIndex > 0)
- sPolygonElem += " ";
- sPolygonElem += aPoint.toString();
- }
- sPolygonElem += R"elem(\" style=\"stroke: none; fill: rgb(114,159,207); fill-opacity: 0.8\"/>)elem";
-
- aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM));
-
- OString sSVGElem = R"elem(<svg version=\"1.2\" width=\")elem" +
- OString::number(aSelection.GetWidth() / 100.0) +
- R"elem(mm\" height=\")elem" +
- OString::number(aSelection.GetHeight() / 100.0) +
- R"elem(mm\" viewBox=\")elem" +
- aSelection.toString() +
- R"elem(\" preserveAspectRatio=\"xMidYMid\" xmlns=\"http://www.w3.org/2000/svg\">)elem";
-
- aExtraInfo.append(", \"svg\": \"");
- aExtraInfo.append(sSVGElem);
- aExtraInfo.append("\\n ");
- aExtraInfo.append(sPolygonElem);
- aExtraInfo.append("\\n</svg>");
- aExtraInfo.append("\""); // svg
- }
- }
- }
- }
- aExtraInfo.append("}"); // dragInfo
- }
- }
- }
- }
- }
- aExtraInfo.append("}");
-
- sSelectionText = aSelection.toString() +
- ", " + OString::number(nRotAngle);
- if (!aExtraInfo.isEmpty())
- {
- sSelectionText += ", " + aExtraInfo.makeStringAndClear();
- }
- }
-
- if (sSelectionText.isEmpty())
- sSelectionText = "EMPTY";
-
- if (bTableSelection)
- {
- boost::property_tree::ptree aTableRectangle;
- aTableRectangle.put("x", aSelection.Left());
- aTableRectangle.put("y", aSelection.Top());
- aTableRectangle.put("width", aSelection.GetWidth());
- aTableRectangle.put("height", aSelection.GetHeight());
- aTableJsonTree.push_back(std::make_pair("rectangle", aTableRectangle));
-
- std::stringstream aStream;
- boost::property_tree::write_json(aStream, aTableJsonTree);
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, aStream.str().c_str());
- }
- else
- {
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TABLE_SELECTED, "{}");
- }
-
- if (pOtherShell)
- {
- // Another shell wants to know about our existing
- // selection.
- if (pViewShell != pOtherShell)
- SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelectionText);
- }
- else
- {
- // We have a new selection, so both pViewShell and the
- // other views want to know about it.
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelectionText.getStr());
- SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelectionText);
- }
- }
+ SetMarkHandlesForLOKit(aRect, pOtherShell);
}
if (bFrmHdl)
commit 26f19cc4e7a8a838263cee412b0a1bc7a9351889
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat May 16 19:45:41 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:26:45 2020 +0200
vcl: VectorGraphicSearch - add search result selection rectangles
Change-Id: Ia0c5610f600719bcfb5de503f3876fc896cb630a
diff --git a/include/vcl/VectorGraphicSearch.hxx b/include/vcl/VectorGraphicSearch.hxx
index 6c2589db1d01..41c7745d0cf5 100644
--- a/include/vcl/VectorGraphicSearch.hxx
+++ b/include/vcl/VectorGraphicSearch.hxx
@@ -14,6 +14,8 @@
#include <vcl/vectorgraphicdata.hxx>
#include <vcl/dllapi.h>
+#include <basegfx/range/b2drectangle.hxx>
+
#include <memory>
class SearchContext;
@@ -34,6 +36,7 @@ public:
bool search(OUString const& rSearchString);
bool next();
int index();
+ std::vector<basegfx::B2DRectangle> getTextRectangles();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
index 0ed21ccf9e26..112748d23bbe 100644
--- a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
+++ b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
@@ -9,6 +9,7 @@
#include <cppunit/TestAssert.h>
#include <cppunit/extensions/HelperMacros.h>
+
#include <unotest/bootstrapfixturebase.hxx>
#include <unotest/directories.hxx>
@@ -43,6 +44,28 @@ void VectorGraphicSearchTest::test()
CPPUNIT_ASSERT_EQUAL(true, aSearch.search("lazy"));
CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+ auto aRectangles = aSearch.getTextRectangles();
+ CPPUNIT_ASSERT_EQUAL(size_t(4), aRectangles.size());
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(229.00, aRectangles[0].getMinX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(231.85, aRectangles[0].getMaxX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(724.10, aRectangles[0].getMinY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(732.42, aRectangles[0].getMaxY(), 1E-2);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(232.47, aRectangles[1].getMinX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(237.22, aRectangles[1].getMaxX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(723.99, aRectangles[1].getMinY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(729.72, aRectangles[1].getMaxY(), 1E-2);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(237.68, aRectangles[2].getMinX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(242.35, aRectangles[2].getMaxX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(724.09, aRectangles[2].getMinY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(729.60, aRectangles[2].getMaxY(), 1E-2);
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(242.81, aRectangles[3].getMinX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(248.61, aRectangles[3].getMaxX(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(721.51, aRectangles[3].getMinY(), 1E-2);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(729.60, aRectangles[3].getMaxY(), 1E-2);
}
CPPUNIT_TEST_SUITE_REGISTRATION(VectorGraphicSearchTest);
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index 34ac0abd6654..8e90145cbecb 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -8,9 +8,10 @@
*
*/
-#include <sal/config.h>
#include <vcl/VectorGraphicSearch.hxx>
+#include <sal/config.h>
+
#include <fpdf_doc.h>
#include <fpdf_text.h>
@@ -93,6 +94,44 @@ public:
return FPDFText_GetSchResultIndex(mpSearchHandle);
return -1;
}
+
+ int size()
+ {
+ if (mpSearchHandle)
+ return FPDFText_GetSchCount(mpSearchHandle);
+ return -1;
+ }
+
+ std::vector<basegfx::B2DRectangle> getTextRectangles()
+ {
+ std::vector<basegfx::B2DRectangle> aRectangles;
+
+ if (!mpTextPage || !mpSearchHandle)
+ return aRectangles;
+
+ int nIndex = index();
+ if (nIndex < 0)
+ return aRectangles;
+
+ int nSize = size();
+ if (nSize <= 0)
+ return aRectangles;
+
+ for (int nCount = 0; nCount < nSize; nCount++)
+ {
+ double left = 0.0;
+ double right = 0.0;
+ double bottom = 0.0;
+ double top = 0.0;
+
+ if (FPDFText_GetCharBox(mpTextPage, nIndex + nCount, &left, &right, &bottom, &top))
+ {
+ aRectangles.emplace_back(left, bottom, right, top);
+ }
+ }
+
+ return aRectangles;
+ }
};
VectorGraphicSearch::VectorGraphicSearch(Graphic const& rGraphic)
@@ -182,4 +221,12 @@ int VectorGraphicSearch::index()
return -1;
}
+std::vector<basegfx::B2DRectangle> VectorGraphicSearch::getTextRectangles()
+{
+ if (mpSearchContext)
+ return mpSearchContext->getTextRectangles();
+
+ return std::vector<basegfx::B2DRectangle>();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d7e54c28d492dffc1f86a9f44af775e1953052df
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri May 15 12:20:42 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:26:45 2020 +0200
vcl: Add internal "Implementation" class for VectorGraphicSearch
We need to hide includes (needed for members) of PDFium inside
from the outside, so not everyone using the VectorGraphicSearch
needs to depend on PDFium too.
Change-Id: I95e46c714758b130594d78a4618af7350e29a075
diff --git a/include/vcl/VectorGraphicSearch.hxx b/include/vcl/VectorGraphicSearch.hxx
index 3411d0a931e6..6c2589db1d01 100644
--- a/include/vcl/VectorGraphicSearch.hxx
+++ b/include/vcl/VectorGraphicSearch.hxx
@@ -14,8 +14,6 @@
#include <vcl/vectorgraphicdata.hxx>
#include <vcl/dllapi.h>
-#include <fpdf_doc.h>
-
#include <memory>
class SearchContext;
@@ -23,9 +21,11 @@ class SearchContext;
class VCL_DLLPUBLIC VectorGraphicSearch final
{
private:
+ class Implementation;
+ std::unique_ptr<Implementation> mpImplementation;
Graphic maGraphic;
- FPDF_DOCUMENT mpPdfDocument;
std::unique_ptr<SearchContext> mpSearchContext;
+
bool searchPDF(std::shared_ptr<VectorGraphicData> const& rData, OUString const& rSearchString);
public:
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index 864c65f2dda2..34ac0abd6654 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -11,8 +11,26 @@
#include <sal/config.h>
#include <vcl/VectorGraphicSearch.hxx>
+#include <fpdf_doc.h>
#include <fpdf_text.h>
+class VectorGraphicSearch::Implementation
+{
+public:
+ FPDF_DOCUMENT mpPdfDocument;
+
+ Implementation()
+ : mpPdfDocument(nullptr)
+ {
+ }
+
+ ~Implementation()
+ {
+ if (mpPdfDocument)
+ FPDF_CloseDocument(mpPdfDocument);
+ }
+};
+
class SearchContext
{
public:
@@ -78,8 +96,8 @@ public:
};
VectorGraphicSearch::VectorGraphicSearch(Graphic const& rGraphic)
- : maGraphic(rGraphic)
- , mpPdfDocument(nullptr)
+ : mpImplementation(std::make_unique<VectorGraphicSearch::Implementation>())
+ , maGraphic(rGraphic)
{
FPDF_LIBRARY_CONFIG aConfig;
aConfig.version = 2;
@@ -92,9 +110,7 @@ VectorGraphicSearch::VectorGraphicSearch(Graphic const& rGraphic)
VectorGraphicSearch::~VectorGraphicSearch()
{
mpSearchContext.reset();
-
- if (mpPdfDocument)
- FPDF_CloseDocument(mpPdfDocument);
+ mpImplementation.reset();
FPDF_DestroyLibrary();
}
@@ -115,11 +131,11 @@ bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rD
if (rSearchString.isEmpty())
return false;
- mpPdfDocument
+ mpImplementation->mpPdfDocument
= FPDF_LoadMemDocument(rData->getVectorGraphicDataArray().getConstArray(),
rData->getVectorGraphicDataArrayLength(), /*password=*/nullptr);
- if (!mpPdfDocument)
+ if (!mpImplementation->mpPdfDocument)
{
//TODO: Handle failure to load.
switch (FPDF_GetLastError())
@@ -146,7 +162,8 @@ bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rD
sal_Int32 nPageIndex = std::max(rData->getPageIndex(), 0);
- mpSearchContext.reset(new SearchContext(mpPdfDocument, nPageIndex, rSearchString));
+ mpSearchContext.reset(
+ new SearchContext(mpImplementation->mpPdfDocument, nPageIndex, rSearchString));
return mpSearchContext->initialize();
}
commit 7b7bfe2a9de68a00b02700801f821a0dea1ff52d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri May 8 22:28:35 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:26:45 2020 +0200
Move some basic primitives to drawinglayer CORE
Mostly which are easy to move and used in VclProcessor2D
Change-Id: Ie1559e13a2a7cdb5225421def2f9145026ff9121
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index 814fff713ae1..a9d70da2aa84 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -50,11 +50,6 @@ $(eval $(call gb_Library_use_libraries,drawinglayer,\
$(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/animation/animationtiming \
drawinglayer/source/attribute/fillgraphicattribute \
- drawinglayer/source/attribute/fillgradientattribute \
- drawinglayer/source/attribute/fillhatchattribute \
- drawinglayer/source/attribute/fontattribute \
- drawinglayer/source/attribute/lineattribute \
- drawinglayer/source/attribute/linestartendattribute \
drawinglayer/source/attribute/materialattribute3d \
drawinglayer/source/attribute/sdrallattribute3d \
drawinglayer/source/attribute/sdrfillattribute \
@@ -67,11 +62,9 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/attribute/sdrobjectattribute3d \
drawinglayer/source/attribute/sdrsceneattribute3d \
drawinglayer/source/attribute/sdrshadowattribute \
- drawinglayer/source/attribute/strokeattribute \
drawinglayer/source/geometry/viewinformation3d \
drawinglayer/source/primitive2d/animatedprimitive2d \
drawinglayer/source/primitive2d/backgroundcolorprimitive2d \
- drawinglayer/source/primitive2d/bitmapprimitive2d \
drawinglayer/source/primitive2d/borderlineprimitive2d \
drawinglayer/source/primitive2d/controlprimitive2d \
drawinglayer/source/primitive2d/cropprimitive2d \
@@ -80,54 +73,32 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/primitive2d/embedded3dprimitive2d \
drawinglayer/source/primitive2d/epsprimitive2d \
drawinglayer/source/primitive2d/fillgraphicprimitive2d \
- drawinglayer/source/primitive2d/fillgradientprimitive2d \
- drawinglayer/source/primitive2d/fillhatchprimitive2d \
drawinglayer/source/primitive2d/glowprimitive2d \
drawinglayer/source/primitive2d/graphicprimitivehelper2d \
drawinglayer/source/primitive2d/graphicprimitive2d \
drawinglayer/source/primitive2d/gridprimitive2d \
- drawinglayer/source/primitive2d/groupprimitive2d \
drawinglayer/source/primitive2d/helplineprimitive2d \
drawinglayer/source/primitive2d/hiddengeometryprimitive2d \
drawinglayer/source/primitive2d/invertprimitive2d \
drawinglayer/source/primitive2d/markerarrayprimitive2d \
- drawinglayer/source/primitive2d/maskprimitive2d \
drawinglayer/source/primitive2d/mediaprimitive2d \
drawinglayer/source/primitive2d/metafileprimitive2d \
- drawinglayer/source/primitive2d/modifiedcolorprimitive2d \
- drawinglayer/source/primitive2d/objectinfoprimitive2d \
drawinglayer/source/primitive2d/pagehierarchyprimitive2d \
- drawinglayer/source/primitive2d/pagepreviewprimitive2d \
drawinglayer/source/primitive2d/patternfillprimitive2d \
- drawinglayer/source/primitive2d/pointarrayprimitive2d \
- drawinglayer/source/primitive2d/polygonprimitive2d \
- drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D \
- drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D \
- drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D \
- drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D \
- drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D \
- drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D \
drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D \
- drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D \
- drawinglayer/source/primitive2d/primitivetools2d \
drawinglayer/source/primitive2d/sceneprimitive2d \
drawinglayer/source/primitive2d/sdrdecompositiontools2d \
drawinglayer/source/primitive2d/shadowprimitive2d \
drawinglayer/source/primitive2d/softedgeprimitive2d \
drawinglayer/source/primitive2d/structuretagprimitive2d \
- drawinglayer/source/primitive2d/svggradientprimitive2d \
drawinglayer/source/primitive2d/textbreakuphelper \
drawinglayer/source/primitive2d/textdecoratedprimitive2d \
drawinglayer/source/primitive2d/texteffectprimitive2d \
- drawinglayer/source/primitive2d/textenumsprimitive2d \
drawinglayer/source/primitive2d/texthierarchyprimitive2d \
drawinglayer/source/primitive2d/textlayoutdevice \
drawinglayer/source/primitive2d/textlineprimitive2d \
drawinglayer/source/primitive2d/textprimitive2d \
drawinglayer/source/primitive2d/textstrikeoutprimitive2d \
- drawinglayer/source/primitive2d/transformprimitive2d \
- drawinglayer/source/primitive2d/transparenceprimitive2d \
- drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d \
drawinglayer/source/primitive2d/wallpaperprimitive2d \
drawinglayer/source/primitive2d/wrongspellprimitive2d \
drawinglayer/source/primitive3d/baseprimitive3d \
@@ -186,7 +157,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/tools/primitive2dxmldump \
drawinglayer/source/drawinglayeruno/drawinglayeruno \
drawinglayer/source/drawinglayeruno/xprimitive2drenderer \
- drawinglayer/source/texture/texture \
drawinglayer/source/dumper/XShapeDumper \
drawinglayer/source/dumper/EnhancedShapeDumper \
))
diff --git a/drawinglayer/Library_drawinglayercore.mk b/drawinglayer/Library_drawinglayercore.mk
index f1643d27014d..972ac32f5388 100644
--- a/drawinglayer/Library_drawinglayercore.mk
+++ b/drawinglayer/Library_drawinglayercore.mk
@@ -40,10 +40,47 @@ $(eval $(call gb_Library_use_libraries,drawinglayercore,\
))
$(eval $(call gb_Library_add_exception_objects,drawinglayercore,\
+ drawinglayer/source/attribute/lineattribute \
+ drawinglayer/source/attribute/strokeattribute \
+ drawinglayer/source/attribute/linestartendattribute \
+ drawinglayer/source/attribute/fillgradientattribute \
+ drawinglayer/source/attribute/fillhatchattribute \
+ drawinglayer/source/attribute/fontattribute \
+ drawinglayer/source/geometry/viewinformation2d \
+ drawinglayer/source/texture/texture \
drawinglayer/source/primitive2d/baseprimitive2d \
drawinglayer/source/primitive2d/Primitive2DContainer \
drawinglayer/source/primitive2d/Tools \
- drawinglayer/source/geometry/viewinformation2d \
+ drawinglayer/source/primitive2d/polygonprimitive2d \
+ drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D \
+ drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D \
+ drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D \
+ drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D \
+ drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D \
+ drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D \
+ drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D \
+ drawinglayer/source/primitive2d/fillgradientprimitive2d \
+ drawinglayer/source/primitive2d/maskprimitive2d \
+ drawinglayer/source/primitive2d/groupprimitive2d \
+ drawinglayer/source/primitive2d/fillhatchprimitive2d \
+ drawinglayer/source/primitive2d/primitivetools2d \
+ drawinglayer/source/primitive2d/pointarrayprimitive2d \
+ drawinglayer/source/primitive2d/modifiedcolorprimitive2d \
+ drawinglayer/source/primitive2d/bitmapprimitive2d \
+ drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d \
+ drawinglayer/source/primitive2d/transparenceprimitive2d \
+ drawinglayer/source/primitive2d/pagepreviewprimitive2d \
+ drawinglayer/source/primitive2d/transformprimitive2d \
+ drawinglayer/source/primitive2d/svggradientprimitive2d \
+ drawinglayer/source/primitive2d/objectinfoprimitive2d \
+ drawinglayer/source/primitive2d/textenumsprimitive2d \
))
+# drawinglayer/source/primitive2d/epsprimitive2d \
+# drawinglayer/source/primitive2d/markerarrayprimitive2d \
+# drawinglayer/source/primitive2d/fillgraphicprimitive2d \
+# drawinglayer/source/primitive2d/textdecoratedprimitive2d \
+# drawinglayer/source/primitive2d/textprimitive2d \
+
+
# vim: set noet sw=4 ts=4:
diff --git a/filter/Library_pdffilter.mk b/filter/Library_pdffilter.mk
index 9694490655de..9320e3648724 100644
--- a/filter/Library_pdffilter.mk
+++ b/filter/Library_pdffilter.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_Library_use_libraries,pdffilter,\
cppuhelper \
cppu \
sal \
+ drawinglayercore \
drawinglayer \
))
commit f2a3364d6bf0ae373a2e5cc4a8c71a212eac6e96
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri May 8 20:50:29 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:26:44 2020 +0200
drawinglayer: externalize PointArrayPrimitive2D class
Change-Id: I8ee993947bf2f4437cf3a429c43a81132fac0947
diff --git a/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx b/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx
index 613b8969828d..682132218411 100644
--- a/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx
@@ -39,7 +39,7 @@ namespace drawinglayer::primitive2d
should process it (Currently it is only used for grid visualisation,
but this may change).
*/
- class PointArrayPrimitive2D final : public BasePrimitive2D
+ class DRAWINGLAYER_DLLPUBLIC PointArrayPrimitive2D final : public BasePrimitive2D
{
private:
/// the array of positions
commit d5d9f940a64feff8e3a999962277f8299dfc5d44
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri May 8 20:43:38 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:26:44 2020 +0200
drawinglayer: externalize classes in texture.hxx
Change-Id: I1e49a6c896733ebebf16db23f3c2f8b06161d659
diff --git a/drawinglayer/inc/texture/texture.hxx b/drawinglayer/inc/texture/texture.hxx
index 24e23a4b241c..b34bde38d1bc 100644
--- a/drawinglayer/inc/texture/texture.hxx
+++ b/drawinglayer/inc/texture/texture.hxx
@@ -30,7 +30,7 @@
namespace drawinglayer::texture
{
- class GeoTexSvx
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvx
{
public:
GeoTexSvx();
@@ -53,7 +53,7 @@ namespace drawinglayer::texture
basegfx::BColor maBColor;
};
- class GeoTexSvxGradient : public GeoTexSvx
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradient : public GeoTexSvx
{
protected:
basegfx::ODFGradientInfo maGradientInfo;
@@ -79,7 +79,7 @@ namespace drawinglayer::texture
basegfx::BColor& rOuterColor) = 0;
};
- class GeoTexSvxGradientLinear final : public GeoTexSvxGradient
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientLinear final : public GeoTexSvxGradient
{
double mfUnitMinX;
double mfUnitWidth;
@@ -102,7 +102,7 @@ namespace drawinglayer::texture
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override;
};
- class GeoTexSvxGradientAxial final : public GeoTexSvxGradient
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientAxial final : public GeoTexSvxGradient
{
double mfUnitMinX;
double mfUnitWidth;
@@ -124,7 +124,7 @@ namespace drawinglayer::texture
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override;
};
- class GeoTexSvxGradientRadial final : public GeoTexSvxGradient
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRadial final : public GeoTexSvxGradient
{
public:
GeoTexSvxGradientRadial(
@@ -143,7 +143,7 @@ namespace drawinglayer::texture
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override;
};
- class GeoTexSvxGradientElliptical final : public GeoTexSvxGradient
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientElliptical final : public GeoTexSvxGradient
{
public:
GeoTexSvxGradientElliptical(
@@ -163,7 +163,7 @@ namespace drawinglayer::texture
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override;
};
- class GeoTexSvxGradientSquare final : public GeoTexSvxGradient
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientSquare final : public GeoTexSvxGradient
{
public:
GeoTexSvxGradientSquare(
@@ -183,7 +183,7 @@ namespace drawinglayer::texture
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override;
};
- class GeoTexSvxGradientRect final : public GeoTexSvxGradient
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRect final : public GeoTexSvxGradient
{
public:
GeoTexSvxGradientRect(
@@ -203,7 +203,7 @@ namespace drawinglayer::texture
virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const override;
};
- class GeoTexSvxHatch final : public GeoTexSvx
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxHatch final : public GeoTexSvx
{
basegfx::B2DRange maOutputRange;
basegfx::B2DHomMatrix maTextureTransform;
@@ -239,7 +239,7 @@ namespace drawinglayer::texture
// given percentage value (offsetX has to be 0.0 <= offsetX <= 1.0).
// Accordingly to offsetY. If both are given, offsetX is preferred
// and offsetY is ignored.
- class GeoTexSvxTiled final : public GeoTexSvx
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxTiled final : public GeoTexSvx
{
basegfx::B2DRange maRange;
double mfOffsetX;
commit 9b0dcd61f25878915f0a4507b451dd48fdde37e3
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Fri May 8 20:40:59 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:26:44 2020 +0200
drawinglayer: externalize FillHatchPrimitive2D class
Change-Id: I9ad1f179a43bb6c501cb699c0f26523f47307829
diff --git a/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx
index bab7e47b03e8..c7b3a559bc42 100644
--- a/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx
@@ -26,9 +26,6 @@
#include <drawinglayer/attribute/fillhatchattribute.hxx>
#include <basegfx/color/bcolor.hxx>
-
-// FillHatchPrimitive2D class
-
namespace drawinglayer::primitive2d
{
/** FillHatchPrimitive2D class
@@ -45,7 +42,7 @@ namespace drawinglayer::primitive2d
The decomposition will deliver the hatch lines.
*/
- class FillHatchPrimitive2D final : public DiscreteMetricDependentPrimitive2D
+ class DRAWINGLAYER_DLLPUBLIC FillHatchPrimitive2D final : public DiscreteMetricDependentPrimitive2D
{
private:
/// the geometrically visible area
commit ca018b401e4db7c3555f3b9874ca9e31cf01f30e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu May 7 22:01:22 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:26:43 2020 +0200
vcl: VectorGraphicSearch - for searching text inside PDF
Change-Id: Iee940a3927330c8739774ff3c1af15998f89193b
diff --git a/include/vcl/VectorGraphicSearch.hxx b/include/vcl/VectorGraphicSearch.hxx
new file mode 100644
index 000000000000..3411d0a931e6
--- /dev/null
+++ b/include/vcl/VectorGraphicSearch.hxx
@@ -0,0 +1,39 @@
+/* -*- 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 <vcl/graph.hxx>
+#include <vcl/vectorgraphicdata.hxx>
+#include <vcl/dllapi.h>
+
+#include <fpdf_doc.h>
+
+#include <memory>
+
+class SearchContext;
+
+class VCL_DLLPUBLIC VectorGraphicSearch final
+{
+private:
+ Graphic maGraphic;
+ FPDF_DOCUMENT mpPdfDocument;
+ std::unique_ptr<SearchContext> mpSearchContext;
+ bool searchPDF(std::shared_ptr<VectorGraphicData> const& rData, OUString const& rSearchString);
+
+public:
+ VectorGraphicSearch(Graphic const& rGraphic);
+ ~VectorGraphicSearch();
+ bool search(OUString const& rSearchString);
+ bool next();
+ int index();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/CppunitTest_vcl_graphic_test.mk b/vcl/CppunitTest_vcl_graphic_test.mk
index 353d054e1ba7..2f2c61735ef8 100644
--- a/vcl/CppunitTest_vcl_graphic_test.mk
+++ b/vcl/CppunitTest_vcl_graphic_test.mk
@@ -14,11 +14,12 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_graphic_test, \
vcl/qa/cppunit/GraphicDescriptorTest \
vcl/qa/cppunit/GraphicFormatDetectorTest \
vcl/qa/cppunit/GraphicNativeMetadataTest \
+ vcl/qa/cppunit/VectorGraphicSearchTest \
))
-$(eval $(call gb_CppunitTest_use_externals,vcl_graphic_test,\
- boost_headers \
- glm_headers \
+$(eval $(call gb_CppunitTest_use_externals,vcl_graphic_test, \
+ boost_headers \
+ $(if $(filter PDFIUM,$(BUILD_TYPE)),pdfium) \
))
ifeq ($(TLS),NSS)
$(eval $(call gb_CppunitTest_use_externals,vcl_graphic_test,\
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index be525ec09ea1..873bd41224b2 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -330,6 +330,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/graphic/UnoGraphicObject \
vcl/source/graphic/UnoGraphicProvider \
vcl/source/graphic/UnoGraphicTransformer \
+ vcl/source/graphic/VectorGraphicSearch \
vcl/source/bitmap/bitmap \
vcl/source/bitmap/bitmapfilter \
vcl/source/bitmap/BitmapAlphaClampFilter \
diff --git a/vcl/qa/cppunit/VectorGraphicSearchTest.cxx b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
new file mode 100644
index 000000000000..0ed21ccf9e26
--- /dev/null
+++ b/vcl/qa/cppunit/VectorGraphicSearchTest.cxx
@@ -0,0 +1,50 @@
+/* -*- 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 <cppunit/TestAssert.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <unotest/bootstrapfixturebase.hxx>
+#include <unotest/directories.hxx>
+
+#include <vcl/VectorGraphicSearch.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/graphicfilter.hxx>
+#include <tools/stream.hxx>
+
+class VectorGraphicSearchTest : public test::BootstrapFixtureBase
+{
+ OUString getFullUrl(const OUString& sFileName)
+ {
+ return m_directories.getURLFromSrc("/vcl/qa/cppunit/data/") + sFileName;
+ }
+
+ void test();
+
+ CPPUNIT_TEST_SUITE(VectorGraphicSearchTest);
+ CPPUNIT_TEST(test);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void VectorGraphicSearchTest::test()
+{
+ OUString aURL = getFullUrl("Pangram.pdf");
+ SvFileStream aStream(aURL, StreamMode::READ);
+ GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
+ Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream);
+ aGraphic.makeAvailable();
+
+ VectorGraphicSearch aSearch(aGraphic);
+ CPPUNIT_ASSERT_EQUAL(true, aSearch.search("lazy"));
+ CPPUNIT_ASSERT_EQUAL(true, aSearch.next());
+ CPPUNIT_ASSERT_EQUAL(34, aSearch.index());
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(VectorGraphicSearchTest);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qa/cppunit/data/Pangram.pdf b/vcl/qa/cppunit/data/Pangram.pdf
new file mode 100644
index 000000000000..0714fda4e4dd
Binary files /dev/null and b/vcl/qa/cppunit/data/Pangram.pdf differ
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
new file mode 100644
index 000000000000..864c65f2dda2
--- /dev/null
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -0,0 +1,168 @@
+/* -*- 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 <sal/config.h>
+#include <vcl/VectorGraphicSearch.hxx>
+
+#include <fpdf_text.h>
+
+class SearchContext
+{
+public:
+ bool bInitialized = false;
+
+ FPDF_DOCUMENT mpPdfDocument;
+ sal_Int32 mnPageIndex;
+ FPDF_PAGE mpPage;
+ FPDF_TEXTPAGE mpTextPage;
+ OUString maSearchString;
+ FPDF_SCHHANDLE mpSearchHandle;
+
+ SearchContext(FPDF_DOCUMENT pPdfDocument, sal_Int32 nPageIndex, OUString const& rSearchString)
+ : mpPdfDocument(pPdfDocument)
+ , mnPageIndex(nPageIndex)
+ , mpPage(nullptr)
+ , mpTextPage(nullptr)
+ , maSearchString(rSearchString)
+ , mpSearchHandle(nullptr)
+ {
+ }
+
+ ~SearchContext()
+ {
+ if (mpSearchHandle)
+ FPDFText_FindClose(mpSearchHandle);
+ if (mpTextPage)
+ FPDFText_ClosePage(mpTextPage);
+ if (mpPage)
+ FPDF_ClosePage(mpPage);
+ }
+
+ bool initialize()
+ {
+ if (!mpPdfDocument)
+ return false;
+ mpPage = FPDF_LoadPage(mpPdfDocument, mnPageIndex);
+ if (!mpPage)
+ return false;
+ mpTextPage = FPDFText_LoadPage(mpPage);
+ if (!mpTextPage)
+ return false;
+
+ FPDF_WIDESTRING pString = reinterpret_cast<FPDF_WIDESTRING>(maSearchString.getStr());
+ mpSearchHandle = FPDFText_FindStart(mpTextPage, pString, 0, 0);
+
+ return mpSearchHandle != nullptr;
+ }
+
+ bool next()
+ {
+ if (mpSearchHandle)
+ return FPDFText_FindNext(mpSearchHandle);
+ return false;
+ }
+
+ int index()
+ {
+ if (mpSearchHandle)
+ return FPDFText_GetSchResultIndex(mpSearchHandle);
+ return -1;
+ }
+};
+
+VectorGraphicSearch::VectorGraphicSearch(Graphic const& rGraphic)
+ : maGraphic(rGraphic)
+ , mpPdfDocument(nullptr)
+{
+ 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();
+
+ if (mpPdfDocument)
+ FPDF_CloseDocument(mpPdfDocument);
+ FPDF_DestroyLibrary();
+}
+
+bool VectorGraphicSearch::search(OUString const& rSearchString)
+{
+ auto pData = maGraphic.getVectorGraphicData();
+
+ if (pData && pData->getVectorGraphicDataType() == VectorGraphicDataType::Pdf)
+ {
+ return searchPDF(pData, rSearchString);
+ }
+ return false;
+}
+
+bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rData,
+ OUString const& rSearchString)
+{
+ if (rSearchString.isEmpty())
+ return false;
+
+ mpPdfDocument
+ = FPDF_LoadMemDocument(rData->getVectorGraphicDataArray().getConstArray(),
+ rData->getVectorGraphicDataArrayLength(), /*password=*/nullptr);
+
+ if (!mpPdfDocument)
+ {
+ //TODO: Handle failure to load.
+ switch (FPDF_GetLastError())
+ {
+ case FPDF_ERR_SUCCESS:
+ break;
+ case FPDF_ERR_UNKNOWN:
+ break;
+ case FPDF_ERR_FILE:
+ break;
+ case FPDF_ERR_FORMAT:
+ break;
+ case FPDF_ERR_PASSWORD:
+ break;
+ case FPDF_ERR_SECURITY:
+ break;
+ case FPDF_ERR_PAGE:
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ sal_Int32 nPageIndex = std::max(rData->getPageIndex(), 0);
+
+ mpSearchContext.reset(new SearchContext(mpPdfDocument, nPageIndex, rSearchString));
+
+ return mpSearchContext->initialize();
+}
+
+bool VectorGraphicSearch::next()
+{
+ if (mpSearchContext)
+ return mpSearchContext->next();
+ return false;
+}
+
+int VectorGraphicSearch::index()
+{
+ if (mpSearchContext)
+ return mpSearchContext->index();
+ return -1;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 031ea16bd5e211da894d5279263566dd4e353d1e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Apr 1 13:00:25 2020 +0200
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:26:43 2020 +0200
Add OutputDevice::drawPrimitive2D to OutputDevice
Change-Id: Ifc22eca62df72bddd247ba097054f34756520614
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index f2e19567150e..203456ac1ae8 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -49,6 +49,8 @@
#include <com/sun/star/drawing/LineCap.hpp>
#include <com/sun/star/uno/Reference.h>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+
#include <memory>
#include <vector>
@@ -1957,6 +1959,9 @@ public:
///@}
+ bool drawPrimitive2D(drawinglayer::primitive2d::Primitive2DContainer & rPrimitive2D);
+
+
/** @name Native Widget Rendering functions
These all just call through to the private mpGraphics functions of the same name.
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 35590174946e..be525ec09ea1 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_Library_use_libraries,vcl,\
basegfx \
comphelper \
cppuhelper \
+ drawinglayercore \
i18nlangtag \
i18nutil \
$(if $(filter OPENCL,$(BUILD_TYPE)),opencl) \
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index fe06032d7ca0..6848ba813a41 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -698,4 +698,9 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
return bDrawn;
}
+bool OutputDevice::drawPrimitive2D(drawinglayer::primitive2d::Primitive2DContainer & rPrimitive2D)
+{
+ return false;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 6ba14e2f25231247916af6e243c10a82887e627a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Mar 7 14:33:43 2020 +0100
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Wed May 20 21:26:43 2020 +0200
Separate core drawinglayer func. into drawinglayercore library
This separates the drawinglayer core functionallity into a
separate library, to keep a strict separation what is backend
dependent and what is not. More strict separation can be done
at a later date.
This will make it possible to push part of drawinglayer
(part of processor2d) directly into VCL.
Change-Id: Ibc26580067e50bf20d7cdd37fa0e44eb10200878
diff --git a/Repository.mk b/Repository.mk
index c02196c545d2..64c11deb3d19 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -350,6 +350,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
$(call gb_Helper_optional,SCRIPTING,dlgprov) \
$(if $(filter WNT,$(OS)),directx9canvas) \
$(if $(ENABLE_OPENGL_CANVAS),oglcanvas) \
+ drawinglayercore \
drawinglayer \
editeng \
$(if $(filter WNT,$(OS)),emser) \
diff --git a/drawinglayer/CppunitTest_drawinglayer_border.mk b/drawinglayer/CppunitTest_drawinglayer_border.mk
index fa2f715590cd..e00006c18dba 100644
--- a/drawinglayer/CppunitTest_drawinglayer_border.mk
+++ b/drawinglayer/CppunitTest_drawinglayer_border.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,drawinglayer_border, \
sal \
salhelper \
drawinglayer \
+ drawinglayercore \
vcl \
test \
tl \
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index 24b8055836d0..814fff713ae1 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_Library_use_externals,drawinglayer,\
))
$(eval $(call gb_Library_use_libraries,drawinglayer,\
+ drawinglayercore \
basegfx \
canvastools \
comphelper \
@@ -67,11 +68,9 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/attribute/sdrsceneattribute3d \
drawinglayer/source/attribute/sdrshadowattribute \
drawinglayer/source/attribute/strokeattribute \
- drawinglayer/source/geometry/viewinformation2d \
drawinglayer/source/geometry/viewinformation3d \
drawinglayer/source/primitive2d/animatedprimitive2d \
drawinglayer/source/primitive2d/backgroundcolorprimitive2d \
- drawinglayer/source/primitive2d/baseprimitive2d \
drawinglayer/source/primitive2d/bitmapprimitive2d \
drawinglayer/source/primitive2d/borderlineprimitive2d \
drawinglayer/source/primitive2d/controlprimitive2d \
@@ -111,7 +110,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D \
drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D \
drawinglayer/source/primitive2d/primitivetools2d \
- drawinglayer/source/primitive2d/Primitive2DContainer \
drawinglayer/source/primitive2d/sceneprimitive2d \
drawinglayer/source/primitive2d/sdrdecompositiontools2d \
drawinglayer/source/primitive2d/shadowprimitive2d \
@@ -127,7 +125,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/primitive2d/textlineprimitive2d \
drawinglayer/source/primitive2d/textprimitive2d \
drawinglayer/source/primitive2d/textstrikeoutprimitive2d \
- drawinglayer/source/primitive2d/Tools \
drawinglayer/source/primitive2d/transformprimitive2d \
drawinglayer/source/primitive2d/transparenceprimitive2d \
drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d \
diff --git a/drawinglayer/Library_drawinglayercore.mk b/drawinglayer/Library_drawinglayercore.mk
new file mode 100644
index 000000000000..f1643d27014d
--- /dev/null
+++ b/drawinglayer/Library_drawinglayercore.mk
@@ -0,0 +1,49 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_Library_Library,drawinglayercore))
+
+$(eval $(call gb_Library_set_include,drawinglayercore,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/drawinglayer/inc \
+))
+
+$(eval $(call gb_Library_add_defs,drawinglayercore,\
+ -DDRAWINGLAYERCORE_DLLIMPLEMENTATION \
+))
+
+$(eval $(call gb_Library_set_precompiled_header,drawinglayercore,drawinglayer/inc/pch/precompiled_drawinglayercore))
+
+$(eval $(call gb_Library_use_sdk_api,drawinglayercore))
+
+$(eval $(call gb_Library_use_externals,drawinglayercore,\
+ boost_headers \
+ libxml2 \
+))
+
+$(eval $(call gb_Library_use_libraries,drawinglayercore,\
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ i18nlangtag \
+ sal \
+ salhelper \
+ svl \
+ tl \
+))
+
+$(eval $(call gb_Library_add_exception_objects,drawinglayercore,\
+ drawinglayer/source/primitive2d/baseprimitive2d \
+ drawinglayer/source/primitive2d/Primitive2DContainer \
+ drawinglayer/source/primitive2d/Tools \
+ drawinglayer/source/geometry/viewinformation2d \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/drawinglayer/Module_drawinglayer.mk b/drawinglayer/Module_drawinglayer.mk
index 6d329e95c60a..687cd9c2671f 100644
--- a/drawinglayer/Module_drawinglayer.mk
+++ b/drawinglayer/Module_drawinglayer.mk
@@ -10,6 +10,7 @@
$(eval $(call gb_Module_Module,drawinglayer))
$(eval $(call gb_Module_add_targets,drawinglayer,\
+ Library_drawinglayercore \
Library_drawinglayer \
))
diff --git a/drawinglayer/inc/pch/precompiled_drawinglayer.hxx b/drawinglayer/inc/pch/precompiled_drawinglayer.hxx
index 9aaf7bace296..d60954dab588 100644
--- a/drawinglayer/inc/pch/precompiled_drawinglayer.hxx
+++ b/drawinglayer/inc/pch/precompiled_drawinglayer.hxx
@@ -93,7 +93,6 @@
#include <basegfx/range/basicrange.hxx>
#include <basegfx/tuple/b2dtuple.hxx>
#include <basegfx/tuple/b3dtuple.hxx>
-#include <basegfx/utils/canvastools.hxx>
#include <basegfx/vector/b2dvector.hxx>
#include <basegfx/vector/b2enums.hxx>
#include <basegfx/vector/b2ivector.hxx>
@@ -105,7 +104,7 @@
#include <com/sun/star/drawing/TextureMode.hpp>
#include <com/sun/star/drawing/TextureProjectionMode.hpp>
#include <com/sun/star/graphic/XPrimitive3D.hpp>
-#include <com/sun/star/util/XAccounting.hpp>
+#include <com/sun/star/uno/Reference.hxx>
#include <comphelper/comphelperdllapi.h>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
@@ -139,7 +138,6 @@
#include <drawinglayer/drawinglayerdllapi.h>
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/geometry/viewinformation3d.hxx>
-#include <drawinglayer/primitive2d/CommonTypes.hxx>
#include <drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx>
#include <drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx>
#include <drawinglayer/primitive2d/PolyPolygonGraphicPrimitive2D.hxx>
@@ -147,9 +145,6 @@
#include <drawinglayer/primitive2d/PolyPolygonHatchPrimitive2D.hxx>
#include <drawinglayer/primitive2d/PolyPolygonMarkerPrimitive2D.hxx>
#include <drawinglayer/primitive2d/PolyPolygonStrokePrimitive2D.hxx>
-#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
-#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx>
-#include <drawinglayer/primitive2d/Tools.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
diff --git a/drawinglayer/inc/pch/precompiled_drawinglayercore.cxx b/drawinglayer/inc/pch/precompiled_drawinglayercore.cxx
new file mode 100644
index 000000000000..4a8c23ea8e65
--- /dev/null
+++ b/drawinglayer/inc/pch/precompiled_drawinglayercore.cxx
@@ -0,0 +1,12 @@
+/* -*- 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 "precompiled_drawinglayercore.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/inc/pch/precompiled_drawinglayercore.hxx b/drawinglayer/inc/pch/precompiled_drawinglayercore.hxx
new file mode 100644
index 000000000000..4cc5ca4612c9
--- /dev/null
+++ b/drawinglayer/inc/pch/precompiled_drawinglayercore.hxx
@@ -0,0 +1,46 @@
+/* -*- 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/.
+ */
+
+/*
+ This file has been autogenerated by update_pch.sh. It is possible to edit it
+ manually (such as when an include file has been moved/renamed/removed). All such
+ manual changes will be rewritten by the next run of update_pch.sh (which presumably
+ also fixes all possible problems, so it's usually better to use it).
+
+ Generated on 2020-03-07 12:37:18 using:
+ ./bin/update_pch drawinglayer drawinglayercore --cutoff=4 --exclude:system --exclude:module --exclude:local
+
+ If after updating build fails, use the following command to locate conflicting headers:
+ ./bin/update_pch_bisect ./drawinglayer/inc/pch/precompiled_drawinglayercore.hxx "make drawinglayer.build" --find-conflicts
+*/
+
+#if PCH_LEVEL >= 1
+#include <ostream>
+#include <vector>
+#endif // PCH_LEVEL >= 1
+#if PCH_LEVEL >= 2
+#include <osl/diagnose.h>
+#include <osl/interlck.h>
+#include <sal/config.h>
+#include <sal/types.h>
+#endif // PCH_LEVEL >= 2
+#if PCH_LEVEL >= 3
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/utils/canvastools.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#endif // PCH_LEVEL >= 3
+#if PCH_LEVEL >= 4
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#endif // PCH_LEVEL >= 4
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/emfio/CppunitTest_emfio_emf_test.mk b/emfio/CppunitTest_emfio_emf_test.mk
index 123e4b3549bd..2679c0a604d9 100644
--- a/emfio/CppunitTest_emfio_emf_test.mk
+++ b/emfio/CppunitTest_emfio_emf_test.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_sdk_api,emfio_emf))
$(eval $(call gb_CppunitTest_use_libraries,emfio_emf,\
basegfx \
drawinglayer \
+ drawinglayercore \
cppu \
cppuhelper \
comphelper \
diff --git a/emfio/Library_emfio.mk b/emfio/Library_emfio.mk
index 52fde14885b3..89add50b781a 100644
--- a/emfio/Library_emfio.mk
+++ b/emfio/Library_emfio.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_Library_use_sdk_api,emfio))
$(eval $(call gb_Library_use_libraries,emfio,\
basegfx \
+ drawinglayercore \
drawinglayer \
cppu \
cppuhelper \
diff --git a/filter/Library_svgfilter.mk b/filter/Library_svgfilter.mk
index 21318aa1fd03..1f0caf11758c 100644
--- a/filter/Library_svgfilter.mk
+++ b/filter/Library_svgfilter.mk
@@ -56,6 +56,7 @@ $(eval $(call gb_Library_use_libraries,svgfilter,\
sax \
salhelper \
comphelper \
+ drawinglayercore \
drawinglayer \
basegfx \
cppuhelper \
diff --git a/include/drawinglayer/drawinglayerdllapi.h b/include/drawinglayer/drawinglayerdllapi.h
index 0b3983504919..36a0d8abfea2 100644
--- a/include/drawinglayer/drawinglayerdllapi.h
+++ b/include/drawinglayer/drawinglayerdllapi.h
@@ -19,6 +19,12 @@
#endif
#define DRAWINGLAYER_DLLPRIVATE SAL_DLLPRIVATE
+#if defined(DRAWINGLAYERCORE_DLLIMPLEMENTATION)
+#define DRAWINGLAYERCORE_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define DRAWINGLAYERCORE_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx
index 95be29a72bda..06b17248d213 100644
--- a/include/drawinglayer/geometry/viewinformation2d.hxx
+++ b/include/drawinglayer/geometry/viewinformation2d.hxx
@@ -63,7 +63,7 @@ namespace drawinglayer::geometry
It is an implementation to support the sequence of PropertyValues used in a
css::graphic::XPrimitive2D for C++ implementations working with those
*/
-class DRAWINGLAYER_DLLPUBLIC ViewInformation2D
+class DRAWINGLAYERCORE_DLLPUBLIC ViewInformation2D
{
public:
typedef o3tl::cow_wrapper<ImpViewInformation2D, o3tl::ThreadSafeRefCountingPolicy> ImplType;
diff --git a/include/drawinglayer/primitive2d/Primitive2DContainer.hxx b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
index cca3a0a91485..c096e9a8cc2f 100644
--- a/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
+++ b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
@@ -34,7 +34,7 @@ class ViewInformation2D;
namespace drawinglayer::primitive2d
{
-class SAL_WARN_UNUSED DRAWINGLAYER_DLLPUBLIC Primitive2DContainer
+class SAL_WARN_UNUSED DRAWINGLAYERCORE_DLLPUBLIC Primitive2DContainer
: public std::deque<Primitive2DReference>,
public Primitive2DDecompositionVisitor
{
diff --git a/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx b/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
index dfe04b32a320..e174d1e0878d 100644
--- a/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
+++ b/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
@@ -27,7 +27,7 @@ namespace drawinglayer::primitive2d
class Primitive2DContainer;
// Visitor class for walking a tree of Primitive2DReference
-class DRAWINGLAYER_DLLPUBLIC Primitive2DDecompositionVisitor
+class DRAWINGLAYERCORE_DLLPUBLIC Primitive2DDecompositionVisitor
{
public:
virtual void append(const Primitive2DReference&) = 0;
diff --git a/include/drawinglayer/primitive2d/Tools.hxx b/include/drawinglayer/primitive2d/Tools.hxx
index fbb6f5717c01..1c30565c8c1b 100644
--- a/include/drawinglayer/primitive2d/Tools.hxx
+++ b/include/drawinglayer/primitive2d/Tools.hxx
@@ -31,16 +31,16 @@ class ViewInformation2D;
namespace drawinglayer::primitive2d
{
/// get B2DRange from a given Primitive2DReference
-basegfx::B2DRange DRAWINGLAYER_DLLPUBLIC getB2DRangeFromPrimitive2DReference(
+basegfx::B2DRange DRAWINGLAYERCORE_DLLPUBLIC getB2DRangeFromPrimitive2DReference(
const Primitive2DReference& rCandidate, const geometry::ViewInformation2D& aViewInformation);
/** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
and using compare operator
*/
-bool DRAWINGLAYER_DLLPUBLIC arePrimitive2DReferencesEqual(const Primitive2DReference& rA,
- const Primitive2DReference& rB);
+bool DRAWINGLAYERCORE_DLLPUBLIC arePrimitive2DReferencesEqual(const Primitive2DReference& rA,
+ const Primitive2DReference& rB);
-OUString DRAWINGLAYER_DLLPUBLIC idToString(sal_uInt32 nId);
+OUString DRAWINGLAYERCORE_DLLPUBLIC idToString(sal_uInt32 nId);
} // end of namespace drawinglayer::primitive2d
diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
index 693dcc4b1e32..56ff35344de5 100644
--- a/include/drawinglayer/primitive2d/baseprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
@@ -120,8 +120,8 @@ typedef cppu::WeakComponentImplHelper<css::graphic::XPrimitive2D, css::util::XAc
for view-independent primitives which are defined by not using ViewInformation2D
in their get2DDecomposition/getB2DRange implementations.
*/
-class DRAWINGLAYER_DLLPUBLIC BasePrimitive2D : protected cppu::BaseMutex,
- public BasePrimitive2DImplBase
+class DRAWINGLAYERCORE_DLLPUBLIC BasePrimitive2D : protected cppu::BaseMutex,
+ public BasePrimitive2DImplBase
{
BasePrimitive2D(const BasePrimitive2D&) = delete;
BasePrimitive2D& operator=(const BasePrimitive2D&) = delete;
@@ -199,7 +199,7 @@ public:
to identify if a new decomposition is needed at the next call
(f) return maBuffered2DDecomposition
*/
-class DRAWINGLAYER_DLLPUBLIC BufferedDecompositionPrimitive2D : public BasePrimitive2D
+class DRAWINGLAYERCORE_DLLPUBLIC BufferedDecompositionPrimitive2D : public BasePrimitive2D
{
private:
/// a sequence used for buffering the last create2DDecomposition() result
diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index 8943de7ab4c3..60fb6676dab9 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_ucalc, \
cppuhelper \
dbtools \
drawinglayer \
+ drawinglayercore \
editeng \
for \
forui \
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 997b14c0add9..b540b27c9834 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -70,6 +70,7 @@ $(eval $(call gb_Library_use_libraries,sc,\
cppu \
cppuhelper \
dbtools \
+ drawinglayercore \
drawinglayer \
editeng \
for \
diff --git a/sd/CppunitTest_sd_uimpress.mk b/sd/CppunitTest_sd_uimpress.mk
index 93426dfc3a55..63f143978231 100644
--- a/sd/CppunitTest_sd_uimpress.mk
+++ b/sd/CppunitTest_sd_uimpress.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sd_uimpress,\
cppu \
cppuhelper \
drawinglayer \
+ drawinglayercore \
editeng \
i18nlangtag \
i18nutil \
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index 43b168be8d8c..24520633e77f 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -74,6 +74,7 @@ $(eval $(call gb_Library_use_libraries,sd,\
cppcanvas \
cppu \
cppuhelper \
+ drawinglayercore \
drawinglayer \
editeng \
i18nlangtag \
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 67a66ef2d211..a6d6b7d6b71a 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_Library_use_libraries,sfx,\
comphelper \
cppu \
cppuhelper \
+ drawinglayercore \
drawinglayer \
fwe \
i18nlangtag \
diff --git a/svgio/CppunitTest_svgio.mk b/svgio/CppunitTest_svgio.mk
index c6f4db91fc60..24fb7a39af32 100644
--- a/svgio/CppunitTest_svgio.mk
+++ b/svgio/CppunitTest_svgio.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_CppunitTest_use_library_objects,svgio,\
$(eval $(call gb_CppunitTest_use_libraries,svgio,\
basegfx \
drawinglayer \
+ drawinglayercore \
cppu \
cppuhelper \
comphelper \
diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list