24#include <com/sun/star/beans/PropertyValue.hpp>
25#include <com/sun/star/beans/XPropertySet.hpp>
26#include <com/sun/star/configuration/theDefaultProvider.hpp>
27#include <com/sun/star/container/XNameAccess.hpp>
28#include <com/sun/star/uno/XComponentContext.hpp>
29#include <com/sun/star/lang/XMultiServiceFactory.hpp>
33void Options::ReadFromConfig(
bool i_bFile)
35 bool bSuccess =
false;
40 css::uno::Reference<css::lang::XMultiServiceFactory> xConfigProvider;
41 css::uno::Reference<css::container::XNameAccess> xConfigAccess;
45 css::uno::Reference<css::uno::XComponentContext> xContext(
50 xConfigProvider = css::configuration::theDefaultProvider::get(xContext);
52 css::beans::PropertyValue aVal;
53 aVal.Name =
"nodepath";
55 aVal.Value <<= OUString(
"/org.openoffice.Office.Common/Print/Option/File");
57 aVal.Value <<= OUString(
"/org.openoffice.Office.Common/Print/Option/Printer");
59 xConfigProvider->createInstanceWithArguments(
60 "com.sun.star.configuration.ConfigurationAccess", { css::uno::Any(aVal) }),
62 if (xConfigAccess.is())
64 css::uno::Reference<css::beans::XPropertySet> xSet(xConfigAccess,
70 if (xSet->getPropertyValue(
"ReduceTransparency") >>= bValue)
71 SetReduceTransparency(bValue);
72 if (xSet->getPropertyValue(
"ReducedTransparencyMode") >>= nValue)
74 if (xSet->getPropertyValue(
"ReduceGradients") >>= bValue)
75 SetReduceGradients(bValue);
76 if (xSet->getPropertyValue(
"ReducedGradientMode") >>= nValue)
77 SetReducedGradientMode(
static_cast<GradientMode>(nValue));
78 if (xSet->getPropertyValue(
"ReducedGradientStepCount") >>= nValue)
79 SetReducedGradientStepCount(
static_cast<sal_uInt16
>(nValue));
80 if (xSet->getPropertyValue(
"ReduceBitmaps") >>= bValue)
81 SetReduceBitmaps(bValue);
82 if (xSet->getPropertyValue(
"ReducedBitmapMode") >>= nValue)
83 SetReducedBitmapMode(
static_cast<BitmapMode>(nValue));
84 if (xSet->getPropertyValue(
"ReducedBitmapResolution") >>= nValue)
85 SetReducedBitmapResolution(
static_cast<sal_uInt16
>(nValue));
86 if (xSet->getPropertyValue(
"ReducedBitmapIncludesTransparency") >>= bValue)
87 SetReducedBitmapIncludesTransparency(bValue);
88 if (xSet->getPropertyValue(
"ConvertToGreyscales") >>= bValue)
89 SetConvertToGreyscales(bValue);
90 if (xSet->getPropertyValue(
"PDFAsStandardPrintJobFormat") >>= bValue)
91 SetPDFAsStandardPrintJobFormat(bValue);
97 catch (
const css::uno::Exception&)
101 catch (
const css::lang::WrappedTargetException&)
Reference< XComponentContext > getProcessComponentContext()