[Libreoffice-commits] .: vcl/generic vcl/inc vcl/unx

2013-01-09 Thread Libreoffice Gerrit user
 vcl/generic/print/genprnpsp.cxx |1 +
 vcl/inc/vcl/jobdata.hxx |3 ++-
 vcl/unx/generic/printer/jobdata.cxx |8 +++-
 3 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 9c4d77f22d58f5b500c95f65a431628a8d8d6e6e
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Jan 9 12:44:09 2013 +

Resolves: fdo#59131 resolve default backend on printer-setup

For setting permanent defaults via spadmin we don't want to resolve the
default backend on saving default, this happens during the print
initialization stuff.

But when we tweak the printer settings for a single print job and reset 
back to
default, we need to resolve that to what backend we want

Change-Id: Iac2370624b6d248c9658fb0fbc2f2d449849d81a

diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx
index 9949eae..6800e01 100644
--- a/vcl/generic/print/genprnpsp.cxx
+++ b/vcl/generic/print/genprnpsp.cxx
@@ -584,6 +584,7 @@ sal_Bool PspSalInfoPrinter::Setup( SalFrame* pFrame, 
ImplJobSetup* pJobSetup )
 
 if( pSetupFunction( aInfo ) )
 {
+aInfo.resolveDefaultBackend();
 rtl_freeMemory( pJobSetup-mpDriverData );
 pJobSetup-mpDriverData = NULL;
 
diff --git a/vcl/inc/vcl/jobdata.hxx b/vcl/inc/vcl/jobdata.hxx
index 577e0fa..3f81877 100644
--- a/vcl/inc/vcl/jobdata.hxx
+++ b/vcl/inc/vcl/jobdata.hxx
@@ -68,7 +68,8 @@ struct VCL_DLLPUBLIC JobData
 void setCollate( bool bCollate );
 bool setPaper( int nWidth, int nHeight ); // dimensions in pt
 bool setPaperBin( int nPaperBin ); // dimensions in pt
-void setDefaultBackend( bool bUsePDF );
+void resolveDefaultBackend();
+void setDefaultBackend(bool bUsePDF);
 
 // creates a new buffer using new
 // it is up to the user to delete it again
diff --git a/vcl/unx/generic/printer/jobdata.cxx 
b/vcl/unx/generic/printer/jobdata.cxx
index 385ed02..c55f64a 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -18,9 +18,9 @@
  */
 
 
+#include officecfg/Office/Common.hxx
 #include vcl/jobdata.hxx
 #include vcl/printerinfomanager.hxx
-
 #include tools/stream.hxx
 
 #include sal/alloca.h
@@ -269,6 +269,12 @@ bool JobData::constructFromStreamBuffer( void* pData, int 
bytes, JobData rJobDa
 return bVersion  bPrinter  bOrientation  bCopies  bContext  
bMargin  bPSLevel  bPDFDevice  bColorDevice  bColorDepth;
 }
 
+void JobData::resolveDefaultBackend()
+{
+if (m_nPSLevel == 0  m_nPDFDevice == 0)
+
setDefaultBackend(officecfg::Office::Common::Print::Option::Printer::PDFAsStandardPrintJobFormat::get());
+}
+
 void JobData::setDefaultBackend(bool bUsePDF)
 {
 if (bUsePDF  m_nPSLevel == 0  m_nPDFDevice == 0)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/generic vcl/inc vcl/unx

2011-12-13 Thread Michael Meeks
 vcl/generic/app/gensys.cxx|   70 ++
 vcl/inc/generic/gensys.h  |1 
 vcl/unx/generic/plugadapt/salplug.cxx |6 ++
 vcl/unx/gtk/gdi/salprn-gtk.cxx|   67 
 vcl/unx/gtk/window/gtkframe.cxx   |2 
 5 files changed, 79 insertions(+), 67 deletions(-)

New commits:
commit b664d9290852f3f4f07ea86f9c2234df6e83b2cf
Author: Michael Meeks michael.me...@suse.com
Date:   Tue Dec 13 17:52:01 2011 +

Disable gtk3 at run-time, unless in experimental mode.

diff --git a/vcl/generic/app/gensys.cxx b/vcl/generic/app/gensys.cxx
index 2fae484..f7d3f0a 100644
--- a/vcl/generic/app/gensys.cxx
+++ b/vcl/generic/app/gensys.cxx
@@ -40,6 +40,13 @@
 #include osl/process.h
 #include osl/thread.h
 
+#include vcl/unohelp.hxx
+#include com/sun/star/beans/PropertyValue.hpp
+#include com/sun/star/container/XNameAccess.hpp
+#include com/sun/star/lang/XMultiServiceFactory.hpp
+
+using namespace com::sun::star;
+
 SalGenericSystem::SalGenericSystem()
 {
 }
@@ -174,4 +181,67 @@ rtl::OString SalGenericSystem::getFrameResName( 
SalExtStyle nStyle )
 return aBuf.makeStringAndClear();
 }
 
+bool
+SalGenericSystem::enableExperimentalFeatures()
+{
+bool bEnable = true;
+try
+{
+// get service provider
+uno::Referencelang::XMultiServiceFactory const 
xSMgr(vcl::unohelper::GetMultiServiceFactory());
+// create configuration hierachical access name
+if (xSMgr.is())
+{
+try
+{
+uno::Referencelang::XMultiServiceFactory const 
xConfigProvider(
+   uno::Referencelang::XMultiServiceFactory(
+
xSMgr-createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+
com.sun.star.configuration.ConfigurationProvider))),
+uno::UNO_QUERY))
+;
+if (xConfigProvider.is())
+{
+uno::Sequenceuno::Any aArgs(1);
+beans::PropertyValue aVal;
+aVal.Name = 
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(nodepath));
+aVal.Value = 
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(/org.openoffice.Office.Common/Misc));
+aArgs.getArray()[0] = aVal;
+uno::Referencecontainer::XNameAccess const xConfigAccess(
+uno::Referencecontainer::XNameAccess(
+xConfigProvider-createInstanceWithArguments(
+
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(com.sun.star.configuration.ConfigurationAccess)),
+aArgs),
+uno::UNO_QUERY))
+;
+if (xConfigAccess.is())
+{
+try
+{
+sal_Bool bValue = sal_False;
+uno::Any const 
aAny(xConfigAccess-getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ExperimentalMode;
+if (aAny = bValue)
+bEnable = bValue;
+}
+catch (container::NoSuchElementException const)
+{
+}
+catch (lang::WrappedTargetException const)
+{
+}
+}
+}
+}
+catch (uno::Exception const)
+{
+}
+}
+}
+catch (lang::WrappedTargetException const)
+{
+}
+
+return bEnable;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/generic/gensys.h b/vcl/inc/generic/gensys.h
index e485cc5..fd21110 100644
--- a/vcl/inc/generic/gensys.h
+++ b/vcl/inc/generic/gensys.h
@@ -57,6 +57,7 @@ class VCL_DLLPUBLIC SalGenericSystem : public SalSystem
 static const char *getFrameResName();
 static const char *getFrameClassName();
 static rtl::OString getFrameResName( SalExtStyle nStyle );
+static boolenableExperimentalFeatures();
 };
 
 #endif // _SV_GENSYS_H
diff --git a/vcl/unx/generic/plugadapt/salplug.cxx 
b/vcl/unx/generic/plugadapt/salplug.cxx
index 9e6f47f..9bd9781 100644
--- a/vcl/unx/generic/plugadapt/salplug.cxx
+++ b/vcl/unx/generic/plugadapt/salplug.cxx
@@ -33,6 +33,7 @@
 #include rtl/ustrbuf.hxx
 
 #include salinst.hxx
+#include generic/gensys.h
 #include generic/gendata.hxx
 #include unx/desktops.hxx
 #include vcl/printerinfomanager.hxx
@@ -52,6 +53,11 @@ static SalInstance* tryInstance( const OUString rModuleBase 
)
 {
 SalInstance* pInst = NULL;
 
+// Disable gtk3 plugin load except in experimental mode for now.
+if( rModuleBase.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( gtk3 ) ) 
+!SalGenericSystem::enableExperimentalFeatures() )
+