Split BasePrimitive2D UNO interface into separate object

Rather than make all the BasePrimitive2D classes bear the cost of being an UNO
object, we just wrap the top level BasePrimitive2D in this class when we need
to pass them over UNO.

This reduces the locking overhead when doing normal drawinglayer operations,
and reduces the size of drawinglayer objects and the cost of initialising
them, which shaves 5% off the load/display time of a large barchart.

Add new drawinglayer::convertPrimitive2DContainerToBitmapEx utility
method to avoid needing to convert to Sequence<XPrimitive2D>

Change-Id: I553eaa4c16ba016b098cb21f6c55f5008f0d9b53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126487
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2021-12-07 18:53:11 +02:00 committed by Noel Grandin
parent be596c0192
commit e3bd776e02
61 changed files with 421 additions and 236 deletions

View file

@ -133,7 +133,7 @@ namespace drawinglayer::unorenderer
const primitive2d::Primitive2DReference xEmbedRef(
new primitive2d::TransformPrimitive2D(
aEmbedding,
comphelper::sequenceToContainer<primitive2d::Primitive2DContainer>(aPrimitive2DSequence)));
aPrimitive2DSequence));
primitive2d::Primitive2DContainer xEmbedSeq { xEmbedRef };
BitmapEx aBitmapEx(

View file

@ -33,8 +33,6 @@ void BufferedDecompositionPrimitive2D::get2DDecomposition(
Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard(m_aMutex);
if (getBuffered2DDecomposition().empty())
{
Primitive2DContainer aNewSequence;

View file

@ -21,12 +21,39 @@
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/primitive2d/Tools.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
using namespace css;
namespace drawinglayer::primitive2d
{
Primitive2DContainer::Primitive2DContainer(
const css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>>& rSource)
{
for (const auto& rPrimitive : rSource)
append(static_cast<const UnoPrimitive2D*>(rPrimitive.get())->getBasePrimitive2D());
}
Primitive2DContainer::Primitive2DContainer(
const std::deque<css::uno::Reference<css::graphic::XPrimitive2D>>& rSource)
{
for (const auto& rPrimitive : rSource)
append(static_cast<const UnoPrimitive2D*>(rPrimitive.get())->getBasePrimitive2D());
}
css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>>
Primitive2DContainer::toSequence() const
{
css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>> aVal(size());
auto p = aVal.getArray();
for (const auto& rPrimitive : *this)
{
*p = new UnoPrimitive2D(rPrimitive);
++p;
}
return aVal;
}
Primitive2DContainer Primitive2DContainer::maybeInvert(bool bInvert) const
{
const sal_uInt32 nSize(size());
@ -115,7 +142,47 @@ void Primitive2DContainer::append(Primitive2DContainer&& rSource)
void Primitive2DContainer::append(const Primitive2DSequence& rSource)
{
this->insert(this->end(), rSource.begin(), rSource.end());
for (const auto& rPrimitive : rSource)
append(static_cast<const UnoPrimitive2D*>(rPrimitive.get())->getBasePrimitive2D());
}
UnoPrimitive2D::~UnoPrimitive2D() {}
basegfx::B2DRange
UnoPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard(m_aMutex);
return mxPrimitive->getB2DRange(rViewInformation);
}
sal_uInt32 UnoPrimitive2D::getPrimitive2DID() const { return mxPrimitive->getPrimitive2DID(); }
void UnoPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard(m_aMutex);
mxPrimitive->get2DDecomposition(rVisitor, rViewInformation);
}
css::uno::Sequence<::css::uno::Reference<::css::graphic::XPrimitive2D>>
SAL_CALL UnoPrimitive2D::getDecomposition(
const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters)
{
std::unique_lock aGuard(m_aMutex);
return mxPrimitive->getDecomposition(rViewParameters).toSequence();
}
css::geometry::RealRectangle2D SAL_CALL
UnoPrimitive2D::getRange(const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters)
{
std::unique_lock aGuard(m_aMutex);
return mxPrimitive->getRange(rViewParameters);
}
sal_Int64 SAL_CALL UnoPrimitive2D::estimateUsage()
{
std::unique_lock aGuard(m_aMutex);
return mxPrimitive->estimateUsage();
}
} // end of namespace drawinglayer::primitive2d

View file

@ -35,9 +35,7 @@ getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate,
if (!rCandidate)
return basegfx::B2DRange();
// get C++ implementation base
const BasePrimitive2D* pCandidate(static_cast<BasePrimitive2D*>(rCandidate.get()));
return pCandidate->getB2DRange(aViewInformation);
return rCandidate->getB2DRange(aViewInformation);
}
bool arePrimitive2DReferencesEqual(const Primitive2DReference& rxA, const Primitive2DReference& rxB)
@ -54,10 +52,28 @@ bool arePrimitive2DReferencesEqual(const Primitive2DReference& rxA, const Primit
return true;
}
const BasePrimitive2D* pA(static_cast<const BasePrimitive2D*>(rxA.get()));
const BasePrimitive2D* pB(static_cast<const BasePrimitive2D*>(rxB.get()));
return rxA->operator==(*rxB);
}
return pA->operator==(*pB);
bool arePrimitive2DReferencesEqual(const css::uno::Reference<css::graphic::XPrimitive2D>& rxA,
const css::uno::Reference<css::graphic::XPrimitive2D>& rxB)
{
const bool bAIs(rxA.is());
if (bAIs != rxB.is())
{
return false;
}
if (!bAIs)
{
return true;
}
auto pA = static_cast<const UnoPrimitive2D*>(rxA.get());
auto pB = static_cast<const UnoPrimitive2D*>(rxB.get());
return (*pA->getBasePrimitive2D()) == (*pB->getBasePrimitive2D());
}
OUString idToString(sal_uInt32 nId)

View file

@ -67,8 +67,6 @@ namespace drawinglayer::primitive2d
void BackgroundColorPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard( m_aMutex );
if(!getBuffered2DDecomposition().empty() && (maLastViewport != rViewInformation.getViewport()))
{
// conditions of last local decomposition have changed, delete
@ -82,7 +80,6 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}

View file

