summaryrefslogtreecommitdiff
path: root/sw/source/ui/config/usrpref.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/config/usrpref.cxx')
-rw-r--r--sw/source/ui/config/usrpref.cxx107
1 files changed, 33 insertions, 74 deletions
diff --git a/sw/source/ui/config/usrpref.cxx b/sw/source/ui/config/usrpref.cxx
index c8b6bd7d3ab1..2d5acfa0c9a4 100644
--- a/sw/source/ui/config/usrpref.cxx
+++ b/sw/source/ui/config/usrpref.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,6 +32,7 @@
#include <tools/stream.hxx>
#include <unotools/syslocale.hxx>
+#include <svl/cjkoptions.hxx>
#include "swtypes.hxx"
#include "hintids.hxx"
@@ -46,10 +48,11 @@
#include <unomid.h>
using namespace utl;
-using namespace rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
void SwMasterUsrPref::SetUsrPref(const SwViewOption &rCopy)
{
@@ -67,12 +70,20 @@ SwMasterUsrPref::SwMasterUsrPref(sal_Bool bWeb) :
aLayoutConfig(bWeb, *this),
aGridConfig(bWeb, *this),
aCursorConfig(*this),
- pWebColorConfig(bWeb ? new SwWebColorConfig(*this) : 0)
+ pWebColorConfig(bWeb ? new SwWebColorConfig(*this) : 0),
+ bApplyCharUnit(sal_False)
{
MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
+ SvtCJKOptions aCJKOptions;
eUserMetric = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH;
- eHScrollMetric = eUserMetric;
- eVScrollMetric = eUserMetric;
+
+ sal_Bool bCJKEnabled = aCJKOptions.IsAsianTypographyEnabled();
+ bApplyCharUnit = bCJKEnabled;
+ eHScrollMetric = bApplyCharUnit ? FUNIT_CHAR : eUserMetric;
+ eVScrollMetric = bApplyCharUnit ? FUNIT_LINE : eUserMetric;
+
+ bIsHScrollMetricSet = bApplyCharUnit;
+ bIsVScrollMetricSet = bApplyCharUnit;
aContentConfig.Load();
aLayoutConfig.Load();
@@ -81,16 +92,12 @@ SwMasterUsrPref::SwMasterUsrPref(sal_Bool bWeb) :
if(pWebColorConfig)
pWebColorConfig->Load();
}
-/* -----------------------------13.02.01 09:48--------------------------------
- ---------------------------------------------------------------------------*/
SwMasterUsrPref::~SwMasterUsrPref()
{
delete pWebColorConfig;
}
-/*-- 28.09.00 09:55:32---------------------------------------------------
- -----------------------------------------------------------------------*/
Sequence<OUString> SwContentViewConfig::GetPropertyNames()
{
static const char* aPropNames[] =
@@ -107,13 +114,13 @@ Sequence<OUString> SwContentViewConfig::GetPropertyNames()
"NonprintingCharacter/Space", // 9
"NonprintingCharacter/Break", // 10
"NonprintingCharacter/ProtectedSpace", // 11
- "NonprintingCharacter/Tab", // 12 //not in Writer/Web
- "NonprintingCharacter/HiddenText", // 13
- "NonprintingCharacter/HiddenParagraph", // 14
- "NonprintingCharacter/HiddenCharacter", // 15
- "Update/Link", // 16
- "Update/Field", // 17
- "Update/Chart" // 18
+ "NonprintingCharacter/Tab", // 12 //not in Writer/Web
+ "NonprintingCharacter/HiddenText", // 13
+ "NonprintingCharacter/HiddenParagraph", // 14
+ "NonprintingCharacter/HiddenCharacter", // 15
+ "Update/Link", // 16
+ "Update/Field", // 17
+ "Update/Chart" // 18
};
@@ -126,9 +133,7 @@ Sequence<OUString> SwContentViewConfig::GetPropertyNames()
}
return aNames;
}
-/*-- 28.09.00 09:55:33---------------------------------------------------
- -----------------------------------------------------------------------*/
SwContentViewConfig::SwContentViewConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) :
ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Content") : C2U("Office.Writer/Content")),
rParent(rPar),
@@ -137,22 +142,16 @@ SwContentViewConfig::SwContentViewConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar)
Load();
EnableNotification( GetPropertyNames() );
}
-/*-- 28.09.00 09:55:33---------------------------------------------------
- -----------------------------------------------------------------------*/
SwContentViewConfig::~SwContentViewConfig()
{
}
-/*-- 09.02.07 09:55:33---------------------------------------------------
- -----------------------------------------------------------------------*/
void SwContentViewConfig::Notify( const Sequence< OUString > & /*rPropertyNames*/ )
{
Load();
}
-/*-- 28.09.00 09:55:33---------------------------------------------------
- -----------------------------------------------------------------------*/
void SwContentViewConfig::Commit()
{
Sequence<OUString> aNames = GetPropertyNames();
@@ -190,15 +189,13 @@ void SwContentViewConfig::Commit()
}
PutProperties(aNames, aValues);
}
-/*-- 28.09.00 09:55:34---------------------------------------------------
- -----------------------------------------------------------------------*/
void SwContentViewConfig::Load()
{
Sequence<OUString> aNames = GetPropertyNames();
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
- DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
if(aValues.getLength() == aNames.getLength())
{
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
@@ -238,9 +235,7 @@ void SwContentViewConfig::Load()
}
}
}
-/*-- 28.09.00 09:55:34---------------------------------------------------
- -----------------------------------------------------------------------*/
Sequence<OUString> SwLayoutViewConfig::GetPropertyNames()
{
static const char* aPropNames[] =
@@ -266,8 +261,9 @@ Sequence<OUString> SwLayoutViewConfig::GetPropertyNames()
"ViewLayout/Columns", //17
"ViewLayout/BookMode", //18
"Other/IsSquaredPageMode" //19
+ "Other/ApplyCharUnit" //20
};
- const int nCount = bWeb ? 15 : 20;
+ const int nCount = bWeb ? 15 : 21;
Sequence<OUString> aNames(nCount);
OUString* pNames = aNames.getArray();
for(int i = 0; i < nCount; i++)
@@ -276,9 +272,7 @@ Sequence<OUString> SwLayoutViewConfig::GetPropertyNames()
}
return aNames;
}
-/*-- 28.09.00 09:55:34---------------------------------------------------
- -----------------------------------------------------------------------*/
SwLayoutViewConfig::SwLayoutViewConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) :
ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Layout") : C2U("Office.Writer/Layout"),
CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
@@ -286,15 +280,11 @@ SwLayoutViewConfig::SwLayoutViewConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) :
bWeb(bIsWeb)
{
}
-/*-- 28.09.00 09:55:35---------------------------------------------------
- -----------------------------------------------------------------------*/
SwLayoutViewConfig::~SwLayoutViewConfig()
{
}
-/*-- 28.09.00 09:55:36---------------------------------------------------
- -----------------------------------------------------------------------*/
void SwLayoutViewConfig::Commit()
{
Sequence<OUString> aNames = GetPropertyNames();
@@ -335,19 +325,18 @@ void SwLayoutViewConfig::Commit()
case 17: rVal <<= (sal_Int32)rParent.GetViewLayoutColumns(); break; // "ViewLayout/Columns",
case 18: rVal <<= (sal_Bool) rParent.IsViewLayoutBookMode(); break; // "ViewLayout/BookMode",
case 19: rVal <<= (sal_Bool) rParent.IsSquaredPageMode(); break; // "Other/IsSquaredPageMode",
+ case 20: rVal <<= (sal_Bool) rParent.IsApplyCharUnit(); break; // "Other/IsSquaredPageMode",
}
}
PutProperties(aNames, aValues);
}
-/*-- 28.09.00 09:55:36---------------------------------------------------
- -----------------------------------------------------------------------*/
void SwLayoutViewConfig::Load()
{
Sequence<OUString> aNames = GetPropertyNames();
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
- DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
if(aValues.getLength() == aNames.getLength())
{
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
@@ -391,6 +380,7 @@ void SwLayoutViewConfig::Load()
case 17: rParent.SetViewLayoutColumns( static_cast<sal_uInt16>(nInt32Val) ); break;// "ViewLayout/Columns",
case 18: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode",
case 19: rParent.SetDefaultPageMode(bSet,sal_True); break;// "Other/IsSquaredPageMode",
+ case 20: rParent.SetApplyCharUnit(bSet); break;// "Other/ApplyUserChar"
}
}
}
@@ -399,9 +389,6 @@ void SwLayoutViewConfig::Load()
void SwLayoutViewConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
-/* -----------------------------19.01.01 13:07--------------------------------
-
- ---------------------------------------------------------------------------*/
Sequence<OUString> SwGridConfig::GetPropertyNames()
{
static const char* aPropNames[] =
@@ -423,9 +410,7 @@ Sequence<OUString> SwGridConfig::GetPropertyNames()
}
return aNames;
}
-/* -----------------------------19.01.01 13:07--------------------------------
- ---------------------------------------------------------------------------*/
SwGridConfig::SwGridConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) :
ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Grid") : C2U("Office.Writer/Grid"),
CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
@@ -433,15 +418,11 @@ SwGridConfig::SwGridConfig(sal_Bool bIsWeb, SwMasterUsrPref& rPar) :
bWeb(bIsWeb)
{
}
-/* -----------------------------19.01.01 13:07--------------------------------
- ---------------------------------------------------------------------------*/
SwGridConfig::~SwGridConfig()
{
}
-/* -----------------------------19.01.01 13:07--------------------------------
- ---------------------------------------------------------------------------*/
void SwGridConfig::Commit()
{
Sequence<OUString> aNames = GetPropertyNames();
@@ -467,15 +448,13 @@ void SwGridConfig::Commit()
}
PutProperties(aNames, aValues);
}
-/* -----------------------------19.01.01 13:07--------------------------------
- ---------------------------------------------------------------------------*/
void SwGridConfig::Load()
{
Sequence<OUString> aNames = GetPropertyNames();
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
- DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
if(aValues.getLength() == aNames.getLength())
{
Size aSnap(rParent.GetSnapSize());
@@ -505,9 +484,6 @@ void SwGridConfig::Load()
void SwGridConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
-/* -----------------------------19.01.01 13:07--------------------------------
-
- ---------------------------------------------------------------------------*/
Sequence<OUString> SwCursorConfig::GetPropertyNames()
{
static const char* aPropNames[] =
@@ -520,27 +496,21 @@ Sequence<OUString> SwCursorConfig::GetPropertyNames()
Sequence<OUString> aNames(nCount);
OUString* pNames = aNames.getArray();
for(int i = 0; i < nCount; i++)
- pNames[i] = C2U(aPropNames[i]);
+ pNames[i] = rtl::OUString::createFromAscii(aPropNames[i]);
return aNames;
}
-/* -----------------------------19.01.01 13:07--------------------------------
- ---------------------------------------------------------------------------*/
SwCursorConfig::SwCursorConfig(SwMasterUsrPref& rPar) :
ConfigItem(C2U("Office.Writer/Cursor"),
CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
rParent(rPar)
{
}
-/* -----------------------------19.01.01 13:07--------------------------------
- ---------------------------------------------------------------------------*/
SwCursorConfig::~SwCursorConfig()
{
}
-/* -----------------------------19.01.01 13:07--------------------------------
- ---------------------------------------------------------------------------*/
void SwCursorConfig::Commit()
{
Sequence<OUString> aNames = GetPropertyNames();
@@ -562,15 +532,13 @@ void SwCursorConfig::Commit()
}
PutProperties(aNames, aValues);
}
-/* -----------------------------19.01.01 13:07--------------------------------
- ---------------------------------------------------------------------------*/
void SwCursorConfig::Load()
{
Sequence<OUString> aNames = GetPropertyNames();
Sequence<Any> aValues = GetProperties(aNames);
const Any* pValues = aValues.getConstArray();
- DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
if(aValues.getLength() == aNames.getLength())
{
@@ -598,9 +566,6 @@ void SwCursorConfig::Load()
void SwCursorConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
-/*-- 28.09.00 09:55:33---------------------------------------------------
-
- -----------------------------------------------------------------------*/
SwWebColorConfig::SwWebColorConfig(SwMasterUsrPref& rPar) :
ConfigItem(C2U("Office.WriterWeb/Background"),
CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
@@ -609,15 +574,11 @@ SwWebColorConfig::SwWebColorConfig(SwMasterUsrPref& rPar) :
{
aPropNames.getArray()[0] = C2U("Color");
}
-/*-- 28.09.00 09:55:33---------------------------------------------------
- -----------------------------------------------------------------------*/
SwWebColorConfig::~SwWebColorConfig()
{
}
-/*-- 28.09.00 09:55:33---------------------------------------------------
- -----------------------------------------------------------------------*/
void SwWebColorConfig::Commit()
{
Sequence<Any> aValues(aPropNames.getLength());
@@ -634,14 +595,11 @@ void SwWebColorConfig::Commit()
void SwWebColorConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
-/*-- 28.09.00 09:55:34---------------------------------------------------
-
- -----------------------------------------------------------------------*/
void SwWebColorConfig::Load()
{
Sequence<Any> aValues = GetProperties(aPropNames);
const Any* pValues = aValues.getConstArray();
- DBG_ASSERT(aValues.getLength() == aPropNames.getLength(), "GetProperties failed");
+ OSL_ENSURE(aValues.getLength() == aPropNames.getLength(), "GetProperties failed");
if(aValues.getLength() == aPropNames.getLength())
{
for(int nProp = 0; nProp < aPropNames.getLength(); nProp++)
@@ -661,3 +619,4 @@ void SwWebColorConfig::Load()
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */