vcl/inc/pdf/pdfwriter_impl.hxx    |    3 ++-
 vcl/source/gdi/pdfwriter_impl.cxx |   14 +++++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit da42c917c49940b3507b72fcd8f603331d922244
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Oct 3 09:01:56 2022 +0100
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Mon Oct 3 15:49:22 2022 +0200

    tdf#150786 use the same colors for pdf widgets regardless of theme
    
    use StyleSettings::SetStandardStyles()
    
    Change-Id: Idf08872fabfe50cbc73091e17dd3ad7a4acc6715
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140878
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index d718529476b9..0919414c4dc5 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -55,11 +55,11 @@
 #include <vcl/BinaryDataContainer.hxx>
 
 #include <vcl/filter/pdfobjectcontainer.hxx>
+#include <vcl/settings.hxx>
 #include <pdf/ExternalPDFStreams.hxx>
 #include <pdf/pdfbuildin_fonts.hxx>
 #include <pdf/pdffontcache.hxx>
 
-class StyleSettings;
 class FontSubsetInfo;
 class ZCodec;
 class EncHashTransporter;
@@ -664,6 +664,7 @@ private:
     void DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& 
rEndPoint) override;
 
     MapMode                             m_aMapMode; // PDFWriterImpl scaled 
units
+    StyleSettings                       m_aWidgetStyleSettings;
     std::vector< PDFPage >              m_aPages;
     /* maps object numbers to file offsets (needed for xref) */
     std::vector< sal_uInt64 >           m_aObjects;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 4577eff96b86..e28f1fa75997 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1196,6 +1196,7 @@ PDFWriterImpl::PDFWriterImpl( const 
PDFWriter::PDFWriterContext& rContext,
                                PDFWriter& i_rOuterFace)
         : VirtualDevice(Application::GetDefaultDevice(), 
DeviceFormat::DEFAULT, DeviceFormat::NONE, OUTDEV_PDF),
         m_aMapMode( MapUnit::MapPoint, Point(), Fraction( 1, pointToPixel(1) 
), Fraction( 1, pointToPixel(1) ) ),
+        m_aWidgetStyleSettings(Application::GetSettings().GetStyleSettings()),
         m_nCurrentStructElement( 0 ),
         m_bEmitStructure( true ),
         m_nNextFID( 1 ),
@@ -1231,6 +1232,9 @@ PDFWriterImpl::PDFWriterImpl( const 
PDFWriter::PDFWriterContext& rContext,
     aFont.SetFamilyName( "Times" );
     aFont.SetFontSize( Size( 0, 12 ) );
 
+    // tdf#150786 use the same settings for widgets regardless of theme
+    m_aWidgetStyleSettings.SetStandardStyles();
+
     GraphicsState aState;
     aState.m_aMapMode       = m_aMapMode;
     aState.m_aFont          = aFont;
@@ -3633,7 +3637,7 @@ static const Color& replaceColor( const Color& rCol1, 
const Color& rCol2 )
 
 void PDFWriterImpl::createDefaultPushButtonAppearance( PDFWidget& rButton, 
const PDFWriter::PushButtonWidget& rWidget )
 {
-    const StyleSettings& rSettings = 
Application::GetSettings().GetStyleSettings();
+    const StyleSettings& rSettings = m_aWidgetStyleSettings;
 
     // save graphics state
     push( PushFlags::ALL );
@@ -3740,7 +3744,7 @@ Font PDFWriterImpl::drawFieldBorder( PDFWidget& rIntern,
 
 void PDFWriterImpl::createDefaultEditAppearance( PDFWidget& rEdit, const 
PDFWriter::EditWidget& rWidget )
 {
-    const StyleSettings& rSettings = 
Application::GetSettings().GetStyleSettings();
+    const StyleSettings& rSettings = m_aWidgetStyleSettings;
     SvMemoryStream* pEditStream = new SvMemoryStream( 1024, 1024 );
 
     push( PushFlags::ALL );
@@ -3786,7 +3790,7 @@ void PDFWriterImpl::createDefaultEditAppearance( 
PDFWidget& rEdit, const PDFWrit
 
 void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const 
PDFWriter::ListBoxWidget& rWidget )
 {
-    const StyleSettings& rSettings = 
Application::GetSettings().GetStyleSettings();
+    const StyleSettings& rSettings = m_aWidgetStyleSettings;
     SvMemoryStream* pListBoxStream = new SvMemoryStream( 1024, 1024 );
 
     push( PushFlags::ALL );
@@ -3831,7 +3835,7 @@ void PDFWriterImpl::createDefaultListBoxAppearance( 
PDFWidget& rBox, const PDFWr
 
 void PDFWriterImpl::createDefaultCheckBoxAppearance( PDFWidget& rBox, const 
PDFWriter::CheckBoxWidget& rWidget )
 {
-    const StyleSettings& rSettings = 
Application::GetSettings().GetStyleSettings();
+    const StyleSettings& rSettings = m_aWidgetStyleSettings;
 
     // save graphics state
     push( PushFlags::ALL );
@@ -3971,7 +3975,7 @@ void PDFWriterImpl::createDefaultCheckBoxAppearance( 
PDFWidget& rBox, const PDFW
 
 void PDFWriterImpl::createDefaultRadioButtonAppearance( PDFWidget& rBox, const 
PDFWriter::RadioButtonWidget& rWidget )
 {
-    const StyleSettings& rSettings = 
Application::GetSettings().GetStyleSettings();
+    const StyleSettings& rSettings = m_aWidgetStyleSettings;
 
     // save graphics state
     push( PushFlags::ALL );

Reply via email to