@ -19,6 +19,7 @@
#include <sal/config.h>
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/primitive2d/Tools.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
@ -141,23 +142,23 @@ void BasePrimitive2D::get2DDecomposition(
{
}
css::uno::Sequence<::css::uno::Reference<::css::graphic::XPrimitive2D>> SAL_CALL
Primitive2DContainer
BasePrimitive2D::getDecomposition(const uno::Sequence<beans::PropertyValue>& rViewParameters)
{
const auto aViewInformation = geometry::createViewInformation2D(rViewParameters);
Primitive2DContainer aContainer;
get2DDecomposition(aContainer, aViewInformation);
return comphelper::containerToSequence(aContainer);
return aContainer;
}
css::geometry::RealRectangle2D SAL_CALL
css::geometry::RealRectangle2D
BasePrimitive2D::getRange(const uno::Sequence<beans::PropertyValue>& rViewParameters)
{
const auto aViewInformation = geometry::createViewInformation2D(rViewParameters);
return basegfx::unotools::rectangle2DFromB2DRectangle(getB2DRange(aViewInformation));
}
sal_Int64 SAL_CALL BasePrimitive2D::estimateUsage()
sal_Int64 BasePrimitive2D::estimateUsage()
{
return 0; // for now ignore the objects themselves
}

View file

@ -52,7 +52,7 @@ BitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInforma
return aRetval;
}
sal_Int64 SAL_CALL BitmapPrimitive2D::estimateUsage()
sal_Int64 BitmapPrimitive2D::estimateUsage()
{
if (!getXBitmap().is())
{

View file

@ -316,7 +316,6 @@ namespace drawinglayer::primitive2d
{
// this primitive is view-dependent related to the scaling. If scaling has changed,
// destroy existing decomposition. To detect change, use size of unit size in view coordinates
std::unique_lock aGuard( m_aMutex );
const basegfx::B2DVector aNewScaling(rViewInformation.getObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0));
if(!getBuffered2DDecomposition().empty())
@ -335,7 +334,6 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}

View file

@ -35,8 +35,6 @@ namespace drawinglayer::primitive2d
{
bool Embedded3DPrimitive2D::impGetShadow3D() const
{
std::unique_lock aGuard( m_aMutex );
// create on demand
if(!mbShadow3DChecked && !getChildren3D().empty())
{

View file

@ -173,10 +173,8 @@ namespace drawinglayer::primitive2d
void FillHatchPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard( m_aMutex );
bool bAdaptDistance(0 != getFillHatch().getMinimalDiscreteDistance());
aGuard.unlock();
if(bAdaptDistance)
{
// behave view-dependent

View file

@ -518,7 +518,7 @@ namespace drawinglayer::primitive2d
aRetval.resize(1);
aRetval[0] = new TransformPrimitive2D(
aEmbedVectorGraphic,
rGraphic.getVectorGraphicData()->getPrimitive2DSequence());
Primitive2DContainer(rGraphic.getVectorGraphicData()->getPrimitive2DSequence()));
}
}
else

View file

@ -305,8 +305,6 @@ namespace drawinglayer::primitive2d
void GridPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard( m_aMutex );
if(!getBuffered2DDecomposition().empty())
{
if(maLastViewport != rViewInformation.getViewport() || maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation())
@ -324,7 +322,6 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}

View file

@ -53,16 +53,13 @@ namespace drawinglayer::primitive2d
getChildren(rVisitor);
}
sal_Int64 SAL_CALL GroupPrimitive2D::estimateUsage()
sal_Int64 GroupPrimitive2D::estimateUsage()
{
size_t nRet(0);
for (auto& it : getChildren())
{
uno::Reference<util::XAccounting> const xAcc(it, uno::UNO_QUERY);
if (xAcc.is())
{
nRet += xAcc->estimateUsage();
}
if (it)
nRet += it->estimateUsage();
}
return nRet;
}

View file

@ -155,8 +155,6 @@ namespace drawinglayer::primitive2d
void HelplinePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard( m_aMutex );
if(!getBuffered2DDecomposition().empty())
{
if(maLastViewport != rViewInformation.getViewport() || maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation())
@ -174,7 +172,6 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}

View file

@ -350,17 +350,12 @@ namespace drawinglayer::primitive2d
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
sal_Int64 SAL_CALL PatternFillPrimitive2D::estimateUsage()
sal_Int64 PatternFillPrimitive2D::estimateUsage()
{
size_t nRet(0);
for (auto& it : getChildren())
{
uno::Reference<util::XAccounting> const xAcc(it, uno::UNO_QUERY);
if (xAcc.is())
{
nRet += xAcc->estimateUsage();
}
}
if (it)
nRet += it->estimateUsage();
return nRet;
}

View file

@ -167,7 +167,6 @@ void PolygonMarkerPrimitive2D::get2DDecomposition(
Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard(m_aMutex);
bool bNeedNewDecomposition(false);
if (!getBuffered2DDecomposition().empty())
@ -195,7 +194,6 @@ void PolygonMarkerPrimitive2D::get2DDecomposition(
}
// use parent implementation
aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}

View file

@ -26,8 +26,6 @@ namespace drawinglayer::primitive2d
{
void DiscreteMetricDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard( m_aMutex );
// get the current DiscreteUnit, look at X and Y and use the maximum
const basegfx::B2DVector aDiscreteVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0));
const double fDiscreteUnit(std::min(fabs(aDiscreteVector.getX()), fabs(aDiscreteVector.getY())));
@ -45,7 +43,6 @@ namespace drawinglayer::primitive2d
}
// call base implementation
aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
@ -54,8 +51,6 @@ namespace drawinglayer::primitive2d
void ViewportDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard( m_aMutex );
// get the current Viewport
const basegfx::B2DRange& rViewport = rViewInformation.getViewport();
@ -72,14 +67,11 @@ namespace drawinglayer::primitive2d
}
// call base implementation
aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
void ViewTransformationDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard( m_aMutex );
// get the current ViewTransformation
const basegfx::B2DHomMatrix& rViewTransformation = rViewInformation.getViewTransformation();
@ -96,14 +88,11 @@ namespace drawinglayer::primitive2d
}
// call base implementation
aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
void ObjectAndViewTransformationDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard( m_aMutex );
// get the current ViewTransformation
const basegfx::B2DHomMatrix& rViewTransformation = rViewInformation.getViewTransformation();
@ -130,7 +119,6 @@ namespace drawinglayer::primitive2d
}
// call base implementation
aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}

View file

@ -509,8 +509,6 @@ namespace drawinglayer::primitive2d
Primitive2DContainer ScenePrimitive2D::getShadow2D() const
{
std::unique_lock aGuard( m_aMutex );
Primitive2DContainer aRetval;
// create 2D shadows from contained 3D primitives
@ -624,8 +622,6 @@ namespace drawinglayer::primitive2d
void ScenePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard( m_aMutex );
// get the involved ranges (see helper method calculateDiscreteSizes for details)
basegfx::B2DRange aDiscreteRange;
basegfx::B2DRange aUnitVisibleRange;
@ -679,7 +675,6 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}

View file

@ -213,8 +213,6 @@ void TextEffectPrimitive2D::get2DDecomposition(
Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation) const
{
std::unique_lock aGuard(m_aMutex);
if (!getBuffered2DDecomposition().empty())
{
if (maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation())
@ -233,7 +231,6 @@ void TextEffectPrimitive2D::get2DDecomposition(
}
// use parent implementation
aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}

View file

@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <comphelper/sequence.hxx>
@ -48,8 +49,7 @@ namespace drawinglayer::processor2d
// Primitive2DDecompositionVisitor
void BaseProcessor2D::visit(const primitive2d::Primitive2DReference& rCandidate)
{
const primitive2d::BasePrimitive2D* pBasePrimitive = static_cast< const primitive2d::BasePrimitive2D* >(rCandidate.get());
processBasePrimitive2D(*pBasePrimitive);
processBasePrimitive2D(*rCandidate);
}
void BaseProcessor2D::visit(const primitive2d::Primitive2DContainer& rContainer)
{
@ -64,9 +64,8 @@ namespace drawinglayer::processor2d
{
for (const primitive2d::Primitive2DReference& rCandidate : rSource)
{
const primitive2d::BasePrimitive2D* pBasePrimitive = static_cast< const primitive2d::BasePrimitive2D* >(rCandidate.get());
if (pBasePrimitive)
processBasePrimitive2D(*pBasePrimitive);
if (rCandidate)
processBasePrimitive2D(*rCandidate);
}
}

View file

@ -620,9 +620,7 @@ void VclPixelProcessor2D::processUnifiedTransparencePrimitive2D(
if (1 == rContent.size())
{
const primitive2d::Primitive2DReference xReference(rContent[0]);
const primitive2d::BasePrimitive2D* pBasePrimitive
= static_cast<const primitive2d::BasePrimitive2D*>(xReference.get());
const primitive2d::BasePrimitive2D* pBasePrimitive = rContent[0].get();
switch (pBasePrimitive->getPrimitive2DID())
{

View file

@ -34,6 +34,7 @@
#include <vcl/bitmapex.hxx>
#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <vcl/graph.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>

View file

@ -23,7 +23,10 @@
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/processor2d/processor2dtools.hxx>
#include <vcl/svapp.hxx>
#include <vcl/virdev.hxx>
#include <com/sun/star/geometry/RealRectangle2D.hpp>
#include <tools/diagnose_ex.h>
#include <drawinglayer/converters.hxx>
@ -170,6 +173,100 @@ namespace drawinglayer
return aRetval;
}
BitmapEx convertPrimitive2DContainerToBitmapEx(
primitive2d::Primitive2DContainer&& rSequence,
const basegfx::B2DRange& rTargetRange,
sal_uInt32 nMaximumQuadraticPixels,
const o3tl::Length eTargetUnit,
const std::optional<Size>& rTargetDPI)
{
if(rSequence.empty())
return BitmapEx();
try
{
css::geometry::RealRectangle2D aRealRect;
aRealRect.X1 = rTargetRange.getMinX();
aRealRect.Y1 = rTargetRange.getMinY();
aRealRect.X2 = rTargetRange.getMaxX();
aRealRect.Y2 = rTargetRange.getMaxY();
// get system DPI
Size aDPI(Application::GetDefaultDevice()->LogicToPixel(Size(1, 1), MapMode(MapUnit::MapInch)));
if (rTargetDPI.has_value())
{
aDPI = *rTargetDPI;
}
::sal_uInt32 DPI_X = aDPI.getWidth();
::sal_uInt32 DPI_Y = aDPI.getHeight();
const basegfx::B2DRange aRange(aRealRect.X1, aRealRect.Y1, aRealRect.X2, aRealRect.Y2);
const double fWidth(aRange.getWidth());
const double fHeight(aRange.getHeight());
if(!(basegfx::fTools::more(fWidth, 0.0) && basegfx::fTools::more(fHeight, 0.0)))
return BitmapEx();
if(0 == DPI_X)
{
DPI_X = 75;
}
if(0 == DPI_Y)
{
DPI_Y = 75;
}
if(0 == nMaximumQuadraticPixels)
{
nMaximumQuadraticPixels = 500000;
}
const auto aViewInformation2D = geometry::createViewInformation2D({});
const sal_uInt32 nDiscreteWidth(basegfx::fround(o3tl::convert(fWidth, eTargetUnit, o3tl::Length::in) * DPI_X));
const sal_uInt32 nDiscreteHeight(basegfx::fround(o3tl::convert(fHeight, eTargetUnit, o3tl::Length::in) * DPI_Y));
basegfx::B2DHomMatrix aEmbedding(
basegfx::utils::createTranslateB2DHomMatrix(
-aRange.getMinX(),
-aRange.getMinY()));
aEmbedding.scale(
nDiscreteWidth / fWidth,
nDiscreteHeight / fHeight);
const primitive2d::Primitive2DReference xEmbedRef(
new primitive2d::TransformPrimitive2D(
aEmbedding,
std::move(rSequence)));
primitive2d::Primitive2DContainer xEmbedSeq { xEmbedRef };
BitmapEx aBitmapEx(
convertToBitmapEx(
std::move(xEmbedSeq),
aViewInformation2D,
nDiscreteWidth,
nDiscreteHeight,
nMaximumQuadraticPixels));
if(aBitmapEx.IsEmpty())
return BitmapEx();
aBitmapEx.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
aBitmapEx.SetPrefSize(Size(basegfx::fround(fWidth), basegfx::fround(fHeight)));
return aBitmapEx;
}
catch (const css::uno::Exception&)
{
TOOLS_WARN_EXCEPTION("vcl", "Got no graphic::XPrimitive2DRenderer!");
}
catch (const std::exception& e)
{
SAL_WARN("vcl", "Got no graphic::XPrimitive2DRenderer! : " << e.what());
}
return BitmapEx();
}
} // end of namespace drawinglayer
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -605,10 +605,7 @@ void Primitive2dXmlDump::decomposeAndWrite(
{
for (size_t i = 0; i < rPrimitive2DSequence.size(); i++)
{
drawinglayer::primitive2d::Primitive2DReference xPrimitive2DReference
= rPrimitive2DSequence[i];
const BasePrimitive2D* pBasePrimitive
= static_cast<const BasePrimitive2D*>(xPrimitive2DReference.get());
const BasePrimitive2D* pBasePrimitive = rPrimitive2DSequence[i].get();
sal_uInt32 nId = pBasePrimitive->getPrimitive2DID();
if (nId < maFilter.size() && maFilter[nId])
continue;

View file

@ -1257,7 +1257,7 @@ namespace wmfemfhelper
// prepare Primitive2DSequence, put text in foreground
drawinglayer::primitive2d::Primitive2DContainer aSequence(2);
aSequence[1] = drawinglayer::primitive2d::Primitive2DReference(pResult);
aSequence[1] = pResult;
// prepare filled polygon
basegfx::B2DPolygon aOutline(basegfx::utils::createPolygonFromRect(aTextRange));

View file

@ -32,17 +32,10 @@ $(eval $(call gb_CppunitTest_use_libraries,emfio_wmf,\
vcl \
))
$(eval $(call gb_CppunitTest_use_components,emfio_wmf,\
configmgr/source/configmgr \
emfio/emfio \
i18npool/util/i18npool \
ucb/source/core/ucb1 \
unotools/util/utl \
))
$(eval $(call gb_CppunitTest_use_configuration,emfio_wmf))
$(eval $(call gb_CppunitTest_use_sdk_api,emfio_wmf))
$(eval $(call gb_CppunitTest_use_ure,emfio_wmf))
$(eval $(call gb_CppunitTest_use_vcl,emfio_wmf))
$(eval $(call gb_CppunitTest_use_rdb,emfio_wmf,services))
# vim: set noet sw=4 ts=4:

View file

@ -24,6 +24,7 @@
#include <com/sun/star/graphic/EmfTools.hpp>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/tools/primitive2dxmldump.hxx>
#include <vcl/filter/PDFiumLibrary.hxx>
@ -162,8 +163,7 @@ void Test::testPolyPolygon()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/fdo79679-2.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
@ -205,8 +205,7 @@ void Test::TestDrawImagePointsTypeBitmap()
= parseEmf(u"/emfio/qa/cppunit/emf/data/TestDrawImagePointsTypeBitmap.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "polypolygoncolor", "color", "#0080ff");
@ -237,8 +236,7 @@ void Test::TestDrawString()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestDrawString.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
// check correct import of the DrawString: height, position, text, color and font
@ -259,8 +257,7 @@ void Test::TestDrawStringAlign()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestDrawStringAlign.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "mask/transform", 9);
@ -330,8 +327,7 @@ void Test::TestDrawStringTransparent()
= parseEmf(u"/emfio/qa/cppunit/emf/data/TestDrawStringTransparent.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "mask/transform/unifiedtransparence", "transparence",
@ -358,8 +354,7 @@ void Test::TestDrawStringWithBrush()
= parseEmf(u"/emfio/qa/cppunit/emf/data/TestDrawStringWithBrush.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "transform/textdecoratedportion", "xy11", "20");
assertXPath(pDocument, aXPathPrefix + "transform/textdecoratedportion", "xy13", "16");
@ -379,8 +374,7 @@ void Test::TestDrawLine()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestDrawLine.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
// check correct import of the DrawLine: color and width of the line
@ -394,8 +388,7 @@ void Test::TestLinearGradient()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestLinearGradient.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, "/primitive2D/metafile/transform", "xy11", "1");
@ -433,8 +426,7 @@ void Test::TestTextMapMode()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TextMapMode.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "polypolygoncolor", 2);
@ -471,8 +463,7 @@ void Test::TestEnglishMapMode()
= parseEmf(u"/emfio/qa/cppunit/emf/data/test_mm_hienglish_ref.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", 1);
@ -514,8 +505,7 @@ void Test::TestRectangleWithModifyWorldTransform()
= parseEmf(u"/emfio/qa/cppunit/emf/data/TestRectangleWithModifyWorldTransform.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "polypolygoncolor", 1);
@ -535,8 +525,7 @@ void Test::TestChordWithModifyWorldTransform()
= parseEmf(u"/emfio/qa/cppunit/emf/data/TestChordWithModifyWorldTransform.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "polypolygoncolor", "color", "#ffffff");
@ -557,8 +546,7 @@ void Test::TestArcStartPointEqualEndPoint()
= parseEmf(u"/emfio/qa/cppunit/emf/data/TestArcStartPointEqualEndPoint.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "mask/group/mask/polygonhairline", "color", "#000000");
@ -607,8 +595,7 @@ void Test::TestArcInsideWronglyDefinedRectangle()
= parseEmf(u"/emfio/qa/cppunit/emf/data/TestArcInsideWronglyDefinedRectangle.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "polygonhairline", "color", "#000000");
@ -634,8 +621,7 @@ void Test::TestEllipseWithSelectClipPath()
= parseEmf(u"/emfio/qa/cppunit/emf/data/TestEllipseWithSelectClipPath.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "group/mask/polypolygon", 1);
@ -666,8 +652,7 @@ void Test::TestEllipseXformIntersectClipRect()
= parseEmf(u"/emfio/qa/cppunit/emf/data/TestEllipseXformIntersectClipRect.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 0h3000v2000h-3000z");
@ -725,8 +710,7 @@ void Test::TestDrawPolyLine16WithClip()
= parseEmf(u"/emfio/qa/cppunit/emf/data/TestDrawPolyLine16WithClip.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 0h3943v3939h-3943z");
@ -754,8 +738,7 @@ void Test::TestFillRegion()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestFillRegion.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 0h3943v3939h-3943z");
@ -779,8 +762,7 @@ void Test::TestPolylinetoCloseStroke()
= parseEmf(u"/emfio/qa/cppunit/emf/data/TestPolylinetoCloseStroke.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "polygonhairline", 2);
@ -807,8 +789,7 @@ void Test::TestExtTextOutOpaqueAndClipTransform()
= parseEmf(u"/emfio/qa/cppunit/emf/data/TestExtTextOutOpaqueAndClipTransform.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "textsimpleportion", 2);
@ -862,8 +843,7 @@ void Test::TestBitBltStretchBltWMF()
= parseEmf(u"/emfio/qa/cppunit/wmf/data/TestBitBltStretchBlt.wmf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "mask/bitmap", 2);
@ -913,8 +893,7 @@ void Test::TestExtTextOutOpaqueAndClipWMF()
= parseEmf(u"/emfio/qa/cppunit/wmf/data/TestExtTextOutOpaqueAndClip.wmf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
#ifdef MACOSX
@ -964,8 +943,7 @@ void Test::TestPaletteWMF()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/wmf/data/TestPalette.wmf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "mask/polypolygoncolor", 2);
@ -995,8 +973,7 @@ void Test::TestRestoreDCWMF()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/wmf/data/TestRestoreDC.wmf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "polypolygoncolor", 3);
@ -1024,8 +1001,7 @@ void Test::TestRoundrectWMF()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/wmf/data/TestRoundRect.wmf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "polypolygoncolor", "color", "#ffffff");
@ -1066,8 +1042,7 @@ void Test::TestStretchDIBWMF()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/wmf/data/TestStretchDIB.wmf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "mask/bitmap", "xy11", "12065");
@ -1095,8 +1070,7 @@ void Test::TestPolyLineWidth()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestPolyLineWidth.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "polypolygoncolor/polypolygon", "path",
@ -1115,8 +1089,7 @@ void Test::TestRestoreDC()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestRestoreDC.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "polypolygoncolor", "color", "#ff0000");
@ -1133,8 +1106,7 @@ void Test::TestRoundRect()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestRoundRect.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "polypolygoncolor", 2);
@ -1186,8 +1158,7 @@ void Test::TestCreatePen()
Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestCreatePen.emf");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument
= dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT(pDocument);
assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 0h31250v18192h-31250z");

View file

@ -24,7 +24,7 @@
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/sequence.hxx>
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <vcl/outdev.hxx>
#include <vcl/svapp.hxx>
@ -202,7 +202,7 @@ namespace emfio::emfreader
SAL_WARN("emfio", "Invalid stream (!)");
}
return comphelper::containerToSequence(aRetval);
return aRetval.toSequence();
}
void XEmfParser::setSizeHint(const geometry::RealPoint2D& rSize)

View file

@ -49,6 +49,7 @@ $(eval $(call gb_Library_use_libraries,pdffilter,\
cppuhelper \
cppu \
sal \
salhelper \
drawinglayer \
drawinglayercore \
))

View file

@ -13,6 +13,7 @@
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/pdfread.hxx>
#include <vcl/svapp.hxx>
@ -89,8 +90,11 @@ XPdfDecomposer::getDecomposition(const uno::Reference<util::XBinaryDataContainer
0));
// create primitive
return { new drawinglayer::primitive2d::BitmapPrimitive2D(
VCLUnoHelper::CreateVCLXBitmap(aReplacement), aBitmapTransform) };
return drawinglayer::primitive2d::Primitive2DContainer{
new drawinglayer::primitive2d::BitmapPrimitive2D(
VCLUnoHelper::CreateVCLXBitmap(aReplacement), aBitmapTransform)
}
.toSequence();
}
OUString SAL_CALL XPdfDecomposer::getImplementationName()

View file

@ -45,6 +45,7 @@
#include <tools/zcodec.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
#include "svgfilter.hxx"
@ -258,15 +259,10 @@ bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescripto
for(const auto& rCandidate : aContainer)
{
if(rCandidate.is())
if(rCandidate && PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D != rCandidate->getPrimitive2DID())
{
auto pBasePrimitive = static_cast< const drawinglayer::primitive2d::BasePrimitive2D* >(rCandidate.get());
if(PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D != pBasePrimitive->getPrimitive2DID())
{
bAllAreHiddenGeometry = false;
break;
}
bAllAreHiddenGeometry = false;
break;
}
}

View file

@ -29,6 +29,14 @@ convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSeq,
const geometry::ViewInformation2D& rViewInformation2D, sal_uInt32 nDiscreteWidth,
sal_uInt32 nDiscreteHeight, sal_uInt32 nMaxSquarePixels);
// helper to convert any Primitive2DSequence to a good quality BitmapEx,
// using default parameters
BitmapEx DRAWINGLAYER_DLLPUBLIC convertPrimitive2DContainerToBitmapEx(
drawinglayer::primitive2d::Primitive2DContainer&& rSeq, const basegfx::B2DRange& rTargetRange,
const sal_uInt32 nMaximumQuadraticPixels = 500000,
const o3tl::Length eTargetUnit = o3tl::Length::mm100,
const std::optional<Size>& rTargetDPI = std::nullopt);
} // end of namespace drawinglayer
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -20,7 +20,7 @@
#pragma once
#include <drawinglayer/drawinglayerdllapi.h>
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
namespace drawinglayer::geometry

View file

@ -20,11 +20,13 @@
#pragma once
#include <com/sun/star/graphic/XPrimitive2D.hpp>
#include <rtl/ref.hxx>
namespace drawinglayer::primitive2d
{
typedef css::uno::Reference<css::graphic::XPrimitive2D> Primitive2DReference;
typedef css::uno::Sequence<Primitive2DReference> Primitive2DSequence;
class BasePrimitive2D;
typedef rtl::Reference<BasePrimitive2D> Primitive2DReference;
typedef css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>> Primitive2DSequence;
} // end of namespace drawinglayer::primitive2d

View file

@ -21,6 +21,7 @@
#include <drawinglayer/drawinglayerdllapi.h>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/primitive2d/CommonTypes.hxx>
#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx>
@ -70,6 +71,9 @@ public:
: deque(first, last)
{
}
Primitive2DContainer(
const css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>>&);
Primitive2DContainer(const std::deque<css::uno::Reference<css::graphic::XPrimitive2D>>&);
virtual void visit(const Primitive2DReference& rSource) override { append(rSource); }
virtual void visit(const Primitive2DContainer& rSource) override { append(rSource); }
@ -93,6 +97,8 @@ public:
bool operator!=(const Primitive2DContainer& rB) const { return !operator==(rB); }
basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& aViewInformation) const;
Primitive2DContainer maybeInvert(bool bInvert = false) const;
css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>> toSequence() const;
};
} // end of namespace drawinglayer::primitive2d

