summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2008-12-09 11:54:53 +0000
committerRüdiger Timm <rt@openoffice.org>2008-12-09 11:54:53 +0000
commit4c69fc8f2c08b6ee822124c686897a50785b4714 (patch)
tree6986137b2baaeae8a2bc7ad69379bf65f863a761 /svtools
parentb8db9514147779737d0db35c82a3b680b36e3f9f (diff)
CWS-TOOLING: integrate CWS configitems02_svn
2008-12-02 10:22:34 +0100 as r264664 : #i5114# truncate list also in case list size was changed externaly 2008-11-28 10:25:56 +0100 as r264530 : make gcc happy with new line at end of file 2008-11-21 09:44:40 +0100 jsk r264109 : #i96409# 2008-11-21 08:03:30 +0100 jsk r264106 : #i96409# 2008-11-21 07:55:59 +0100 jsk r264105 : #i96409# 2008-11-10 13:42:44 +0100 as r263518 : make code warning free (linux) 2008-10-21 16:38:44 +0200 as r262573 : #i51626# refactor svtools config items (at least some of them)
Diffstat (limited to 'svtools')
-rw-r--r--svtools/inc/svtools/useroptions.hxx81
-rw-r--r--svtools/qa/complex/ConfigItems/CheckConfigItems.java186
-rw-r--r--svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx400
-rw-r--r--svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx78
-rw-r--r--svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx253
-rw-r--r--svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx806
-rw-r--r--svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx211
-rw-r--r--svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx743
-rw-r--r--svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx92
-rw-r--r--svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx274
-rw-r--r--svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx78
-rw-r--r--svtools/qa/complex/ConfigItems/helper/exports.map10
-rw-r--r--svtools/qa/complex/ConfigItems/helper/makefile.mk81
-rw-r--r--svtools/qa/complex/ConfigItems/makefile.mk91
-rw-r--r--svtools/source/config/accessibilityoptions.cxx594
-rw-r--r--svtools/source/config/historyoptions.cxx1094
-rw-r--r--svtools/source/config/loghelper.hxx59
-rw-r--r--svtools/source/config/printoptions.cxx557
-rw-r--r--svtools/source/config/useroptions.cxx1186
-rw-r--r--svtools/source/config/viewoptions.cxx19
-rw-r--r--svtools/source/inc/configitems/accessibilityoptions_const.hxx58
-rw-r--r--svtools/source/inc/configitems/historyoptions_const.hxx63
-rw-r--r--svtools/source/inc/configitems/useroptions_const.hxx64
23 files changed, 5597 insertions, 1481 deletions
diff --git a/svtools/inc/svtools/useroptions.hxx b/svtools/inc/svtools/useroptions.hxx
index df5379e649a0..f5a07a2e4e79 100644
--- a/svtools/inc/svtools/useroptions.hxx
+++ b/svtools/inc/svtools/useroptions.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: useroptions.hxx,v $
- * $Revision: 1.3 $
+ * $Revision: 1.2.312.2 $
*
* This file is part of OpenOffice.org.
*
@@ -77,51 +77,50 @@ public:
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
// get the address token
- const String& GetCompany() const;
- const String& GetFirstName() const;
- const String& GetLastName() const;
- const String& GetID() const;
- const String& GetStreet() const;
- const String& GetCity() const;
- const String& GetState() const;
- const String& GetZip() const;
- const String& GetCountry() const;
- const String& GetPosition() const;
- const String& GetTitle() const;
- const String& GetTelephoneHome() const;
- const String& GetTelephoneWork() const;
- const String& GetFax() const;
- const String& GetEmail() const;
- const String& GetCustomerNumber() const;
- const String& GetFathersName() const;
- const String& GetApartment() const;
+ ::rtl::OUString GetCompany() const;
+ ::rtl::OUString GetFirstName() const;
+ ::rtl::OUString GetLastName() const;
+ ::rtl::OUString GetID() const;
+ ::rtl::OUString GetStreet() const;
+ ::rtl::OUString GetCity() const;
+ ::rtl::OUString GetState() const;
+ ::rtl::OUString GetZip() const;
+ ::rtl::OUString GetCountry() const;
+ ::rtl::OUString GetPosition() const;
+ ::rtl::OUString GetTitle() const;
+ ::rtl::OUString GetTelephoneHome() const;
+ ::rtl::OUString GetTelephoneWork() const;
+ ::rtl::OUString GetFax() const;
+ ::rtl::OUString GetEmail() const;
+ ::rtl::OUString GetCustomerNumber() const;
+ ::rtl::OUString GetFathersName() const;
+ ::rtl::OUString GetApartment() const;
- const String& GetFullName() const;
- const String& GetLocale() const;
+ ::rtl::OUString GetFullName() const;
+ ::rtl::OUString GetLocale() const;
// set the address token
- void SetCompany( const String& rNewToken );
- void SetFirstName( const String& rNewToken );
- void SetLastName( const String& rNewToken );
- void SetID( const String& rNewToken );
- void SetStreet( const String& rNewToken );
- void SetCity( const String& rNewToken );
- void SetState( const String& rNewToken );
- void SetZip( const String& rNewToken );
- void SetCountry( const String& rNewToken );
- void SetPosition( const String& rNewToken );
- void SetTitle( const String& rNewToken );
- void SetTelephoneHome( const String& rNewToken );
- void SetTelephoneWork( const String& rNewToken );
- void SetFax( const String& rNewToken );
- void SetEmail( const String& rNewToken );
- void SetCustomerNumber( const String& rNewToken );
- void SetFathersName( const String& rNewToken );
- void SetApartment( const String& rNewToken );
+ void SetCompany( const ::rtl::OUString& rNewToken );
+ void SetFirstName( const ::rtl::OUString& rNewToken );
+ void SetLastName( const ::rtl::OUString& rNewToken );
+ void SetID( const ::rtl::OUString& rNewToken );
+ void SetStreet( const ::rtl::OUString& rNewToken );
+ void SetCity( const ::rtl::OUString& rNewToken );
+ void SetState( const ::rtl::OUString& rNewToken );
+ void SetZip( const ::rtl::OUString& rNewToken );
+ void SetCountry( const ::rtl::OUString& rNewToken );
+ void SetPosition( const ::rtl::OUString& rNewToken );
+ void SetTitle( const ::rtl::OUString& rNewToken );
+ void SetTelephoneHome( const ::rtl::OUString& rNewToken );
+ void SetTelephoneWork( const ::rtl::OUString& rNewToken );
+ void SetFax( const ::rtl::OUString& rNewToken );
+ void SetEmail( const ::rtl::OUString& rNewToken );
+ void SetCustomerNumber( const ::rtl::OUString& rNewToken );
+ void SetFathersName( const ::rtl::OUString& rNewToken );
+ void SetApartment( const ::rtl::OUString& rNewToken );
sal_Bool IsTokenReadonly( USHORT nToken ) const;
- const String& GetToken(USHORT nToken) const;
+ ::rtl::OUString GetToken(USHORT nToken) const;
};
#endif // #ifndef INCLUDED_SVTOOLS_USEROPTIONS_HXX
-
diff --git a/svtools/qa/complex/ConfigItems/CheckConfigItems.java b/svtools/qa/complex/ConfigItems/CheckConfigItems.java
new file mode 100644
index 000000000000..97cc21fdec9f
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/CheckConfigItems.java
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CheckConfigItems.java,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:09:22 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+package complex.ConfigItems;
+
+import com.sun.star.beans.*;
+import com.sun.star.lang.*;
+import com.sun.star.uno.*;
+import com.sun.star.task.*;
+
+import complexlib.*;
+
+import java.lang.*;
+import java.util.*;
+
+//-----------------------------------------------
+/** @short todo document me
+ */
+public class CheckConfigItems extends ComplexTestCase
+{
+ //-------------------------------------------
+ // some const
+
+ //-------------------------------------------
+ // member
+
+ /** points to the global uno service manager. */
+ private XMultiServiceFactory m_xSmgr = null;
+
+ /** implements real config item tests in C++. */
+ private XJob m_xTest = null;
+
+ //-------------------------------------------
+ // test environment
+
+ //-------------------------------------------
+ /** @short A function to tell the framework,
+ which test functions are available.
+
+ @return All test methods.
+ @todo Think about selection of tests from outside ...
+ */
+ public String[] getTestMethodNames()
+ {
+ return new String[]
+ {
+ "checkPicklist",
+ "checkURLHistory",
+ "checkHelpBookmarks",
+ "checkPrintOptions",
+ "checkAccessibilityOptions",
+ "checkUserOptions"
+ };
+ }
+
+ //-------------------------------------------
+ /** @short Create the environment for following tests.
+
+ @descr Use either a component loader from desktop or
+ from frame
+ */
+ public void before()
+ throws java.lang.Exception
+ {
+ // get uno service manager from global test environment
+ m_xSmgr = (XMultiServiceFactory)param.getMSF();
+
+ // TODO register helper service
+
+ // create module manager
+ m_xTest = (XJob)UnoRuntime.queryInterface(
+ XJob.class,
+ m_xSmgr.createInstance("com.sun.star.comp.svtools.ConfigItemTest"));
+ }
+
+ //-------------------------------------------
+ /** @short close the environment.
+ */
+ public void after()
+ throws java.lang.Exception
+ {
+ // TODO deregister helper service
+
+ m_xTest = null;
+ m_xSmgr = null;
+ }
+
+ //-------------------------------------------
+ /** @todo document me
+ */
+ public void checkPicklist()
+ throws java.lang.Exception
+ {
+ impl_triggerTest("checkPicklist");
+ }
+
+ //-------------------------------------------
+ /** @todo document me
+ */
+ public void checkURLHistory()
+ throws java.lang.Exception
+ {
+ impl_triggerTest("checkURLHistory");
+ }
+
+ //-------------------------------------------
+ /** @todo document me
+ */
+ public void checkHelpBookmarks()
+ throws java.lang.Exception
+ {
+ impl_triggerTest("checkHelpBookmarks");
+ }
+
+ //-------------------------------------------
+ /** @todo document me
+ */
+ public void checkPrintOptions()
+ throws java.lang.Exception
+ {
+ impl_triggerTest("checkPrintOptions");
+ }
+
+ //-------------------------------------------
+ /** @todo document me
+ */
+ public void checkAccessibilityOptions()
+ throws java.lang.Exception
+ {
+ impl_triggerTest("checkAccessibilityOptions");
+ }
+
+ //-------------------------------------------
+ /** @todo document me
+ */
+ public void checkUserOptions()
+ throws java.lang.Exception
+ {
+ impl_triggerTest("checkUserOptions");
+ }
+
+ //-------------------------------------------
+ /** @todo document me
+ */
+ private void impl_triggerTest(String sTest)
+ throws java.lang.Exception
+ {
+ NamedValue[] lArgs = new NamedValue[1];
+ lArgs[0] = new NamedValue();
+ lArgs[0].Name = "Test";
+ lArgs[0].Value = sTest;
+ m_xTest.execute(lArgs);
+ }
+}
diff --git a/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx
new file mode 100644
index 000000000000..d853bf926467
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx
@@ -0,0 +1,400 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibilityOptTest.cxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#include "AccessibilityOptTest.hxx"
+#include "configitems/accessibilityoptions_const.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include <comphelper/configurationhelper.hxx>
+#include <unotools/processfactory.hxx>
+
+namespace css = ::com::sun::star;
+
+AccessibilityOptTest::AccessibilityOptTest()
+{
+ m_xCfg = css::uno::Reference< css::container::XNameAccess >(
+ ::comphelper::ConfigurationHelper::openConfig(
+ ::utl::getProcessServiceFactory(),
+ s_sAccessibility,
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY);
+}
+
+AccessibilityOptTest::~AccessibilityOptTest()
+{
+ if (m_xCfg.is())
+ m_xCfg.clear();
+}
+
+//=============================================================================
+//test GetAutoDetectSystemHC()
+void AccessibilityOptTest::impl_checkGetAutoDetectSystemHC()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bAutoDetectSystemHC;
+ sal_Bool bAutoDetectSystemHC_;
+
+ bAutoDetectSystemHC = aAccessibilityOpt.GetAutoDetectSystemHC();
+ xSet->setPropertyValue( s_sAutoDetectSystemHC, css::uno::makeAny(bAutoDetectSystemHC ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bAutoDetectSystemHC_ = aAccessibilityOpt.GetAutoDetectSystemHC();
+
+ if ( bAutoDetectSystemHC_ == bAutoDetectSystemHC )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetAutoDetectSystemHC() error!")), 0);
+}
+
+//=============================================================================
+//test GetIsForPagePreviews()
+void AccessibilityOptTest::impl_checkGetIsForPagePreviews()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsForPagePreviews ;
+ sal_Bool bIsForPagePreviews_;
+
+ bIsForPagePreviews = aAccessibilityOpt.GetIsForPagePreviews();
+ xSet->setPropertyValue( s_sIsForPagePreviews, css::uno::makeAny(bIsForPagePreviews ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsForPagePreviews_ = aAccessibilityOpt.GetIsForPagePreviews();
+
+ if ( bIsForPagePreviews_ == bIsForPagePreviews )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsForPagePreviews() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkGetIsHelpTipsDisappear()
+void AccessibilityOptTest::impl_checkGetIsHelpTipsDisappear()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsHelpTipsDisappear ;
+ sal_Bool bIsHelpTipsDisappear_;
+
+ bIsHelpTipsDisappear = aAccessibilityOpt.GetIsHelpTipsDisappear();
+ xSet->setPropertyValue( s_sIsHelpTipsDisappear, css::uno::makeAny(bIsHelpTipsDisappear ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsHelpTipsDisappear_ = aAccessibilityOpt.GetIsHelpTipsDisappear();
+
+ if ( bIsHelpTipsDisappear_ == bIsHelpTipsDisappear )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsHelpTipsDisappear() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkGetIsAllowAnimatedGraphics()
+void AccessibilityOptTest::impl_checkGetIsAllowAnimatedGraphics()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsAllowAnimatedGraphics ;
+ sal_Bool bIsAllowAnimatedGraphics_;
+
+ bIsAllowAnimatedGraphics = aAccessibilityOpt.GetIsAllowAnimatedGraphics();
+ xSet->setPropertyValue( s_sIsAllowAnimatedGraphics, css::uno::makeAny(bIsAllowAnimatedGraphics ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsAllowAnimatedGraphics_ = aAccessibilityOpt.GetIsAllowAnimatedGraphics();
+
+ if ( bIsAllowAnimatedGraphics_ == bIsAllowAnimatedGraphics )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAllowAnimatedGraphics() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkGetIsAllowAnimatedText()
+void AccessibilityOptTest::impl_checkGetIsAllowAnimatedText()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsAllowAnimatedText ;
+ sal_Bool bIsAllowAnimatedText_;
+
+ bIsAllowAnimatedText = aAccessibilityOpt.GetIsAllowAnimatedText();
+ xSet->setPropertyValue( s_sIsAllowAnimatedText, css::uno::makeAny(bIsAllowAnimatedText ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsAllowAnimatedText_ = aAccessibilityOpt.GetIsAllowAnimatedText();
+
+ if ( bIsAllowAnimatedText_ == bIsAllowAnimatedText )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAllowAnimatedText() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkGetIsAutomaticFontColor()
+void AccessibilityOptTest::impl_checkGetIsAutomaticFontColor()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsAutomaticFontColor ;
+ sal_Bool bIsAutomaticFontColor_;
+
+ bIsAutomaticFontColor = aAccessibilityOpt.GetIsAutomaticFontColor();
+ xSet->setPropertyValue( s_sIsAutomaticFontColor, css::uno::makeAny(bIsAutomaticFontColor ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsAutomaticFontColor_ = aAccessibilityOpt.GetIsAutomaticFontColor();
+
+ if ( bIsAutomaticFontColor_ == bIsAutomaticFontColor )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAutomaticFontColor() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkGetIsSystemFont()
+void AccessibilityOptTest::impl_checkGetIsSystemFont()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsSystemFont ;
+ sal_Bool bIsSystemFont_;
+
+ bIsSystemFont = aAccessibilityOpt.GetIsSystemFont();
+ xSet->setPropertyValue( s_sIsSystemFont, css::uno::makeAny(bIsSystemFont ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsSystemFont_ = aAccessibilityOpt.GetIsSystemFont();
+
+ if ( bIsSystemFont_ == bIsSystemFont )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsSystemFont() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkGetHelpTipSeconds()
+void AccessibilityOptTest::impl_checkGetHelpTipSeconds()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Int16 nHelpTipSeconds ;
+ sal_Int16 nHelpTipSeconds_;
+
+ nHelpTipSeconds = aAccessibilityOpt.GetHelpTipSeconds();
+ xSet->setPropertyValue( s_sHelpTipSeconds, css::uno::makeAny(sal_Int16(nHelpTipSeconds+1)) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ nHelpTipSeconds_ = aAccessibilityOpt.GetHelpTipSeconds();
+
+ if ( nHelpTipSeconds_ == nHelpTipSeconds )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetHelpTipSeconds() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkIsSelectionInReadonly()
+void AccessibilityOptTest::impl_checkIsSelectionInReadonly()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsSelectionInReadonly ;
+ sal_Bool bIsSelectionInReadonly_;
+
+ bIsSelectionInReadonly = aAccessibilityOpt.IsSelectionInReadonly();
+ xSet->setPropertyValue( s_sIsSelectionInReadonly, css::uno::makeAny(bIsSelectionInReadonly ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsSelectionInReadonly_ = aAccessibilityOpt.IsSelectionInReadonly();
+
+ if ( bIsSelectionInReadonly_ == bIsSelectionInReadonly )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsSelectionInReadonly() error!")), 0);
+}
+
+//=============================================================================
+//test SetAutoDetectSystemHC()
+void AccessibilityOptTest::impl_checkSetAutoDetectSystemHC()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bAutoDetectSystemHC;
+ sal_Bool bAutoDetectSystemHC_;
+
+ xSet->getPropertyValue(s_sAutoDetectSystemHC) >>= bAutoDetectSystemHC;
+ aAccessibilityOpt.SetAutoDetectSystemHC( bAutoDetectSystemHC ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sAutoDetectSystemHC) >>= bAutoDetectSystemHC_;
+
+ if ( bAutoDetectSystemHC_ == bAutoDetectSystemHC )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetAutoDetectSystemHC() error!")), 0);
+}
+
+//=============================================================================
+//test SetIsForPagePreviews()
+void AccessibilityOptTest::impl_checkSetIsForPagePreviews()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsForPagePreviews ;
+ sal_Bool bIsForPagePreviews_;
+
+ xSet->getPropertyValue(s_sIsForPagePreviews) >>= bIsForPagePreviews;
+ aAccessibilityOpt.SetIsForPagePreviews( bIsForPagePreviews ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsForPagePreviews) >>= bIsForPagePreviews_;
+
+ if ( bIsForPagePreviews_ == bIsForPagePreviews )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsForPagePreviews() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetIsHelpTipsDisappear()
+void AccessibilityOptTest::impl_checkSetIsHelpTipsDisappear()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsHelpTipsDisappear ;
+ sal_Bool bIsHelpTipsDisappear_;
+
+ xSet->getPropertyValue(s_sIsHelpTipsDisappear) >>= bIsHelpTipsDisappear;
+ aAccessibilityOpt.SetIsHelpTipsDisappear( bIsHelpTipsDisappear ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsHelpTipsDisappear) >>= bIsHelpTipsDisappear_;
+
+ if ( bIsHelpTipsDisappear_ == bIsHelpTipsDisappear )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsHelpTipsDisappear() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetIsAllowAnimatedGraphics()
+void AccessibilityOptTest::impl_checkSetIsAllowAnimatedGraphics()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsAllowAnimatedGraphics ;
+ sal_Bool bIsAllowAnimatedGraphics_;
+
+ xSet->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bIsAllowAnimatedGraphics;
+ aAccessibilityOpt.SetIsAllowAnimatedGraphics( bIsAllowAnimatedGraphics ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bIsAllowAnimatedGraphics_;
+
+ if ( bIsAllowAnimatedGraphics_ == bIsAllowAnimatedGraphics )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAllowAnimatedGraphics() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetIsAllowAnimatedText()
+void AccessibilityOptTest::impl_checkSetIsAllowAnimatedText()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsAllowAnimatedText ;
+ sal_Bool bIsAllowAnimatedText_;
+
+ xSet->getPropertyValue(s_sIsAllowAnimatedText) >>= bIsAllowAnimatedText;
+ aAccessibilityOpt.SetIsAllowAnimatedText( bIsAllowAnimatedText ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsAllowAnimatedText) >>= bIsAllowAnimatedText_;
+
+ if ( bIsAllowAnimatedText_ == bIsAllowAnimatedText )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAllowAnimatedText() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetIsAutomaticFontColor()
+void AccessibilityOptTest::impl_checkSetIsAutomaticFontColor()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsAutomaticFontColor ;
+ sal_Bool bIsAutomaticFontColor_;
+
+ xSet->getPropertyValue(s_sIsAutomaticFontColor) >>= bIsAutomaticFontColor;
+ aAccessibilityOpt.SetIsAutomaticFontColor( bIsAutomaticFontColor ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsAutomaticFontColor) >>= bIsAutomaticFontColor_;
+
+ if ( bIsAutomaticFontColor_ == bIsAutomaticFontColor )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAutomaticFontColor() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetIsSystemFont()
+void AccessibilityOptTest::impl_checkSetIsSystemFont()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsSystemFont ;
+ sal_Bool bIsSystemFont_;
+
+ xSet->getPropertyValue(s_sIsSystemFont) >>= bIsSystemFont;
+ aAccessibilityOpt.SetIsSystemFont( bIsSystemFont ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsSystemFont) >>= bIsSystemFont_;
+
+ if ( bIsSystemFont_ == bIsSystemFont )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsSystemFont() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetHelpTipSeconds()
+void AccessibilityOptTest::impl_checkSetHelpTipSeconds()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Int16 nHelpTipSeconds ;
+ sal_Int16 nHelpTipSeconds_;
+
+ xSet->getPropertyValue(s_sHelpTipSeconds) >>= nHelpTipSeconds;
+ aAccessibilityOpt.SetHelpTipSeconds( sal_Int16(nHelpTipSeconds+1) );
+ xSet->getPropertyValue(s_sHelpTipSeconds) >>= nHelpTipSeconds_;
+
+ if ( nHelpTipSeconds_ == nHelpTipSeconds )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetHelpTipSeconds() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetSelectionInReadonly()
+void AccessibilityOptTest::impl_checkSetSelectionInReadonly()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsSelectionInReadonly ;
+ sal_Bool bIsSelectionInReadonly_;
+
+ xSet->getPropertyValue(s_sIsSelectionInReadonly) >>= bIsSelectionInReadonly;
+ aAccessibilityOpt.SetSelectionInReadonly( bIsSelectionInReadonly ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsSelectionInReadonly) >>= bIsSelectionInReadonly_;
+
+ if ( bIsSelectionInReadonly_ == bIsSelectionInReadonly )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSelectionInReadonly() error!")), 0);
+}
+
+//=============================================================================
+void AccessibilityOptTest::impl_checkAccessibilityOptions()
+{
+ impl_checkGetAutoDetectSystemHC();
+ impl_checkGetIsForPagePreviews();
+ impl_checkGetIsHelpTipsDisappear();
+ impl_checkGetIsAllowAnimatedGraphics();
+ impl_checkGetIsAllowAnimatedText();
+ impl_checkGetIsAutomaticFontColor();
+ impl_checkGetIsSystemFont();
+ impl_checkGetHelpTipSeconds();
+ impl_checkIsSelectionInReadonly();
+
+ impl_checkSetAutoDetectSystemHC();
+ impl_checkSetIsForPagePreviews();
+ impl_checkSetIsHelpTipsDisappear();
+ impl_checkSetIsAllowAnimatedGraphics();
+ impl_checkSetIsAllowAnimatedText();
+ impl_checkSetIsAutomaticFontColor();
+ impl_checkSetIsSystemFont();
+ impl_checkSetHelpTipSeconds();
+ impl_checkSetSelectionInReadonly();
+}
diff --git a/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx
new file mode 100644
index 000000000000..fc2f4681e4fe
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibilityOptTest.hxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_ACCESSIBILITYOPTTEST_HXX
+#define SVTOOLS_ACCESSIBILITYOPTTEST_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <svtools/accessibilityoptions.hxx>
+
+namespace css = ::com::sun::star;
+
+class AccessibilityOptTest
+{
+public:
+ AccessibilityOptTest();
+ ~AccessibilityOptTest();
+
+ void impl_checkAccessibilityOptions();
+
+private:
+ void impl_checkGetAutoDetectSystemHC();
+ void impl_checkGetIsForPagePreviews();
+ void impl_checkGetIsHelpTipsDisappear();
+ void impl_checkGetIsAllowAnimatedGraphics();
+ void impl_checkGetIsAllowAnimatedText();
+ void impl_checkGetIsAutomaticFontColor();
+ void impl_checkGetIsSystemFont();
+ void impl_checkGetHelpTipSeconds();
+ void impl_checkIsSelectionInReadonly();
+
+ void impl_checkSetAutoDetectSystemHC();
+ void impl_checkSetIsForPagePreviews();
+ void impl_checkSetIsHelpTipsDisappear();
+ void impl_checkSetIsAllowAnimatedGraphics();
+ void impl_checkSetIsAllowAnimatedText();
+ void impl_checkSetIsAutomaticFontColor();
+ void impl_checkSetIsSystemFont();
+ void impl_checkSetHelpTipSeconds();
+ void impl_checkSetSelectionInReadonly();
+
+private:
+ css::uno::Reference< css::container::XNameAccess > m_xCfg;
+ SvtAccessibilityOptions aAccessibilityOpt;
+};
+
+#endif // #ifndef SVTOOLS_ACCESSIBILITYOPTTEST_HXX
diff --git a/svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx b/svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx
new file mode 100644
index 000000000000..b21d9d76755e
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ConfigItemTest.cxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#include "HistoryOptTest.hxx"
+#include "AccessibilityOptTest.hxx"
+#include "PrintOptTest.hxx"
+#include "UserOptTest.hxx"
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/task/XJob.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <sal/config.h>
+#include <rtl/ustring.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implementationentry.hxx>
+
+//=============================================================================
+namespace css = ::com::sun::star;
+
+namespace svtools{
+
+//=============================================================================
+static const ::rtl::OUString PROP_TEST = ::rtl::OUString::createFromAscii("Test");
+static const ::rtl::OUString TEST_PICKLIST = ::rtl::OUString::createFromAscii("checkPicklist");
+static const ::rtl::OUString TEST_URLHISTORY = ::rtl::OUString::createFromAscii("checkURLHistory");
+static const ::rtl::OUString TEST_HELPBOOKMARKS = ::rtl::OUString::createFromAscii("checkHelpBookmarks");
+static const ::rtl::OUString TEST_ACCESSIBILITYOPTIONS = ::rtl::OUString::createFromAscii("checkAccessibilityOptions");
+static const ::rtl::OUString TEST_PRINTOPTIONS = ::rtl::OUString::createFromAscii("checkPrintOptions");
+static const ::rtl::OUString TEST_USEROPTIONS = ::rtl::OUString::createFromAscii("checkUserOptions");
+
+//=============================================================================
+class ConfigItemTest : public ::cppu::WeakImplHelper2< css::task::XJob ,
+ css::lang::XServiceInfo >
+{
+ //-------------------------------------------------------------------------
+ // interface
+ public:
+ explicit ConfigItemTest(const css::uno::Reference< css::uno::XComponentContext >& xContext);
+
+ // css::task::XJob
+ virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments)
+ throw (css::uno::RuntimeException ,
+ css::lang::IllegalArgumentException,
+ css::uno::Exception );
+
+ // css::lang::XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw (css::uno::RuntimeException);
+
+ //-------------------------------------------------------------------------
+ // internal
+ private:
+ ConfigItemTest(ConfigItemTest &); // not defined
+ virtual ~ConfigItemTest() {}
+ void operator=(ConfigItemTest &); // not defined
+
+ //-------------------------------------------------------------------------
+ // helper for registration !
+ public:
+ static ::rtl::OUString SAL_CALL st_getImplementationName();
+ static css::uno::Sequence< ::rtl::OUString > SAL_CALL st_getSupportedServiceNames();
+ static css::uno::Reference< css::uno::XInterface > SAL_CALL st_create(const css::uno::Reference< css::uno::XComponentContext >& XContext);
+
+ //-------------------------------------------------------------------------
+ // member
+ private:
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+};
+
+//=============================================================================
+ConfigItemTest::ConfigItemTest(const css::uno::Reference< css::uno::XComponentContext >& xContext)
+ : m_xContext(xContext)
+{}
+
+//=============================================================================
+// css::task::XJob
+css::uno::Any SAL_CALL ConfigItemTest::execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments)
+ throw (css::uno::RuntimeException ,
+ css::lang::IllegalArgumentException,
+ css::uno::Exception )
+{
+ ::rtl::OUString sTest;
+ ::sal_Int32 i = 0;
+ ::sal_Int32 c = lArguments.getLength();
+ for (i=0; i<c; ++i)
+ {
+ const css::beans::NamedValue& rArg = lArguments[0];
+ if (rArg.Name.equals(PROP_TEST))
+ rArg.Value >>= sTest;
+ }
+
+ if (sTest.equals(TEST_PICKLIST))
+ {
+ HistoryOptTest aOptTest;
+ aOptTest.checkPicklist();
+ }
+ else if (sTest.equals(TEST_URLHISTORY))
+ {
+ HistoryOptTest aOptTest;
+ aOptTest.checkURLHistory();
+ }
+ else if (sTest.equals(TEST_HELPBOOKMARKS))
+ {
+ HistoryOptTest aOptTest;
+ aOptTest.checkHelpBookmarks();
+ }
+ else if (sTest.equals(TEST_ACCESSIBILITYOPTIONS))
+ {
+ AccessibilityOptTest aOptTest;
+ aOptTest.impl_checkAccessibilityOptions();
+ }
+ else if (sTest.equals(TEST_PRINTOPTIONS))
+ {
+ PrintOptTest aOptTest;
+ aOptTest.impl_checkPrint();
+ }
+ else if (sTest.equals(TEST_USEROPTIONS))
+ {
+ UserOptTest aOptTest;
+ aOptTest.impl_checkUserData();
+ }
+
+ return css::uno::Any();
+}
+
+//=============================================================================
+// com::sun::star::uno::XServiceInfo
+::rtl::OUString SAL_CALL ConfigItemTest::getImplementationName()
+ throw (css::uno::RuntimeException)
+{
+ return ConfigItemTest::st_getImplementationName();
+}
+
+//=============================================================================
+// com::sun::star::uno::XServiceInfo
+::sal_Bool SAL_CALL ConfigItemTest::supportsService(const ::rtl::OUString& sServiceName)
+ throw (css::uno::RuntimeException)
+{
+ css::uno::Sequence< ::rtl::OUString > lServiceNames = ConfigItemTest::st_getSupportedServiceNames();
+ for (::sal_Int32 i = 0; i < lServiceNames.getLength(); ++i)
+ {
+ if (lServiceNames[i].equals(sServiceName))
+ return sal_True;
+ }
+ return sal_False;
+}
+
+//=============================================================================
+// com::sun::star::uno::XServiceInfo
+css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigItemTest::getSupportedServiceNames()
+ throw (css::uno::RuntimeException)
+{
+ return ConfigItemTest::st_getSupportedServiceNames();
+}
+
+//=============================================================================
+::rtl::OUString SAL_CALL ConfigItemTest::st_getImplementationName()
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.ConfigItemTest");
+}
+
+//=============================================================================
+css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigItemTest::st_getSupportedServiceNames()
+{
+ css::uno::Sequence< ::rtl::OUString > lServices(1);
+ lServices[0] = ::rtl::OUString::createFromAscii("com.sun.star.test.ConfigItems");
+ return lServices;
+}
+
+//=============================================================================
+css::uno::Reference< css::uno::XInterface > SAL_CALL ConfigItemTest::st_create(const css::uno::Reference< css::uno::XComponentContext >& xContext)
+{
+ ConfigItemTest* pObject = new ConfigItemTest(xContext);
+ css::uno::Reference< css::uno::XInterface > xObject (static_cast< ::cppu::OWeakObject* >(pObject));
+ return xObject;
+}
+
+} // namespace svtools
+
+//=============================================================================
+static ::cppu::ImplementationEntry const lRegEntries[] =
+{
+ {
+ &::svtools::ConfigItemTest::st_create,
+ &::svtools::ConfigItemTest::st_getImplementationName,
+ &::svtools::ConfigItemTest::st_getSupportedServiceNames,
+ &::cppu::createSingleComponentFactory, 0, 0
+ },
+
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+//=============================================================================
+extern "C" void SAL_CALL component_getImplementationEnvironment(const char** pEnvTypeName,
+ uno_Environment** )
+{
+ *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+//=============================================================================
+extern "C" void * SAL_CALL component_getFactory(const char* sImplName ,
+ void* pServiceManager,
+ void* pRegistryKey )
+{
+ return ::cppu::component_getFactoryHelper(sImplName, pServiceManager, pRegistryKey, lRegEntries);
+}
+
+//=============================================================================
+extern "C" sal_Bool SAL_CALL component_writeInfo(void* pServiceManager,
+ void* pRegistryKey )
+{
+ return ::cppu::component_writeInfoHelper(pServiceManager, pRegistryKey, lRegEntries);
+}
diff --git a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx
new file mode 100644
index 000000000000..8f191abf61ca
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx
@@ -0,0 +1,806 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: HistoryOptTest.cxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#include "HistoryOptTest.hxx"
+#include "configitems/historyoptions_const.hxx"
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+
+#include <comphelper/configurationhelper.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <unotools/processfactory.hxx>
+
+namespace css = ::com::sun::star;
+
+//=============================================================================
+static const ::rtl::OUString MESSAGE_CLEAR_FAILED = ::rtl::OUString::createFromAscii("Clearing the list failed.");
+static const ::rtl::OUString MESSAGE_SETSIZE_FAILED = ::rtl::OUString::createFromAscii("Setting a new size for a list failed.");
+static const ::rtl::OUString MESSAGE_MISS_HISTORY = ::rtl::OUString::createFromAscii("Could not get config access to history list inside config.");
+static const ::rtl::OUString MESSAGE_MISS_ITEMLIST = ::rtl::OUString::createFromAscii("Could not get config access to item list inside config.");
+static const ::rtl::OUString MESSAGE_MISS_ORDERLIST = ::rtl::OUString::createFromAscii("Could not get config access to order list inside config.");
+static const ::rtl::OUString MESSAGE_MISS_ITEM = ::rtl::OUString::createFromAscii("Could not locate item.");
+static const ::rtl::OUString MESSAGE_UNEXPECTED_ITEM = ::rtl::OUString::createFromAscii("Found an unexpected item.");
+static const ::rtl::OUString MESSAGE_WRONG_ORDER = ::rtl::OUString::createFromAscii("Wrong order in history list.");
+
+//=============================================================================
+HistoryOptTest::HistoryOptTest()
+ : m_aConfigItem ( )
+ , m_eList (ePICKLIST)
+ , m_xHistoriesXCU( )
+ , m_xCommonXCU ( )
+{
+}
+
+//=============================================================================
+HistoryOptTest::~HistoryOptTest()
+{
+ m_xHistoriesXCU.clear();
+ m_xCommonXCU.clear();
+}
+
+//=============================================================================
+void HistoryOptTest::checkPicklist()
+{
+ impl_testHistory(ePICKLIST, 4);
+}
+
+//=============================================================================
+void HistoryOptTest::checkURLHistory()
+{
+ impl_testHistory(eHISTORY, 10);
+}
+
+//=============================================================================
+void HistoryOptTest::checkHelpBookmarks()
+{
+ impl_testHistory(eHELPBOOKMARKS, 100);
+}
+
+//=============================================================================
+void HistoryOptTest::impl_testHistory(EHistoryType eHistory ,
+ ::sal_Int32 nMaxItems)
+{
+ try
+ {
+ m_eList = eHistory;
+ ::sal_Int32 c = nMaxItems;
+ ::sal_Int32 i = 0;
+
+ impl_clearList( );
+ impl_setSize (c);
+
+ // a) fill list completely and check if all items could be realy created.
+ // But dont check its order here! Because every new item will change that order.
+ for (i=0; i<c; ++i)
+ {
+ impl_appendItem(i);
+ if ( ! impl_existsItem(i))
+ throw css::uno::Exception(MESSAGE_MISS_ITEM, 0);
+ }
+
+ // b) Check order of all items in list now.
+ // It must be reverse to the item number ...
+ // item max = index 0
+ // item max-1 = index 1
+ // ...
+ for (i=0; i<c; ++i)
+ {
+ ::sal_Int32 nExpectedIndex = (c-1)-i;
+ if ( ! impl_existsItemAtIndex(i, nExpectedIndex))
+ throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
+ }
+
+ // c) increase prio of "first" item so it will switch
+ // to "second" and "second" will switch to "first" :-)
+ // Check also if all other items was not touched.
+ ::sal_Int32 nFirstItem = (c-1);
+ ::sal_Int32 nSecondItem = (c-2);
+ impl_appendItem(nSecondItem);
+
+ if (
+ ( ! impl_existsItemAtIndex(nSecondItem, 0)) ||
+ ( ! impl_existsItemAtIndex(nFirstItem , 1))
+ )
+ throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
+
+ for (i=0; i<nSecondItem; ++i)
+ {
+ ::sal_Int32 nExpectedIndex = (c-1)-i;
+ if ( ! impl_existsItemAtIndex(i, nExpectedIndex))
+ throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
+ }
+
+ // d) Check if appending new items will destroy the oldest one.
+ ::sal_Int32 nNewestItem = c;
+ ::sal_Int32 nOldestItem = 0;
+
+ impl_appendItem(nNewestItem);
+
+ if ( ! impl_existsItemAtIndex(nNewestItem, 0))
+ throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
+
+ if (impl_existsItem(nOldestItem))
+ throw css::uno::Exception(MESSAGE_UNEXPECTED_ITEM, 0);
+
+ // e) Check if decreasing list size will remove oldest items.
+ // Note: impl_setSize() will make sure that 3 items exists only.
+ // Otherwhise it throws an exception. If we further check
+ // positions of three items no further items must be checked.
+ // They cant exists :-)
+ ::sal_Int32 nNewSize = 3;
+ impl_setSize(nNewSize);
+ if (
+ ( ! impl_existsItemAtIndex(nNewestItem, 0)) ||
+ ( ! impl_existsItemAtIndex(nSecondItem, 1)) ||
+ ( ! impl_existsItemAtIndex(nFirstItem , 2))
+ )
+ throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
+
+ // finaly we should try to clean up all used structures so the same office can be used
+ // without problems :-)
+ impl_clearList();
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ impl_clearList();
+ throw ex;
+ }
+
+}
+
+//=============================================================================
+void HistoryOptTest::impl_clearList()
+{
+ m_aConfigItem.Clear(m_eList);
+ ::sal_Int32 nCount = m_aConfigItem.GetList(m_eList).getLength();
+
+ if (nCount != 0)
+ throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0);
+
+ css::uno::Reference< css::container::XNameAccess > xList;
+ xList = impl_getItemList();
+ nCount = xList->getElementNames().getLength();
+
+ if (nCount != 0)
+ throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0);
+
+ xList = impl_getOrderList();
+ nCount = xList->getElementNames().getLength();
+
+ if (nCount != 0)
+ throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0);
+}
+
+//=============================================================================
+void HistoryOptTest::impl_setSize(::sal_Int32 nSize)
+{
+ m_aConfigItem.SetSize (m_eList, nSize);
+
+ // a) size info returned by GetSize() means "MaxSize"
+ // so it must match exactly !
+ ::sal_Int32 nCheck = m_aConfigItem.GetSize(m_eList);
+ if (nCheck != nSize)
+ throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0);
+
+ // b) current size of used XCU lists reflects the current state of
+ // history list and not max size. So it can be less then size !
+ css::uno::Reference< css::container::XNameAccess > xList;
+ xList = impl_getItemList();
+ nCheck = xList->getElementNames().getLength();
+ if (nCheck > nSize)
+ throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0);
+
+ xList = impl_getOrderList();
+ nCheck = xList->getElementNames().getLength();
+ if (nCheck > nSize)
+ throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0);
+}
+
+//=============================================================================
+void HistoryOptTest::impl_appendItem(::sal_Int32 nItem)
+{
+ const ::rtl::OUString sURL = impl_createItemURL (nItem);
+ const ::rtl::OUString sTitle = impl_createItemTitle (nItem);
+ const ::rtl::OUString sPassword = impl_createItemPassword(nItem);
+
+ m_aConfigItem.AppendItem(m_eList, sURL, ::rtl::OUString(), sTitle, sPassword);
+}
+
+//=============================================================================
+::rtl::OUString HistoryOptTest::impl_createItemURL(::sal_Int32 nItem)
+{
+ ::rtl::OUStringBuffer sURL(256);
+ sURL.appendAscii("file:///ooo_api_test/non_existing_test_url_");
+ sURL.append ((::sal_Int32)nItem );
+ sURL.appendAscii(".odt" );
+
+ return sURL.makeStringAndClear();
+}
+
+//=============================================================================
+::rtl::OUString HistoryOptTest::impl_createItemTitle(::sal_Int32 nItem)
+{
+ ::rtl::OUStringBuffer sTitle(256);
+ sTitle.appendAscii("Non Existing Test Item Nr ");
+ sTitle.append ((::sal_Int32)nItem );
+
+ return sTitle.makeStringAndClear();
+}
+
+//=============================================================================
+::rtl::OUString HistoryOptTest::impl_createItemPassword(::sal_Int32 nItem)
+{
+ ::rtl::OUStringBuffer sPassword(256);
+ sPassword.appendAscii("Password_" );
+ sPassword.append ((::sal_Int32)nItem);
+
+ return sPassword.makeStringAndClear();
+}
+
+//=============================================================================
+::sal_Bool HistoryOptTest::impl_existsItem(::sal_Int32 nItem)
+{
+ const ::rtl::OUString sURL = impl_createItemURL(nItem);
+ const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lItems = m_aConfigItem.GetList(m_eList);
+ const ::sal_Int32 c = lItems.getLength ();
+ ::sal_Int32 i = 0;
+ ::sal_Bool bFound = sal_False;
+
+ for (i=0; i<c; ++i)
+ {
+ const ::comphelper::SequenceAsHashMap aItem(lItems[i]);
+ const ::rtl::OUString& sCheck = aItem.getUnpackedValueOrDefault(s_sURL, ::rtl::OUString());
+
+ bFound = sCheck.equals(sURL);
+ if (bFound)
+ break;
+ }
+
+ if ( ! bFound)
+ return sal_False;
+ bFound = sal_False;
+
+ try
+ {
+ css::uno::Reference< css::container::XNameAccess > xItemList = impl_getItemList();
+ css::uno::Reference< css::container::XNameAccess > xItem ;
+ xItemList->getByName(sURL) >>= xItem;
+
+ bFound = xItem.is();
+ }
+ catch(const css::container::NoSuchElementException&)
+ {}
+
+ return bFound;
+}
+
+//=============================================================================
+::sal_Bool HistoryOptTest::impl_existsItemAtIndex(::sal_Int32 nItem ,
+ ::sal_Int32 nIndex)
+{
+ const ::rtl::OUString sURL = impl_createItemURL(nItem);
+ const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lItems = m_aConfigItem.GetList(m_eList);
+ const ::sal_Int32 c = lItems.getLength ();
+ ::sal_Bool bFound = sal_False;
+
+ if (nIndex >= c)
+ return sal_False;
+
+ const ::comphelper::SequenceAsHashMap aItem(lItems[nIndex]);
+ ::rtl::OUString sCheck = aItem.getUnpackedValueOrDefault(s_sURL, ::rtl::OUString());
+
+ bFound = sCheck.equals(sURL);
+ if ( ! bFound)
+ return sal_False;
+ bFound = sal_False;
+
+ try
+ {
+ css::uno::Reference< css::container::XNameAccess > xItemList = impl_getItemList();
+ css::uno::Reference< css::container::XNameAccess > xItem ;
+ xItemList->getByName(sURL) >>= xItem;
+
+ bFound = xItem.is();
+ }
+ catch(const css::container::NoSuchElementException&)
+ {}
+
+ if ( ! bFound)
+ return sal_False;
+ bFound = sal_False;
+
+ try
+ {
+ const ::rtl::OUString sOrder = ::rtl::OUString::valueOf(nIndex);
+ css::uno::Reference< css::container::XNameAccess > xOrderList = impl_getOrderList();
+ css::uno::Reference< css::container::XNameAccess > xOrder ;
+ xOrderList->getByName(sOrder) >>= xOrder;
+
+ if (xOrder.is())
+ {
+ xOrder->getByName(s_sHistoryItemRef) >>= sCheck;
+ bFound = sCheck.equals(sURL);
+ }
+ }
+ catch(const css::container::NoSuchElementException&)
+ {}
+
+ return bFound;
+}
+
+//=============================================================================
+css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getItemList()
+{
+ css::uno::Reference< css::container::XNameAccess > xHistory = impl_getNewHistory();
+ css::uno::Reference< css::container::XNameAccess > xList ;
+ xHistory->getByName (s_sItemList) >>= xList;
+
+ if ( ! xList.is())
+ throw css::uno::Exception(MESSAGE_MISS_ITEMLIST, 0);
+
+ return xList;
+}
+
+//=============================================================================
+css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getOrderList()
+{
+ css::uno::Reference< css::container::XNameAccess > xHistory = impl_getNewHistory();
+ css::uno::Reference< css::container::XNameAccess > xList ;
+ xHistory->getByName (s_sOrderList) >>= xList;
+
+ if ( ! xList.is())
+ throw css::uno::Exception(MESSAGE_MISS_ORDERLIST, 0);
+
+ return xList;
+}
+
+//=============================================================================
+css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getNewHistory()
+{
+ if ( ! m_xHistoriesXCU.is())
+ {
+ m_xHistoriesXCU = css::uno::Reference< css::container::XNameAccess >(
+ ::comphelper::ConfigurationHelper::openConfig(
+ ::utl::getProcessServiceFactory(),
+ s_sHistories,
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY_THROW);
+ }
+
+ css::uno::Reference< css::container::XNameAccess > xHistory;
+
+ switch (m_eList)
+ {
+ case ePICKLIST :
+ m_xHistoriesXCU->getByName(s_sPickList) >>= xHistory;
+ break;
+
+ case eHISTORY :
+ m_xHistoriesXCU->getByName(s_sURLHistory) >>= xHistory;
+ break;
+
+ case eHELPBOOKMARKS :
+ m_xHistoriesXCU->getByName(s_sHelpBookmarks) >>= xHistory;
+ break;
+ }
+
+ if ( ! xHistory.is())
+ throw css::uno::Exception(MESSAGE_MISS_HISTORY, 0);
+
+ return xHistory;
+}
+
+//=============================================================================
+css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getOldHistory()
+{
+ if ( ! m_xCommonXCU.is())
+ {
+ m_xCommonXCU = css::uno::Reference< css::container::XNameAccess >(
+ ::comphelper::ConfigurationHelper::openConfig(
+ ::utl::getProcessServiceFactory(),
+ s_sCommonHistory,
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY_THROW);
+ }
+
+ css::uno::Reference< css::container::XNameAccess > xHistory;
+
+ switch (m_eList)
+ {
+ case ePICKLIST :
+ m_xCommonXCU->getByName(s_sPickList) >>= xHistory;
+ break;
+
+ case eHISTORY :
+ m_xCommonXCU->getByName(s_sURLHistory) >>= xHistory;
+ break;
+
+ case eHELPBOOKMARKS :
+ m_xCommonXCU->getByName(s_sHelpBookmarks) >>= xHistory;
+ break;
+ }
+
+ if ( ! xHistory.is())
+ throw css::uno::Exception(MESSAGE_MISS_HISTORY, 0);
+
+ return xHistory;
+}
+
+/*
+//=============================================================================
+// clear the list in XML directly when using the new Histories.xcs
+void HistoryOptTest::impl_clearList(const ::rtl::OUString& sList)
+{
+ css::uno::Reference< css::container::XNameAccess > xListAccess;
+ css::uno::Reference< css::container::XNameContainer > xItemOrder;
+ css::uno::Reference< css::beans::XPropertySet > xFirstItem;
+ css::uno::Sequence< ::rtl::OUString > sFileList;
+
+ if (sList.equalsAscii("PickList"))
+ m_xCfg->getByName(s_sPickList) >>= xListAccess;
+
+ else if (sList.equalsAscii("URLHistory"))
+ m_xCfg->getByName(s_sURLHistory) >>= xListAccess;
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
+
+ if (xListAccess.is())
+ {
+ xListAccess->getByName(s_sItemList) >>= xItemOrder ;
+ sFileList = xItemOrder->getElementNames();
+ for(sal_Int32 i=0; i<sFileList.getLength(); ++i)
+ xItemOrder->removeByName(sFileList[i]);
+
+ xListAccess->getByName(s_sOrderList) >>= xItemOrder ;
+ sFileList = xItemOrder->getElementNames();
+ for(sal_Int32 j=0; j<sFileList.getLength(); ++j)
+ xItemOrder->removeByName(sFileList[j]);
+
+ xFirstItem = css::uno::Reference< css::beans::XPropertySet >(xListAccess, css::uno::UNO_QUERY);
+ xFirstItem->setPropertyValue( s_sFirstItem, css::uno::makeAny((sal_Int32)0) );
+
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+}
+
+//=============================================================================
+// use configuration API (not ConfigItem!) to verify the results within XML !
+sal_Bool HistoryOptTest::impl_isListEmpty(const ::rtl::OUString& sList)
+{
+ css::uno::Reference< css::container::XNameAccess > xListAccess;
+ css::uno::Reference< css::container::XNameAccess > xItemList;
+ css::uno::Reference< css::container::XNameAccess > xOrderList;
+ sal_Bool bRet = sal_True;
+
+ if (sList.equalsAscii("PickList"))
+ m_xCfg->getByName(s_sPickList) >>= xListAccess;
+
+ else if (sList.equalsAscii("URLHistory"))
+ m_xCfg->getByName(s_sURLHistory) >>= xListAccess;
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
+
+ if (xListAccess.is())
+ {
+ xListAccess->getByName(s_sItemList) >>= xItemList;
+ xListAccess->getByName(s_sOrderList) >>= xOrderList;
+
+ css::uno::Sequence< ::rtl::OUString > sItemList = xItemList->getElementNames();
+ css::uno::Sequence< ::rtl::OUString > sOrderList = xOrderList->getElementNames();
+ if (sItemList.getLength()!=0 || sOrderList.getLength()!=0)
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+//=============================================================================
+// append a item: use configuration API (not ConfigItem!) to verify the results within XML !
+void HistoryOptTest::impl_appendItem(const ::rtl::OUString& sList)
+{//to do...
+}
+
+//=============================================================================
+// test SvtHistoryOptions::GetSize()
+void HistoryOptTest::impl_checkGetSize(const ::rtl::OUString& sList)
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCommonXCU, css::uno::UNO_QUERY);
+
+ sal_uInt32 nSize = 0;
+ sal_uInt32 nSize_ = 0;
+
+ if (sList.equalsAscii("PickList"))
+ {
+ nSize = aHistoryOpt.GetSize(ePICKLIST);
+
+ xSet->setPropertyValue(s_sPickListSize, css::uno::makeAny(nSize+1));
+ ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
+
+ nSize_ = aHistoryOpt.GetSize(ePICKLIST);
+ if (nSize_ == nSize)
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(ePICKLIST) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("URLHistory"))
+ {
+ nSize = aHistoryOpt.GetSize(eHISTORY);
+
+ xSet->setPropertyValue(s_sURLHistorySize, css::uno::makeAny(nSize+1));
+ ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
+
+ nSize_ = aHistoryOpt.GetSize(eHISTORY);
+
+ if (nSize_ == nSize)
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(eHISTORY) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ {
+ nSize = aHistoryOpt.GetSize(eHELPBOOKMARKS);
+
+ xSet->setPropertyValue(s_sHelpBookmarksSize, css::uno::makeAny(nSize+1));
+ ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
+
+ nSize_ = aHistoryOpt.GetSize(eHELPBOOKMARKS);
+
+ if (nSize_ == nSize)
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(eHELPBOOKMARKS) error!")), 0);
+ }
+}
+
+//=============================================================================
+// test SvtHistoryOptions::SetSize()
+void HistoryOptTest::impl_checkSetSize(const ::rtl::OUString& sList)
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCommonXCU, css::uno::UNO_QUERY);
+
+ sal_uInt32 nSize = 0;
+ sal_uInt32 nSize_ = 0;
+
+ if (sList.equalsAscii("PickList"))
+ {
+ xSet->getPropertyValue(s_sPickListSize) >>= nSize;
+ aHistoryOpt.SetSize(ePICKLIST, (nSize+1));
+ xSet->getPropertyValue(s_sPickListSize) >>= nSize_;
+
+ if (nSize_ == nSize) //old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(ePICKLIST) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("URLHistory"))
+ {
+ xSet->getPropertyValue(s_sURLHistorySize) >>= nSize;
+ aHistoryOpt.SetSize(eHISTORY, (nSize+1));
+ xSet->getPropertyValue(s_sURLHistorySize) >>= nSize_;
+
+ if (nSize_ == nSize) //old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(eHISTORY) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ {
+ xSet->getPropertyValue(s_sHelpBookmarksSize) >>= nSize;
+ aHistoryOpt.SetSize(eHELPBOOKMARKS, (nSize+1));
+ xSet->getPropertyValue(s_sHelpBookmarksSize) >>= nSize_;
+
+ if (nSize_ == nSize) //old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(eHELPBOOKMARKS) error!")), 0);
+ }
+}
+
+//=============================================================================
+// test SvtHistoryOptions::Clear()
+void HistoryOptTest::impl_checkClear(const ::rtl::OUString& sList)
+{
+ if (sList.equalsAscii("PickList"))
+ {
+ aHistoryOpt.Clear(ePICKLIST);
+ if ( !impl_isListEmpty(s_sPickList) )
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(ePICKLIST) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("URLHistory"))
+ {
+ aHistoryOpt.Clear(eHISTORY);
+ if ( !impl_isListEmpty(s_sURLHistory) )
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(eHISTORY) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ {
+ aHistoryOpt.Clear(eHELPBOOKMARKS);
+ if ( !impl_isListEmpty(s_sHelpBookmarks) )
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(eHELPBOOKMARKS) error!")), 0);
+ }
+}
+
+//=============================================================================
+// test SvtHistoryOptions::GetList()
+void HistoryOptTest::impl_checkGetList(const ::rtl::OUString& sList)
+{
+ if (sList.equalsAscii("PickList"))
+ {
+ impl_clearList(s_sPickList);
+ aHistoryOpt.AppendItem( ePICKLIST ,
+ ::rtl::OUString::createFromAscii("file:///c/test1"),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+ css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( ePICKLIST );
+
+ if ( aHistoryList.getLength()==0 )
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(ePICKLIST) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("URLHistory"))
+ {
+ impl_clearList(s_sURLHistory);
+ aHistoryOpt.AppendItem( eHISTORY ,
+ ::rtl::OUString::createFromAscii("file:///c/test1"),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+ css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( eHISTORY );
+
+ if ( aHistoryList.getLength()==0 )
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(eHISTORY) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ {
+ impl_clearList(s_sHelpBookmarks);
+ aHistoryOpt.AppendItem( eHELPBOOKMARKS ,
+ ::rtl::OUString::createFromAscii("file:///c/test1"),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+ css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( eHELPBOOKMARKS );
+
+ if ( aHistoryList.getLength()==0 )
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(eHELPBOOKMARKS) error!")), 0);
+ }
+}
+
+void HistoryOptTest::impl_checkAppendItem(const ::rtl::OUString& sList)
+{
+ if (sList.equalsAscii("PickList"))
+ {
+ impl_clearList(s_sPickList);
+ sal_Int32 nListSize = aHistoryOpt.GetSize(ePICKLIST);
+
+ for (sal_Int32 i=0; i<nListSize; ++i)
+ aHistoryOpt.AppendItem( ePICKLIST ,
+ ::rtl::OUString::valueOf(i),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+
+ aHistoryOpt.AppendItem( ePICKLIST ,
+ ::rtl::OUString::valueOf(nListSize),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+ }
+
+ else if (sList.equalsAscii("URLHistory"))
+ {
+ impl_clearList(s_sURLHistory);
+ sal_Int32 nListSize = aHistoryOpt.GetSize(eHISTORY);
+
+ for (sal_Int32 i=0; i<nListSize; ++i)
+ aHistoryOpt.AppendItem( eHISTORY ,
+ ::rtl::OUString::valueOf(i),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+
+ aHistoryOpt.AppendItem( eHISTORY ,
+ ::rtl::OUString::valueOf(nListSize),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+ }
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ {
+ //impl_clearList(s_sHelpBookmarks);
+ //sal_Int32 nListSize = aHistoryOpt.GetSize(eHELPBOOKMARKS);
+
+ //for (sal_Int32 i=0; i<nListSize; ++i)
+ // aHistoryOpt.AppendItem( eHELPBOOKMARKS ,
+ // ::rtl::OUString::valueOf(i),
+ // ::rtl::OUString::createFromAscii(""),
+ // ::rtl::OUString::createFromAscii(""),
+ // ::rtl::OUString::createFromAscii("") );
+
+ //aHistoryOpt.AppendItem( eHELPBOOKMARKS ,
+ // ::rtl::OUString::valueOf(nListSize),
+ // ::rtl::OUString::createFromAscii(""),
+ // ::rtl::OUString::createFromAscii(""),
+ // ::rtl::OUString::createFromAscii("") );
+ }
+}
+
+//=============================================================================
+void HistoryOptTest::impl_checkPicklist()
+{
+ impl_checkGetSize(s_sPickList);
+ impl_checkSetSize(s_sPickList);
+
+ impl_checkClear(s_sPickList);
+ impl_checkGetList(s_sPickList);
+ impl_checkAppendItem(s_sPickList);
+}
+
+//=============================================================================
+void HistoryOptTest::impl_checkURLHistory()
+{
+ impl_checkGetSize(s_sURLHistory);
+ impl_checkSetSize(s_sURLHistory);
+
+ impl_checkClear(s_sURLHistory);
+ impl_checkGetList(s_sURLHistory);
+ impl_checkAppendItem(s_sURLHistory);
+}
+
+//=============================================================================
+void HistoryOptTest::impl_checkHelpBookmarks()
+{
+ impl_checkGetSize(s_sHelpBookmarks);
+ impl_checkSetSize(s_sHelpBookmarks);
+
+ impl_checkClear(s_sHelpBookmarks);
+ impl_checkGetList(s_sHelpBookmarks);
+ impl_checkAppendItem(s_sHelpBookmarks);
+}
+*/
diff --git a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx
new file mode 100644
index 000000000000..fca9802d2781
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: HistoryOptTest.hxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_HISTORYOPTTEST_HXX
+#define SVTOOLS_HISTORYOPTTEST_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <svtools/historyoptions.hxx>
+
+namespace css = ::com::sun::star;
+
+class HistoryOptTest
+{
+ public:
+
+ HistoryOptTest();
+ virtual ~HistoryOptTest();
+
+ //---------------------------------------------------------------------
+ /** unit test of picklist */
+ void checkPicklist();
+
+ //---------------------------------------------------------------------
+ /** unit test of URL list */
+ void checkURLHistory();
+
+ //---------------------------------------------------------------------
+ /** unit test of Help bookmarks */
+ void checkHelpBookmarks();
+
+ private:
+
+ //---------------------------------------------------------------------
+ /** test every well known history list in the same way.
+ * Only the count of created and tested items can be defined from outside
+ * e.g. usefull for stress tests.
+ *
+ * @param eHistory
+ * specify the history list for testing.
+ *
+ * @param nMaxItems
+ * max count of new created and tested history items.
+ */
+ void impl_testHistory(EHistoryType eHistory ,
+ ::sal_Int32 nMaxItems);
+
+ //---------------------------------------------------------------------
+ /** try to clear the whole list and check the results.
+ * If list could not be cleared successfully an exception is thrown.
+ */
+ void impl_clearList();
+
+ //---------------------------------------------------------------------
+ /** define a new size for the current list and check the results.
+ * Note: The given size must match against the defined constraints.
+ * That must be checked before this method is called.
+ *
+ * @param nSize
+ * the new size.
+ */
+ void impl_setSize(::sal_Int32 nSize);
+
+ //---------------------------------------------------------------------
+ /** create a new item (means it's properties using a special schema using the
+ * item id).
+ *
+ * Note: This method does not check if creation was successfully.
+ * Therefore exists more specialized method impl_existsItem()
+ * and impl_existsItemAtPosition().
+ *
+ * @param nItem
+ * id of the item
+ */
+ void impl_appendItem(::sal_Int32 nItem);
+
+ //---------------------------------------------------------------------
+ /** check if an entry for given item id realy exists (in memory and xcu file).
+ *
+ * @param nItem
+ * id of the item
+ *
+ * @return true if item exists - false otherwise.
+ */
+ ::sal_Bool impl_existsItem(::sal_Int32 nItem);
+
+ //---------------------------------------------------------------------
+ /** check if an entry for given item id realy exists (in memory and xcu file).
+ * Further it checks if the requested item is placed at the also specified
+ * position inside history list.
+ *
+ * @param nItem
+ * id of the item
+ *
+ * @param nIndex
+ * expected position of item inside history list.
+ *
+ * @return true if item exists at right position - false otherwise.
+ */
+ ::sal_Bool impl_existsItemAtIndex(::sal_Int32 nItem ,
+ ::sal_Int32 nIndex);
+
+ //---------------------------------------------------------------------
+ /** create an URL suitable for the given item id.
+ *
+ * @param nItem
+ * id of the item
+ *
+ * @return the new created URL.
+ */
+ ::rtl::OUString impl_createItemURL(::sal_Int32 nItem);
+
+ //---------------------------------------------------------------------
+ /** create a title suitable for the given item id.
+ *
+ * @param nItem
+ * id of the item
+ *
+ * @return the new created title.
+ */
+ ::rtl::OUString impl_createItemTitle(::sal_Int32 nItem);
+
+ //---------------------------------------------------------------------
+ /** create a password suitable for the given item id.
+ *
+ * @param nItem
+ * id of the item
+ *
+ * @return the new created password.
+ */
+ ::rtl::OUString impl_createItemPassword(::sal_Int32 nItem);
+
+ //---------------------------------------------------------------------
+ /** returns direct access to the item list inside histories.xcu
+ * suitable for the current defined list type (m_eList).
+ *
+ * @return reference to the item list configuration
+ */
+ css::uno::Reference< css::container::XNameAccess > impl_getItemList();
+
+ //---------------------------------------------------------------------
+ /** returns direct access to the order list inside histories.xcu
+ * suitable for the current defined list type (m_eList).
+ *
+ * @return reference to the order list configuration
+ */
+ css::uno::Reference< css::container::XNameAccess > impl_getOrderList();
+
+ //---------------------------------------------------------------------
+ /** returns direct access to the history list inside histories.xcu
+ * suitable for the current defined list type (m_eList).
+ *
+ * @return reference to the history list configuration
+ */
+ css::uno::Reference< css::container::XNameAccess > impl_getNewHistory();
+
+ //---------------------------------------------------------------------
+ /** returns direct access to the history config inside common.xcu
+ * suitable for the current defined list type (m_eList).
+ *
+ * @return reference to the history configuration
+ */
+ css::uno::Reference< css::container::XNameAccess > impl_getOldHistory();
+
+ private:
+
+ // the config item which should be tested here
+ SvtHistoryOptions m_aConfigItem;
+
+ // defines the special list for testing (picklist, history or url list)
+ EHistoryType m_eList;
+
+ // underlying configuration of the tested config items for cross over checks
+ css::uno::Reference< css::container::XNameAccess > m_xHistoriesXCU;
+
+ // underlying configuration of the tested config items for cross over checks
+ css::uno::Reference< css::container::XNameAccess > m_xCommonXCU;
+};
+
+#endif // #ifndef SVTOOLS_HISTORYOPTTEST_HXX
diff --git a/svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx
new file mode 100644
index 000000000000..69504e4d5d7e
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx
@@ -0,0 +1,743 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: PrintOptTest.cxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#include "PrintOptTest.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <unotools/processfactory.hxx>
+#include <comphelper/configurationhelper.hxx>
+
+namespace css = ::com::sun::star;
+
+// using test only
+#define ROOTNODE_PRINTOPTION rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option")
+#define PROPERTYNAME_REDUCETRANSPARENCY rtl::OUString::createFromAscii("ReduceTransparency")
+#define PROPERTYNAME_REDUCEDTRANSPARENCYMODE rtl::OUString::createFromAscii("ReducedTransparencyMode")
+#define PROPERTYNAME_REDUCEGRADIENTS rtl::OUString::createFromAscii("ReduceGradients")
+#define PROPERTYNAME_REDUCEDGRADIENTMODE rtl::OUString::createFromAscii("ReducedGradientMode")
+#define PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT rtl::OUString::createFromAscii("ReducedGradientStepCount")
+#define PROPERTYNAME_REDUCEBITMAPS rtl::OUString::createFromAscii("ReduceBitmaps")
+#define PROPERTYNAME_REDUCEDBITMAPMODE rtl::OUString::createFromAscii("ReducedBitmapMode")
+#define PROPERTYNAME_REDUCEDBITMAPRESOLUTION rtl::OUString::createFromAscii("ReducedBitmapResolution")
+#define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY rtl::OUString::createFromAscii("ReducedBitmapIncludesTransparency")
+#define PROPERTYNAME_CONVERTTOGREYSCALES rtl::OUString::createFromAscii("ConvertToGreyscales")
+
+PrintOptTest::PrintOptTest()
+{
+ m_xCfg = css::uno::Reference< css::container::XNameAccess >(
+ ::comphelper::ConfigurationHelper::openConfig(
+ ::utl::getProcessServiceFactory(),
+ rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option"),
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY);
+
+ if (m_xCfg.is())
+ {
+ //UniString sTmp = UniString("printer");
+ //xub_StrLen nTokenCount = sTmp.GetTokenCount('/');
+ //sTmp = sTmp.GetToken(nTokenCount - 1, '/');
+ m_xCfg->getByName(rtl::OUString::createFromAscii("Printer")) >>= m_xNode;
+ }
+}
+
+sal_Int16 PrintOptTest::impl_GetReducedTransparencyMode() const
+{
+ sal_Int16 nRet = 0;
+ if (m_xNode.is())
+ {
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nRet;
+ }
+ return nRet;
+}
+void PrintOptTest::impl_SetReducedTransparencyMode(sal_Int16 nMode )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Int16 nUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nUpdate;
+ if (nUpdate != nMode)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEDTRANSPARENCYMODE, css::uno::makeAny(nMode));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Bool PrintOptTest::impl_IsReduceTransparency() const
+{
+ sal_Bool bRet = sal_False;
+ if (m_xNode.is())
+ {
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bRet;
+ }
+ return bRet;
+}
+void PrintOptTest::impl_SetReduceTransparency(sal_Bool bState )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Bool bUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bUpdate;
+ if (bUpdate != bState)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCETRANSPARENCY, css::uno::makeAny(bState));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Bool PrintOptTest::impl_IsReduceGradients() const
+{
+ sal_Bool bRet = sal_False;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bRet;
+ }
+ }
+ return bRet;
+}
+
+void PrintOptTest::impl_SetReduceGradients(sal_Bool bState )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Bool bUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bUpdate;
+ if (bUpdate != bState)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEGRADIENTS, css::uno::makeAny(bState));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Int16 PrintOptTest::impl_GetReducedGradientMode() const
+{
+ sal_Int16 nRet = 0;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nRet;
+ }
+ }
+ return nRet;
+}
+
+void PrintOptTest::impl_SetReducedGradientMode(sal_Int16 nMode )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Int16 nUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nUpdate;
+ if (nUpdate != nMode)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTMODE, css::uno::makeAny(nMode));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Int16 PrintOptTest::impl_GetReducedGradientStepCount() const
+{
+ sal_Int16 nRet = 64;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nRet;
+ }
+ }
+ return nRet;
+}
+void PrintOptTest::impl_SetReducedGradientStepCount(sal_Int16 nStepCount )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Int16 nUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nUpdate;
+ if (nUpdate != nStepCount)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT, css::uno::makeAny(nStepCount));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Bool PrintOptTest::impl_IsReduceBitmaps() const
+{
+ sal_Bool bRet = sal_False;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bRet;
+ }
+ }
+ return bRet;
+}
+
+void PrintOptTest::impl_SetReduceBitmaps(sal_Bool bState )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Bool bUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bUpdate;
+ if (bUpdate != bState)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEBITMAPS, css::uno::makeAny(bState));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Int16 PrintOptTest::impl_GetReducedBitmapMode() const
+{
+ sal_Int16 nRet = 1;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nRet;
+ }
+ }
+ return nRet;
+}
+
+void PrintOptTest::impl_SetReducedBitmapMode(sal_Int16 nMode )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Int16 nUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nUpdate;
+ if (nUpdate != nMode)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPMODE, css::uno::makeAny(nMode));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Int16 PrintOptTest::impl_GetReducedBitmapResolution() const
+{
+ sal_Int16 nRet = 3;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nRet;
+ }
+ }
+ return nRet;
+}
+
+void PrintOptTest::impl_SetReducedBitmapResolution(sal_Int16 nResolution )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Int16 nUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nUpdate;
+ if (nUpdate != nResolution)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPRESOLUTION, css::uno::makeAny(nResolution));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Bool PrintOptTest::impl_IsReducedBitmapIncludesTransparency() const
+{
+ sal_Bool bRet = sal_True;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bRet;
+ }
+ }
+ return bRet;
+}
+
+void PrintOptTest::impl_SetReducedBitmapIncludesTransparency(sal_Bool bState )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Bool bUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bUpdate;
+ if (bUpdate != bState)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY, css::uno::makeAny(bState));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Bool PrintOptTest::impl_IsConvertToGreyscales() const
+{
+ sal_Bool bRet = sal_False;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bRet;
+ }
+ }
+ return bRet;
+}
+
+void PrintOptTest::impl_SetConvertToGreyscales(sal_Bool bState )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Bool bUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bUpdate;
+ if (bUpdate != bState)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_CONVERTTOGREYSCALES, css::uno::makeAny(bState));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+
+PrintOptTest::~PrintOptTest()
+{
+}
+
+void PrintOptTest::impl_checkPrint()
+{
+ //test SetReduceTransparency()
+ sal_Bool bNewValue = sal_False;
+ sal_Bool bOldValue = sal_False;
+ bOldValue = PrintOptTest::impl_IsReduceTransparency();
+ bNewValue = !bOldValue;
+ aPrintOpt.SetReduceTransparency(bNewValue) ;
+ bNewValue = impl_IsReduceTransparency();
+ // if(bNewValue != bOldValue) // test the old source
+ if ( bNewValue == bOldValue ) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReduceTransparency() error!"),
+ 0);
+ }
+
+ //test IsReduceTransparemcy()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = impl_IsReduceTransparency();
+ bNewValue = !bOldValue;
+ impl_SetReduceTransparency(bNewValue);
+ bNewValue = aPrintOpt.IsReduceTransparency();
+ //if(bNewValue != bOldValue) // test the old source
+ if(bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the IsReduceTransparency() error!"),
+ 0);
+ }
+
+ // test SetReducedTransparencyMode()
+ sal_Int16 nOldMode, nNewMode;
+ nOldMode = nNewMode = 0;
+ nOldMode = impl_GetReducedTransparencyMode();
+ nNewMode = nOldMode + 1;
+ aPrintOpt.SetReducedTransparencyMode( nNewMode );
+ nNewMode = impl_GetReducedTransparencyMode();
+ //if(nNewMode != nOldMode) // test the old source
+ if ( nNewMode == nOldMode ) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReducedTransparencyMode() error!"),
+ 0);
+ }
+
+ //test IsReducedTransparencyMode()
+ nOldMode = nNewMode = 0;
+ nOldMode = impl_GetReducedTransparencyMode();
+ nNewMode = nOldMode + 1;
+ impl_SetReducedTransparencyMode(nNewMode);
+ nNewMode = aPrintOpt.GetReducedTransparencyMode();
+ //if(nNewMode != nOldMode) // test the old source
+ if(nNewMode == nOldMode) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the IsReducedTransparencyMode() error!"
+ "nOldMode's value is :"),
+ 0);
+ }
+
+ // test the SetReduceGradients()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = impl_IsReduceGradients();
+ bNewValue = !bOldValue;
+ aPrintOpt.SetReduceGradients(bNewValue);
+ bNewValue = impl_IsReduceGradients();
+ //if (bNewValue != bOldValue) //test the old source
+ if (bNewValue == bOldValue) //test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReduceGradients() error!"),
+ 0);
+
+ }
+
+ // test the IsReduceGradients()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = impl_IsReduceGradients();
+ bNewValue = !bOldValue;
+ this->impl_SetReduceGradients(bNewValue);
+ bNewValue = aPrintOpt.IsReduceGradients();
+ // if (bNewValue != bOldValue) // test the old source
+ if (bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the IsReduceGradients() error!"),
+ 0);
+
+ }
+
+ //test SetRedecedGradientMode()
+ nOldMode = nNewMode = 0;
+ nOldMode = this->impl_GetReducedGradientMode();
+ nNewMode = nOldMode + 1;
+ aPrintOpt.SetReducedGradientMode(nNewMode);
+ nNewMode = this->impl_GetReducedGradientMode();
+ //if (nNewMode != nOldMode) // test the old source
+ if (nNewMode == nOldMode)// test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetRedecedGradientMode() error!"),
+ 0);
+ }
+
+ // test GetReducedGradientMode()
+ nOldMode = nNewMode = 0;
+ nOldMode = this->impl_GetReducedGradientMode();
+ nNewMode = nOldMode + 1;
+ this->impl_SetReducedGradientMode(nNewMode);
+ nNewMode = aPrintOpt.GetReducedGradientMode();
+ //if (nNewMode != nOldMode) // test the old source
+ if (nNewMode == nOldMode) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the GetReducedGradientMode() error!"),
+ 0);
+
+ }
+
+ //test the SetReducedGradientStepCount()
+ sal_Int16 nNewStepCount;
+ sal_Int16 nOldStepCount;
+ nNewStepCount = nOldStepCount = 0;
+ nOldStepCount = this->impl_GetReducedGradientStepCount();
+ nNewStepCount = nOldStepCount + 1;
+ aPrintOpt.SetReducedGradientStepCount(nNewStepCount);
+ nNewStepCount = this->impl_GetReducedGradientStepCount();
+ // if (nNewStepCount != nOldStepCount) // test the old source
+ if (nNewStepCount == nOldStepCount) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReducedGradientStepCount() error!"),
+ 0);
+
+ }
+
+ // test the GetReduceGradientStepCount()
+ nNewStepCount = nOldStepCount = 0;
+ nOldStepCount = this->impl_GetReducedGradientStepCount();
+ nNewStepCount = nOldStepCount + 1;
+ this->impl_SetReducedGradientStepCount(nNewStepCount);
+ nNewStepCount = aPrintOpt.GetReducedGradientStepCount();
+ // if (nNewStepCount != nOldStepCount) //test the old source
+ if (nNewStepCount == nOldStepCount) //test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the GetReduceGradientStepCount() error!"),
+ 0);
+ }
+
+ // test the SetReduceBitmaps()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = this->impl_IsReduceBitmaps();
+ bNewValue = !bOldValue;
+ aPrintOpt.SetReduceBitmaps(bNewValue);
+ bNewValue = this->impl_IsReduceBitmaps();
+ //if (bNewValue != bOldValue) // test the old source
+ if (bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReduceBitmaps() error!"),
+ 0);
+ }
+
+ // test the IsReduceBitmaps()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = this->impl_IsReduceBitmaps();
+ bNewValue = !bOldValue;
+ this->impl_SetReduceBitmaps(bNewValue);
+ bNewValue = aPrintOpt.IsReduceBitmaps();
+ //if (bNewValue != bOldValue) // test the old source
+ if (bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the IsReduceBitmaps() error!"),
+ 0);
+ }
+
+ // test the SetReduceBitmap()
+ nNewMode = nOldMode = 0;
+ nOldMode = impl_GetReducedBitmapMode();
+ nNewMode = nOldMode + 1;
+ aPrintOpt.SetReducedBitmapMode(nNewMode);
+ nNewMode = impl_GetReducedBitmapMode();
+ //if (nNewMode != nOldMode) // test the old source
+ if (nNewMode == nOldMode)// test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReduceBitmap() error!"),
+ 0);
+ }
+
+ // test the SetReduceBitmapMode()
+ nNewMode = nOldMode = 0;
+ nOldMode = this->impl_GetReducedBitmapMode();
+ nNewMode = nOldMode + 1;
+ aPrintOpt.SetReducedBitmapMode(nNewMode);
+ nNewMode = this->impl_GetReducedBitmapMode();
+ //if (nNewMode != nOldMode) // test the old source
+ if (nNewMode == nOldMode) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReduceBitmapMode() error!"),
+ 0);
+ }
+
+ // test the GetReduceBitmapMode()
+ nNewMode = nOldMode = 0;
+ nOldMode = this->impl_GetReducedBitmapMode();
+ nNewMode = nOldMode + 1;
+ this->impl_SetReducedBitmapMode(nNewMode);
+ nNewMode = aPrintOpt.GetReducedBitmapMode();
+ //if (nNewMode != nOldMode) // test the old source
+ if (nNewMode == nOldMode)// test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the GetReduceBitmapMode() error!"),
+ 0);
+
+ }
+
+ // test the SetReducedBitmapResolution()
+ sal_Int16 nOldResolution ;
+ sal_Int16 nNewResolution ;
+ nNewResolution = nOldResolution = 0;
+ nOldResolution = impl_GetReducedBitmapResolution();
+ nNewResolution = nOldResolution + 1;
+ aPrintOpt.SetReducedBitmapResolution(nNewResolution);
+ nNewResolution = impl_GetReducedBitmapResolution();
+ //if (nNewResolution != nOldResolution) // test the old source
+ if (nNewResolution == nOldResolution)// test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReducedBitmapResolution() error!"),
+ 0);
+ }
+
+ // test the GetReduceBitmapResolution()
+ nNewResolution = nOldResolution = 0;
+ nOldResolution = impl_GetReducedBitmapResolution();
+ nNewResolution = nOldResolution + 1;
+ impl_SetReducedBitmapResolution(nNewResolution);
+ nNewResolution = impl_GetReducedBitmapResolution();
+ //if (nNewResolution != nOldResolution) // test the old source
+ if (nNewResolution == nOldResolution) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the GetReduceBitmapResolution() error!"),
+ 0);
+ }
+
+ // test SetReducedBitmapIncludesTransparency()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = impl_IsReducedBitmapIncludesTransparency();
+ bNewValue = !bOldValue;
+ aPrintOpt.SetReducedBitmapIncludesTransparency(bNewValue);
+ bNewValue = impl_IsReducedBitmapIncludesTransparency();
+ //if (bNewValue != bOldValue) // test the new source
+ if (bNewValue == bOldValue) // test the old source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReducedBitmapIncludesTransparency() error!"),
+ 0);
+ }
+
+ // test the IsReducedBitmapIncludesTransparency()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = impl_IsReducedBitmapIncludesTransparency();
+ bNewValue = !bOldValue;
+ impl_SetReducedBitmapIncludesTransparency(bNewValue);
+ bNewValue = aPrintOpt.IsReducedBitmapIncludesTransparency();
+ //if (bNewValue != bOldValue) // test the old source
+ if (bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the IsReducedBitmapIncludesTransparency() error!"),
+ 0);
+ }
+
+ // test the SetConvertToGreyscales()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = this->impl_IsConvertToGreyscales();
+ bNewValue = !bOldValue;
+ aPrintOpt.SetConvertToGreyscales(bNewValue);
+ bNewValue = this->impl_IsConvertToGreyscales();
+ //if (bNewValue != bOldValue) // test the old source
+ if (bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetConvertToGreyscales() error!"),
+ 0);
+ }
+
+ // test the IsConvertToGreyscales()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = this->impl_IsConvertToGreyscales();
+ bNewValue = !bOldValue;
+ impl_SetConvertToGreyscales(bNewValue);
+ bNewValue = aPrintOpt.IsConvertToGreyscales();
+ //if (bNewValue != bOldValue) // test the old source
+ if (bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the IsConvertToGreyscales() error!"),
+ 0);
+ }
+}
diff --git a/svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx
new file mode 100644
index 000000000000..14d4267b8878
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: PrintOptTest.hxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_PRINTOPTTEST_HXX
+#define SVTOOLS_PRINTOPTTEST_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <svtools/printoptions.hxx>
+
+namespace css = ::com::sun::star;
+
+class PrintOptTest
+{
+public:
+
+ PrintOptTest();
+ ~PrintOptTest();
+
+ void impl_checkPrint();
+
+private: //members
+
+ SvtPrinterOptions aPrintOpt;
+ css::uno::Reference< css::container::XNameAccess > m_xCfg;
+ css::uno::Reference< css::container::XNameAccess > m_xNode;
+
+private: // methods
+ sal_Bool impl_IsReduceTransparency() const ;
+ void impl_SetReduceTransparency( sal_Bool bState ) ;
+
+ sal_Int16 impl_GetReducedTransparencyMode() const ;
+ void impl_SetReducedTransparencyMode( sal_Int16 nMode ) ;
+
+ sal_Bool impl_IsReduceGradients() const ;
+ void impl_SetReduceGradients( sal_Bool bState ) ;
+
+ sal_Int16 impl_GetReducedGradientMode() const ;
+ void impl_SetReducedGradientMode( sal_Int16 nMode ) ;
+
+ sal_Int16 impl_GetReducedGradientStepCount() const ;
+ void impl_SetReducedGradientStepCount( sal_Int16 nStepCount );
+
+ sal_Bool impl_IsReduceBitmaps() const ;
+ void impl_SetReduceBitmaps( sal_Bool bState ) ;
+
+ sal_Int16 impl_GetReducedBitmapMode() const ;
+ void impl_SetReducedBitmapMode( sal_Int16 nMode ) ;
+
+ sal_Int16 impl_GetReducedBitmapResolution() const ;
+ void impl_SetReducedBitmapResolution( sal_Int16 nResolution ) ;
+
+ sal_Bool impl_IsReducedBitmapIncludesTransparency() const ;
+ void impl_SetReducedBitmapIncludesTransparency( sal_Bool bState ) ;
+
+ sal_Bool impl_IsConvertToGreyscales() const;
+ void impl_SetConvertToGreyscales( sal_Bool bState ) ;
+
+};
+
+#endif // #ifndef SVTOOLS_PRINTOPTTEST_HXX
diff --git a/svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx
new file mode 100644
index 000000000000..3780eff3f741
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: UserOptTest.cxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#include "UserOptTest.hxx"
+
+namespace css = ::com::sun::star;
+
+//=============================================================================
+static const ::rtl::OUString MESSAGE_SETCOMPANY_FAILED = ::rtl::OUString::createFromAscii("set company failed") ;
+static const ::rtl::OUString MESSAGE_SETFIRSTNAME_FAILED = ::rtl::OUString::createFromAscii("set firstname failed") ;
+static const ::rtl::OUString MESSAGE_SETLASTNAME_FAILED = ::rtl::OUString::createFromAscii("set lastname failed") ;
+static const ::rtl::OUString MESSAGE_SETID_FAILED = ::rtl::OUString::createFromAscii("set ID failed") ;
+static const ::rtl::OUString MESSAGE_SETSTREET_FAILED = ::rtl::OUString::createFromAscii("set street failed") ;
+static const ::rtl::OUString MESSAGE_SETCITY_FAILED = ::rtl::OUString::createFromAscii("set city failed") ;
+static const ::rtl::OUString MESSAGE_SETSTATE_FAILED = ::rtl::OUString::createFromAscii("set state failed") ;
+static const ::rtl::OUString MESSAGE_SETZIP_FAILED = ::rtl::OUString::createFromAscii("set zip failed") ;
+static const ::rtl::OUString MESSAGE_SETCOUNTRY_FAILED = ::rtl::OUString::createFromAscii("set country failed") ;
+static const ::rtl::OUString MESSAGE_SETPOSITION_FAILED = ::rtl::OUString::createFromAscii("set position failed") ;
+static const ::rtl::OUString MESSAGE_SETTITLE_FAILED = ::rtl::OUString::createFromAscii("set title failed") ;
+static const ::rtl::OUString MESSAGE_SETTELEPHONEHOME_FAILED = ::rtl::OUString::createFromAscii("set telephonehome failed") ;
+static const ::rtl::OUString MESSAGE_SETTELEPHONEWORK_FAILED = ::rtl::OUString::createFromAscii("set telephonework failed") ;
+static const ::rtl::OUString MESSAGE_SETFAX_FAILED = ::rtl::OUString::createFromAscii("set fax failed") ;
+static const ::rtl::OUString MESSAGE_SETEMAIL_FAILED = ::rtl::OUString::createFromAscii("set email failed") ;
+static const ::rtl::OUString MESSAGE_SETCUSTOMERNUMBER_FAILED = ::rtl::OUString::createFromAscii("set customernumber failed");
+static const ::rtl::OUString MESSAGE_SETFATHERSNAME_FAILED = ::rtl::OUString::createFromAscii("set fathersname failed") ;
+static const ::rtl::OUString MESSAGE_SETAPARTMENT_FAILED = ::rtl::OUString::createFromAscii("set apartment failed") ;
+
+//=============================================================================
+
+
+UserOptTest::UserOptTest()
+ :m_aConfigItem()
+ ,m_xCfg()
+{
+}
+
+UserOptTest::~UserOptTest()
+{
+}
+
+void UserOptTest::impl_checkUserData()
+{
+ impl_checkSetCompany( ::rtl::OUString() );
+ impl_checkSetFirstName( ::rtl::OUString() );
+ impl_checkSetLastName( ::rtl::OUString() );
+ impl_checkSetID( ::rtl::OUString() );
+ impl_checkSetStreet( ::rtl::OUString() );
+ impl_checkSetCity( ::rtl::OUString() );
+ impl_checkSetState( ::rtl::OUString() );
+ impl_checkSetZip( ::rtl::OUString() );
+ impl_checkSetCountry( ::rtl::OUString() );
+ impl_checkSetPosition( ::rtl::OUString() );
+ impl_checkSetTitle( ::rtl::OUString() );
+ impl_checkSetTelephoneHome( ::rtl::OUString() );
+ impl_checkSetTelephoneWork( ::rtl::OUString() );
+ impl_checkSetFax( ::rtl::OUString() );
+ impl_checkSetEmail( ::rtl::OUString() );
+ //impl_checkSetCustomerNumber( ::rtl::OUString() );
+ impl_checkSetFathersName( ::rtl::OUString() );
+ impl_checkSetApartment( ::rtl::OUString() );
+
+ impl_checkSetCompany( ::rtl::OUString::createFromAscii("RedFlag2000") );
+ impl_checkSetFirstName( ::rtl::OUString::createFromAscii("Yan") );
+ impl_checkSetLastName( ::rtl::OUString::createFromAscii("Wu") );
+ impl_checkSetID( ::rtl::OUString::createFromAscii("wuy") );
+ impl_checkSetStreet( ::rtl::OUString::createFromAscii("SouthFifthRing") );
+ impl_checkSetCity( ::rtl::OUString::createFromAscii("Beijing") );
+ impl_checkSetState( ::rtl::OUString::createFromAscii("Beijing") );
+ impl_checkSetZip( ::rtl::OUString::createFromAscii("100176") );
+ impl_checkSetCountry( ::rtl::OUString::createFromAscii("China") );
+ impl_checkSetPosition( ::rtl::OUString::createFromAscii("Engineer") );
+ impl_checkSetTitle( ::rtl::OUString::createFromAscii("Software Engineer") );
+ impl_checkSetTelephoneHome( ::rtl::OUString::createFromAscii("010-51570010") );
+ impl_checkSetTelephoneWork( ::rtl::OUString::createFromAscii("010-51570010") );
+ impl_checkSetFax( ::rtl::OUString::createFromAscii("010-51570010") );
+ impl_checkSetEmail( ::rtl::OUString::createFromAscii("wuy@redflag2000.cn") );
+ //impl_checkSetCustomerNumber( ::rtl::OUString::createFromAscii("87654321") );
+ impl_checkSetFathersName( ::rtl::OUString::createFromAscii("father") );
+ impl_checkSetApartment( ::rtl::OUString::createFromAscii("apartment") );
+}
+
+void UserOptTest::impl_checkSetCompany( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetCompany( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetCompany();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETCOMPANY_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetFirstName( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetFirstName( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetFirstName();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETFIRSTNAME_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetLastName( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetLastName( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetLastName();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETLASTNAME_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetID( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetID( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetID();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETID_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetStreet( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetStreet( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetStreet();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETSTREET_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetCity( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetCity( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetCity();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETCITY_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetState( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetState( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetState();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETSTATE_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetZip( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetZip( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetZip();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETZIP_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetCountry( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetCountry( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetCountry();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETCOUNTRY_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetPosition( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetPosition( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetPosition();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETPOSITION_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetTitle( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetTitle( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetTitle();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETTITLE_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetTelephoneHome( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetTelephoneHome( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetTelephoneHome();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETTELEPHONEHOME_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetTelephoneWork( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetTelephoneWork( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetTelephoneWork();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETTELEPHONEWORK_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetFax( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetFax( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetFax();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETFAX_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetEmail( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetEmail( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetEmail();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETEMAIL_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetCustomerNumber( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetCustomerNumber( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetCustomerNumber();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETCUSTOMERNUMBER_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetFathersName( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetFathersName( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetFathersName();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETFATHERSNAME_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetApartment( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetApartment( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetApartment();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETAPARTMENT_FAILED, 0);
+}
diff --git a/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx
new file mode 100644
index 000000000000..203a4cbc7cbd
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: UserOptTest.hxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:09:25 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_USEROPTTEST_HXX
+#define SVTOOLS_USEROPTTEST_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <svtools/useroptions.hxx>
+
+namespace css = ::com::sun::star;
+
+class UserOptTest
+{
+public:
+ UserOptTest();
+ ~UserOptTest();
+
+ void impl_checkUserData();
+
+private:
+ void impl_checkSetCompany( const ::rtl::OUString& sUserData );
+ void impl_checkSetFirstName( const ::rtl::OUString& sUserData );
+ void impl_checkSetLastName( const ::rtl::OUString& sUserData );
+ void impl_checkSetID( const ::rtl::OUString& sUserData );
+ void impl_checkSetStreet( const ::rtl::OUString& sUserData );
+ void impl_checkSetCity( const ::rtl::OUString& sUserData );
+ void impl_checkSetState( const ::rtl::OUString& sUserData );
+ void impl_checkSetZip( const ::rtl::OUString& sUserData );
+ void impl_checkSetCountry( const ::rtl::OUString& sUserData );
+ void impl_checkSetPosition( const ::rtl::OUString& sUserData );
+ void impl_checkSetTitle( const ::rtl::OUString& sUserData );
+ void impl_checkSetTelephoneHome( const ::rtl::OUString& sUserData );
+ void impl_checkSetTelephoneWork( const ::rtl::OUString& sUserData );
+ void impl_checkSetFax( const ::rtl::OUString& sUserData );
+ void impl_checkSetEmail( const ::rtl::OUString& sUserData );
+ void impl_checkSetCustomerNumber( const ::rtl::OUString& sUserData );
+ void impl_checkSetFathersName( const ::rtl::OUString& sUserData );
+ void impl_checkSetApartment( const ::rtl::OUString& sUserData );
+
+private:
+ SvtUserOptions m_aConfigItem;
+
+ css::uno::Reference< css::container::XNameAccess > m_xCfg;
+};
+
+#endif // #ifndef SVTOOLS_USEROPTTEST_HXX
diff --git a/svtools/qa/complex/ConfigItems/helper/exports.map b/svtools/qa/complex/ConfigItems/helper/exports.map
new file mode 100644
index 000000000000..85610ad80888
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/helper/exports.map
@@ -0,0 +1,10 @@
+UDK_3_0_0 {
+ global:
+ GetVersionInfo;
+ component_getImplementationEnvironment;
+ component_getFactory;
+ component_writeInfo;
+
+ local:
+ *;
+};
diff --git a/svtools/qa/complex/ConfigItems/helper/makefile.mk b/svtools/qa/complex/ConfigItems/helper/makefile.mk
new file mode 100644
index 000000000000..6070d25b7bd4
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/helper/makefile.mk
@@ -0,0 +1,81 @@
+#*************************************************************************
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.4.2 $
+#
+# last change: $Author: as $ $Date: 2008/03/19 11:09:25 $
+#
+# The Contents of this file are made available subject to
+# the terms of GNU Lesser General Public License Version 2.1.
+#
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2005 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#*************************************************************************
+PRJ=..$/..$/..$/..
+
+PRJNAME= svtools
+TARGET= ConfigItemTest
+USE_DEFFILE= TRUE
+ENABLE_EXCEPTIONS= TRUE
+NO_BSYMBOLIC= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Generate -----------------------------------------------------
+
+INCPOST += $(PRJ)$/source$/inc
+
+# --- light services library ----------------------------------------------------
+
+SHL1TARGET= svt_$(TARGET)
+
+SHL1OBJS= \
+ $(SLO)$/UserOptTest.obj \
+ $(SLO)$/PrintOptTest.obj \
+ $(SLO)$/AccessibilityOptTest.obj \
+ $(SLO)$/HistoryOptTest.obj \
+ $(SLO)$/ConfigItemTest.obj
+
+SHL1STDLIBS= \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(UNOTOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+#SHL1DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN)
+
+DEF1NAME= $(SHL1TARGET)
+
+SHL1VERSIONMAP= exports.map
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svtools/qa/complex/ConfigItems/makefile.mk b/svtools/qa/complex/ConfigItems/makefile.mk
new file mode 100644
index 000000000000..f85c5b0a8e65
--- /dev/null
+++ b/svtools/qa/complex/ConfigItems/makefile.mk
@@ -0,0 +1,91 @@
+#*************************************************************************
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.4.2 $
+#
+# last change: $Author: as $ $Date: 2008/03/19 11:09:22 $
+#
+# The Contents of this file are made available subject to
+# the terms of GNU Lesser General Public License Version 2.1.
+#
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2005 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#*************************************************************************
+PRJ = ..$/..$/..
+TARGET = CheckConfigItems
+PRJNAME = svtools
+PACKAGE = complex$/ConfigItems
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar jut.jar java_uno.jar \
+ OOoRunner.jar
+
+JAVAFILES = CheckConfigItems.java
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+SUBDIRS = helper
+
+#----- make a jar from compiled files ------------------------------
+
+MAXLINELENGTH = 100000
+
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# --- Parameters for the test --------------------------------------
+
+# start an office if the parameter is set for the makefile
+.IF "$(OFFICE)" == ""
+CT_APPEXECCOMMAND =
+.ELSE
+CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
+.ENDIF
+
+# test base is java complex
+CT_TESTBASE = -TestBase java_complex
+
+# test looks something like the.full.package.TestName
+CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b)
+
+# start the runner application
+CT_APP = org.openoffice.Runner
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+RUN: run
+
+run:
+ java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_TEST)
+
+
+
diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx
index 6bf1a648e94b..6f1e3882d705 100644
--- a/svtools/source/config/accessibilityoptions.cxx
+++ b/svtools/source/config/accessibilityoptions.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: accessibilityoptions.cxx,v $
- * $Revision: 1.16 $
+ * $Revision: 1.15.74.2 $
*
* This file is part of OpenOffice.org.
*
@@ -37,10 +37,29 @@
#define SVT_DLLIMPLEMENTATION
#include <svtools/accessibilityoptions.hxx>
+#include "configitems/accessibilityoptions_const.hxx"
+
#include <unotools/configmgr.hxx>
#include <tools/debug.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_
+#include <comphelper/configurationhelper.hxx>
+#endif
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+#ifndef _SVT_LOGHELPER_HXX_
+#include <loghelper.hxx>
+#endif
+
#include <svtools/smplhint.hxx>
#include <vcl/settings.hxx>
@@ -52,95 +71,45 @@
using namespace utl;
using namespace rtl;
using namespace com::sun::star::uno;
+namespace css = com::sun::star;
#define HELP_TIP_TIMEOUT 0xffff // max. timeout setting to pretend a non-timeout
+
// class SvtAccessibilityOptions_Impl ---------------------------------------------
-class SvtAccessibilityOptions_Impl : public utl::ConfigItem, public SfxBroadcaster
+class SvtAccessibilityOptions_Impl
{
private:
- sal_Int16 m_nHelpTipSeconds;
-
- sal_Bool m_bForPagePreviews;
- sal_Bool m_bHelpTipsDisappear;
- sal_Bool m_bAllowAnimatedGraphics;
- sal_Bool m_bAllowAnimatedText;
- sal_Bool m_bAutomaticFontColor;
- sal_Bool m_bSystemFont;
- sal_Bool m_bTextSelectionInReadonly;
- sal_Bool m_bAutoDetectSystemHC;
-
- typedef sal_Bool SvtAccessibilityOptions_Impl:: *BoolPtr;
-
- sal_Bool GetToken( BoolPtr pPtr ) const;
- void SetToken( BoolPtr pPtr, sal_Bool bSet );
- void Load();
-
- //this list needs exactly to mach the listet properties in GetPropertyNames
- enum PropertyNameIndex { PAGEPREVIEWS
- , HELPTIPSDISAPPEAR
- , HELPTIPSECONDS
- , ALLOWANIMATEDGRAPHICS
- , ALLOWANIMATEDTEXT
- , AUTOMATICFONTCOLOR
- , SYSTEMFONT
- , TEXTSELECTION
- , AUTODETECTSYSTEMHC
- };
-
- static Sequence< OUString > GetPropertyNames();
+ css::uno::Reference< css::container::XNameAccess > m_xCfg;
+ sal_Bool bIsModified;
public:
SvtAccessibilityOptions_Impl();
-
- virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
- virtual void Commit();
+ ~SvtAccessibilityOptions_Impl();
void SetVCLSettings();
- sal_Bool GetAutoDetectSystemHC( )
- {return GetToken( &SvtAccessibilityOptions_Impl::m_bAutoDetectSystemHC ); }
- sal_Bool GetIsForPagePreviews() const
- {return GetToken( &SvtAccessibilityOptions_Impl::m_bForPagePreviews );}
- sal_Bool GetIsHelpTipsDisappear() const
- {return GetToken( &SvtAccessibilityOptions_Impl::m_bHelpTipsDisappear );}
- sal_Bool GetIsAllowAnimatedGraphics() const
- {return GetToken( &SvtAccessibilityOptions_Impl::m_bAllowAnimatedGraphics );}
- sal_Bool GetIsAllowAnimatedText() const
- {return GetToken( &SvtAccessibilityOptions_Impl::m_bAllowAnimatedText );}
- sal_Bool GetIsAutomaticFontColor() const
- {return GetToken( &SvtAccessibilityOptions_Impl::m_bAutomaticFontColor );}
- sal_Bool GetIsSystemFont() const
- {return GetToken( &SvtAccessibilityOptions_Impl::m_bSystemFont );}
- sal_Int16 GetHelpTipSeconds() const
- {return m_nHelpTipSeconds;}
- sal_Bool IsSelectionInReadonly() const
- {return m_bTextSelectionInReadonly;}
-
- void SetAutoDetectSystemHC( sal_Bool bSet )
- { SetToken( &SvtAccessibilityOptions_Impl::m_bAutoDetectSystemHC, bSet ); }
- void SetIsForPagePreviews(sal_Bool bSet)
- { SetToken( &SvtAccessibilityOptions_Impl::m_bForPagePreviews, bSet ); }
- void SetIsHelpTipsDisappear(sal_Bool bSet)
- { SetToken( &SvtAccessibilityOptions_Impl::m_bHelpTipsDisappear, bSet ); }
- void SetIsAllowAnimatedGraphics(sal_Bool bSet)
- { SetToken( &SvtAccessibilityOptions_Impl::m_bAllowAnimatedGraphics, bSet ); }
- void SetIsAllowAnimatedText(sal_Bool bSet)
- { SetToken( &SvtAccessibilityOptions_Impl::m_bAllowAnimatedText, bSet ); }
- void SetIsAutomaticFontColor(sal_Bool bSet)
- { SetToken( &SvtAccessibilityOptions_Impl::m_bAutomaticFontColor, bSet ); }
- void SetIsSystemFont(sal_Bool bSet)
- { SetToken( &SvtAccessibilityOptions_Impl::m_bSystemFont, bSet ); }
- void SetHelpTipSeconds(sal_Int16 nSet)
- {
- if(m_nHelpTipSeconds!=nSet)
- {
- m_nHelpTipSeconds=nSet;
- SetModified();
- }
- }
- void SetSelectionInReadonly(sal_Bool bSet)
- {SetToken( &SvtAccessibilityOptions_Impl::m_bTextSelectionInReadonly, bSet);}
+ sal_Bool GetAutoDetectSystemHC();
+ sal_Bool GetIsForPagePreviews() const;
+ sal_Bool GetIsHelpTipsDisappear() const;
+ sal_Bool GetIsAllowAnimatedGraphics() const;
+ sal_Bool GetIsAllowAnimatedText() const;
+ sal_Bool GetIsAutomaticFontColor() const;
+ sal_Bool GetIsSystemFont() const;
+ sal_Int16 GetHelpTipSeconds() const;
+ sal_Bool IsSelectionInReadonly() const;
+
+ void SetAutoDetectSystemHC(sal_Bool bSet);
+ void SetIsForPagePreviews(sal_Bool bSet);
+ void SetIsHelpTipsDisappear(sal_Bool bSet);
+ void SetIsAllowAnimatedGraphics(sal_Bool bSet);
+ void SetIsAllowAnimatedText(sal_Bool bSet);
+ void SetIsAutomaticFontColor(sal_Bool bSet);
+ void SetIsSystemFont(sal_Bool bSet);
+ void SetHelpTipSeconds(sal_Int16 nSet);
+ void SetSelectionInReadonly(sal_Bool bSet);
+
+ sal_Bool IsModified() const { return bIsModified; };
};
// initialization of static members --------------------------------------
@@ -154,168 +123,390 @@ namespace
: public rtl::Static< ::osl::Mutex, SingletonMutex > {};
}
-// functions -------------------------------------------------------------
+// -----------------------------------------------------------------------
+// class SvtAccessibilityOptions_Impl ---------------------------------------------
-Sequence< OUString > SvtAccessibilityOptions_Impl::GetPropertyNames()
+SvtAccessibilityOptions_Impl::SvtAccessibilityOptions_Impl()
{
- //this list needs exactly to mach the enum PropertyNameIndex
- static const char* aPropNames[] =
+ try
{
- "IsForPagePreviews" // PAGEPREVIEWS
- ,"IsHelpTipsDisappear" // HELPTIPSDISAPPEAR
- ,"HelpTipSeconds" // HELPTIPSECONDS
- ,"IsAllowAnimatedGraphics" // ALLOWANIMATEDGRAPHICS
- ,"IsAllowAnimatedText" // ALLOWANIMATEDTEXT
- ,"IsAutomaticFontColor" // AUTOMATICFONTCOLOR
- ,"IsSystemFont" // SYSTEMFONT
- ,"IsSelectionInReadonly" // TEXTSELECTION
- ,"AutoDetectSystemHC" // AUTODETECTSYSTEMHC
- };
- const int nCount = sizeof( aPropNames ) / sizeof( const char* );
- Sequence< OUString > aNames( nCount );
- OUString* pNames = aNames.getArray();
- for ( int i = 0; i < nCount; i++ )
- pNames[i] = OUString::createFromAscii( aPropNames[i] );
+ m_xCfg = css::uno::Reference< css::container::XNameAccess >(
+ ::comphelper::ConfigurationHelper::openConfig(
+ utl::getProcessServiceFactory(),
+ s_sAccessibility,
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY);
+
+ bIsModified = sal_False;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ m_xCfg.clear();
+ LogHelper::logIt(ex);
+ }
+}
- return aNames;
+SvtAccessibilityOptions_Impl::~SvtAccessibilityOptions_Impl()
+{
}
// -----------------------------------------------------------------------
-// class SvtAccessibilityOptions_Impl ---------------------------------------------
+sal_Bool SvtAccessibilityOptions_Impl::GetAutoDetectSystemHC()
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bRet = sal_True;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sAutoDetectSystemHC) >>= bRet;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
-SvtAccessibilityOptions_Impl::SvtAccessibilityOptions_Impl() :
- ConfigItem( OUString::createFromAscii("Office.Common/Accessibility") )
+ return bRet;
+}
+
+sal_Bool SvtAccessibilityOptions_Impl::GetIsForPagePreviews() const
{
- Load();
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bRet = sal_True;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sIsForPagePreviews) >>= bRet;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+ return bRet;
}
-// -----------------------------------------------------------------------
-void SvtAccessibilityOptions_Impl::Load()
+
+sal_Bool SvtAccessibilityOptions_Impl::GetIsHelpTipsDisappear() const
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bRet = sal_True;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sIsHelpTipsDisappear) >>= bRet;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return bRet;
+}
+
+sal_Bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedGraphics() const
{
- Sequence< OUString > aNames = GetPropertyNames();
- Sequence< Any > aValues = GetProperties( aNames );
- EnableNotification( aNames );
- const Any* pValues = aValues.getConstArray();
- DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
- if ( aValues.getLength() == aNames.getLength() )
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bRet = sal_True;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bRet;
+ }
+ catch(const css::uno::Exception& ex)
{
- sal_Bool bTemp = sal_Bool();
+ LogHelper::logIt(ex);
+ }
+
+ return bRet;
+}
+
+sal_Bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedText() const
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bRet = sal_True;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sIsAllowAnimatedText) >>= bRet;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return bRet;
+}
+
+sal_Bool SvtAccessibilityOptions_Impl::GetIsAutomaticFontColor() const
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bRet = sal_False;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sIsAutomaticFontColor) >>= bRet;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return bRet;
+}
+
+sal_Bool SvtAccessibilityOptions_Impl::GetIsSystemFont() const
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bRet = sal_True;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sIsSystemFont) >>= bRet;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return bRet;
+}
+
+sal_Int16 SvtAccessibilityOptions_Impl::GetHelpTipSeconds() const
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Int16 nRet = 4;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sHelpTipSeconds) >>= nRet;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return nRet;
+}
+
+sal_Bool SvtAccessibilityOptions_Impl::IsSelectionInReadonly() const
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bRet = sal_False;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sIsSelectionInReadonly) >>= bRet;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return bRet;
+}
+
+void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(sal_Bool bSet)
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
- for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
+ try
+ {
+ if(xNode.is() && xNode->getPropertyValue(s_sAutoDetectSystemHC)!=bSet)
{
- if ( pValues[nProp].hasValue() )
- {
- if ( pValues[nProp] >>= bTemp )
- {
- switch ( PropertyNameIndex(nProp) )
- {
- case PAGEPREVIEWS: m_bForPagePreviews = bTemp; break;
- case HELPTIPSDISAPPEAR: m_bHelpTipsDisappear = bTemp; break;
- case ALLOWANIMATEDGRAPHICS: m_bAllowAnimatedGraphics = bTemp; break;
- case ALLOWANIMATEDTEXT: m_bAllowAnimatedText = bTemp; break;
- case AUTOMATICFONTCOLOR: m_bAutomaticFontColor = bTemp; break;
- case SYSTEMFONT: m_bSystemFont = bTemp; break;
- case TEXTSELECTION: m_bTextSelectionInReadonly = bTemp; break;
- case AUTODETECTSYSTEMHC: m_bAutoDetectSystemHC = bTemp; break;
- default:
- DBG_ERRORFILE( "invalid index to load a user token" );
- }
- }
- else
- {
- sal_Int16 nTemp = sal_Int16();
- if( pValues[nProp] >>= nTemp )
- {
- if(PropertyNameIndex(nProp)==HELPTIPSECONDS)//this is an integer and not a bool
- m_nHelpTipSeconds=nTemp;
- else
- {
- DBG_ERRORFILE( "sal_Int16 any type not matched with property name" );
- }
- }
- else
- {
- DBG_ERRORFILE( "Wrong any type" );
- }
- }
- }
+ xNode->setPropertyValue(s_sAutoDetectSystemHC, css::uno::makeAny(bSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+
+ bIsModified = sal_True;
}
}
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
}
-// -----------------------------------------------------------------------
-void SvtAccessibilityOptions_Impl::SetVCLSettings()
+void SvtAccessibilityOptions_Impl::SetIsForPagePreviews(sal_Bool bSet)
{
- AllSettings aAllSettings = Application::GetSettings();
- HelpSettings aHelpSettings = aAllSettings.GetHelpSettings();
- aHelpSettings.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT);
- aAllSettings.SetHelpSettings(aHelpSettings);
- if(aAllSettings.GetStyleSettings().GetUseSystemUIFonts() != GetIsSystemFont() )
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+
+ try
{
- StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
- aStyleSettings.SetUseSystemUIFonts( GetIsSystemFont() );
- aAllSettings.SetStyleSettings(aStyleSettings);
- Application::MergeSystemSettings( aAllSettings );
+ if(xNode.is() && xNode->getPropertyValue(s_sIsForPagePreviews)!=bSet)
+ {
+ xNode->setPropertyValue(s_sIsForPagePreviews, css::uno::makeAny(bSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+
+ bIsModified = sal_True;
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
}
+}
- Application::SetSettings(aAllSettings);
+void SvtAccessibilityOptions_Impl::SetIsHelpTipsDisappear(sal_Bool bSet)
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+
+ try
+ {
+ if(xNode.is() && xNode->getPropertyValue(s_sIsHelpTipsDisappear)!=bSet)
+ {
+ xNode->setPropertyValue(s_sIsHelpTipsDisappear, css::uno::makeAny(bSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+
+ bIsModified = sal_True;
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
}
-void SvtAccessibilityOptions_Impl::Commit()
+void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedGraphics(sal_Bool bSet)
{
- ClearModified();
- Sequence< OUString > aNames = GetPropertyNames();
- Sequence< Any > aValues( aNames.getLength() );
- Any* pValues = aValues.getArray();
- sal_Bool bTemp=false;
- for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+
+ try
{
- switch ( PropertyNameIndex(nProp) )
+ if(xNode.is() && xNode->getPropertyValue(s_sIsAllowAnimatedGraphics)!=bSet)
{
- case PAGEPREVIEWS: bTemp = m_bForPagePreviews; break;
- case HELPTIPSDISAPPEAR: bTemp = m_bHelpTipsDisappear; break;
- case HELPTIPSECONDS: pValues[nProp] <<= m_nHelpTipSeconds; continue;//this is an integer and not a bool
- case ALLOWANIMATEDGRAPHICS: bTemp = m_bAllowAnimatedGraphics; break;
- case ALLOWANIMATEDTEXT: bTemp = m_bAllowAnimatedText; break;
- case AUTOMATICFONTCOLOR: bTemp = m_bAutomaticFontColor; break;
- case SYSTEMFONT: bTemp = m_bSystemFont; break;
- case TEXTSELECTION: bTemp = m_bTextSelectionInReadonly; break;
- case AUTODETECTSYSTEMHC: bTemp = m_bAutoDetectSystemHC; break;
- default:
- DBG_ERRORFILE( "invalid index to save a user token" );
+ xNode->setPropertyValue(s_sIsAllowAnimatedGraphics, css::uno::makeAny(bSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+
+ bIsModified = sal_True;
}
- pValues[nProp] <<= bTemp;
}
- PutProperties( aNames, aValues );
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedText(sal_Bool bSet)
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+
+ try
+ {
+ if(xNode.is() && xNode->getPropertyValue(s_sIsAllowAnimatedText)!=bSet)
+ {
+ xNode->setPropertyValue(s_sIsAllowAnimatedText, css::uno::makeAny(bSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
- //notify SfxListener
+ bIsModified = sal_True;
+ }
+ }
+ catch(const css::uno::Exception& ex)
{
- SfxSimpleHint aHint = SfxSimpleHint( SFX_HINT_ACCESSIBILITY_CHANGED );
- Broadcast(aHint);
- SetVCLSettings();
+ LogHelper::logIt(ex);
}
}
-// -----------------------------------------------------------------------
+void SvtAccessibilityOptions_Impl::SetIsAutomaticFontColor(sal_Bool bSet)
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
-void SvtAccessibilityOptions_Impl::Notify( const Sequence<rtl::OUString>& )
+ try
+ {
+ if(xNode.is() && xNode->getPropertyValue(s_sIsAutomaticFontColor)!=bSet)
+ {
+ xNode->setPropertyValue(s_sIsAutomaticFontColor, css::uno::makeAny(bSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+
+ bIsModified = sal_True;
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtAccessibilityOptions_Impl::SetIsSystemFont(sal_Bool bSet)
{
- Load();
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+
+ try
+ {
+ if(xNode.is() && xNode->getPropertyValue(s_sIsSystemFont)!=bSet)
+ {
+ xNode->setPropertyValue(s_sIsSystemFont, css::uno::makeAny(bSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+
+ bIsModified = sal_True;
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
}
-// -----------------------------------------------------------------------
+void SvtAccessibilityOptions_Impl::SetHelpTipSeconds(sal_Int16 nSet)
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+
+ try
+ {
+ if(xNode.is() && xNode->getPropertyValue(s_sHelpTipSeconds)!=nSet)
+ {
+ xNode->setPropertyValue(s_sHelpTipSeconds, css::uno::makeAny(nSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
-sal_Bool SvtAccessibilityOptions_Impl::GetToken( BoolPtr pPtr ) const
+ bIsModified = sal_True;
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtAccessibilityOptions_Impl::SetSelectionInReadonly(sal_Bool bSet)
{
- return this->*pPtr;
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+
+ try
+ {
+ if(xNode.is() && xNode->getPropertyValue(s_sIsSelectionInReadonly)!=bSet)
+ {
+ xNode->setPropertyValue(s_sIsSelectionInReadonly, css::uno::makeAny(bSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+
+ bIsModified = sal_True;
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
}
-void SvtAccessibilityOptions_Impl::SetToken( BoolPtr pPtr, sal_Bool bSet )
+void SvtAccessibilityOptions_Impl::SetVCLSettings()
{
- if(this->*pPtr != bSet)
+ AllSettings aAllSettings = Application::GetSettings();
+ HelpSettings aHelpSettings = aAllSettings.GetHelpSettings();
+ aHelpSettings.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT);
+ aAllSettings.SetHelpSettings(aHelpSettings);
+ if(aAllSettings.GetStyleSettings().GetUseSystemUIFonts() != GetIsSystemFont() )
{
- this->*pPtr = bSet;
- SetModified();
+ StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ aStyleSettings.SetUseSystemUIFonts( GetIsSystemFont() );
+ aAllSettings.SetStyleSettings(aStyleSettings);
+ Application::MergeSystemSettings( aAllSettings );
}
+
+ Application::SetSettings(aAllSettings);
}
// -----------------------------------------------------------------------
@@ -330,21 +521,21 @@ SvtAccessibilityOptions::SvtAccessibilityOptions()
sm_pSingleImplConfig = new SvtAccessibilityOptions_Impl;
ItemHolder2::holdConfigItem(E_ACCESSIBILITYOPTIONS);
}
- ++sm_nAccessibilityRefCount;
+ ++sm_nAccessibilityRefCount;
}
- StartListening( *sm_pSingleImplConfig, TRUE );
+ //StartListening( *sm_pSingleImplConfig, TRUE );
}
// -----------------------------------------------------------------------
SvtAccessibilityOptions::~SvtAccessibilityOptions()
{
- EndListening( *sm_pSingleImplConfig, TRUE );
+ //EndListening( *sm_pSingleImplConfig, TRUE );
::osl::MutexGuard aGuard( SingletonMutex::get() );
if( !--sm_nAccessibilityRefCount )
{
- if( sm_pSingleImplConfig->IsModified() )
- sm_pSingleImplConfig->Commit();
+ //if( sm_pSingleImplConfig->IsModified() )
+ // sm_pSingleImplConfig->Commit();
DELETEZ( sm_pSingleImplConfig );
}
}
@@ -369,7 +560,7 @@ sal_Bool SvtAccessibilityOptions::IsModified() const
}
void SvtAccessibilityOptions::Commit()
{
- sm_pSingleImplConfig->Commit();
+ //sm_pSingleImplConfig->Commit();
}
// -----------------------------------------------------------------------
@@ -464,4 +655,3 @@ void SvtAccessibilityOptions::SetVCLSettings()
sm_pSingleImplConfig->SetVCLSettings();
}
// -----------------------------------------------------------------------
-
diff --git a/svtools/source/config/historyoptions.cxx b/svtools/source/config/historyoptions.cxx
index 11216e8cf1a5..d658f25d1a73 100644
--- a/svtools/source/config/historyoptions.cxx
+++ b/svtools/source/config/historyoptions.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: historyoptions.cxx,v $
- * $Revision: 1.22 $
+ * $Revision: 1.21.234.2 $
*
* This file is part of OpenOffice.org.
*
@@ -34,10 +34,11 @@
#endif
//_________________________________________________________________________________________________________________
-// includes
+// includes
//_________________________________________________________________________________________________________________
#include <svtools/historyoptions.hxx>
+#include "configitems/historyoptions_const.hxx"
#include <unotools/configmgr.hxx>
#include <unotools/configitem.hxx>
#include <tools/debug.hxx>
@@ -55,59 +56,60 @@
#include <rtl/logfile.hxx>
#include "itemholder1.hxx"
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::std ;
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::com::sun::star::uno ;
-using namespace ::com::sun::star::beans ;
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
-#define ROOTNODE_HISTORY OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/History/" ))
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
-#define DEFAULT_PICKLISTSIZE 4
-#define DEFAULT_HISTORYSIZE 10
-#define DEFAULT_HELPBOOKMARKSIZE 100
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
-#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/" ))
+#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_
+#include <comphelper/configurationhelper.hxx>
+#endif
-#define PROPERTYNAME_PICKLISTSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("PickListSize" ))
-#define PROPERTYNAME_HISTORYSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("Size" ))
-#define PROPERTYNAME_HELPBOOKMARKSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("HelpBookmarkSize" ))
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
-#define PROPERTYNAME_PICKLIST OUString(RTL_CONSTASCII_USTRINGPARAM("PickList" ))
-#define PROPERTYNAME_HISTORY OUString(RTL_CONSTASCII_USTRINGPARAM("List" ))
-#define PROPERTYNAME_HELPBOOKMARKS OUString(RTL_CONSTASCII_USTRINGPARAM("HelpBookmarks" ))
+#ifndef _SVT_LOGHELPER_HXX
+#include "loghelper.hxx"
+#endif
-#define PROPERTYNAME_HISTORYITEM_URL HISTORY_PROPERTYNAME_URL
-#define PROPERTYNAME_HISTORYITEM_FILTER HISTORY_PROPERTYNAME_FILTER
-#define PROPERTYNAME_HISTORYITEM_TITLE HISTORY_PROPERTYNAME_TITLE
-#define PROPERTYNAME_HISTORYITEM_PASSWORD HISTORY_PROPERTYNAME_PASSWORD
+//_________________________________________________________________________________________________________________
+// namespaces
+//_________________________________________________________________________________________________________________
-#define OFFSET_URL 0
-#define OFFSET_FILTER 1
-#define OFFSET_TITLE 2
-#define OFFSET_PASSWORD 3
+using namespace ::std ;
+using namespace ::utl ;
+using namespace ::rtl ;
+using namespace ::osl ;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::beans ;
-#define PROPERTYHANDLE_PICKLISTSIZE 0
-#define PROPERTYHANDLE_HISTORYSIZE 1
-#define PROPERTYHANDLE_HELPBOOKMARKSIZE 2
+namespace css = ::com::sun::star;
-#define FIXPROPERTYCOUNT 3 // counts PROPERYHANDLE_PICKLISTSIZE ... PROPERTYHANDLE_HELPBOOKMARKSIZE!
+//_________________________________________________________________________________________________________________
+// const
+//_________________________________________________________________________________________________________________
-#define FIXP OUString(RTL_CONSTASCII_USTRINGPARAM("p" ))
-#define FIXH OUString(RTL_CONSTASCII_USTRINGPARAM("h" ))
-#define FIXB OUString(RTL_CONSTASCII_USTRINGPARAM("b" ))
+namespace {
+ static const ::sal_Int32 s_nOffsetURL = 0;
+ static const ::sal_Int32 s_nOffsetFilter = 1;
+ static const ::sal_Int32 s_nOffsetTitle = 2;
+ static const ::sal_Int32 s_nOffsetPassword = 3;
+}
//_________________________________________________________________________________________________________________
-// private declarations!
+// private declarations!
//_________________________________________________________________________________________________________________
struct IMPL_THistoryItem
@@ -116,15 +118,15 @@ struct IMPL_THistoryItem
{
}
- IMPL_THistoryItem( const OUString& sNewURL ,
- const OUString& sNewFilter ,
- const OUString& sNewTitle ,
- const OUString& sNewPassword )
+ IMPL_THistoryItem( const OUString& sNewURL ,
+ const OUString& sNewFilter ,
+ const OUString& sNewTitle ,
+ const OUString& sNewPassword )
{
- sURL = sNewURL ;
- sFilter = sNewFilter ;
- sTitle = sNewTitle ;
- sPassword = sNewPassword ;
+ sURL = sNewURL ;
+ sFilter = sNewFilter ;
+ sTitle = sNewTitle ;
+ sPassword = sNewPassword ;
}
sal_Bool operator==( const OUString& sSearchedURL )
@@ -132,294 +134,68 @@ struct IMPL_THistoryItem
return( sURL == sSearchedURL );
}
- OUString sURL ;
- OUString sFilter ;
- OUString sTitle ;
- OUString sPassword ;
+ OUString sURL ;
+ OUString sFilter ;
+ OUString sTitle ;
+ OUString sPassword ;
};
-class SvtHistoryOptions_Impl : public ConfigItem
+//*****************************************************************************************************************
+// class SvtHistoryOptions_Impl
+// redesigned
+//*****************************************************************************************************************
+class SvtHistoryOptions_Impl
{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- SvtHistoryOptions_Impl();
- ~SvtHistoryOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short called for notify of configmanager
- @descr These method is called from the ConfigManager before application ends or from the
- PropertyChangeListener if the sub tree broadcasts changes. You must update your
- internal values.
-
- @seealso baseclass ConfigItem
-
- @param "seqPropertyNames" is the list of properties which should be updated.
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Notify( const Sequence< OUString >& seqPropertyNames );
-
- /*-****************************************************************************************************//**
- @short write changes to configuration
- @descr These method writes the changed values into the sub tree
- and should always called in our destructor to guarantee consistency of config data.
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Commit();
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short base implementation of public interface for "SvtHistoryOptions"!
- @descr These class is used as static member of "SvtHistoryOptions" ...
- => The code exist only for one time and isn't duplicated for every instance!
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- sal_uInt32 GetSize ( EHistoryType eHistory );
- void SetSize ( EHistoryType eHistory ,
- sal_uInt32 nSize );
- void Clear ( EHistoryType eHistory );
- Sequence< Sequence< PropertyValue > > GetList ( EHistoryType eHistory );
- void AppendItem ( EHistoryType eHistory ,
- const OUString& sURL ,
- const OUString& sFilter ,
- const OUString& sTitle ,
- const OUString& sPassword );
-
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- /*-****************************************************************************************************//**
- @short return list of key names of ouer configuration management which represent oue module tree
- @descr These methods return the current list of key names! We need it to get needed values from our
- configuration management and support dynamical history lists!
-
- @seealso -
-
- @param -
- @return A list of configuration key names is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- Sequence< OUString > impl_GetPropertyNames( sal_uInt32& nPicklistCount ,
- sal_uInt32& nHistoryCount ,
- sal_uInt32& nHelpBookmarkCount );
-
- /*-****************************************************************************************************//**
- @short convert routine
- @descr Intern we hold ouer values in a deque. Sometimes we need his content as a return sequence.
- Then we must convert ouer internal format to extern.
- That is the reason for these method!
-
- @seealso -
-
- @param "aList" list in deque format.
- @return A list which right format is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- Sequence< Sequence< PropertyValue > > impl_GetSequenceFromList( const deque< IMPL_THistoryItem >& aList );
-
- /*-****************************************************************************************************//**
- @short helper
- @descr Some code is the same for different internal history list. So we can get a pointer as an access to
- right internal member list by calling this method with right enum value.
- Returned pointer can be used to implement some functionality on this list then.
- By the way - we return max size of these list too ...
-
- @seealso using!
-
- @param "eType" describe, which list should be returned as pointer
- @return A pointer to one of our internal member lists.
-
- @onerror We return NULL.
- *//*-*****************************************************************************************************/
-
- void impl_GetListInfo( EHistoryType eType ,
- deque< IMPL_THistoryItem >** ppList ,
- sal_uInt32** ppMaxSize );
-
- //-------------------------------------------------------------------------------------------------------------
- // private member
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- deque< IMPL_THistoryItem > m_aPicklist ;
- sal_uInt32 m_nPicklistSize ;
- deque< IMPL_THistoryItem > m_aHistory ;
- sal_uInt32 m_nHistorySize ;
- deque< IMPL_THistoryItem > m_aHelpBookmarks ;
- sal_uInt32 m_nHelpBookmarkSize ;
+public:
+ SvtHistoryOptions_Impl();
+ ~SvtHistoryOptions_Impl();
+
+ sal_uInt32 GetSize( EHistoryType eHistory );
+ void SetSize( EHistoryType eHistory, sal_uInt32 nSize );
+ void Clear( EHistoryType eHistory );
+ Sequence< Sequence< PropertyValue > > GetList( EHistoryType eHistory );
+ void AppendItem( EHistoryType eHistory ,
+ const OUString& sURL ,
+ const OUString& sFilter ,
+ const OUString& sTitle ,
+ const OUString& sPassword );
+
+private:
+ void impl_truncateList (EHistoryType eHistory, sal_uInt32 nSize);
+
+private:
+ css::uno::Reference< css::container::XNameAccess > m_xCfg;
+ css::uno::Reference< css::container::XNameAccess > m_xCommonXCU;
};
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
//*****************************************************************************************************************
// constructor
//*****************************************************************************************************************
SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()
- // Init baseclasses first
- : ConfigItem ( ROOTNODE_HISTORY )
- // Init member then...
{
- // Use our list snapshot of configuration keys to get his values.
- // See impl_GetPropertyNames() for further informations.
- sal_uInt32 nPicklistCount = 0;
- sal_uInt32 nHistoryCount = 0;
- sal_uInt32 nHelpBookmarkCount = 0;
- Sequence< OUString > seqNames = impl_GetPropertyNames ( nPicklistCount ,
- nHistoryCount ,
- nHelpBookmarkCount );
- Sequence< Any > seqValues = GetProperties ( seqNames );
-
- // Safe impossible cases.
- // We need values from ALL configuration keys.
- // Follow assignment use order of values in relation to our list of key names!
- DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- // Copy values from list in right order to ouer internal member.
- // Attention: List for names and values have an internal construction pattern!
- // zB:
- // Name Value
- // /Picklist/Size 2
- // /History/Size 3
- // /Picklist/List/1/URL "file://a"
- // /Picklist/List/1/Filter "writer-..."
- // /Picklist/List/1/Title "Test1"
- // /Picklist/List/1/Password "lysemyf1"
- // /Picklist/List/2/URL "file://b"
- // /Picklist/List/2/Filter "calc-..."
- // /Picklist/List/2/Title "Test2"
- // /Picklist/List/2/Password "lysemyf2"
- // /History/List/2/URL "http://blub"
- // /History/List/2/Filter "html-..."
- // /History/List/2/Title "blub"
- // /History/List/2/Password "xxx"
- // ... and so on ...
-
- // First we must read sizes of ouer history lists => the first to values.
- // We need these informations to work correctly with follow keys!
- seqValues[PROPERTYHANDLE_PICKLISTSIZE ] >>= m_nPicklistSize ;
- seqValues[PROPERTYHANDLE_HISTORYSIZE ] >>= m_nHistorySize ;
- seqValues[PROPERTYHANDLE_HELPBOOKMARKSIZE] >>= m_nHelpBookmarkSize ;
-
- // Safe impossible cases.
- // I think a size of 0 isn't relay meaningful.
- if( m_nPicklistSize < 1 )
+ try
{
- m_nPicklistSize = DEFAULT_PICKLISTSIZE;
- DBG_ASSERT( sal_False, "SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()\nI think a picklist size of 0 isn't relay meaningful! Set new value to 4 entries.\n" );
+ m_xCfg = Reference< css::container::XNameAccess > (
+ ::comphelper::ConfigurationHelper::openConfig(
+ utl::getProcessServiceFactory(),
+ s_sHistories,
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY );
+
+ m_xCommonXCU = Reference< css::container::XNameAccess > (
+ ::comphelper::ConfigurationHelper::openConfig(
+ utl::getProcessServiceFactory(),
+ s_sCommonHistory,
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY );
}
- if( m_nHistorySize < 1 )
+ catch(const css::uno::Exception& ex)
{
- m_nHistorySize = DEFAULT_HISTORYSIZE;
- DBG_ASSERT( sal_False, "SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()\nI think a history size of 0 isn't relay meaningful! Set new value to 10 entries.\n" );
- }
- if( m_nHelpBookmarkSize < 1 )
- {
- m_nHelpBookmarkSize = DEFAULT_HELPBOOKMARKSIZE;
- DBG_ASSERT( sal_False, "SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()\nI think a help bookmark size of 0 isn't relay meaningful! Set new value to 100 entries.\n" );
- }
-
- IMPL_THistoryItem aItem;
- sal_uInt32 nPosition = FIXPROPERTYCOUNT; // step over first three readed size values! but count begins at 0!
- // Get names/values for picklist.
- // 4 subkeys for every item!
- OUString sName;
- sal_uInt32 nItem;
- for( nItem=0; nItem<nPicklistCount; ++nItem )
- {
- seqValues[nPosition] >>= aItem.sURL ;
- ++nPosition;
- seqValues[nPosition] >>= aItem.sFilter ;
- ++nPosition;
- seqValues[nPosition] >>= aItem.sTitle ;
- ++nPosition;
- seqValues[nPosition] >>= aItem.sPassword ;
- ++nPosition;
- m_aPicklist.push_back( aItem );
- }
+ m_xCfg.clear();
+ m_xCommonXCU.clear();
- // Attention: Don't reset nPosition here!
-
- // Get names/values for picklist.
- // 4 subkeys for every item!
- for( nItem=0; nItem<nHistoryCount; ++nItem )
- {
- seqValues[nPosition] >>= aItem.sURL ;
- ++nPosition;
- seqValues[nPosition] >>= aItem.sFilter ;
- ++nPosition;
- seqValues[nPosition] >>= aItem.sTitle ;
- ++nPosition;
- seqValues[nPosition] >>= aItem.sPassword ;
- ++nPosition;
- m_aHistory.push_back( aItem );
- }
-
- // Get names/values for help bookmarks.
- // 4 subkeys for every item!
- for( nItem=0; nItem<nHelpBookmarkCount; ++nItem )
- {
- seqValues[nPosition] >>= aItem.sURL ;
- ++nPosition;
- seqValues[nPosition] >>= aItem.sFilter ;
- ++nPosition;
- seqValues[nPosition] >>= aItem.sTitle ;
- ++nPosition;
- seqValues[nPosition] >>= aItem.sPassword ;
- ++nPosition;
- m_aHelpBookmarks.push_back( aItem );
+ LogHelper::logIt(ex);
}
-
-/*TODO: Not used in the moment! see Notify() ...
- // Enable notification mechanism of ouer baseclass.
- // We need it to get information about changes outside these class on ouer used configuration keys!
- Sequence< OUString > seqNotifications( seqNames );
- sal_Int32 nNotifyCount = seqNames.getLength();
- seqNotifications.realloc( nNotifyCount+PROPERTYCOUNT_LISTNODES );
- seqNotification[nNotifyCount ] = PROPERTYNAME_PICKLIST;
- seqNotification[nNotifyCount+1] = PROPERTYNAME_HISTORY ;
- EnableNotification( seqNotification );
-*/
}
//*****************************************************************************************************************
@@ -427,379 +203,441 @@ SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()
//*****************************************************************************************************************
SvtHistoryOptions_Impl::~SvtHistoryOptions_Impl()
{
- // We must save our current values .. if user forget it!
- if( IsModified() == sal_True )
- {
- Commit();
- }
}
//*****************************************************************************************************************
// public method
+// Attention: We return the max. size of our internal lists - That is the capacity not the size!
//*****************************************************************************************************************
-void SvtHistoryOptions_Impl::Notify( const Sequence< OUString >& )
+sal_uInt32 SvtHistoryOptions_Impl::GetSize( EHistoryType eHistory )
{
- DBG_ASSERT( sal_False, "SvtHistoryOptions_Impl::Notify()\nNot implemented yet! I don't know how I can handle a dynamical list of unknown properties ...\n" );
-}
+ sal_uInt32 nSize = 0 ;
+ css::uno::Reference< css::beans::XPropertySet > xListAccess(m_xCommonXCU, css::uno::UNO_QUERY);
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtHistoryOptions_Impl::Commit()
-{
- // First write fix properties.
- Sequence< OUString > seqFixPropertyNames ( FIXPROPERTYCOUNT );
- Sequence< Any > seqFixPropertyValues( FIXPROPERTYCOUNT );
- seqFixPropertyNames [PROPERTYHANDLE_PICKLISTSIZE ] = PROPERTYNAME_PICKLISTSIZE ;
- seqFixPropertyNames [PROPERTYHANDLE_HISTORYSIZE ] = PROPERTYNAME_HISTORYSIZE ;
- seqFixPropertyNames [PROPERTYHANDLE_HELPBOOKMARKSIZE] = PROPERTYNAME_HELPBOOKMARKSIZE ;
- seqFixPropertyValues[PROPERTYHANDLE_PICKLISTSIZE ] <<= m_nPicklistSize ;
- seqFixPropertyValues[PROPERTYHANDLE_HISTORYSIZE ] <<= m_nHistorySize ;
- seqFixPropertyValues[PROPERTYHANDLE_HELPBOOKMARKSIZE] <<= m_nHelpBookmarkSize ;
- PutProperties( seqFixPropertyNames, seqFixPropertyValues );
-
- // Write set of dynamic properties then.
- ClearNodeSet( PROPERTYNAME_PICKLIST );
- ClearNodeSet( PROPERTYNAME_HISTORY );
- ClearNodeSet( PROPERTYNAME_HELPBOOKMARKS );
-
- IMPL_THistoryItem aItem ;
- OUString sNode ;
- Sequence< PropertyValue > seqPropertyValues( 4 ) ;
-
- // Copy picklist entries to save-list!
- sal_uInt32 nPicklistCount = m_aPicklist.size();
- sal_uInt32 nItem;
- for( nItem=0; nItem<nPicklistCount; ++nItem )
+ try
{
- aItem = m_aPicklist[nItem];
- sNode = PROPERTYNAME_PICKLIST + PATHDELIMITER + FIXP + OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER;
- seqPropertyValues[OFFSET_URL ].Name = sNode + PROPERTYNAME_HISTORYITEM_URL ;
- seqPropertyValues[OFFSET_FILTER ].Name = sNode + PROPERTYNAME_HISTORYITEM_FILTER ;
- seqPropertyValues[OFFSET_TITLE ].Name = sNode + PROPERTYNAME_HISTORYITEM_TITLE ;
- seqPropertyValues[OFFSET_PASSWORD ].Name = sNode + PROPERTYNAME_HISTORYITEM_PASSWORD ;
- seqPropertyValues[OFFSET_URL ].Value <<= aItem.sURL ;
- seqPropertyValues[OFFSET_FILTER ].Value <<= aItem.sFilter ;
- seqPropertyValues[OFFSET_TITLE ].Value <<= aItem.sTitle ;
- seqPropertyValues[OFFSET_PASSWORD ].Value <<= aItem.sPassword ;
-
- SetSetProperties( PROPERTYNAME_PICKLIST, seqPropertyValues );
- }
+ switch( eHistory )
+ {
+ case ePICKLIST:
+ xListAccess->getPropertyValue(s_sPickListSize) >>= nSize;
+ break;
- // Copy URL-list entries to save-list!
- sal_uInt32 nHistoryCount = m_aHistory.size();
- for( nItem=0; nItem<nHistoryCount; ++nItem )
- {
- aItem = m_aHistory[nItem];
- sNode = PROPERTYNAME_HISTORY + PATHDELIMITER + FIXH + OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER;
- seqPropertyValues[OFFSET_URL ].Name = sNode + PROPERTYNAME_HISTORYITEM_URL ;
- seqPropertyValues[OFFSET_FILTER ].Name = sNode + PROPERTYNAME_HISTORYITEM_FILTER ;
- seqPropertyValues[OFFSET_TITLE ].Name = sNode + PROPERTYNAME_HISTORYITEM_TITLE ;
- seqPropertyValues[OFFSET_PASSWORD ].Name = sNode + PROPERTYNAME_HISTORYITEM_PASSWORD ;
- seqPropertyValues[OFFSET_URL ].Value <<= aItem.sURL ;
- seqPropertyValues[OFFSET_FILTER ].Value <<= aItem.sFilter ;
- seqPropertyValues[OFFSET_TITLE ].Value <<= aItem.sTitle ;
- seqPropertyValues[OFFSET_PASSWORD ].Value <<= aItem.sPassword ;
-
- SetSetProperties( PROPERTYNAME_HISTORY, seqPropertyValues );
- }
+ case eHISTORY:
+ xListAccess->getPropertyValue(s_sURLHistorySize) >>= nSize;
+ break;
+
+ case eHELPBOOKMARKS:
+ xListAccess->getPropertyValue(s_sHelpBookmarksSize) >>= nSize;
+ break;
- // Copy HelpBookmark-list entries to save-list!
- sal_uInt32 nHelpBookmarkCount = m_aHelpBookmarks.size();
- for( nItem=0; nItem<nHelpBookmarkCount; ++nItem )
+ default:
+ break;
+ }
+ }
+ catch(const css::uno::Exception& ex)
{
- aItem = m_aHelpBookmarks[nItem];
- sNode = PROPERTYNAME_HELPBOOKMARKS + PATHDELIMITER + FIXB + OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER;
- seqPropertyValues[OFFSET_URL ].Name = sNode + PROPERTYNAME_HISTORYITEM_URL ;
- seqPropertyValues[OFFSET_FILTER ].Name = sNode + PROPERTYNAME_HISTORYITEM_FILTER ;
- seqPropertyValues[OFFSET_TITLE ].Name = sNode + PROPERTYNAME_HISTORYITEM_TITLE ;
- seqPropertyValues[OFFSET_PASSWORD ].Name = sNode + PROPERTYNAME_HISTORYITEM_PASSWORD ;
- seqPropertyValues[OFFSET_URL ].Value <<= aItem.sURL ;
- seqPropertyValues[OFFSET_FILTER ].Value <<= aItem.sFilter ;
- seqPropertyValues[OFFSET_TITLE ].Value <<= aItem.sTitle ;
- seqPropertyValues[OFFSET_PASSWORD ].Value <<= aItem.sPassword ;
-
- SetSetProperties( PROPERTYNAME_HELPBOOKMARKS, seqPropertyValues );
+ LogHelper::logIt(ex);
}
+
+ return nSize;
}
//*****************************************************************************************************************
// public method
+// Attention: We return the max. size of our internal lists - That is the capacity not the size!
//*****************************************************************************************************************
-sal_uInt32 SvtHistoryOptions_Impl::GetSize( EHistoryType eHistory )
+void SvtHistoryOptions_Impl::SetSize( EHistoryType eHistory, sal_uInt32 nSize )
{
- // Attention: We return the max. size of our internal lists - That is the capacity not the size!
+ css::uno::Reference< css::beans::XPropertySet > xListAccess(m_xCommonXCU, css::uno::UNO_QUERY);
+ if (! xListAccess.is ())
+ return;
+
+ try
+ {
+ switch( eHistory )
+ {
+ case ePICKLIST:
+ if(nSize!=GetSize(ePICKLIST))
+ {
+ xListAccess->setPropertyValue(s_sPickListSize, css::uno::makeAny(nSize));
+ ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
+ }
+ break;
+
+ case eHISTORY:
+ if(nSize!=GetSize(eHISTORY))
+ {
+ xListAccess->setPropertyValue(s_sURLHistorySize, css::uno::makeAny(nSize));
+ ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
+ }
+ break;
+
+ case eHELPBOOKMARKS:
+ if(nSize!=GetSize(eHELPBOOKMARKS))
+ {
+ xListAccess->setPropertyValue(s_sHelpBookmarksSize, css::uno::makeAny(nSize));
+ ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
+ }
+ break;
- // Set default return value if method failed!
- sal_uInt32 nSize = 0;
- // Get size of searched history list.
- switch( eHistory )
+ default:
+ break;
+ }
+
+ impl_truncateList (eHistory, nSize);
+ }
+ catch(const css::uno::Exception& ex)
{
- case ePICKLIST : nSize = m_nPicklistSize;
- break;
- case eHISTORY : nSize = m_nHistorySize;
- break;
- case eHELPBOOKMARKS : nSize = m_nHistorySize;
- break;
+ LogHelper::logIt(ex);
}
- // Return result of operation.
- return nSize;
}
-
-//*****************************************************************************************************************
-// public method
+
//*****************************************************************************************************************
-void SvtHistoryOptions_Impl::SetSize( EHistoryType eHistory, sal_uInt32 nSize )
+void SvtHistoryOptions_Impl::impl_truncateList ( EHistoryType eHistory, sal_uInt32 nSize )
{
- // Attention: We set the max. size of our internal lists - That is the capacity not the size!
- // Set size of searched history list.
- deque< IMPL_THistoryItem >* pList = NULL;
- sal_uInt32* pMaxSize = NULL;
- impl_GetListInfo( eHistory, &pList, &pMaxSize );
-
- if( pList!=NULL && pMaxSize!=NULL )
+ css::uno::Reference< css::container::XNameAccess > xList;
+ css::uno::Reference< css::container::XNameContainer > xItemList;
+ css::uno::Reference< css::container::XNameContainer > xOrderList;
+ css::uno::Reference< css::beans::XPropertySet > xSet;
+
+ try
{
- // If to much items in current list ...
+ switch( eHistory )
+ {
+ case ePICKLIST:
+ m_xCfg->getByName(s_sPickList) >>= xList;
+ break;
+
+ case eHISTORY:
+ m_xCfg->getByName(s_sURLHistory) >>= xList;
+ break;
+
+ case eHELPBOOKMARKS:
+ m_xCfg->getByName(s_sHelpBookmarks) >>= xList;
+ break;
+
+ default:
+ break;
+ }
+
+ // If too much items in current list ...
// truncate the oldest items BEFORE you set the new one.
- if( nSize<pList->size() )
+ if ( ! xList.is())
+ return;
+
+ xList->getByName(s_sOrderList) >>= xOrderList;
+ xList->getByName(s_sItemList) >>= xItemList;
+
+ const sal_uInt32 nLength = xOrderList->getElementNames().getLength();
+ if (nSize < nLength)
{
- sal_uInt32 nOldItemCount = pList->size()-nSize;
- while( nOldItemCount>0 )
+ for (sal_uInt32 i=nLength-1; i>=nSize; --i)
{
- pList->pop_back();
- --nOldItemCount;
+ ::rtl::OUString sTmp;
+ const ::rtl::OUString sRemove = ::rtl::OUString::valueOf((sal_Int32)i);
+ xOrderList->getByName(sRemove) >>= xSet;
+ xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp;
+ xItemList->removeByName(sTmp);
+ xOrderList->removeByName(sRemove);
}
+
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
}
- *pMaxSize = nSize;
- Commit();
}
-}
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
//*****************************************************************************************************************
// public method
+// Clear specified history list
//*****************************************************************************************************************
void SvtHistoryOptions_Impl::Clear( EHistoryType eHistory )
{
- // Clear specified history list.
- deque< IMPL_THistoryItem >* pList = NULL;
- sal_uInt32* pMaxSize = NULL;
- impl_GetListInfo( eHistory, &pList, &pMaxSize );
+ css::uno::Reference< css::container::XNameAccess > xListAccess;
+ css::uno::Reference< css::container::XNameContainer > xNode;
+ Sequence< ::rtl::OUString > lOrders;
- if( pList!=NULL && pMaxSize!=NULL )
+ try
{
- pList->clear();
- Commit();
+ switch( eHistory )
+ {
+ case ePICKLIST:
+ {
+ m_xCfg->getByName(s_sPickList) >>= xListAccess;
+ break;
+ }
+
+ case eHISTORY:
+ {
+ m_xCfg->getByName(s_sURLHistory) >>= xListAccess;
+ break;
+ }
+
+ case eHELPBOOKMARKS:
+ {
+ m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ if (xListAccess.is())
+ {
+ // clear ItemList
+ xListAccess->getByName(s_sItemList) >>= xNode ;
+ lOrders = xNode->getElementNames();
+ const sal_Int32 nLength = lOrders.getLength();
+ for(sal_Int32 i=0; i<nLength; ++i)
+ xNode->removeByName(lOrders[i]);
+
+ // clear OrderList
+ xListAccess->getByName(s_sOrderList) >>= xNode ;
+ lOrders = xNode->getElementNames();
+ for(sal_Int32 j=0; j<nLength; ++j)
+ xNode->removeByName(lOrders[j]);
+
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
}
}
//*****************************************************************************************************************
// public method
+// get a sequence list from the items
//*****************************************************************************************************************
Sequence< Sequence< PropertyValue > > SvtHistoryOptions_Impl::GetList( EHistoryType eHistory )
{
- // Set default return value.
- Sequence< Sequence< PropertyValue > > seqReturn;
+ impl_truncateList (eHistory, GetSize (eHistory));
+
+ Sequence< Sequence< PropertyValue > > seqReturn; // Set default return value.
+ Sequence< PropertyValue > seqProperties( 4 );
+ Sequence< ::rtl::OUString > lOrders;
+
+ css::uno::Reference< css::container::XNameAccess > xListAccess;
+ css::uno::Reference< css::container::XNameAccess > xItemList;
+ css::uno::Reference< css::container::XNameAccess > xOrderList;
+ css::uno::Reference< css::beans::XPropertySet > xSet;
+
+ seqProperties[s_nOffsetURL ].Name = HISTORY_PROPERTYNAME_URL;
+ seqProperties[s_nOffsetFilter ].Name = HISTORY_PROPERTYNAME_FILTER;
+ seqProperties[s_nOffsetTitle ].Name = HISTORY_PROPERTYNAME_TITLE;
+ seqProperties[s_nOffsetPassword ].Name = HISTORY_PROPERTYNAME_PASSWORD;
+
+ try
+ {
+ switch( eHistory )
+ {
+ case ePICKLIST:
+ {
+ m_xCfg->getByName(s_sPickList) >>= xListAccess;
+ break;
+ }
+
+ case eHISTORY:
+ {
+ m_xCfg->getByName(s_sURLHistory) >>= xListAccess;
+ break;
+ }
- deque< IMPL_THistoryItem >* pList = NULL;
- sal_uInt32* pMaxSize = NULL;
- impl_GetListInfo( eHistory, &pList, &pMaxSize );
+ case eHELPBOOKMARKS:
+ {
+ m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
+ break;
+ }
- if( pList!=NULL && pMaxSize!=NULL )
- seqReturn = impl_GetSequenceFromList( *pList );
+ default:
+ break;
+ }
+
+ if (xListAccess.is())
+ {
+ xListAccess->getByName(s_sItemList) >>= xItemList;
+ xListAccess->getByName(s_sOrderList) >>= xOrderList;
+
+ const sal_Int32 nLength = xOrderList->getElementNames().getLength();
+ Sequence< Sequence< PropertyValue > > aRet(nLength);
+
+ for(sal_Int32 nItem=0; nItem<nLength; ++nItem)
+ {
+ ::rtl::OUString sUrl;
+ xOrderList->getByName(::rtl::OUString::valueOf(nItem)) >>= xSet;
+ xSet->getPropertyValue(s_sHistoryItemRef) >>= sUrl;
+
+ xItemList->getByName(sUrl) >>= xSet;
+ seqProperties[s_nOffsetURL ].Value <<= sUrl;
+ xSet->getPropertyValue(s_sFilter) >>= seqProperties[s_nOffsetFilter ].Value;
+ xSet->getPropertyValue(s_sTitle) >>= seqProperties[s_nOffsetTitle ].Value;
+ xSet->getPropertyValue(s_sPassword) >>= seqProperties[s_nOffsetPassword ].Value;
+ aRet[nItem] = seqProperties;
+ }
+ seqReturn = aRet;
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
return seqReturn;
}
//*****************************************************************************************************************
// public method
+// implements a deque in XML
//*****************************************************************************************************************
-void SvtHistoryOptions_Impl::AppendItem( EHistoryType eHistory ,
- const OUString& sURL ,
- const OUString& sFilter ,
- const OUString& sTitle ,
- const OUString& sPassword )
+void SvtHistoryOptions_Impl::AppendItem( EHistoryType eHistory ,
+ const OUString& sURL ,
+ const OUString& sFilter ,
+ const OUString& sTitle ,
+ const OUString& sPassword )
{
- // create new list item with given values
- IMPL_THistoryItem aItem( sURL, sFilter, sTitle, sPassword );
-
- // search for right internal list by given enum
- deque< IMPL_THistoryItem >* pList = NULL;
- sal_uInt32* pMaxSize = NULL;
- impl_GetListInfo( eHistory, &pList, &pMaxSize );
+ impl_truncateList (eHistory, GetSize (eHistory));
+
+ css::uno::Reference< css::container::XNameAccess > xListAccess;
+ sal_Int32 nMaxSize = 0;
- // work on these list
- if( pList!=NULL && pMaxSize!=NULL )
+ switch(eHistory)
{
- deque< IMPL_THistoryItem >::iterator pItem = ::std::find( pList->begin(), pList->end(), sURL );
- if( pItem == pList->end() )
+ case ePICKLIST:
+ {
+ m_xCfg->getByName(s_sPickList) >>= xListAccess;
+ nMaxSize = GetSize(ePICKLIST);
+ }
+ break;
+ case eHISTORY:
{
- // If current list full ... delete the oldest item.
- if( pList->size() >= *pMaxSize )
- pList->pop_back();
- // Append new item to list.
- pList->push_front( aItem );
- Commit();
+ m_xCfg->getByName(s_sURLHistory) >>= xListAccess;
+ nMaxSize = GetSize(eHISTORY);
}
- else if (pItem != pList->begin())
+ break;
+ case eHELPBOOKMARKS:
{
- IMPL_THistoryItem aTempItem = *pItem;
- pList->erase(pItem);
- pList->push_front(aTempItem);
- Commit();
+ m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
+ nMaxSize = GetSize(eHELPBOOKMARKS);
}
+ break;
+ default:
+ break;
}
-}
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< OUString > SvtHistoryOptions_Impl::impl_GetPropertyNames( sal_uInt32& nPicklistCount ,
- sal_uInt32& nHistoryCount ,
- sal_uInt32& nHelpBookmarkCount )
-{
- /* TODO
- Index basiert einf�gen !!! => p0 => 0 p1 => 1 ...
- */
-
- // First get ALL names of current existing list items in configuration!
- Sequence< OUString > seqPicklistItems = GetNodeNames( PROPERTYNAME_PICKLIST );
- Sequence< OUString > seqHistoryItems = GetNodeNames( PROPERTYNAME_HISTORY );
- Sequence< OUString > seqHelpBookmarkItems = GetNodeNames( PROPERTYNAME_HELPBOOKMARKS );
-
- // Get information about list counts ...
- nPicklistCount = seqPicklistItems.getLength ();
- nHistoryCount = seqHistoryItems.getLength ();
- nHelpBookmarkCount = seqHelpBookmarkItems.getLength();
- // ... and create a property list with right size! (+2...see fix properties below!)
- Sequence< OUString > seqProperties( FIXPROPERTYCOUNT +
- (nPicklistCount *4) +
- (nHistoryCount *4) +
- (nHelpBookmarkCount*4) );
-
- // Add names of fix properties to list.
- seqProperties[PROPERTYHANDLE_PICKLISTSIZE ] = PROPERTYNAME_PICKLISTSIZE ;
- seqProperties[PROPERTYHANDLE_HISTORYSIZE ] = PROPERTYNAME_HISTORYSIZE ;
- seqProperties[PROPERTYHANDLE_HELPBOOKMARKSIZE] = PROPERTYNAME_HELPBOOKMARKSIZE ;
-
- sal_uInt32 nPosition = FIXPROPERTYCOUNT; // step over three fix properties for sizes! but count begins at 0!
- // Add names for picklist to list.
- // 4 subkeys for every item!
- // nPosition is the start point of an history item, nItem an index into right list of node names!
- sal_uInt32 nItem;
- for( nItem=0; nItem<nPicklistCount; ++nItem )
- {
- seqProperties[nPosition] = PROPERTYNAME_PICKLIST + PATHDELIMITER + seqPicklistItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_URL ;
- ++nPosition;
- seqProperties[nPosition] = PROPERTYNAME_PICKLIST + PATHDELIMITER + seqPicklistItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_FILTER ;
- ++nPosition;
- seqProperties[nPosition] = PROPERTYNAME_PICKLIST + PATHDELIMITER + seqPicklistItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_TITLE ;
- ++nPosition;
- seqProperties[nPosition] = PROPERTYNAME_PICKLIST + PATHDELIMITER + seqPicklistItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_PASSWORD ;
- ++nPosition;
- }
+ if (nMaxSize==0)
+ return;
- // Attention: Don't reset nPosition here!
+ css::uno::Reference< css::container::XNameContainer > xItemList;
+ css::uno::Reference< css::container::XNameContainer > xOrderList;
+ css::uno::Reference< css::beans::XPropertySet > xSet;
- // Add names for URL-list to list.
- // 4 subkeys for every item!
- // nPosition is the start point of an history item, nItem an index into right list of node names!
- for( nItem=0; nItem<nHistoryCount; ++nItem )
+ try
{
- seqProperties[nPosition] = PROPERTYNAME_HISTORY + PATHDELIMITER + seqHistoryItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_URL ;
- ++nPosition;
- seqProperties[nPosition] = PROPERTYNAME_HISTORY + PATHDELIMITER + seqHistoryItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_FILTER ;
- ++nPosition;
- seqProperties[nPosition] = PROPERTYNAME_HISTORY + PATHDELIMITER + seqHistoryItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_TITLE ;
- ++nPosition;
- seqProperties[nPosition] = PROPERTYNAME_HISTORY + PATHDELIMITER + seqHistoryItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_PASSWORD ;
- ++nPosition;
- }
-
- // Attention: Don't reset nPosition here!
+ xListAccess->getByName(s_sItemList) >>= xItemList;
+ xListAccess->getByName(s_sOrderList) >>= xOrderList;
+ sal_Int32 nLength = xOrderList->getElementNames().getLength();
- // Add names for HelpBookmark-list to list.
- // 4 subkeys for every item!
- // nPosition is the start point of an bokmark item, nItem an index into right list of node names!
- for( nItem=0; nItem<nHelpBookmarkCount; ++nItem )
- {
- seqProperties[nPosition] = PROPERTYNAME_HELPBOOKMARKS + PATHDELIMITER + seqHelpBookmarkItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_URL ;
- ++nPosition;
- seqProperties[nPosition] = PROPERTYNAME_HELPBOOKMARKS + PATHDELIMITER + seqHelpBookmarkItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_FILTER ;
- ++nPosition;
- seqProperties[nPosition] = PROPERTYNAME_HELPBOOKMARKS + PATHDELIMITER + seqHelpBookmarkItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_TITLE ;
- ++nPosition;
- seqProperties[nPosition] = PROPERTYNAME_HELPBOOKMARKS + PATHDELIMITER + seqHelpBookmarkItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_PASSWORD ;
- ++nPosition;
- }
+ // The item to be appended is already existing!
+ if (xItemList->hasByName(sURL))
+ {
+ for (sal_Int32 i=0; i<nLength; ++i)
+ {
+ ::rtl::OUString sTmp;
+ xOrderList->getByName(::rtl::OUString::valueOf(i)) >>= xSet;
+ xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp;
+
+ if(sURL == sTmp)
+ {
+ ::rtl::OUString sFind;
+ xOrderList->getByName( ::rtl::OUString::valueOf(i) ) >>= xSet;
+ xSet->getPropertyValue(s_sHistoryItemRef) >>= sFind;
+ for (sal_Int32 j=i-1; j>=0; --j)
+ {
+ css::uno::Reference< css::beans::XPropertySet > xPrevSet;
+ css::uno::Reference< css::beans::XPropertySet > xNextSet;
+ xOrderList->getByName( ::rtl::OUString::valueOf(j+1) ) >>= xPrevSet;
+ xOrderList->getByName( ::rtl::OUString::valueOf(j) ) >>= xNextSet;
+
+ ::rtl::OUString sTemp;
+ xNextSet->getPropertyValue(s_sHistoryItemRef) >>= sTemp;
+ xPrevSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sTemp));
+ }
+ xOrderList->getByName( ::rtl::OUString::valueOf((sal_Int32)0) ) >>= xSet;
+ xSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sFind));
+
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ break;
+ }
+ }
+ }
- // Return result.
- return seqProperties;
-}
+ // The item to be appended is not existing!
+ else
+ {
+ css::uno::Reference< css::lang::XSingleServiceFactory > xFac;
+ css::uno::Reference< css::uno::XInterface > xInst;
+ css::uno::Reference< css::beans::XPropertySet > xPrevSet;
+ css::uno::Reference< css::beans::XPropertySet > xNextSet;
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< Sequence< PropertyValue > > SvtHistoryOptions_Impl::impl_GetSequenceFromList( const deque< IMPL_THistoryItem >& aList )
-{
- // Initialize return sequence with right size.
- sal_uInt32 nCount = aList.size();
- Sequence< Sequence< PropertyValue > > seqResult( nCount );
- Sequence< PropertyValue > seqProperties( 4 );
- // Copy items from given to return list.
- for( sal_uInt32 nItem=0; nItem<nCount; ++nItem )
- {
- seqProperties[OFFSET_URL ].Name = HISTORY_PROPERTYNAME_URL ;
- seqProperties[OFFSET_FILTER ].Name = HISTORY_PROPERTYNAME_FILTER ;
- seqProperties[OFFSET_TITLE ].Name = HISTORY_PROPERTYNAME_TITLE ;
- seqProperties[OFFSET_PASSWORD ].Name = HISTORY_PROPERTYNAME_PASSWORD ;
- seqProperties[OFFSET_URL ].Value <<= aList[nItem].sURL ;
- seqProperties[OFFSET_FILTER ].Value <<= aList[nItem].sFilter ;
- seqProperties[OFFSET_TITLE ].Value <<= aList[nItem].sTitle ;
- seqProperties[OFFSET_PASSWORD ].Value <<= aList[nItem].sPassword ;
- seqResult[nItem] = seqProperties;
+ // Append new item to OrderList.
+ if ( nLength == nMaxSize )
+ {
+ ::rtl::OUString sRemove;
+ xOrderList->getByName(::rtl::OUString::valueOf(nLength-1)) >>= xSet;
+ xSet->getPropertyValue(s_sHistoryItemRef) >>= sRemove;
+ xItemList->removeByName(sRemove);
+ }
+ if ( nLength != nMaxSize )
+ {
+ xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xOrderList, css::uno::UNO_QUERY);
+ xInst = xFac->createInstance();
+ ::rtl::OUString sPush = ::rtl::OUString::valueOf(nLength++);
+ xOrderList->insertByName(sPush, css::uno::makeAny(xInst));
+ }
+ for (sal_Int32 j=nLength-1; j>0; --j)
+ {
+ xOrderList->getByName( ::rtl::OUString::valueOf(j) ) >>= xPrevSet;
+ xOrderList->getByName( ::rtl::OUString::valueOf(j-1) ) >>= xNextSet;
+ ::rtl::OUString sTemp;
+ xNextSet->getPropertyValue(s_sHistoryItemRef) >>= sTemp;
+ xPrevSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sTemp));
+ }
+ xOrderList->getByName( ::rtl::OUString::valueOf((sal_Int32)0) ) >>= xSet;
+ xSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sURL));
+
+ // Append the item to ItemList.
+ xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xItemList, css::uno::UNO_QUERY);
+ xInst = xFac->createInstance();
+ xItemList->insertByName(sURL, css::uno::makeAny(xInst));
+ xSet = css::uno::Reference< css::beans::XPropertySet >(xInst, css::uno::UNO_QUERY);
+ xSet->setPropertyValue(s_sFilter, css::uno::makeAny(sFilter));
+ xSet->setPropertyValue(s_sTitle, css::uno::makeAny(sTitle));
+ xSet->setPropertyValue(s_sPassword, css::uno::makeAny(sPassword));
+
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
}
- return seqResult;
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-void SvtHistoryOptions_Impl::impl_GetListInfo( EHistoryType eType ,
- deque< IMPL_THistoryItem >** ppList ,
- sal_uInt32** ppMaxSize )
-{
- *ppList = NULL ;
- *ppMaxSize = NULL ;
- switch( eType )
+ catch(const css::uno::Exception& ex)
{
- case ePICKLIST : {
- *ppList = &m_aPicklist ;
- *ppMaxSize = &m_nPicklistSize;
- }
- break;
- case eHISTORY : {
- *ppList = &m_aHistory ;
- *ppMaxSize = &m_nHistorySize;
- }
- break;
- case eHELPBOOKMARKS : {
- *ppList = &m_aHelpBookmarks ;
- *ppMaxSize = &m_nHelpBookmarkSize;
- }
- break;
+ LogHelper::logIt(ex);
}
}
//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
+// initialize static member
+// DON'T DO IT IN YOUR HEADER!
+// see definition for further informations
//*****************************************************************************************************************
-SvtHistoryOptions_Impl* SvtHistoryOptions::m_pDataContainer = NULL ;
-sal_Int32 SvtHistoryOptions::m_nRefCount = 0 ;
+SvtHistoryOptions_Impl* SvtHistoryOptions::m_pDataContainer = NULL ;
+sal_Int32 SvtHistoryOptions::m_nRefCount = 0 ;
//*****************************************************************************************************************
-// constructor
+// constructor
//*****************************************************************************************************************
SvtHistoryOptions::SvtHistoryOptions()
{
@@ -818,7 +656,7 @@ SvtHistoryOptions::SvtHistoryOptions()
}
//*****************************************************************************************************************
-// destructor
+// destructor
//*****************************************************************************************************************
SvtHistoryOptions::~SvtHistoryOptions()
{
@@ -836,7 +674,7 @@ SvtHistoryOptions::~SvtHistoryOptions()
}
//*****************************************************************************************************************
-// public method
+// public method
//*****************************************************************************************************************
sal_uInt32 SvtHistoryOptions::GetSize( EHistoryType eHistory ) const
{
@@ -845,7 +683,7 @@ sal_uInt32 SvtHistoryOptions::GetSize( EHistoryType eHistory ) const
}
//*****************************************************************************************************************
-// public method
+// public method
//*****************************************************************************************************************
void SvtHistoryOptions::SetSize( EHistoryType eHistory, sal_uInt32 nSize )
{
@@ -854,7 +692,7 @@ void SvtHistoryOptions::SetSize( EHistoryType eHistory, sal_uInt32 nSize )
}
//*****************************************************************************************************************
-// public method
+// public method
//*****************************************************************************************************************
void SvtHistoryOptions::Clear( EHistoryType eHistory )
{
@@ -863,7 +701,7 @@ void SvtHistoryOptions::Clear( EHistoryType eHistory )
}
//*****************************************************************************************************************
-// public method
+// public method
//*****************************************************************************************************************
Sequence< Sequence< PropertyValue > > SvtHistoryOptions::GetList( EHistoryType eHistory ) const
{
@@ -872,20 +710,20 @@ Sequence< Sequence< PropertyValue > > SvtHistoryOptions::GetList( EHistoryType e
}
//*****************************************************************************************************************
-// public method
+// public method
//*****************************************************************************************************************
-void SvtHistoryOptions::AppendItem( EHistoryType eHistory ,
- const OUString& sURL ,
- const OUString& sFilter ,
- const OUString& sTitle ,
- const OUString& sPassword )
+void SvtHistoryOptions::AppendItem( EHistoryType eHistory ,
+ const OUString& sURL ,
+ const OUString& sFilter ,
+ const OUString& sTitle ,
+ const OUString& sPassword )
{
MutexGuard aGuard( GetOwnStaticMutex() );
m_pDataContainer->AppendItem( eHistory, sURL, sFilter, sTitle, sPassword );
}
//*****************************************************************************************************************
-// private method
+// private method
//*****************************************************************************************************************
Mutex& SvtHistoryOptions::GetOwnStaticMutex()
{
diff --git a/svtools/source/config/loghelper.hxx b/svtools/source/config/loghelper.hxx
new file mode 100644
index 000000000000..22efd5cff46d
--- /dev/null
+++ b/svtools/source/config/loghelper.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: loghelper.hxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:20:29 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+#ifndef _SVT_LOGHELPER_HXX
+#define _SVT_LOGHELPER_HXX
+
+namespace css = ::com::sun::star;
+
+class LogHelper
+{
+public:
+ LogHelper();
+ ~LogHelper();
+
+ static void logIt(const css::uno::Exception&){}
+};
+
+inline void logIt(const css::uno::Exception& ex)
+{
+ ::rtl::OUStringBuffer sMsg(256);
+ sMsg.appendAscii("Unexpected exception catched. Original message was:\n\"" );
+ sMsg.append(ex.Message);
+ sMsg.appendAscii("\"");
+ OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr());
+}
+
+#endif
+
diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx
index 04dd03fa7273..657d82ddb44e 100644
--- a/svtools/source/config/printoptions.cxx
+++ b/svtools/source/config/printoptions.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: printoptions.cxx,v $
- * $Revision: 1.15 $
+ * $Revision: 1.14.236.3 $
*
* This file is part of OpenOffice.org.
*
@@ -48,8 +48,37 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+
+#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_
+#include <comphelper/configurationhelper.hxx>
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+
+#ifndef _SVT_LOGHELPER_HXX
+#include <loghelper.hxx>
+#endif
+
#include <itemholder2.hxx>
+
// -----------
// - statics -
// -----------
@@ -63,6 +92,7 @@ static USHORT aDPIArray[] = { 72, 96, 150, 200, 300, 600 };
// -----------
#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Print/Option"))
+#define ROOTNODE_PRINTOPTION OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/Print/Option"))
#define PROPERTYNAME_REDUCETRANSPARENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceTransparency"))
#define PROPERTYNAME_REDUCEDTRANSPARENCYMODE OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedTransparencyMode"))
@@ -75,19 +105,6 @@ static USHORT aDPIArray[] = { 72, 96, 150, 200, 300, 600 };
#define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapIncludesTransparency"))
#define PROPERTYNAME_CONVERTTOGREYSCALES OUString(RTL_CONSTASCII_USTRINGPARAM("ConvertToGreyscales"))
-#define PROPERTYHDL_REDUCETRANSPARENCY 0
-#define PROPERTYHDL_REDUCEDTRANSPARENCYMODE 1
-#define PROPERTYHDL_REDUCEGRADIENTS 2
-#define PROPERTYHDL_REDUCEDGRADIENTMODE 3
-#define PROPERTYHDL_REDUCEDGRADIENTSTEPCOUNT 4
-#define PROPERTYHDL_REDUCEBITMAPS 5
-#define PROPERTYHDL_REDUCEDBITMAPMODE 6
-#define PROPERTYHDL_REDUCEDBITMAPRESOLUTION 7
-#define PROPERTYHDL_REDUCEDBITMAPINCLUDESTRANSPARENCY 8
-#define PROPERTYHDL_CONVERTTOGREYSCALES 9
-
-#define PROPERTYCOUNT 10
-
// --------------
// - Namespaces -
// --------------
@@ -96,6 +113,7 @@ using namespace ::utl;
using namespace ::rtl;
using namespace ::osl;
using namespace ::com::sun::star::uno;
+namespace css = com::sun::star;
// -----------
// - statics -
@@ -114,7 +132,7 @@ sal_Int32 SvtPrintFileOptions::m_nRefCount = 0;
// - SvtPrintOptions_Impl -
// ------------------------
-class SvtPrintOptions_Impl : public ConfigItem
+class SvtPrintOptions_Impl
{
public:
@@ -126,255 +144,408 @@ public:
~SvtPrintOptions_Impl();
//---------------------------------------------------------------------------------------------------------
-// overloaded methods of baseclass
-//---------------------------------------------------------------------------------------------------------
-
- virtual void Commit();
-
-//---------------------------------------------------------------------------------------------------------
// public interface
//---------------------------------------------------------------------------------------------------------
- sal_Bool IsReduceTransparency() const { return m_bReduceTransparency; }
- sal_Int16 GetReducedTransparencyMode() const { return m_nReducedTransparencyMode; }
- sal_Bool IsReduceGradients() const { return m_bReduceGradients; }
- sal_Int16 GetReducedGradientMode() const { return m_nReducedGradientMode; }
- sal_Int16 GetReducedGradientStepCount() const { return m_nReducedGradientStepCount; }
- sal_Bool IsReduceBitmaps() const { return m_bReduceBitmaps; }
- sal_Int16 GetReducedBitmapMode() const { return m_nReducedBitmapMode; }
- sal_Int16 GetReducedBitmapResolution() const { return m_nReducedBitmapResolution; }
- sal_Bool IsReducedBitmapIncludesTransparency() const { return m_bReducedBitmapIncludesTransparency; }
- sal_Bool IsConvertToGreyscales() const { return m_bConvertToGreyscales; }
-
- void SetReduceTransparency( sal_Bool bState ) { m_bReduceTransparency = bState; SetModified(); }
- void SetReducedTransparencyMode( sal_Int16 nMode ) { m_nReducedTransparencyMode = nMode; SetModified(); }
- void SetReduceGradients( sal_Bool bState ) { m_bReduceGradients = bState; SetModified(); }
- void SetReducedGradientMode( sal_Int16 nMode ) { m_nReducedGradientMode = nMode; SetModified(); }
- void SetReducedGradientStepCount( sal_Int16 nStepCount ) { m_nReducedGradientStepCount = nStepCount; SetModified(); }
- void SetReduceBitmaps( sal_Bool bState ) { m_bReduceBitmaps = bState; SetModified(); }
- void SetReducedBitmapMode( sal_Int16 nMode ) { m_nReducedBitmapMode = nMode; SetModified(); }
- void SetReducedBitmapResolution( sal_Int16 nResolution ) { m_nReducedBitmapResolution = nResolution; SetModified(); }
- void SetReducedBitmapIncludesTransparency( sal_Bool bState ) { m_bReducedBitmapIncludesTransparency = bState; SetModified(); }
- void SetConvertToGreyscales( sal_Bool bState ) { m_bConvertToGreyscales = bState; SetModified(); }
-
-//-------------------------------------------------------------------------------------------------------------
-// private methods
+ sal_Bool IsReduceTransparency() const ;
+ sal_Int16 GetReducedTransparencyMode() const ;
+ sal_Bool IsReduceGradients() const ;
+ sal_Int16 GetReducedGradientMode() const ;
+ sal_Int16 GetReducedGradientStepCount() const ;
+ sal_Bool IsReduceBitmaps() const ;
+ sal_Int16 GetReducedBitmapMode() const ;
+ sal_Int16 GetReducedBitmapResolution() const ;
+ sal_Bool IsReducedBitmapIncludesTransparency() const ;
+ sal_Bool IsConvertToGreyscales() const;
+
+ void SetReduceTransparency( sal_Bool bState ) ;
+ void SetReducedTransparencyMode( sal_Int16 nMode ) ;
+ void SetReduceGradients( sal_Bool bState ) ;
+ void SetReducedGradientMode( sal_Int16 nMode ) ;
+ void SetReducedGradientStepCount( sal_Int16 nStepCount ) ;
+ void SetReduceBitmaps( sal_Bool bState ) ;
+ void SetReducedBitmapMode( sal_Int16 nMode ) ;
+ void SetReducedBitmapResolution( sal_Int16 nResolution ) ;
+ void SetReducedBitmapIncludesTransparency( sal_Bool bState ) ;
+ void SetConvertToGreyscales( sal_Bool bState ) ;
+
//-------------------------------------------------------------------------------------------------------------
-
-private:
-
- static Sequence< OUString > impl_GetPropertyNames();
-
+// private API
+//-------------------------------------------------------------------------------------------------------------
+
+private:
+ void impl_setValue (const ::rtl::OUString& sProp,
+ ::sal_Bool bNew );
+ void impl_setValue (const ::rtl::OUString& sProp,
+ ::sal_Int16 nNew );
+
//-------------------------------------------------------------------------------------------------------------
// private member
//-------------------------------------------------------------------------------------------------------------
private:
-
- sal_Bool m_bReduceTransparency;
- sal_Int16 m_nReducedTransparencyMode;
- sal_Bool m_bReduceGradients;
- sal_Int16 m_nReducedGradientMode;
- sal_Int16 m_nReducedGradientStepCount;
- sal_Bool m_bReduceBitmaps;
- sal_Int16 m_nReducedBitmapMode;
- sal_Int16 m_nReducedBitmapResolution;
- sal_Bool m_bReducedBitmapIncludesTransparency;
- sal_Bool m_bConvertToGreyscales;
+ css::uno::Reference< css::container::XNameAccess > m_xCfg;
+ css::uno::Reference< css::container::XNameAccess > m_xNode;
};
-// -----------------------------------------------------------------------------
-
-SvtPrintOptions_Impl::SvtPrintOptions_Impl( const OUString& rConfigRoot ) :
- ConfigItem( rConfigRoot ),
- m_bReduceTransparency( sal_False ),
- m_nReducedTransparencyMode( 0 ),
- m_bReduceGradients( sal_False ),
- m_nReducedGradientMode( 0 ),
- m_nReducedGradientStepCount( 64 ),
- m_bReduceBitmaps( sal_False ),
- m_nReducedBitmapMode( 1 ),
- m_nReducedBitmapResolution( 3 ),
- m_bReducedBitmapIncludesTransparency( sal_True ),
- m_bConvertToGreyscales( sal_False )
+SvtPrintOptions_Impl::SvtPrintOptions_Impl(const OUString& rConfigRoot)
{
- Sequence< OUString > seqNames( impl_GetPropertyNames() );
- Sequence< Any > seqValues( GetProperties( seqNames ) );
+ try
+ {
+ m_xCfg = css::uno::Reference< css::container::XNameAccess >(
+ ::comphelper::ConfigurationHelper::openConfig(
+ utl::getProcessServiceFactory(),
+ ROOTNODE_PRINTOPTION,
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY);
+
+ if (m_xCfg.is())
+ {
+ UniString sTmp = UniString(rConfigRoot);
+ xub_StrLen nTokenCount = sTmp.GetTokenCount('/');
+ sTmp = sTmp.GetToken(nTokenCount - 1, '/');
+ m_xCfg->getByName(OUString(sTmp.GetBuffer())) >>= m_xNode;
+ }
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ m_xNode.clear();
+ m_xCfg.clear();
+ LogHelper::logIt(ex);
+ }
+}
- DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtPrintOptions_Impl::SvtPrintOptions_Impl()\nI miss some values of configuration keys!\n" );
+sal_Bool SvtPrintOptions_Impl::IsReduceTransparency() const
+{
+ sal_Bool bRet = sal_False;
+ try
+ {
+ if (m_xNode.is())
+ {
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bRet;
+ }
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
- // Copy values from list in right order to our internal member.
- sal_Int32 nPropertyCount = seqValues.getLength();
- sal_Int32 nProperty = 0;
+ return bRet;
+}
- for( nProperty=0; nProperty<nPropertyCount; ++nProperty )
+sal_Int16 SvtPrintOptions_Impl::GetReducedTransparencyMode() const
+{
+ sal_Int16 nRet = 0;
+ try
{
- DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtPrintOptions_Impl::SvtPrintOptions_Impl()\nInvalid property value for property detected!\n" );
+ if (m_xNode.is())
+ {
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nRet;
+ }
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
- switch( nProperty )
+ return nRet;
+}
+
+sal_Bool SvtPrintOptions_Impl::IsReduceGradients() const
+{
+ sal_Bool bRet = sal_False;
+ try
+ {
+ if (m_xNode.is())
{
- case PROPERTYHDL_REDUCETRANSPARENCY:
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
{
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" );
- seqValues[nProperty] >>= m_bReduceTransparency;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bRet;
}
- break;
+ }
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+ return bRet;
+}
- case PROPERTYHDL_REDUCEDTRANSPARENCYMODE:
+sal_Int16 SvtPrintOptions_Impl::GetReducedGradientMode() const
+{
+ sal_Int16 nRet = 0;
+ try
+ {
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
{
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "Invalid type" );
- seqValues[nProperty] >>= m_nReducedTransparencyMode;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nRet;
}
- break;
+ }
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
- case PROPERTYHDL_REDUCEGRADIENTS:
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" );
- seqValues[nProperty] >>= m_bReduceGradients;
- }
- break;
+ return nRet;
+}
- case PROPERTYHDL_REDUCEDGRADIENTMODE:
+sal_Int16 SvtPrintOptions_Impl::GetReducedGradientStepCount() const
+{
+ sal_Int16 nRet = 64;
+ try
+ {
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
{
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "Invalid type" );
- seqValues[nProperty] >>= m_nReducedGradientMode;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nRet;
}
- break;
+ }
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
- case PROPERTYHDL_REDUCEDGRADIENTSTEPCOUNT:
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "Invalid type" );
- seqValues[nProperty] >>= m_nReducedGradientStepCount;
- }
- break;
+ return nRet;
+}
- case PROPERTYHDL_REDUCEBITMAPS:
+sal_Bool SvtPrintOptions_Impl::IsReduceBitmaps() const
+{
+ sal_Bool bRet = sal_False;
+ try
+ {
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
{
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" );
- seqValues[nProperty] >>= m_bReduceBitmaps;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bRet;
}
- break;
+ }
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
- case PROPERTYHDL_REDUCEDBITMAPMODE:
+ return bRet;
+}
+
+sal_Int16 SvtPrintOptions_Impl::GetReducedBitmapMode() const
+{
+ sal_Int16 nRet = 1;
+ try
+ {
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
{
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "Invalid type" );
- seqValues[nProperty] >>= m_nReducedBitmapMode;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nRet;
}
- break;
+ }
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return nRet;
+}
- case PROPERTYHDL_REDUCEDBITMAPRESOLUTION:
+sal_Int16 SvtPrintOptions_Impl::GetReducedBitmapResolution() const
+{
+ sal_Int16 nRet = 3;
+ try
+ {
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
{
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "Invalid type" );
- seqValues[nProperty] >>= m_nReducedBitmapResolution;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nRet;
}
- break;
+ }
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
- case PROPERTYHDL_REDUCEDBITMAPINCLUDESTRANSPARENCY:
+ return nRet;
+}
+
+sal_Bool SvtPrintOptions_Impl::IsReducedBitmapIncludesTransparency() const
+{
+ sal_Bool bRet = sal_True;
+ try
+ {
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
{
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" );
- seqValues[nProperty] >>= m_bReducedBitmapIncludesTransparency;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bRet;
}
- break;
+ }
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return bRet;
+}
- case PROPERTYHDL_CONVERTTOGREYSCALES:
+sal_Bool SvtPrintOptions_Impl::IsConvertToGreyscales() const
+{
+ sal_Bool bRet = sal_False;
+ try
+ {
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
{
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" );
- seqValues[nProperty] >>= m_bConvertToGreyscales;
+ xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bRet;
}
- break;
}
}
+ catch (const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return bRet;
+
+}
+
+void SvtPrintOptions_Impl::SetReduceTransparency(sal_Bool bState)
+{
+ impl_setValue(PROPERTYNAME_REDUCETRANSPARENCY, bState);
}
-// -----------------------------------------------------------------------------
+void SvtPrintOptions_Impl::SetReducedTransparencyMode(sal_Int16 nMode)
+{
+ impl_setValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE, nMode);
+}
-SvtPrintOptions_Impl::~SvtPrintOptions_Impl()
+void SvtPrintOptions_Impl::SetReduceGradients(sal_Bool bState)
{
- if( IsModified() )
- Commit();
+ impl_setValue(PROPERTYNAME_REDUCEGRADIENTS, bState);
}
-// -----------------------------------------------------------------------------
+void SvtPrintOptions_Impl::SetReducedGradientMode(sal_Int16 nMode)
+{
+ impl_setValue(PROPERTYNAME_REDUCEDGRADIENTMODE, nMode);
+}
-void SvtPrintOptions_Impl::Commit()
+void SvtPrintOptions_Impl::SetReducedGradientStepCount(sal_Int16 nStepCount )
{
- Sequence< OUString > aSeqNames( impl_GetPropertyNames() );
- Sequence< Any > aSeqValues( aSeqNames.getLength() );
+ impl_setValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT, nStepCount);
+}
- for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty )
- {
- switch( nProperty )
- {
- case PROPERTYHDL_REDUCETRANSPARENCY:
- aSeqValues[nProperty] <<= m_bReduceTransparency;
- break;
+void SvtPrintOptions_Impl::SetReduceBitmaps(sal_Bool bState )
+{
+ impl_setValue(PROPERTYNAME_REDUCEBITMAPS, bState);
+}
- case PROPERTYHDL_REDUCEDTRANSPARENCYMODE:
- aSeqValues[nProperty] <<= m_nReducedTransparencyMode;
- break;
+void SvtPrintOptions_Impl::SetReducedBitmapMode(sal_Int16 nMode )
+{
+ impl_setValue(PROPERTYNAME_REDUCEDBITMAPMODE, nMode);
+}
- case PROPERTYHDL_REDUCEGRADIENTS:
- aSeqValues[nProperty] <<= m_bReduceGradients;
- break;
+void SvtPrintOptions_Impl::SetReducedBitmapResolution(sal_Int16 nResolution )
+{
+ impl_setValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION, nResolution);
+}
- case PROPERTYHDL_REDUCEDGRADIENTMODE:
- aSeqValues[nProperty] <<= m_nReducedGradientMode;
- break;
+void SvtPrintOptions_Impl::SetReducedBitmapIncludesTransparency(sal_Bool bState )
+{
+ impl_setValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY, bState);
+}
- case PROPERTYHDL_REDUCEDGRADIENTSTEPCOUNT:
- aSeqValues[nProperty] <<= m_nReducedGradientStepCount;
- break;
+void SvtPrintOptions_Impl::SetConvertToGreyscales(sal_Bool bState)
+{
+ impl_setValue(PROPERTYNAME_CONVERTTOGREYSCALES, bState);
+}
- case PROPERTYHDL_REDUCEBITMAPS:
- aSeqValues[nProperty] <<= m_bReduceBitmaps;
- break;
+SvtPrintOptions_Impl::~SvtPrintOptions_Impl()
+{
+ m_xNode.clear();
+ m_xCfg.clear();
+}
- case PROPERTYHDL_REDUCEDBITMAPMODE:
- aSeqValues[nProperty] <<= m_nReducedBitmapMode;
- break;
+void SvtPrintOptions_Impl::impl_setValue (const ::rtl::OUString& sProp,
+ ::sal_Bool bNew )
+{
+ try
+ {
+ if ( ! m_xNode.is())
+ return;
- case PROPERTYHDL_REDUCEDBITMAPRESOLUTION:
- aSeqValues[nProperty] <<= m_nReducedBitmapResolution;
- break;
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if ( ! xSet.is())
+ return;
- case PROPERTYHDL_REDUCEDBITMAPINCLUDESTRANSPARENCY:
- aSeqValues[nProperty] <<= m_bReducedBitmapIncludesTransparency;
- break;
+ ::sal_Bool bOld = ! bNew;
+ if ( ! (xSet->getPropertyValue(sProp) >>= bOld))
+ return;
- case PROPERTYHDL_CONVERTTOGREYSCALES:
- aSeqValues[nProperty] <<= m_bConvertToGreyscales;
- break;
+ if (bOld != bNew)
+ {
+ xSet->setPropertyValue(sProp, css::uno::makeAny(bNew));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
}
}
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
- PutProperties( aSeqNames, aSeqValues );
-}
+void SvtPrintOptions_Impl::impl_setValue (const ::rtl::OUString& sProp,
+ ::sal_Int16 nNew )
+{
+ try
+ {
+ if ( ! m_xNode.is())
+ return;
-// -----------------------------------------------------------------------------
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if ( ! xSet.is())
+ return;
-Sequence< OUString > SvtPrintOptions_Impl::impl_GetPropertyNames()
-{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
- {
- PROPERTYNAME_REDUCETRANSPARENCY,
- PROPERTYNAME_REDUCEDTRANSPARENCYMODE,
- PROPERTYNAME_REDUCEGRADIENTS,
- PROPERTYNAME_REDUCEDGRADIENTMODE,
- PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT,
- PROPERTYNAME_REDUCEBITMAPS,
- PROPERTYNAME_REDUCEDBITMAPMODE,
- PROPERTYNAME_REDUCEDBITMAPRESOLUTION,
- PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY,
- PROPERTYNAME_CONVERTTOGREYSCALES
- };
+ ::sal_Int16 nOld = nNew+1;
+ if ( ! (xSet->getPropertyValue(sProp) >>= nOld))
+ return;
- // Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
+ if (nOld != nNew)
+ {
+ xSet->setPropertyValue(sProp, css::uno::makeAny(nNew));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+// -----------------------------------------------------------------------------
- return seqPropertyNames;
-}
// -----------------------
// - SvtBasePrintOptions -
diff --git a/svtools/source/config/useroptions.cxx b/svtools/source/config/useroptions.cxx
index 19b6f459290f..aad000a235f1 100644
--- a/svtools/source/config/useroptions.cxx
+++ b/svtools/source/config/useroptions.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: useroptions.cxx,v $
- * $Revision: 1.25 $
+ * $Revision: 1.24.238.2 $
*
* This file is part of OpenOffice.org.
*
@@ -36,6 +36,8 @@
#define SVT_DLLIMPLEMENTATION
#include <svtools/useroptions.hxx>
+#include "configitems/useroptions_const.hxx"
+
#include <unotools/configmgr.hxx>
#include <tools/debug.hxx>
#include <com/sun/star/uno/Any.hxx>
@@ -47,135 +49,106 @@
#include <rtl/logfile.hxx>
#include "itemholder2.hxx"
+#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
+#include <com/sun/star/beans/Property.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
+
+#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_
+#include <comphelper/configurationhelper.hxx>
+#endif
+
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
+#include <unotools/processfactory.hxx>
+#endif
+
+#ifndef _SVT_LOGHELPER_HXX
+#include "loghelper.hxx"
+#endif
+
using namespace utl;
using namespace rtl;
using namespace com::sun::star::uno;
+namespace css = ::com::sun::star;
+
// class SvtUserOptions_Impl ---------------------------------------------
-class SvtUserOptions_Impl : public utl::ConfigItem, public SfxBroadcaster
+class SvtUserOptions_Impl
{
-private:
- String m_aCompany;
- String m_aFirstName;
- String m_aLastName;
- String m_aID;
- String m_aStreet;
- String m_aCity;
- String m_aState;
- String m_aZip;
- String m_aCountry;
- String m_aPosition;
- String m_aTitle;
- String m_aTelephoneHome;
- String m_aTelephoneWork;
- String m_aFax;
- String m_aEmail;
- String m_aCustomerNumber;
- String m_aFathersName;
- String m_aApartment;
-
- String m_aEmptyString;
- String m_aFullName;
- String m_aLocale;
-
- sal_Bool m_bIsROCompany;
- sal_Bool m_bIsROFirstName;
- sal_Bool m_bIsROLastName;
- sal_Bool m_bIsROID;
- sal_Bool m_bIsROStreet;
- sal_Bool m_bIsROCity;
- sal_Bool m_bIsROState;
- sal_Bool m_bIsROZip;
- sal_Bool m_bIsROCountry;
- sal_Bool m_bIsROPosition;
- sal_Bool m_bIsROTitle;
- sal_Bool m_bIsROTelephoneHome;
- sal_Bool m_bIsROTelephoneWork;
- sal_Bool m_bIsROFax;
- sal_Bool m_bIsROEmail;
- sal_Bool m_bIsROCustomerNumber;
- sal_Bool m_bIsROFathersName;
- sal_Bool m_bIsROApartment;
-
- typedef String SvtUserOptions_Impl:: *StrPtr;
-
- void SetToken( StrPtr pPtr, const String& rNewToken );
- void InitFullName();
- void Load();
-
- static void InitUserPropertyNames();
public:
SvtUserOptions_Impl();
~SvtUserOptions_Impl();
- virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
- virtual void Commit();
-
// get the user token
- const String& GetCompany() const { return m_aCompany; }
- const String& GetFirstName() const { return m_aFirstName; }
- const String& GetLastName() const { return m_aLastName; }
- const String& GetID() const { return m_aID; }
- const String& GetStreet() const { return m_aStreet; }
- const String& GetCity() const { return m_aCity; }
- const String& GetState() const { return m_aState; }
- const String& GetZip() const { return m_aZip; }
- const String& GetCountry() const { return m_aCountry; }
- const String& GetPosition() const { return m_aPosition; }
- const String& GetTitle() const { return m_aTitle; }
- const String& GetTelephoneHome() const { return m_aTelephoneHome; }
- const String& GetTelephoneWork() const { return m_aTelephoneWork; }
- const String& GetFax() const { return m_aFax; }
- const String& GetEmail() const { return m_aEmail; }
- const String& GetCustomerNumber() const { return m_aCustomerNumber; }
- const String& GetFathersName() const { return m_aFathersName; }
- const String& GetApartment() const { return m_aApartment; }
-
- const String& GetFullName();
- const String& GetLocale() const { return m_aLocale; }
+ ::rtl::OUString GetCompany() const;
+ ::rtl::OUString GetFirstName() const;
+ ::rtl::OUString GetLastName() const;
+ ::rtl::OUString GetID() const;
+ ::rtl::OUString GetStreet() const;
+ ::rtl::OUString GetCity() const;
+ ::rtl::OUString GetState() const;
+ ::rtl::OUString GetZip() const;
+ ::rtl::OUString GetCountry() const;
+ ::rtl::OUString GetPosition() const;
+ ::rtl::OUString GetTitle() const;
+ ::rtl::OUString GetTelephoneHome() const;
+ ::rtl::OUString GetTelephoneWork() const;
+ ::rtl::OUString GetFax() const;
+ ::rtl::OUString GetEmail() const;
+ ::rtl::OUString GetCustomerNumber() const;
+ ::rtl::OUString GetFathersName() const;
+ ::rtl::OUString GetApartment() const;
+
+ ::rtl::OUString GetFullName() const;
+ ::rtl::OUString GetLocale() const { return m_aLocale; }
// set the address token
- void SetCompany( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aCompany, rNewToken ); }
- void SetFirstName( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aFirstName, rNewToken ); InitFullName();}
- void SetLastName( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aLastName, rNewToken ); InitFullName();}
- void SetID( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aID, rNewToken ); }
- void SetStreet( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aStreet, rNewToken ); }
- void SetCity( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aCity, rNewToken ); }
- void SetState( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aState, rNewToken ); }
- void SetZip( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aZip, rNewToken ); }
- void SetCountry( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aCountry, rNewToken ); }
- void SetPosition( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aPosition, rNewToken ); }
- void SetTitle( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aTitle, rNewToken ); }
- void SetTelephoneHome( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aTelephoneHome, rNewToken ); }
- void SetTelephoneWork( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aTelephoneWork, rNewToken ); }
- void SetFax( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aFax, rNewToken ); }
- void SetEmail( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aEmail, rNewToken ); }
- void SetCustomerNumber( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aCustomerNumber, rNewToken ); }
- void SetFathersName( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aFathersName, rNewToken ); }
- void SetApartment( const String& rNewToken )
- { SetToken( &SvtUserOptions_Impl::m_aApartment, rNewToken ); }
-
-
- sal_Bool IsTokenReadonly( USHORT nToken ) const;
- const String& GetToken(USHORT nToken) const;
+ void SetCompany( const ::rtl::OUString& rNewToken );
+ void SetFirstName( const ::rtl::OUString& rNewToken );
+ void SetLastName( const ::rtl::OUString& rNewToken );
+ void SetID( const ::rtl::OUString& rNewToken );
+ void SetStreet( const ::rtl::OUString& rNewToken );
+ void SetCity( const ::rtl::OUString& rNewToken );
+ void SetState( const ::rtl::OUString& rNewToken );
+ void SetZip( const ::rtl::OUString& rNewToken );
+ void SetCountry( const ::rtl::OUString& rNewToken );
+ void SetPosition( const ::rtl::OUString& rNewToken );
+ void SetTitle( const ::rtl::OUString& rNewToken );
+ void SetTelephoneHome( const ::rtl::OUString& rNewToken );
+ void SetTelephoneWork( const ::rtl::OUString& rNewToken );
+ void SetFax( const ::rtl::OUString& rNewToken );
+ void SetEmail( const ::rtl::OUString& rNewToken );
+ void SetCustomerNumber( const ::rtl::OUString& rNewToken );
+ void SetFathersName( const ::rtl::OUString& rNewToken );
+ void SetApartment( const ::rtl::OUString& rNewToken );
+
+ sal_Bool IsTokenReadonly( USHORT nToken ) const;
+ ::rtl::OUString GetToken(USHORT nToken) const;
+
+private:
+ css::uno::Reference< css::container::XNameAccess > m_xCfg;
+ css::uno::Reference< css::beans::XPropertySet > m_xData;
+ ::rtl::OUString m_aLocale;
};
// global ----------------------------------------------------------------
@@ -193,288 +166,694 @@ namespace
: public rtl::Static< Sequence< rtl::OUString >, PropertyNames> {};
}
+// class SvtUserOptions_Impl ---------------------------------------------
+
+// -----------------------------------------------------------------------
+SvtUserOptions_Impl::SvtUserOptions_Impl()
+{
+ try
+ {
+ m_xCfg = Reference< css::container::XNameAccess > (
+ ::comphelper::ConfigurationHelper::openConfig(
+ utl::getProcessServiceFactory(),
+ s_sData,
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY );
+
+ m_xData = css::uno::Reference< css::beans::XPropertySet >(m_xCfg, css::uno::UNO_QUERY);
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ m_xCfg.clear();
+ LogHelper::logIt(ex);
+ }
+
+ Any aAny = ConfigManager::GetConfigManager()->GetDirectConfigProperty( ConfigManager::LOCALE );
+ ::rtl::OUString aLocale;
+ if ( aAny >>= aLocale )
+ m_aLocale = aLocale;
+ else
+ {
+ DBG_ERRORFILE( "SvtUserOptions_Impl::SvtUserOptions_Impl(): no locale found" );
+ }
+}
+
// -----------------------------------------------------------------------
-void SvtUserOptions_Impl::InitUserPropertyNames()
+SvtUserOptions_Impl::~SvtUserOptions_Impl()
{
- static const char* aPropNames[] =
+}
+
+::rtl::OUString SvtUserOptions_Impl::GetCompany() const
+{
+ ::rtl::OUString sCompany;
+
+ try
+ {
+ m_xData->getPropertyValue(s_so) >>= sCompany;
+ }
+ catch ( const css::uno::Exception& ex )
{
- "Data/l", // USER_OPT_CITY
- "Data/o", // USER_OPT_COMPANY
- "Data/c", // USER_OPT_COUNTRY
- "Data/mail", // USER_OPT_EMAIL
- "Data/facsimiletelephonenumber",// USER_OPT_FAX
- "Data/givenname", // USER_OPT_FIRSTNAME
- "Data/sn", // USER_OPT_LASTNAME
- "Data/position", // USER_OPT_POSITION
- "Data/st", // USER_OPT_STATE
- "Data/street", // USER_OPT_STREET
- "Data/homephone", // USER_OPT_TELEPHONEHOME
- "Data/telephonenumber", // USER_OPT_TELEPHONEWORK
- "Data/title", // USER_OPT_TITLE
- "Data/initials", // USER_OPT_ID
- "Data/postalcode", // USER_OPT_ZIP
- "Data/fathersname", // USER_OPT_FATHERSNAME
- "Data/apartment" // USER_OPT_APARTMENT
- };
- const int nCount = sizeof( aPropNames ) / sizeof( const char* );
- Sequence< rtl::OUString > &rPropertyNames = PropertyNames::get();
- rPropertyNames.realloc(nCount);
- OUString* pNames = rPropertyNames.getArray();
- for ( int i = 0; i < nCount; i++ )
- pNames[i] = OUString::createFromAscii( aPropNames[i] );
+ LogHelper::logIt(ex);
+ }
+
+ return sCompany;
}
-// class SvtUserOptions_Impl ---------------------------------------------
+::rtl::OUString SvtUserOptions_Impl::GetFirstName() const
+{
+ ::rtl::OUString sFirstName;
+
+ try
+ {
+ m_xData->getPropertyValue(s_sgivenname) >>= sFirstName;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return sFirstName;
+}
-void SvtUserOptions_Impl::SetToken( StrPtr pPtr, const String& rNewToken )
+::rtl::OUString SvtUserOptions_Impl::GetLastName() const
{
- this->*pPtr = rNewToken;
- SetModified();
+ ::rtl::OUString sLastName;
+
+ try
+ {
+ m_xData->getPropertyValue(s_ssn) >>= sLastName;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return sLastName;
}
-// -----------------------------------------------------------------------
+::rtl::OUString SvtUserOptions_Impl::GetID() const
+{
+ ::rtl::OUString sID;
+
+ try
+ {
+ m_xData->getPropertyValue(s_sinitials) >>= sID;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
-void SvtUserOptions_Impl::InitFullName()
+ return sID;
+}
+
+::rtl::OUString SvtUserOptions_Impl::GetStreet() const
{
- m_aFullName = GetFirstName();
- m_aFullName.EraseLeadingAndTrailingChars();
- if ( m_aFullName.Len() )
- m_aFullName += ' ';
- m_aFullName += GetLastName();
- m_aFullName.EraseTrailingChars();
+ ::rtl::OUString sStreet;
+
+ try
+ {
+ m_xData->getPropertyValue(s_sstreet) >>= sStreet;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return sStreet;
}
-// -----------------------------------------------------------------------
-SvtUserOptions_Impl::SvtUserOptions_Impl() :
+::rtl::OUString SvtUserOptions_Impl::GetCity() const
+{
+ ::rtl::OUString sCity;
- ConfigItem( OUString::createFromAscii("UserProfile") ),
+ try
+ {
+ m_xData->getPropertyValue(s_sl) >>= sCity;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
- m_bIsROCompany( READONLY_DEFAULT ),
- m_bIsROFirstName( READONLY_DEFAULT ),
- m_bIsROLastName( READONLY_DEFAULT ),
- m_bIsROID( READONLY_DEFAULT ),
- m_bIsROStreet( READONLY_DEFAULT ),
- m_bIsROCity( READONLY_DEFAULT ),
- m_bIsROState( READONLY_DEFAULT ),
- m_bIsROZip( READONLY_DEFAULT ),
- m_bIsROCountry( READONLY_DEFAULT ),
- m_bIsROPosition( READONLY_DEFAULT ),
- m_bIsROTitle( READONLY_DEFAULT ),
- m_bIsROTelephoneHome( READONLY_DEFAULT ),
- m_bIsROTelephoneWork( READONLY_DEFAULT ),
- m_bIsROFax( READONLY_DEFAULT ),
- m_bIsROEmail( READONLY_DEFAULT ),
- m_bIsROCustomerNumber( READONLY_DEFAULT ),
- m_bIsROFathersName( READONLY_DEFAULT ),
- m_bIsROApartment( READONLY_DEFAULT )
+ return sCity;
+}
+
+::rtl::OUString SvtUserOptions_Impl::GetState() const
{
- InitUserPropertyNames();
- EnableNotification( PropertyNames::get() );
- Load();
- Any aAny = ConfigManager::GetConfigManager()->GetDirectConfigProperty( ConfigManager::LOCALE );
- OUString aLocale;
- if ( aAny >>= aLocale )
- m_aLocale = String( aLocale );
- else
+ ::rtl::OUString sState;
+
+ try
{
- DBG_ERRORFILE( "SvtUserOptions_Impl::SvtUserOptions_Impl(): no locale found" );
+ m_xData->getPropertyValue(s_sst) >>= sState;
}
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return sState;
}
-// -----------------------------------------------------------------------
-SvtUserOptions_Impl::~SvtUserOptions_Impl()
+::rtl::OUString SvtUserOptions_Impl::GetZip() const
{
+ ::rtl::OUString sZip;
+
+ try
+ {
+ m_xData->getPropertyValue(s_spostalcode) >>= sZip;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return sZip;
}
-// -----------------------------------------------------------------------
-void SvtUserOptions_Impl::Load()
+::rtl::OUString SvtUserOptions_Impl::GetCountry() const
{
- Sequence< rtl::OUString > &rPropertyNames = PropertyNames::get();
- Sequence< Any > seqValues = GetProperties( rPropertyNames );
- Sequence< sal_Bool > seqRO = GetReadOnlyStates( rPropertyNames );
- const Any* pValues = seqValues.getConstArray();
- DBG_ASSERT( seqValues.getLength() == rPropertyNames.getLength(), "GetProperties failed" );
- if ( seqValues.getLength() == rPropertyNames.getLength() )
+ ::rtl::OUString sCountry;
+
+ try
{
- OUString aTempStr;
+ m_xData->getPropertyValue(s_sc) >>= sCountry;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
- for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ )
- {
- if ( pValues[nProp].hasValue() )
- {
- if ( pValues[nProp] >>= aTempStr )
- {
- String* pToken = NULL;
- sal_Bool* pBool = NULL;
-
- switch ( nProp )
- {
- case USER_OPT_COMPANY:
- pToken = &m_aCompany; pBool = &m_bIsROCompany; break;
- case USER_OPT_FIRSTNAME:
- pToken = &m_aFirstName; pBool = &m_bIsROFirstName; break;
- case USER_OPT_LASTNAME:
- pToken = &m_aLastName; pBool = &m_bIsROLastName; break;
- case USER_OPT_ID:
- pToken = &m_aID; pBool = &m_bIsROID; break;
- case USER_OPT_STREET:
- pToken = &m_aStreet; pBool = &m_bIsROStreet; break;
- case USER_OPT_CITY:
- pToken = &m_aCity; pBool = &m_bIsROCity; break;
- case USER_OPT_STATE:
- pToken = &m_aState; pBool = &m_bIsROState; break;
- case USER_OPT_ZIP:
- pToken = &m_aZip; pBool = &m_bIsROZip; break;
- case USER_OPT_COUNTRY:
- pToken = &m_aCountry; pBool = &m_bIsROCountry; break;
- case USER_OPT_POSITION:
- pToken = &m_aPosition; pBool = &m_bIsROPosition; break;
- case USER_OPT_TITLE:
- pToken = &m_aTitle; pBool = &m_bIsROTitle; break;
- case USER_OPT_TELEPHONEHOME:
- pToken = &m_aTelephoneHome; pBool = &m_bIsROTelephoneHome; break;
- case USER_OPT_TELEPHONEWORK:
- pToken = &m_aTelephoneWork; pBool = &m_bIsROTelephoneWork; break;
- case USER_OPT_FAX:
- pToken = &m_aFax; pBool = &m_bIsROFax; break;
- case USER_OPT_EMAIL:
- pToken = &m_aEmail; pBool = &m_bIsROEmail; break;
- case USER_OPT_FATHERSNAME:
- pToken = &m_aFathersName; pBool = &m_bIsROFathersName; break;
- case USER_OPT_APARTMENT:
- pToken = &m_aApartment; pBool = &m_bIsROApartment; break;
- default:
- DBG_ERRORFILE( "invalid index to load a user token" );
- }
-
- if ( pToken )
- *pToken = String( aTempStr );
- if ( pBool )
- *pBool = seqRO[nProp];
- }
- else
- {
- DBG_ERRORFILE( "Wrong any type" );
- }
- }
- }
+ return sCountry;
+}
+
+::rtl::OUString SvtUserOptions_Impl::GetPosition() const
+{
+ ::rtl::OUString sPosition;
+
+ try
+ {
+ m_xData->getPropertyValue(s_sposition) >>= sPosition;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
}
- InitFullName();
+
+ return sPosition;
+}
+
+::rtl::OUString SvtUserOptions_Impl::GetTitle() const
+{
+ ::rtl::OUString sTitle;
+
+ try
+ {
+ m_xData->getPropertyValue(s_stitle) >>= sTitle;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return sTitle;
}
-// -----------------------------------------------------------------------
-void SvtUserOptions_Impl::Commit()
+::rtl::OUString SvtUserOptions_Impl::GetTelephoneHome() const
{
- Sequence< rtl::OUString > &rPropertyNames = PropertyNames::get();
- sal_Int32 nOrgCount = rPropertyNames.getLength();
+ ::rtl::OUString sTelephoneHome;
- Sequence< OUString > seqNames( nOrgCount );
- Sequence< Any > seqValues( nOrgCount );
- sal_Int32 nRealCount = 0;
+ try
+ {
+ m_xData->getPropertyValue(s_shomephone) >>= sTelephoneHome;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
- OUString aTempStr;
+ return sTelephoneHome;
+}
- for ( int nProp = 0; nProp < nOrgCount; nProp++ )
+::rtl::OUString SvtUserOptions_Impl::GetTelephoneWork() const
+{
+ ::rtl::OUString sTelephoneWork;
+
+ try
{
- sal_Bool* pbReadonly = NULL;
+ m_xData->getPropertyValue(s_stelephonenumber) >>= sTelephoneWork;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
- switch ( nProp )
- {
- case USER_OPT_COMPANY:
- aTempStr = OUString( m_aCompany ); pbReadonly = &m_bIsROCompany; break;
- case USER_OPT_FIRSTNAME:
- aTempStr = OUString( m_aFirstName ); pbReadonly = &m_bIsROFirstName; break;
- case USER_OPT_LASTNAME:
- aTempStr = OUString( m_aLastName ); pbReadonly = &m_bIsROLastName; break;
- case USER_OPT_ID:
- aTempStr = OUString( m_aID ); pbReadonly = &m_bIsROID; break;
- case USER_OPT_STREET:
- aTempStr = OUString( m_aStreet ); pbReadonly = &m_bIsROStreet; break;
- case USER_OPT_CITY:
- aTempStr = OUString( m_aCity ); pbReadonly = &m_bIsROCity; break;
- case USER_OPT_STATE:
- aTempStr = OUString( m_aState ); pbReadonly = &m_bIsROState; break;
- case USER_OPT_ZIP:
- aTempStr = OUString( m_aZip ); pbReadonly = &m_bIsROZip; break;
- case USER_OPT_COUNTRY:
- aTempStr = OUString( m_aCountry ); pbReadonly = &m_bIsROCountry; break;
- case USER_OPT_POSITION:
- aTempStr = OUString( m_aPosition ); pbReadonly = &m_bIsROPosition; break;
- case USER_OPT_TITLE:
- aTempStr = OUString( m_aTitle ); pbReadonly = &m_bIsROTitle; break;
- case USER_OPT_TELEPHONEHOME:
- aTempStr = OUString( m_aTelephoneHome ); pbReadonly = &m_bIsROTelephoneHome; break;
- case USER_OPT_TELEPHONEWORK:
- aTempStr = OUString( m_aTelephoneWork ); pbReadonly = &m_bIsROTelephoneWork; break;
- case USER_OPT_FAX:
- aTempStr = OUString( m_aFax ); pbReadonly = &m_bIsROFax; break;
- case USER_OPT_EMAIL:
- aTempStr = OUString( m_aEmail ); pbReadonly = &m_bIsROEmail; break;
- case USER_OPT_FATHERSNAME:
- aTempStr = OUString( m_aFathersName ); pbReadonly = &m_bIsROFathersName; break;
- case USER_OPT_APARTMENT:
- aTempStr = OUString( m_aApartment ); pbReadonly = &m_bIsROApartment; break;
- default:
- DBG_ERRORFILE( "invalid index to save a user token" );
- }
+ return sTelephoneWork;
+}
- if ( pbReadonly && !(*pbReadonly) )
- {
- seqValues[nRealCount] <<= aTempStr;
- seqNames[nRealCount] = rPropertyNames[nProp];
- ++nRealCount;
- }
+::rtl::OUString SvtUserOptions_Impl::GetFax() const
+{
+ ::rtl::OUString sFax;
+
+ try
+ {
+ m_xData->getPropertyValue(s_sfacsimiletelephonenumber) >>= sFax;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
}
- // Set properties in configuration.
- seqNames.realloc( nRealCount );
- seqValues.realloc( nRealCount );
- PutProperties( seqNames, seqValues );
- //broadcast changes
- Broadcast(SfxSimpleHint(SFX_HINT_USER_OPTIONS_CHANGED));
+ return sFax;
}
-// -----------------------------------------------------------------------
+::rtl::OUString SvtUserOptions_Impl::GetEmail() const
+{
+ ::rtl::OUString sEmail;
+
+ try
+ {
+ m_xData->getPropertyValue(s_smail) >>= sEmail;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return sEmail;
+}
+
+::rtl::OUString SvtUserOptions_Impl::GetCustomerNumber() const
+{
+ ::rtl::OUString sCustomerNumber;
+
+ try
+ {
+ m_xData->getPropertyValue(s_scustomernumber) >>= sCustomerNumber;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return sCustomerNumber;
+}
+
+::rtl::OUString SvtUserOptions_Impl::GetFathersName() const
+{
+ ::rtl::OUString sFathersName;
+
+ try
+ {
+ m_xData->getPropertyValue(s_sfathersname) >>= sFathersName;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return sFathersName;
+}
+
+::rtl::OUString SvtUserOptions_Impl::GetApartment() const
+{
+ ::rtl::OUString sApartment;
+
+ try
+ {
+ m_xData->getPropertyValue(s_sapartment) >>= sApartment;
+ }
+ catch ( const css::uno::Exception& ex )
+ {
+ LogHelper::logIt(ex);
+ }
+
+ return sApartment;
+}
+
+void SvtUserOptions_Impl::SetCompany( const ::rtl::OUString& sCompany )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_so, css::uno::makeAny(::rtl::OUString(sCompany)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetFirstName( const ::rtl::OUString& sFirstName )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_sgivenname, css::uno::makeAny(::rtl::OUString(sFirstName)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetLastName( const ::rtl::OUString& sLastName )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_ssn, css::uno::makeAny(::rtl::OUString(sLastName)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+void SvtUserOptions_Impl::SetID( const ::rtl::OUString& sID )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_sinitials, css::uno::makeAny(::rtl::OUString(sID)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
-const String& SvtUserOptions_Impl::GetFullName()
+void SvtUserOptions_Impl::SetStreet( const ::rtl::OUString& sStreet )
{
- if ( IsModified() )
- InitFullName();
- return m_aFullName;
+ try
+ {
+ m_xData->setPropertyValue(s_sstreet, css::uno::makeAny(::rtl::OUString(sStreet)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetCity( const ::rtl::OUString& sCity )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_sl, css::uno::makeAny(::rtl::OUString(sCity)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetState( const ::rtl::OUString& sState )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_sst, css::uno::makeAny(::rtl::OUString(sState)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetZip( const ::rtl::OUString& sZip )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_spostalcode, css::uno::makeAny(::rtl::OUString(sZip)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetCountry( const ::rtl::OUString& sCountry )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_sc, css::uno::makeAny(::rtl::OUString(sCountry)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetPosition( const ::rtl::OUString& sPosition )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_sposition, css::uno::makeAny(::rtl::OUString(sPosition)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetTitle( const ::rtl::OUString& sTitle )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_stitle, css::uno::makeAny(::rtl::OUString(sTitle)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetTelephoneHome( const ::rtl::OUString& sTelephoneHome )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_shomephone, css::uno::makeAny(::rtl::OUString(sTelephoneHome)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetTelephoneWork( const ::rtl::OUString& sTelephoneWork )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_stelephonenumber, css::uno::makeAny(::rtl::OUString(sTelephoneWork)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetFax( const ::rtl::OUString& sFax )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_sfacsimiletelephonenumber, css::uno::makeAny(::rtl::OUString(sFax)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetEmail( const ::rtl::OUString& sEmail )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_smail, css::uno::makeAny(::rtl::OUString(sEmail)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetCustomerNumber( const ::rtl::OUString& sCustomerNumber )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_scustomernumber, css::uno::makeAny(::rtl::OUString(sCustomerNumber)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetFathersName( const ::rtl::OUString& sFathersName )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_sfathersname, css::uno::makeAny(::rtl::OUString(sFathersName)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
+}
+
+void SvtUserOptions_Impl::SetApartment( const ::rtl::OUString& sApartment )
+{
+ try
+ {
+ m_xData->setPropertyValue(s_sapartment, css::uno::makeAny(::rtl::OUString(sApartment)));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ catch ( const css::uno::Exception& ex)
+ {
+ LogHelper::logIt(ex);
+ }
}
// -----------------------------------------------------------------------
-void SvtUserOptions_Impl::Notify( const Sequence<rtl::OUString>& )
+::rtl::OUString SvtUserOptions_Impl::GetFullName() const
{
- Load();
- Broadcast(SfxSimpleHint(SFX_HINT_USER_OPTIONS_CHANGED));
+ ::rtl::OUString sFullName;
+
+ sFullName = GetFirstName();
+ sFullName.trim();
+ if ( sFullName.getLength() )
+ sFullName += ::rtl::OUString::createFromAscii(" ");
+ sFullName += GetLastName();
+ sFullName.trim();
+
+ return sFullName;
}
// -----------------------------------------------------------------------
sal_Bool SvtUserOptions_Impl::IsTokenReadonly( USHORT nToken ) const
{
- sal_Bool bRet = sal_False;
+ css::uno::Reference< css::beans::XPropertySet > xData(m_xCfg, css::uno::UNO_QUERY);
+ css::uno::Reference< css::beans::XPropertySetInfo > xInfo = xData->getPropertySetInfo();
+ css::beans::Property aProp;
+ sal_Bool bRet = sal_False;
switch ( nToken )
{
- case USER_OPT_COMPANY: bRet = m_bIsROCompany; break;
- case USER_OPT_FIRSTNAME: bRet = m_bIsROFirstName; break;
- case USER_OPT_LASTNAME: bRet = m_bIsROLastName; break;
- case USER_OPT_ID: bRet = m_bIsROID; break;
- case USER_OPT_STREET: bRet = m_bIsROStreet; break;
- case USER_OPT_CITY: bRet = m_bIsROCity; break;
- case USER_OPT_STATE: bRet = m_bIsROState; break;
- case USER_OPT_ZIP: bRet = m_bIsROZip; break;
- case USER_OPT_COUNTRY: bRet = m_bIsROCountry; break;
- case USER_OPT_POSITION: bRet = m_bIsROPosition; break;
- case USER_OPT_TITLE: bRet = m_bIsROTitle; break;
- case USER_OPT_TELEPHONEHOME: bRet = m_bIsROTelephoneHome; break;
- case USER_OPT_TELEPHONEWORK: bRet = m_bIsROTelephoneWork; break;
- case USER_OPT_FAX: bRet = m_bIsROFax; break;
- case USER_OPT_EMAIL: bRet = m_bIsROEmail; break;
+ case USER_OPT_COMPANY:
+ {
+ aProp = xInfo->getPropertyByName(s_so);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_FIRSTNAME:
+ {
+ aProp = xInfo->getPropertyByName(s_sgivenname);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_LASTNAME:
+ {
+ aProp = xInfo->getPropertyByName(s_ssn);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_ID:
+ {
+ aProp = xInfo->getPropertyByName(s_sinitials);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_STREET:
+ {
+ aProp = xInfo->getPropertyByName(s_sstreet);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_CITY:
+ {
+ aProp = xInfo->getPropertyByName(s_sl);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_STATE:
+ {
+ aProp = xInfo->getPropertyByName(s_sst);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_ZIP:
+ {
+ aProp = xInfo->getPropertyByName(s_spostalcode);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_COUNTRY:
+ {
+ aProp = xInfo->getPropertyByName(s_sc);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_POSITION:
+ {
+ aProp = xInfo->getPropertyByName(s_sposition);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_TITLE:
+ {
+ aProp = xInfo->getPropertyByName(s_stitle);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_TELEPHONEHOME:
+ {
+ aProp = xInfo->getPropertyByName(s_shomephone);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_TELEPHONEWORK:
+ {
+ aProp = xInfo->getPropertyByName(s_stelephonenumber);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_FAX:
+ {
+ aProp = xInfo->getPropertyByName(s_sfacsimiletelephonenumber);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_EMAIL:
+ {
+ aProp = xInfo->getPropertyByName(s_smail);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_FATHERSNAME:
+ {
+ aProp = xInfo->getPropertyByName(s_sfathersname);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
+ case USER_OPT_APARTMENT:
+ {
+ aProp = xInfo->getPropertyByName(s_sapartment);
+ bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
+ break;
+ }
default:
DBG_ERRORFILE( "SvtUserOptions_Impl::IsTokenReadonly(): invalid token" );
}
@@ -483,32 +862,32 @@ sal_Bool SvtUserOptions_Impl::IsTokenReadonly( USHORT nToken ) const
}
//------------------------------------------------------------------------
-const String& SvtUserOptions_Impl::GetToken(USHORT nToken) const
+::rtl::OUString SvtUserOptions_Impl::GetToken(USHORT nToken) const
{
- const String* pRet = 0;
+ ::rtl::OUString pRet;
switch(nToken)
{
- case USER_OPT_COMPANY: pRet = &m_aCompany; break;
- case USER_OPT_FIRSTNAME: pRet = &m_aFirstName; break;
- case USER_OPT_LASTNAME: pRet = &m_aLastName; break;
- case USER_OPT_ID: pRet = &m_aID; break;
- case USER_OPT_STREET: pRet = &m_aStreet; break;
- case USER_OPT_CITY: pRet = &m_aCity; break;
- case USER_OPT_STATE: pRet = &m_aState; break;
- case USER_OPT_ZIP: pRet = &m_aZip; break;
- case USER_OPT_COUNTRY: pRet = &m_aCountry; break;
- case USER_OPT_POSITION: pRet = &m_aPosition; break;
- case USER_OPT_TITLE: pRet = &m_aTitle; break;
- case USER_OPT_TELEPHONEHOME: pRet = &m_aTelephoneHome; break;
- case USER_OPT_TELEPHONEWORK: pRet = &m_aTelephoneWork; break;
- case USER_OPT_FAX: pRet = &m_aFax; break;
- case USER_OPT_EMAIL: pRet = &m_aEmail; break;
- case USER_OPT_FATHERSNAME: pRet = &m_aFathersName; break;
- case USER_OPT_APARTMENT: pRet = &m_aApartment; break;
+ case USER_OPT_COMPANY: pRet = GetCompany(); break;
+ case USER_OPT_FIRSTNAME: pRet = GetFirstName(); break;
+ case USER_OPT_LASTNAME: pRet = GetLastName(); break;
+ case USER_OPT_ID: pRet = GetID(); break;
+ case USER_OPT_STREET: pRet = GetStreet(); break;
+ case USER_OPT_CITY: pRet = GetCity(); break;
+ case USER_OPT_STATE: pRet = GetState(); break;
+ case USER_OPT_ZIP: pRet = GetZip(); break;
+ case USER_OPT_COUNTRY: pRet = GetCountry(); break;
+ case USER_OPT_POSITION: pRet = GetPosition(); break;
+ case USER_OPT_TITLE: pRet = GetTitle(); break;
+ case USER_OPT_TELEPHONEHOME: pRet = GetTelephoneHome(); break;
+ case USER_OPT_TELEPHONEWORK: pRet = GetTelephoneWork(); break;
+ case USER_OPT_FAX: pRet = GetFax(); break;
+ case USER_OPT_EMAIL: pRet = GetEmail(); break;
+ case USER_OPT_FATHERSNAME: pRet = GetFathersName(); break;
+ case USER_OPT_APARTMENT: pRet = GetApartment(); break;
default:
DBG_ERRORFILE( "SvtUserOptions_Impl::GetToken(): invalid token" );
}
- return *pRet;
+ return pRet;
}
// class SvtUserOptions --------------------------------------------------
@@ -527,7 +906,7 @@ SvtUserOptions::SvtUserOptions()
}
++nRefCount;
pImp = pOptions;
- StartListening( *pImp);
+ //StartListening( *pImp);
}
// -----------------------------------------------------------------------
@@ -539,8 +918,8 @@ SvtUserOptions::~SvtUserOptions()
if ( !--nRefCount )
{
- if ( pOptions->IsModified() )
- pOptions->Commit();
+ //if ( pOptions->IsModified() )
+ // pOptions->Commit();
DELETEZ( pOptions );
}
}
@@ -572,7 +951,7 @@ SvtUserOptions::~SvtUserOptions()
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetCompany() const
+::rtl::OUString SvtUserOptions::GetCompany() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetCompany();
@@ -580,7 +959,7 @@ const String& SvtUserOptions::GetCompany() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetFirstName() const
+::rtl::OUString SvtUserOptions::GetFirstName() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetFirstName();
@@ -588,7 +967,7 @@ const String& SvtUserOptions::GetFirstName() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetLastName() const
+::rtl::OUString SvtUserOptions::GetLastName() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetLastName();
@@ -596,7 +975,7 @@ const String& SvtUserOptions::GetLastName() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetID() const
+::rtl::OUString SvtUserOptions::GetID() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetID();
@@ -604,7 +983,7 @@ const String& SvtUserOptions::GetID() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetStreet() const
+::rtl::OUString SvtUserOptions::GetStreet() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetStreet();
@@ -612,7 +991,7 @@ const String& SvtUserOptions::GetStreet() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetCity() const
+::rtl::OUString SvtUserOptions::GetCity() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetCity();
@@ -620,7 +999,7 @@ const String& SvtUserOptions::GetCity() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetState() const
+::rtl::OUString SvtUserOptions::GetState() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetState();
@@ -628,7 +1007,7 @@ const String& SvtUserOptions::GetState() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetZip() const
+::rtl::OUString SvtUserOptions::GetZip() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetZip();
@@ -636,7 +1015,7 @@ const String& SvtUserOptions::GetZip() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetCountry() const
+::rtl::OUString SvtUserOptions::GetCountry() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetCountry();
@@ -644,7 +1023,7 @@ const String& SvtUserOptions::GetCountry() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetPosition() const
+::rtl::OUString SvtUserOptions::GetPosition() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetPosition();
@@ -652,7 +1031,7 @@ const String& SvtUserOptions::GetPosition() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetTitle() const
+::rtl::OUString SvtUserOptions::GetTitle() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetTitle();
@@ -660,7 +1039,7 @@ const String& SvtUserOptions::GetTitle() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetTelephoneHome() const
+::rtl::OUString SvtUserOptions::GetTelephoneHome() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetTelephoneHome();
@@ -668,7 +1047,7 @@ const String& SvtUserOptions::GetTelephoneHome() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetTelephoneWork() const
+::rtl::OUString SvtUserOptions::GetTelephoneWork() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetTelephoneWork();
@@ -676,7 +1055,7 @@ const String& SvtUserOptions::GetTelephoneWork() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetFax() const
+::rtl::OUString SvtUserOptions::GetFax() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetFax();
@@ -684,7 +1063,7 @@ const String& SvtUserOptions::GetFax() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetEmail() const
+::rtl::OUString SvtUserOptions::GetEmail() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetEmail();
@@ -692,14 +1071,14 @@ const String& SvtUserOptions::GetEmail() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetCustomerNumber() const
+::rtl::OUString SvtUserOptions::GetCustomerNumber() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetCustomerNumber();
}
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetFathersName() const
+::rtl::OUString SvtUserOptions::GetFathersName() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetFathersName() ;
@@ -707,7 +1086,7 @@ const String& SvtUserOptions::GetFathersName() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetApartment() const
+::rtl::OUString SvtUserOptions::GetApartment() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetApartment();
@@ -715,7 +1094,7 @@ const String& SvtUserOptions::GetApartment() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetFullName() const
+::rtl::OUString SvtUserOptions::GetFullName() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetFullName();
@@ -723,7 +1102,7 @@ const String& SvtUserOptions::GetFullName() const
// -----------------------------------------------------------------------
-const String& SvtUserOptions::GetLocale() const
+::rtl::OUString SvtUserOptions::GetLocale() const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetLocale();
@@ -731,7 +1110,7 @@ const String& SvtUserOptions::GetLocale() const
// -----------------------------------------------------------------------
-void SvtUserOptions::SetCompany( const String& rNewToken )
+void SvtUserOptions::SetCompany( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetCompany( rNewToken );
@@ -739,7 +1118,7 @@ void SvtUserOptions::SetCompany( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetFirstName( const String& rNewToken )
+void SvtUserOptions::SetFirstName( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetFirstName( rNewToken );
@@ -747,7 +1126,7 @@ void SvtUserOptions::SetFirstName( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetLastName( const String& rNewToken )
+void SvtUserOptions::SetLastName( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetLastName( rNewToken );
@@ -755,7 +1134,7 @@ void SvtUserOptions::SetLastName( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetID( const String& rNewToken )
+void SvtUserOptions::SetID( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetID( rNewToken );
@@ -763,7 +1142,7 @@ void SvtUserOptions::SetID( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetStreet( const String& rNewToken )
+void SvtUserOptions::SetStreet( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetStreet( rNewToken );
@@ -771,7 +1150,7 @@ void SvtUserOptions::SetStreet( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetCity( const String& rNewToken )
+void SvtUserOptions::SetCity( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetCity( rNewToken );
@@ -779,7 +1158,7 @@ void SvtUserOptions::SetCity( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetState( const String& rNewToken )
+void SvtUserOptions::SetState( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetState( rNewToken );
@@ -787,7 +1166,7 @@ void SvtUserOptions::SetState( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetZip( const String& rNewToken )
+void SvtUserOptions::SetZip( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetZip( rNewToken );
@@ -795,7 +1174,7 @@ void SvtUserOptions::SetZip( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetCountry( const String& rNewToken )
+void SvtUserOptions::SetCountry( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetCountry( rNewToken );
@@ -803,7 +1182,7 @@ void SvtUserOptions::SetCountry( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetPosition( const String& rNewToken )
+void SvtUserOptions::SetPosition( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetPosition( rNewToken );
@@ -811,7 +1190,7 @@ void SvtUserOptions::SetPosition( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetTitle( const String& rNewToken )
+void SvtUserOptions::SetTitle( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetTitle( rNewToken );
@@ -819,7 +1198,7 @@ void SvtUserOptions::SetTitle( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetTelephoneHome( const String& rNewToken )
+void SvtUserOptions::SetTelephoneHome( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetTelephoneHome( rNewToken );
@@ -827,7 +1206,7 @@ void SvtUserOptions::SetTelephoneHome( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetTelephoneWork( const String& rNewToken )
+void SvtUserOptions::SetTelephoneWork( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetTelephoneWork( rNewToken );
@@ -835,7 +1214,7 @@ void SvtUserOptions::SetTelephoneWork( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetFax( const String& rNewToken )
+void SvtUserOptions::SetFax( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetFax( rNewToken );
@@ -843,7 +1222,7 @@ void SvtUserOptions::SetFax( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetEmail( const String& rNewToken )
+void SvtUserOptions::SetEmail( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetEmail( rNewToken );
@@ -851,14 +1230,14 @@ void SvtUserOptions::SetEmail( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetCustomerNumber( const String& rNewToken )
+void SvtUserOptions::SetCustomerNumber( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetCustomerNumber( rNewToken );
}
// -----------------------------------------------------------------------
-void SvtUserOptions::SetFathersName( const String& rNewToken )
+void SvtUserOptions::SetFathersName( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetFathersName( rNewToken );
@@ -866,7 +1245,7 @@ void SvtUserOptions::SetFathersName( const String& rNewToken )
// -----------------------------------------------------------------------
-void SvtUserOptions::SetApartment( const String& rNewToken )
+void SvtUserOptions::SetApartment( const ::rtl::OUString& rNewToken )
{
::osl::MutexGuard aGuard( GetInitMutex() );
pImp->SetApartment( rNewToken );
@@ -880,7 +1259,7 @@ sal_Bool SvtUserOptions::IsTokenReadonly( USHORT nToken ) const
return pImp->IsTokenReadonly( nToken );
}
//------------------------------------------------------------------------
-const String& SvtUserOptions::GetToken(USHORT nToken) const
+::rtl::OUString SvtUserOptions::GetToken(USHORT nToken) const
{
::osl::MutexGuard aGuard( GetInitMutex() );
return pImp->GetToken( nToken );
@@ -893,4 +1272,3 @@ void SvtUserOptions::Notify( SfxBroadcaster&, const SfxHint& rHint )
vos::OGuard aVclGuard( Application::GetSolarMutex() );
Broadcast( rHint );
}
-
diff --git a/svtools/source/config/viewoptions.cxx b/svtools/source/config/viewoptions.cxx
index 8ef5e95c203d..d4c8d65dbe04 100644
--- a/svtools/source/config/viewoptions.cxx
+++ b/svtools/source/config/viewoptions.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: viewoptions.cxx,v $
- * $Revision: 1.30 $
+ * $Revision: 1.29.236.2 $
*
* This file is part of OpenOffice.org.
*
@@ -382,9 +382,7 @@ SvtViewOptionsBase_Impl::SvtViewOptionsBase_Impl( const ::rtl::OUString& sList )
/*-************************************************************************************************************//**
@short dtor
- @descr If something was changed on our internal cached values - baselcass can tell us that by return value
- of method "IsModified()". So we should flush these changes by calling "Commit()" of our own instance.
- It's an auto-save. Normaly user of these object should do that explicitly!
+ @descr clean up something
@attention We implement a write through cache! So we mustn't do it realy. All changes was written to cfg directly.
Commit isn't neccessary then.
@@ -401,15 +399,10 @@ SvtViewOptionsBase_Impl::SvtViewOptionsBase_Impl( const ::rtl::OUString& sList )
*//*-*************************************************************************************************************/
SvtViewOptionsBase_Impl::~SvtViewOptionsBase_Impl()
{
- try
- {
- if (m_xRoot.is())
- ::comphelper::ConfigurationHelper::flush(m_xRoot);
- }
- catch(const css::uno::Exception& ex)
- {
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
+ // dont flush configuration changes here to m_xRoot.
+ // That must be done inside every SetXXX() method already !
+ // Here its to late - DisposedExceptions from used configuration access can occure otherwise.
+
m_xRoot.clear();
m_xSet.clear();
diff --git a/svtools/source/inc/configitems/accessibilityoptions_const.hxx b/svtools/source/inc/configitems/accessibilityoptions_const.hxx
new file mode 100644
index 000000000000..07dff55591a6
--- /dev/null
+++ b/svtools/source/inc/configitems/accessibilityoptions_const.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: accessibilityoptions_const.hxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:17:49 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#ifndef INCLUDE_CONFIGITEMS_ACCESSIBILITYOPTIONS_CONST_HXX
+#define INCLUDE_CONFIGITEMS_ACCESSIBILITYOPTIONS_CONST_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace
+{
+ static const ::rtl::OUString s_sAccessibility = ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/Accessibility");
+ static const ::rtl::OUString s_sAutoDetectSystemHC = ::rtl::OUString::createFromAscii("AutoDetectSystemHC");
+ static const ::rtl::OUString s_sIsForPagePreviews = ::rtl::OUString::createFromAscii("IsForPagePreviews");
+ static const ::rtl::OUString s_sIsHelpTipsDisappear = ::rtl::OUString::createFromAscii("IsHelpTipsDisappear");
+ static const ::rtl::OUString s_sHelpTipSeconds = ::rtl::OUString::createFromAscii("HelpTipSeconds");
+ static const ::rtl::OUString s_sIsAllowAnimatedGraphics = ::rtl::OUString::createFromAscii("IsAllowAnimatedGraphics");
+ static const ::rtl::OUString s_sIsAllowAnimatedText = ::rtl::OUString::createFromAscii("IsAllowAnimatedText");
+ static const ::rtl::OUString s_sIsAutomaticFontColor = ::rtl::OUString::createFromAscii("IsAutomaticFontColor");
+ static const ::rtl::OUString s_sIsSystemFont = ::rtl::OUString::createFromAscii("IsSystemFont");
+ static const ::rtl::OUString s_sIsSelectionInReadonly = ::rtl::OUString::createFromAscii("IsSelectionInReadonly");
+}
+
+#endif // INCLUDE_CONFIGITEMS_ACCESSIBILITYOPTIONS_CONST_HXX
diff --git a/svtools/source/inc/configitems/historyoptions_const.hxx b/svtools/source/inc/configitems/historyoptions_const.hxx
new file mode 100644
index 000000000000..c9148aeb26f8
--- /dev/null
+++ b/svtools/source/inc/configitems/historyoptions_const.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: historyoptions_const.hxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:17:49 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#ifndef INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX
+#define INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace
+{
+ static const ::rtl::OUString s_sCommonHistory = ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/History");
+ static const ::rtl::OUString s_sHistories = ::rtl::OUString::createFromAscii("org.openoffice.Office.Histories/Histories");
+ static const ::rtl::OUString s_sPickListSize = ::rtl::OUString::createFromAscii("PickListSize");
+ static const ::rtl::OUString s_sURLHistorySize = ::rtl::OUString::createFromAscii("Size");
+ static const ::rtl::OUString s_sHelpBookmarksSize = ::rtl::OUString::createFromAscii("HelpBookmarkSize");
+ static const ::rtl::OUString s_sPickList = ::rtl::OUString::createFromAscii("PickList");
+ static const ::rtl::OUString s_sURLHistory = ::rtl::OUString::createFromAscii("URLHistory");
+ static const ::rtl::OUString s_sHelpBookmarks = ::rtl::OUString::createFromAscii("HelpBookmarks");
+ static const ::rtl::OUString s_sItemList = ::rtl::OUString::createFromAscii("ItemList");
+ static const ::rtl::OUString s_sOrderList = ::rtl::OUString::createFromAscii("OrderList");
+ static const ::rtl::OUString s_sHistoryItemRef = ::rtl::OUString::createFromAscii("HistoryItemRef");
+ static const ::rtl::OUString s_sURL = ::rtl::OUString::createFromAscii("URL");
+ static const ::rtl::OUString s_sFilter = ::rtl::OUString::createFromAscii("Filter");
+ static const ::rtl::OUString s_sTitle = ::rtl::OUString::createFromAscii("Title");
+ static const ::rtl::OUString s_sPassword = ::rtl::OUString::createFromAscii("Password");
+}
+
+#endif // INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX
diff --git a/svtools/source/inc/configitems/useroptions_const.hxx b/svtools/source/inc/configitems/useroptions_const.hxx
new file mode 100644
index 000000000000..bd3c6535b00c
--- /dev/null
+++ b/svtools/source/inc/configitems/useroptions_const.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: useroptions_const.hxx,v $
+ *
+ * $Revision: 1.1.4.2 $
+ *
+ * last change: $Author: as $ $Date: 2008/03/19 11:17:50 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX
+#define INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace
+{
+ static const ::rtl::OUString s_sData = ::rtl::OUString::createFromAscii("org.openoffice.UserProfile/Data");
+ static const ::rtl::OUString s_so = ::rtl::OUString::createFromAscii("o"); // USER_OPT_COMPANY
+ static const ::rtl::OUString s_sgivenname = ::rtl::OUString::createFromAscii("givenname"); // USER_OPT_FIRSTNAME
+ static const ::rtl::OUString s_ssn = ::rtl::OUString::createFromAscii("sn"); // USER_OPT_LASTNAME
+ static const ::rtl::OUString s_sinitials = ::rtl::OUString::createFromAscii("initials"); // USER_OPT_ID
+ static const ::rtl::OUString s_sstreet = ::rtl::OUString::createFromAscii("street"); // USER_OPT_STREET
+ static const ::rtl::OUString s_sl = ::rtl::OUString::createFromAscii("l"); // USER_OPT_CITY
+ static const ::rtl::OUString s_sst = ::rtl::OUString::createFromAscii("st"); // USER_OPT_STATE
+ static const ::rtl::OUString s_spostalcode = ::rtl::OUString::createFromAscii("postalcode"); // USER_OPT_ZIP
+ static const ::rtl::OUString s_sc = ::rtl::OUString::createFromAscii("c"); // USER_OPT_COUNTRY
+ static const ::rtl::OUString s_stitle = ::rtl::OUString::createFromAscii("title"); // USER_OPT_TITLE
+ static const ::rtl::OUString s_sposition = ::rtl::OUString::createFromAscii("position"); // USER_OPT_POSITION
+ static const ::rtl::OUString s_shomephone = ::rtl::OUString::createFromAscii("homephone"); // USER_OPT_TELEPHONEHOME
+ static const ::rtl::OUString s_stelephonenumber = ::rtl::OUString::createFromAscii("telephonenumber"); // USER_OPT_TELEPHONEWORK
+ static const ::rtl::OUString s_sfacsimiletelephonenumber = ::rtl::OUString::createFromAscii("facsimiletelephonenumber"); // USER_OPT_FAX
+ static const ::rtl::OUString s_smail = ::rtl::OUString::createFromAscii("mail"); // USER_OPT_EMAIL
+ static const ::rtl::OUString s_scustomernumber = ::rtl::OUString::createFromAscii("customernumber"); // USER_OPT_CUSTOMERNUMBER
+ static const ::rtl::OUString s_sfathersname = ::rtl::OUString::createFromAscii("fathersname"); // USER_OPT_FATHERSNAME
+ static const ::rtl::OUString s_sapartment = ::rtl::OUString::createFromAscii("apartment"); // USER_OPT_APARTMENT
+}
+
+#endif // INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX