remove dependency from drawinglayer to framework
to try and untangle the dependency mess a little.
This means
(*) tunneling a piece of information from VCLXWindow via
the XWindowPeer::getProperty method, so
we do not need to directly call VCLXWindow.
(*) moving some formpdf code from framework "down" to vcl,
where the drawinglayer code can use it
Change-Id: I2c1ff3e34941b3147e66cf0a2d0fdb13293e3aa2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144341
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index 8945e1c4..5a3c80b 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -47,7 +47,6 @@ $(eval $(call gb_Library_use_libraries,drawinglayer,\
salhelper \
svl \
svt \
tk \
tl \
vcl \
))
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index c776319..6fe6e57 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -19,6 +19,7 @@
#include <drawinglayer/primitive2d/controlprimitive2d.hxx>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/awt/XVclWindowPeer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/awt/XControl.hpp>
@@ -145,16 +146,11 @@ namespace drawinglayer::primitive2d
if(xControl.is())
{
uno::Reference<awt::XWindowPeer> xWindowPeer(xControl->getPeer());
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindowPeer);
if (pWindow)
if (xWindowPeer)
{
pWindow = pWindow->GetParent();
if(pWindow && MapUnit::Map100thMM == pWindow->GetMapMode().GetMapUnit())
{
bUserIs100thmm = true;
}
uno::Reference<awt::XVclWindowPeer> xPeerProps(xWindowPeer, uno::UNO_QUERY_THROW);
uno::Any aAny = xPeerProps->getProperty("ParentIs100thmm"); // see VCLXWindow::getProperty
aAny >>= bUserIs100thmm;
}
}
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 3b3f27b..33257f4 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -38,7 +38,7 @@
#include <vcl/graphictools.hxx>
#include <vcl/metaact.hxx>
#include <vcl/graph.hxx> // for PDFExtOutDevData Graphic support
#include <toolkit/helper/formpdfexport.hxx> // for PDFExtOutDevData Graphic support
#include <vcl/formpdfexport.hxx> // for PDFExtOutDevData Graphic support
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
#include <drawinglayer/primitive2d/textprimitive2d.hxx>
#include <drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx>
diff --git a/include/toolkit/helper/formpdfexport.hxx b/include/vcl/formpdfexport.hxx
similarity index 93%
rename from include/toolkit/helper/formpdfexport.hxx
rename to include/vcl/formpdfexport.hxx
index d1aa35e..a2aed55 100644
--- a/include/toolkit/helper/formpdfexport.hxx
+++ b/include/vcl/formpdfexport.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_TOOLKIT_HELPER_FORMPDFEXPORT_HXX
#define INCLUDED_TOOLKIT_HELPER_FORMPDFEXPORT_HXX
#include <toolkit/dllapi.h>
#include <vcl/dllapi.h>
#include <vcl/pdfwriter.hxx>
@@ -41,7 +41,7 @@ namespace toolkitform
/** creates a PDF compatible control descriptor for the given control
*/
std::unique_ptr<vcl::PDFWriter::AnyWidget> TOOLKIT_DLLPUBLIC describePDFControl(
std::unique_ptr<vcl::PDFWriter::AnyWidget> VCL_DLLPUBLIC describePDFControl(
const css::uno::Reference< css::awt::XControl >& _rxControl,
vcl::PDFExtOutDevData& i_pdfExportData
);
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index f6a4b82..0fa8c84 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -6129,7 +6129,6 @@ include/toolkit/controls/unocontrolmodel.hxx
include/toolkit/controls/unocontrols.hxx
include/toolkit/helper/accessiblefactory.hxx
include/toolkit/helper/convert.hxx
include/toolkit/helper/formpdfexport.hxx
include/toolkit/helper/listenermultiplexer.hxx
include/toolkit/helper/macros.hxx
include/toolkit/helper/mutexandbroadcasthelper.hxx
@@ -6323,6 +6322,7 @@ include/vcl/fntstyle.hxx
include/vcl/font.hxx
include/vcl/fontcapabilities.hxx
include/vcl/fontcharmap.hxx
include/vcl/formpdfexport.hxx
include/vcl/gdimtf.hxx
include/vcl/gfxlink.hxx
include/vcl/gradient.hxx
@@ -13670,7 +13670,6 @@ toolkit/source/hatchwindow/ipwin.cxx
toolkit/source/hatchwindow/ipwin.hxx
toolkit/source/helper/accessibilityclient.cxx
toolkit/source/helper/btndlg.cxx
toolkit/source/helper/formpdfexport.cxx
toolkit/source/helper/imagealign.cxx
toolkit/source/helper/listenermultiplexer.cxx
toolkit/source/helper/property.cxx
@@ -14766,6 +14765,7 @@ vcl/source/gdi/VerticalOrientationData.cxx
vcl/source/gdi/configsettings.cxx
vcl/source/gdi/cvtgrf.cxx
vcl/source/gdi/embeddedfontshelper.cxx
vcl/source/gdi/formpdfexport.cxx
vcl/source/gdi/gdimetafiletools.cxx
vcl/source/gdi/gdimtf.cxx
vcl/source/gdi/gfxlink.cxx
diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk
index 266f64d..75ae962 100644
--- a/toolkit/Library_tk.mk
+++ b/toolkit/Library_tk.mk
@@ -125,7 +125,6 @@ $(eval $(call gb_Library_add_exception_objects,tk,\
toolkit/source/hatchwindow/ipwin \
toolkit/source/helper/accessibilityclient \
toolkit/source/helper/btndlg \
toolkit/source/helper/formpdfexport \
toolkit/source/helper/imagealign \
toolkit/source/helper/listenermultiplexer \
toolkit/source/helper/property \
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 98342be..d00bcf7 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -1953,6 +1953,21 @@ css::uno::Any VCLXWindow::getProperty( const OUString& PropertyName )
css::uno::Any aProp;
if ( GetWindow() )
{
if (PropertyName == "ParentIs100thmm")
{
bool bParentIs100thmm = false;
VclPtr<vcl::Window> pWindow = GetWindow();
if (pWindow)
{
pWindow = pWindow->GetParent();
if(pWindow && MapUnit::Map100thMM == pWindow->GetMapMode().GetMapUnit())
{
bParentIs100thmm = true;
}
}
aProp <<= bParentIs100thmm;
return aProp;
}
WindowType eWinType = GetWindow()->GetType();
sal_uInt16 nPropType = GetPropertyId( PropertyName );
switch ( nPropType )
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index cff520c..74e8ff6 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -263,6 +263,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/source/treelist/uiobject \
vcl/source/text/ImplLayoutRuns \
vcl/source/text/mnemonic \
vcl/source/gdi/formpdfexport \
vcl/source/gdi/configsettings \
vcl/source/gdi/cvtgrf \
vcl/source/gdi/embeddedfontshelper \
diff --git a/toolkit/source/helper/formpdfexport.cxx b/vcl/source/gdi/formpdfexport.cxx
similarity index 95%
rename from toolkit/source/helper/formpdfexport.cxx
rename to vcl/source/gdi/formpdfexport.cxx
index d03b866..3850d35 100644
--- a/toolkit/source/helper/formpdfexport.cxx
+++ b/vcl/source/gdi/formpdfexport.cxx
@@ -19,7 +19,7 @@
#include <memory>
#include <toolkit/helper/formpdfexport.hxx>
#include <vcl/formpdfexport.hxx>
#include <comphelper/diagnose_ex.hxx>
#include <tools/lineend.hxx>
#include <unordered_map>
@@ -39,11 +39,46 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/pdfextoutdevdata.hxx>
#include <vcl/unohelp.hxx>
#include <algorithm>
#include <iterator>
static vcl::Font CreateFont( const css::awt::FontDescriptor& rDescr )
{
vcl::Font aFont;
if ( !rDescr.Name.isEmpty() )
aFont.SetFamilyName( rDescr.Name );
if ( !rDescr.StyleName.isEmpty() )
aFont.SetStyleName( rDescr.StyleName );
if ( rDescr.Height )
aFont.SetFontSize( Size( rDescr.Width, rDescr.Height ) );
if ( static_cast<FontFamily>(rDescr.Family) != FAMILY_DONTKNOW )
aFont.SetFamily( static_cast<FontFamily>(rDescr.Family) );
if ( static_cast<rtl_TextEncoding>(rDescr.CharSet) != RTL_TEXTENCODING_DONTKNOW )
aFont.SetCharSet( static_cast<rtl_TextEncoding>(rDescr.CharSet) );
if ( static_cast<FontPitch>(rDescr.Pitch) != PITCH_DONTKNOW )
aFont.SetPitch( static_cast<FontPitch>(rDescr.Pitch) );
if ( rDescr.CharacterWidth )
aFont.SetWidthType(vcl::unohelper::ConvertFontWidth(rDescr.CharacterWidth));
if ( rDescr.Weight )
aFont.SetWeight(vcl::unohelper::ConvertFontWeight(rDescr.Weight));
if ( rDescr.Slant != css::awt::FontSlant_DONTKNOW )
aFont.SetItalic(vcl::unohelper::ConvertFontSlant(rDescr.Slant));
if ( static_cast<FontLineStyle>(rDescr.Underline) != LINESTYLE_DONTKNOW )
aFont.SetUnderline( static_cast<FontLineStyle>(rDescr.Underline) );
if ( static_cast<FontStrikeout>(rDescr.Strikeout) != STRIKEOUT_DONTKNOW )
aFont.SetStrikeout( static_cast<FontStrikeout>(rDescr.Strikeout) );
// Not DONTKNOW
aFont.SetOrientation( Degree10(static_cast<sal_Int16>(rDescr.Orientation * 10)) );
aFont.SetKerning( static_cast<FontKerning>(rDescr.Kerning) );
aFont.SetWordLineMode( rDescr.WordLineMode );
return aFont;
}
namespace toolkitform
{
@@ -442,7 +477,7 @@ namespace toolkitform
FontDescriptor aUNOFont;
if( ! (xModelProps->getPropertyValue( FM_PROP_FONT ) >>= aUNOFont) )
SAL_WARN("toolkit.helper", "describePDFControl: unable to get property " << FM_PROP_FONT);
Descriptor->TextFont = VCLUnoHelper::CreateFont( aUNOFont, vcl::Font() );
Descriptor->TextFont = CreateFont( aUNOFont );
}
// tab order