View file

@ -22,13 +22,9 @@
#include <drawinglayer/drawinglayerdllapi.h>
#include <drawinglayer/primitive2d/CommonTypes.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <basegfx/range/b2drange.hxx>
namespace drawinglayer::geometry
{
class ViewInformation2D;
}
namespace drawinglayer::primitive2d
{
/// get B2DRange from a given Primitive2DReference
@ -41,6 +37,13 @@ basegfx::B2DRange DRAWINGLAYERCORE_DLLPUBLIC getB2DRangeFromPrimitive2DReference
bool DRAWINGLAYERCORE_DLLPUBLIC arePrimitive2DReferencesEqual(const Primitive2DReference& rA,
const Primitive2DReference& rB);
/** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
and using compare operator
*/
bool DRAWINGLAYERCORE_DLLPUBLIC
arePrimitive2DReferencesEqual(const css::uno::Reference<css::graphic::XPrimitive2D>& rA,
const css::uno::Reference<css::graphic::XPrimitive2D>& rB);
OUString DRAWINGLAYERCORE_DLLPUBLIC idToString(sal_uInt32 nId);
} // end of namespace drawinglayer::primitive2d

View file

@ -31,6 +31,9 @@
#include <com/sun/star/util/XAccounting.hpp>
#include <basegfx/range/b2drange.hxx>
#include <com/sun/star/graphic/XPrimitive2D.hpp>
#include <salhelper/simplereferenceobject.hxx>
#include <rtl/ref.hxx>
#include <deque>
#include <mutex>
namespace drawinglayer::geometry
@ -147,7 +150,7 @@ namespace drawinglayer::primitive2d
for view-independent primitives which are defined by not using ViewInformation2D
in their get2DDecomposition/getB2DRange implementations.
*/
class DRAWINGLAYERCORE_DLLPUBLIC BasePrimitive2D : public BasePrimitive2DImplBase
class DRAWINGLAYERCORE_DLLPUBLIC BasePrimitive2D : public salhelper::SimpleReferenceObject
{
BasePrimitive2D(const BasePrimitive2D&) = delete;
BasePrimitive2D& operator=(const BasePrimitive2D&) = delete;
@ -180,6 +183,54 @@ public:
// Methods from XPrimitive2D
/** The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It
will construct a ViewInformation2D from the ViewParameters for that purpose
*/
virtual Primitive2DContainer
getDecomposition(const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters);
/** The getRange implementation for UNO API will use getRange from this implementation. It
will construct a ViewInformation2D from the ViewParameters for that purpose
*/
virtual css::geometry::RealRectangle2D
getRange(const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters);
// XAccounting
virtual sal_Int64 estimateUsage();
};
/**
Rather than make all the BasePrimitive2D classes bear the cost of being an UNO
object, we just wrap the top level BasePrimitive2D in this class when we need
to pass them over UNO
*/
class DRAWINGLAYERCORE_DLLPUBLIC UnoPrimitive2D final : public BasePrimitive2DImplBase
{
UnoPrimitive2D(const UnoPrimitive2D&) = delete;
UnoPrimitive2D& operator=(const UnoPrimitive2D&) = delete;
public:
// constructor/destructor
UnoPrimitive2D(const rtl::Reference<BasePrimitive2D>& rPrimitive)
: mxPrimitive(rPrimitive)
{
}
virtual ~UnoPrimitive2D() override;
/// The default implementation will use getDecomposition results to create the range
basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
/** provide unique ID for fast identifying of known primitive implementations in renderers. These use
the defines from drawinglayer_primitivetypes2d.hxx to define unique IDs.
*/
sal_uInt32 getPrimitive2DID() const;
/// The default implementation will return an empty sequence
void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation) const;
// Methods from XPrimitive2D
/** The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It
will construct a ViewInformation2D from the ViewParameters for that purpose
*/
@ -194,6 +245,11 @@ public:
// XAccounting
virtual sal_Int64 SAL_CALL estimateUsage() override;
rtl::Reference<BasePrimitive2D> const& getBasePrimitive2D() const { return mxPrimitive; }
private:
rtl::Reference<BasePrimitive2D> mxPrimitive;
};
} // end of namespace drawinglayer::primitive2d

View file

@ -67,7 +67,7 @@ public:
getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
// XAccounting
virtual sal_Int64 SAL_CALL estimateUsage() override;
virtual sal_Int64 estimateUsage() override;
/// provide unique ID
virtual sal_uInt32 getPrimitive2DID() const override;

View file

@ -85,7 +85,7 @@ namespace drawinglayer::primitive2d
virtual sal_uInt32 getPrimitive2DID() const override;
// XAccounting
virtual sal_Int64 SAL_CALL estimateUsage() override;
virtual sal_Int64 estimateUsage() override;
};
} // end of namespace drawinglayer::primitive2d

View file

@ -85,7 +85,7 @@ namespace drawinglayer::primitive2d
virtual sal_uInt32 getPrimitive2DID() const override;
// XAccounting
virtual sal_Int64 SAL_CALL estimateUsage() override;
virtual sal_Int64 estimateUsage() override;
/// helper which creates the content - checks if clipping is needed and eventually
/// creates buffered content to speed up rendering

View file

@ -20,7 +20,7 @@
#pragma once
#include <drawinglayer/drawinglayerdllapi.h>
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
@ -39,7 +39,7 @@ namespace drawinglayer::primitive2d
{
private:
const TextSimplePortionPrimitive2D& mrSource;
Primitive2DContainer mxResult;
Primitive2DContainer mxResult;
TextLayouterDevice maTextLayouter;
basegfx::utils::B2DHomMatrixBufferedOnDemandDecompose maDecTrans;

View file

@ -21,7 +21,7 @@
#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
#include <drawinglayer/drawinglayerdllapi.h>
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
namespace basegfx { class B2DPolygon; }

View file

@ -156,7 +156,7 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWid
const drawinglayer::primitive2d::Primitive2DReference xTransformRef(
new drawinglayer::primitive2d::TransformPrimitive2D(
aTransform,
aVectorGraphicData.getPrimitive2DSequence()));
drawinglayer::primitive2d::Primitive2DContainer(aVectorGraphicData.getPrimitive2DSequence())));
// UNO dance to render from drawinglayer
@ -178,7 +178,7 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWid
const uno::Reference< rendering::XBitmap > xBitmap(
xPrimitive2DRenderer->rasterize(
drawinglayer::primitive2d::Primitive2DSequence(&xTransformRef, 1),
drawinglayer::primitive2d::Primitive2DContainer{xTransformRef}.toSequence(),
uno::Sequence< beans::PropertyValue >(),
fFakeDPI,
fFakeDPI,

View file

@ -18,6 +18,7 @@
#include <comphelper/processfactory.hxx>
#include <drawinglayer/attribute/fontattribute.hxx>
#include <drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx>
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/processor2d/processorfromoutputdevice.hxx>

View file

@ -80,6 +80,7 @@
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/docpasswordrequest.hxx>
#include <comphelper/docpasswordhelper.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <com/sun/star/uno/Reference.h>

View file

@ -35,6 +35,7 @@ $(eval $(call gb_CppunitTest_use_libraries,svgio,\
cppuhelper \
comphelper \
sal \
salhelper \
sax \
svt \
test \

View file

@ -34,6 +34,7 @@ $(eval $(call gb_CppunitTest_use_libraries,svgio_tools,\
cppu \
cppuhelper \
sal \
salhelper \
sax \
svt \
tk \

View file

@ -39,6 +39,7 @@ $(eval $(call gb_Library_use_libraries,svgio,\
cppu \
cppuhelper \
sal \
salhelper \
tk \
tl \
sax \

View file

@ -20,6 +20,7 @@
#include <drawinglayer/primitive2d/Tools.hxx>
#include <drawinglayer/tools/primitive2dxmldump.hxx>
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <memory>
#include <string_view>
@ -129,7 +130,7 @@ Primitive2DSequence Test::parseSvg(std::u16string_view aSource)
void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive)
{
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(rPrimitive));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(rPrimitive));
CPPUNIT_ASSERT (pDocument);
@ -149,8 +150,11 @@ void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive)
bool arePrimitive2DSequencesEqual(const Primitive2DSequence& rA, const Primitive2DSequence& rB)
{
return std::equal(rA.begin(), rA.end(), rB.begin(), rB.end(),
[](const Primitive2DReference& a, const Primitive2DReference& b) {
return drawinglayer::primitive2d::arePrimitive2DReferencesEqual(a, b); });
[](const css::uno::Reference<css::graphic::XPrimitive2D>& a,
const css::uno::Reference<css::graphic::XPrimitive2D>& b)
{
return drawinglayer::primitive2d::arePrimitive2DReferencesEqual(a, b);
});
}
// Attributes for an object (like rect as in this case) can be defined
@ -185,7 +189,7 @@ void Test::testTdf87309()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf87309.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf87309));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf87309);
CPPUNIT_ASSERT (pDocument);
@ -204,7 +208,7 @@ void Test::testFontsizeKeywords()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizeKeywords.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizeKeywords));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceFontsizeKeywords);
CPPUNIT_ASSERT (pDocument);
@ -267,7 +271,7 @@ void Test::testFontsizePercentage()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizePercentage.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizePercentage));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceFontsizePercentage);
CPPUNIT_ASSERT (pDocument);
@ -284,7 +288,7 @@ void Test::testFontsizeRelative()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizeRelative.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizeRelative));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceFontsizeRelative);
CPPUNIT_ASSERT (pDocument);
@ -306,7 +310,7 @@ void Test::testTdf45771()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf45771.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf45771));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf45771);
CPPUNIT_ASSERT (pDocument);
@ -323,7 +327,7 @@ void Test::testTdf97941()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97941.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97941));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf97941);
CPPUNIT_ASSERT (pDocument);
@ -339,7 +343,7 @@ void Test::testTdf104339()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf104339.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf104339));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf104339);
CPPUNIT_ASSERT (pDocument);
assertXPath(pDocument, "/primitive2D/transform/transform/transform/transform/transform/polypolygoncolor", "color", "#000000");
@ -351,7 +355,7 @@ void Test::testTdf85770()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf85770.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf85770));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf85770));
CPPUNIT_ASSERT (pDocument);
@ -377,7 +381,7 @@ void Test::testTdf79163()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf79163.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf79163));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf79163));
CPPUNIT_ASSERT (pDocument);
@ -390,7 +394,7 @@ void Test::testTdf97542_1()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97542_1.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97542_1));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf97542_1));
CPPUNIT_ASSERT (pDocument);
@ -406,7 +410,7 @@ void Test::testTdf97542_2()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97542_2.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97542_2));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf97542_2));
CPPUNIT_ASSERT (pDocument);
@ -422,7 +426,7 @@ void Test::testTdf97543()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97543.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97543));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf97543));
CPPUNIT_ASSERT (pDocument);
@ -441,7 +445,7 @@ void Test::testRGBColor()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBColor.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBColor));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceRGBColor));
CPPUNIT_ASSERT (pDocument);
@ -460,7 +464,7 @@ void Test::testRGBAColor()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBAColor.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBAColor));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceRGBAColor));
CPPUNIT_ASSERT (pDocument);
@ -473,7 +477,7 @@ void Test::testNoneColor()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBAColor.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceRGBAColor));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceRGBAColor));
CPPUNIT_ASSERT (pDocument);
@ -490,7 +494,7 @@ void Test::testTdf97936()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97936.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97936));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf97936));
CPPUNIT_ASSERT (pDocument);
@ -518,7 +522,7 @@ void Test::testClipPathAndParentStyle()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndParentStyle.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceClipPathAndParentStyle));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndParentStyle));
CPPUNIT_ASSERT (pDocument);
@ -536,7 +540,7 @@ void Test::testClipPathAndStyle()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceClipPathAndStyle));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle));
CPPUNIT_ASSERT (pDocument);
@ -553,7 +557,7 @@ void Test::testi125329()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequencei125329.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequencei125329));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequencei125329));
CPPUNIT_ASSERT (pDocument);
@ -576,7 +580,7 @@ void Test::testMaskingPath07b()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskingPath07b.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceMaskingPath07b));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceMaskingPath07b));
CPPUNIT_ASSERT (pDocument);
@ -588,7 +592,7 @@ void Test::test123926()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence123926.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence123926));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence123926));
CPPUNIT_ASSERT (pDocument);
@ -602,7 +606,7 @@ void Test::test47446()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence47446.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence47446));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence47446));
CPPUNIT_ASSERT (pDocument);
@ -617,7 +621,7 @@ void Test::test47446b()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence47446b.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence47446b));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence47446b));
CPPUNIT_ASSERT (pDocument);
@ -632,7 +636,7 @@ void Test::testMaskText()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskText.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceMaskText));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceMaskText));
CPPUNIT_ASSERT (pDocument);
@ -650,7 +654,7 @@ void Test::testTdf99994()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf99994.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf99994));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf99994));
CPPUNIT_ASSERT (pDocument);
@ -667,7 +671,7 @@ void Test::testTdf99115()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf99115.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf99115) );
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf99115) );
CPPUNIT_ASSERT (pDocument);
@ -716,7 +720,7 @@ void Test::testTdf101237()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf101237.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf101237));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf101237));
CPPUNIT_ASSERT (pDocument);
@ -731,7 +735,7 @@ void Test::testTdf94765()
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf94765.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf94765));
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf94765));
CPPUNIT_ASSERT (pDocument);
@ -762,7 +766,7 @@ void Test::testBehaviourWhenWidthAndHeightIsOrIsNotSet()
basegfx::B2DRange aRange;
uno::Sequence<beans::PropertyValue> aViewParameters;
for (Primitive2DReference const & xReference : aSequence)
for (css::uno::Reference<css::graphic::XPrimitive2D> const & xReference : aSequence)
{
if (xReference.is())
{
@ -787,7 +791,7 @@ void Test::testBehaviourWhenWidthAndHeightIsOrIsNotSet()
basegfx::B2DRange aRange;
uno::Sequence<beans::PropertyValue> aViewParameters;
for (Primitive2DReference const & xReference : aSequence)
for (css::uno::Reference<css::graphic::XPrimitive2D> const & xReference : aSequence)
{
if (xReference.is())
{

View file

@ -141,7 +141,7 @@ namespace svgio::svgreader
OSL_ENSURE(false, "Invalid stream (!)");
}
return comphelper::containerToSequence(aRetval);
return aRetval.toSequence();
}
uno::Any SAL_CALL XSvgParser::getDrawCommands(

View file

@ -38,6 +38,7 @@
#include <vcl/svapp.hxx>
#include <drawinglayer/processor2d/processor2dtools.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <bitmaps.hlst>

View file

@ -36,7 +36,7 @@ css::uno::Sequence< css::uno::Reference< css::graphic::XPrimitive2D > > SAL_CALL
const sdr::contact::ViewContact& rSource(pSource->GetViewContact());
drawinglayer::primitive2d::Primitive2DContainer aSourceVal;
rSource.getViewIndependentPrimitive2DContainer(aSourceVal);
aRetval = comphelper::containerToSequence(aSourceVal);
aRetval = aSourceVal.toSequence();
}
}
@ -75,7 +75,7 @@ css::uno::Sequence< css::uno::Reference< css::graphic::XPrimitive2D > > SAL_CALL
const sdr::contact::ViewContact& rSource(pSource->GetViewContact());
drawinglayer::primitive2d::Primitive2DContainer aSourceRetval;
rSource.getViewIndependentPrimitive2DContainer(aSourceRetval);
aRetval = comphelper::containerToSequence(aSourceRetval);
aRetval = aSourceRetval.toSequence();
}
}

View file

@ -212,7 +212,7 @@ basegfx::B2DRange getTextAnchorRange(const attribute::SdrTextAttribute& rText,
else
{
// add to decomposition
return Primitive2DReference(pNewFillPrimitive);
return pNewFillPrimitive;
}
}
@ -249,7 +249,7 @@ basegfx::B2DRange getTextAnchorRange(const attribute::SdrTextAttribute& rText,
else
{
// add to decomposition
return Primitive2DReference(pNewLinePrimitive);
return pNewLinePrimitive;
}
}

View file

@ -145,15 +145,15 @@ void SdrGrafObj::onGraphicChanged()
if (rVectorGraphicDataPtr->getType() == VectorGraphicDataType::Pdf)
return;
const drawinglayer::primitive2d::Primitive2DContainer aSequence(rVectorGraphicDataPtr->getPrimitive2DSequence());
const std::deque<css::uno::Reference<css::graphic::XPrimitive2D>>& rContainer(rVectorGraphicDataPtr->getPrimitive2DSequence());
if (aSequence.empty())
if (rContainer.empty())
return;
drawinglayer::geometry::ViewInformation2D aViewInformation2D;
drawinglayer::processor2d::ObjectInfoPrimitiveExtractor2D aProcessor(aViewInformation2D);
aProcessor.process(aSequence);
aProcessor.process(rContainer);
const drawinglayer::primitive2d::ObjectInfoPrimitive2D* pResult = aProcessor.getResult();

View file

@ -41,6 +41,7 @@
#include <svx/sdr/contact/objectcontact.hxx>
#include <svx/sdr/animation/objectanimator.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/converters.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <comphelper/lok.hxx>
#include <svx/svdviter.hxx>
@ -118,7 +119,7 @@ BitmapEx convertMetafileToBitmapEx(
rTargetRange.getRange(),
rTargetRange.getMinimum()),
rMtf));
aBitmapEx = convertPrimitive2DSequenceToBitmapEx(
aBitmapEx = drawinglayer::convertPrimitive2DContainerToBitmapEx(
drawinglayer::primitive2d::Primitive2DContainer { aMtf },
rTargetRange,
nMaximumQuadraticPixels);

View file

@ -456,14 +456,11 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
for (const drawinglayer::primitive2d::Primitive2DReference& xReference : aHitContainer)
{
if (xReference.is())
auto pBasePrimitive = xReference.get();
if (pBasePrimitive && pBasePrimitive->getPrimitive2DID() == PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D)
{
auto pBasePrimitive = static_cast<const drawinglayer::primitive2d::BasePrimitive2D*>(xReference.get());
if (pBasePrimitive->getPrimitive2DID() == PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D)
{
pTextHierarchyFieldPrimitive2D = static_cast<const drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D*>(xReference.get());
break;
}
pTextHierarchyFieldPrimitive2D = static_cast<const drawinglayer::primitive2d::TextHierarchyFieldPrimitive2D*>(pBasePrimitive);
break;
}
}

View file

@ -43,6 +43,7 @@
#include <vcl/vectorgraphicdata.hxx>
#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/converters.hxx>
#include <svx/sdr/contact/viewcontact.hxx>
#include <sdr/contact/objectcontactofobjlistpainter.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
@ -502,8 +503,8 @@ BitmapEx SdrExchangeView::GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked, const
// if we have geometry and it has a range, convert to BitmapEx using
// common tooling
aBmp = convertPrimitive2DSequenceToBitmapEx(
xPrimitives,
aBmp = drawinglayer::convertPrimitive2DContainerToBitmapEx(
std::move(xPrimitives),
aRange,
nMaximumQuadraticPixels,
eRangeUnit,

View file

@ -80,6 +80,7 @@
#include <svx/lathe3d.hxx>
#include <extrud3d.hxx>
#include <svx/sdr/contact/viewcontact.hxx>
#include <drawinglayer/converters.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
@ -748,8 +749,8 @@ uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const
}
const BitmapEx aBmp(
convertPrimitive2DSequenceToBitmapEx(
xPrimitives,
drawinglayer::convertPrimitive2DContainerToBitmapEx(
std::move(xPrimitives),
aRange));
Graphic aGraph(aBmp);

View file

@ -63,6 +63,7 @@ $(eval $(call gb_Library_use_libraries,vcl,\
cppu \
cppuhelper \
$(call gb_Helper_optional,BREAKPAD,crashreport) \
drawinglayercore \
i18nlangtag \
i18nutil \
$(if $(ENABLE_JAVA),jvmaccess) \

View file

@ -91,7 +91,7 @@ void loadFromSvg(SvStream& rStream, const OUString& sPath, BitmapEx& rBitmapEx,
geometry::RealRectangle2D aRealRect;
basegfx::B2DRange aRange;
for (Primitive2DReference const & xReference : aPrimitiveSequence)
for (css::uno::Reference<css::graphic::XPrimitive2D> const & xReference : aPrimitiveSequence)
{
if (xReference.is())
{

View file

@ -42,6 +42,7 @@
#include <vcl/metaact.hxx>
#include <impgraph.hxx>
#include <com/sun/star/graphic/XPrimitive2D.hpp>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <vcl/dibtools.hxx>
#include <map>
#include <memory>
@ -715,12 +716,16 @@ const GDIMetaFile& ImpGraphic::getGDIMetaFile() const
{
// try to cast to MetafileAccessor implementation
const css::uno::Reference< css::graphic::XPrimitive2D > xReference(aSequence[0]);
const MetafileAccessor* pMetafileAccessor = dynamic_cast< const MetafileAccessor* >(xReference.get());
if (pMetafileAccessor)
auto pUnoPrimitive = static_cast< const drawinglayer::primitive2d::UnoPrimitive2D* >(xReference.get());
if (pUnoPrimitive)
{
// it is a MetafileAccessor implementation, get Metafile
pMetafileAccessor->accessMetafile(const_cast< ImpGraphic* >(this)->maMetaFile);
const MetafileAccessor* pMetafileAccessor = dynamic_cast< const MetafileAccessor* >(pUnoPrimitive->getBasePrimitive2D().get());
if (pMetafileAccessor)
{
// it is a MetafileAccessor implementation, get Metafile
pMetafileAccessor->accessMetafile(const_cast< ImpGraphic* >(this)->maMetaFile);
}
}
}
}