Files
libreoffice/sw/source/ui/config/usrpref.cxx

684 lines
29 KiB
C++
Raw Normal View History

2000-09-18 16:15:01 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 16:15:01 +00:00
*
* Copyright 2008 by Sun Microsystems, Inc.
2000-09-18 16:15:01 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:15:01 +00:00
*
* $RCSfile: usrpref.cxx,v $
* $Revision: 1.39 $
2000-09-18 16:15:01 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 16:15:01 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 16:15:01 +00:00
*
* OpenOffice.org 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 version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 16:15:01 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 16:15:01 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
2000-09-18 16:15:01 +00:00
#include <tools/stream.hxx>
CWS-TOOLING: integrate CWS oj18 2009-08-21 15:08:49 +0200 oj r275263 : wrong check 2009-08-21 08:56:01 +0200 oj r275215 : missing not 2009-08-20 07:27:13 +0200 oj r275164 : use new method from global 2009-08-19 10:22:35 +0200 oj r275138 : call GetLocale instead of pLocale 2009-08-18 10:39:32 +0200 oj r275082 : missing header include 2009-08-18 10:09:44 +0200 oj r275081 : new methods at global 2009-08-18 10:09:00 +0200 oj r275080 : unused var 2009-08-18 08:59:04 +0200 oj r275078 : move files from classes to xml 2009-08-17 14:58:16 +0200 oj r275056 : CWS-TOOLING: rebase CWS oj18 to trunk@275001 (milestone: DEV300:m55) 2009-08-17 13:29:44 +0200 oj r275047 : compile error 2009-08-17 13:27:47 +0200 oj r275045 : compile error 2009-08-17 11:44:54 +0200 oj r275040 : add dep 2009-07-22 14:26:05 +0200 oj r274240 : move unused services into fwl 2009-07-22 14:25:35 +0200 oj r274239 : move unused services into fwl 2009-07-22 13:47:45 +0200 oj r274233 : remove some unused code 2009-07-22 09:06:20 +0200 oj r274219 : export dbtoolsclient dbcharsethelper for sc 2009-07-22 08:48:58 +0200 oj r274218 : create NumberFormatter on demand 2009-07-22 08:39:23 +0200 oj r274217 : change char to sal_Char 2009-07-22 07:33:34 +0200 oj r274214 : export dbtoolsclient dbcharsethelper for sc 2009-07-22 07:30:04 +0200 oj r274213 : late init of numberformatter and breakiterator 2009-07-22 07:28:55 +0200 oj r274212 : export dbtoolsclient dbcharsethelper for sc 2009-07-21 13:43:28 +0200 oj r274196 : check if quick start is enbaled 2009-07-21 13:40:09 +0200 oj r274195 : check config entry for UiEventsLogger 2009-07-21 13:37:40 +0200 oj r274194 : code refactoring, remove of duplicate code and some late inits and removale of not needed files 2009-07-21 13:35:38 +0200 oj r274193 : code refactoring, remove of duplicate code and some late inits and removale of not needed files 2009-07-21 13:33:41 +0200 oj r274192 : doc meta data will now be created on demand 2009-07-21 13:13:40 +0200 oj r274187 : load ldap functions on demand 2009-07-21 13:03:17 +0200 oj r274183 : late init of TransliterationImpl 2009-07-21 12:36:10 +0200 oj r274180 : late init of charClass
2009-09-08 04:57:32 +00:00
#include <svtools/syslocale.hxx>
2000-09-18 16:15:01 +00:00
#include "swtypes.hxx"
#include "hintids.hxx"
#include "uitool.hxx"
#include "usrpref.hxx"
#include "crstate.hxx"
2000-11-19 10:41:10 +00:00
#include <linguistic/lngprops.hxx>
2000-09-18 16:15:01 +00:00
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <unotools/localedatawrapper.hxx>
2000-09-18 16:15:01 +00:00
#include <unomid.h>
using namespace utl;
using namespace rtl;
2000-09-18 16:15:01 +00:00
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
2000-09-18 16:15:01 +00:00
void SwMasterUsrPref::SetUsrPref(const SwViewOption &rCopy)
{
*((SwViewOption*)this) = rCopy;
}
SwMasterUsrPref::SwMasterUsrPref(BOOL bWeb) :
eFldUpdateFlags(AUTOUPD_OFF),
nLinkUpdateMode(0),
bIsHScrollMetricSet(sal_False),
2003-04-04 12:59:20 +00:00
bIsVScrollMetricSet(sal_False),
nDefTab( MM50 * 4 ),
bIsSquaredPageMode(sal_False),
aContentConfig(bWeb, *this),
aLayoutConfig(bWeb, *this),
aGridConfig(bWeb, *this),
aCursorConfig(*this),
pWebColorConfig(bWeb ? new SwWebColorConfig(*this) : 0)
2000-09-18 16:15:01 +00:00
{
CWS-TOOLING: integrate CWS oj18 2009-08-21 15:08:49 +0200 oj r275263 : wrong check 2009-08-21 08:56:01 +0200 oj r275215 : missing not 2009-08-20 07:27:13 +0200 oj r275164 : use new method from global 2009-08-19 10:22:35 +0200 oj r275138 : call GetLocale instead of pLocale 2009-08-18 10:39:32 +0200 oj r275082 : missing header include 2009-08-18 10:09:44 +0200 oj r275081 : new methods at global 2009-08-18 10:09:00 +0200 oj r275080 : unused var 2009-08-18 08:59:04 +0200 oj r275078 : move files from classes to xml 2009-08-17 14:58:16 +0200 oj r275056 : CWS-TOOLING: rebase CWS oj18 to trunk@275001 (milestone: DEV300:m55) 2009-08-17 13:29:44 +0200 oj r275047 : compile error 2009-08-17 13:27:47 +0200 oj r275045 : compile error 2009-08-17 11:44:54 +0200 oj r275040 : add dep 2009-07-22 14:26:05 +0200 oj r274240 : move unused services into fwl 2009-07-22 14:25:35 +0200 oj r274239 : move unused services into fwl 2009-07-22 13:47:45 +0200 oj r274233 : remove some unused code 2009-07-22 09:06:20 +0200 oj r274219 : export dbtoolsclient dbcharsethelper for sc 2009-07-22 08:48:58 +0200 oj r274218 : create NumberFormatter on demand 2009-07-22 08:39:23 +0200 oj r274217 : change char to sal_Char 2009-07-22 07:33:34 +0200 oj r274214 : export dbtoolsclient dbcharsethelper for sc 2009-07-22 07:30:04 +0200 oj r274213 : late init of numberformatter and breakiterator 2009-07-22 07:28:55 +0200 oj r274212 : export dbtoolsclient dbcharsethelper for sc 2009-07-21 13:43:28 +0200 oj r274196 : check if quick start is enbaled 2009-07-21 13:40:09 +0200 oj r274195 : check config entry for UiEventsLogger 2009-07-21 13:37:40 +0200 oj r274194 : code refactoring, remove of duplicate code and some late inits and removale of not needed files 2009-07-21 13:35:38 +0200 oj r274193 : code refactoring, remove of duplicate code and some late inits and removale of not needed files 2009-07-21 13:33:41 +0200 oj r274192 : doc meta data will now be created on demand 2009-07-21 13:13:40 +0200 oj r274187 : load ldap functions on demand 2009-07-21 13:03:17 +0200 oj r274183 : late init of TransliterationImpl 2009-07-21 12:36:10 +0200 oj r274180 : late init of charClass
2009-09-08 04:57:32 +00:00
MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
eUserMetric = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH;
eHScrollMetric = eUserMetric;
eVScrollMetric = eUserMetric;
aContentConfig.Load();
aLayoutConfig.Load();
2001-01-19 11:45:03 +00:00
aGridConfig.Load();
2001-01-24 15:08:03 +00:00
aCursorConfig.Load();
2001-02-13 08:52:11 +00:00
if(pWebColorConfig)
pWebColorConfig->Load();
}
/* -----------------------------13.02.01 09:48--------------------------------
---------------------------------------------------------------------------*/
SwMasterUsrPref::~SwMasterUsrPref()
{
delete pWebColorConfig;
}
/*-- 28.09.00 09:55:32---------------------------------------------------
2000-09-18 16:15:01 +00:00
-----------------------------------------------------------------------*/
Sequence<OUString> SwContentViewConfig::GetPropertyNames()
{
static const char* aPropNames[] =
2000-09-18 16:15:01 +00:00
{
"Display/GraphicObject", // 0
"Display/Table", // 1
"Display/DrawingControl", // 2
"Display/FieldCode", // 3
"Display/Note", // 4
"Display/PreventTips", // 5
"NonprintingCharacter/MetaCharacters", // 6
"NonprintingCharacter/ParagraphEnd", // 7
"NonprintingCharacter/OptionalHyphen", // 8
"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
};
const int nCount = bWeb ? 12 : 19;
Sequence<OUString> aNames(nCount);
OUString* pNames = aNames.getArray();
for(int i = 0; i < nCount; i++)
2000-09-18 16:15:01 +00:00
{
pNames[i] = OUString::createFromAscii(aPropNames[i]);
2000-09-18 16:15:01 +00:00
}
return aNames;
}
/*-- 28.09.00 09:55:33---------------------------------------------------
2000-09-18 16:15:01 +00:00
-----------------------------------------------------------------------*/
SwContentViewConfig::SwContentViewConfig(BOOL bIsWeb, SwMasterUsrPref& rPar) :
ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Content") : C2U("Office.Writer/Content")),
rParent(rPar),
bWeb(bIsWeb)
{
Load();
EnableNotification( GetPropertyNames() );
}
/*-- 28.09.00 09:55:33---------------------------------------------------
2000-09-18 16:15:01 +00:00
-----------------------------------------------------------------------*/
SwContentViewConfig::~SwContentViewConfig()
{
}
/*-- 09.02.07 09:55:33---------------------------------------------------
-----------------------------------------------------------------------*/
void SwContentViewConfig::Notify( const Sequence< OUString > & /*rPropertyNames*/ )
{
Load();
}
/*-- 28.09.00 09:55:33---------------------------------------------------
2000-09-18 16:15:01 +00:00
-----------------------------------------------------------------------*/
void SwContentViewConfig::Commit()
{
Sequence<OUString> aNames = GetPropertyNames();
2000-09-18 16:15:01 +00:00
Sequence<Any> aValues(aNames.getLength());
Any* pValues = aValues.getArray();
2000-09-18 16:15:01 +00:00
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
sal_Bool bVal = FALSE;
switch(nProp)
2000-09-18 16:15:01 +00:00
{
case 0: bVal = rParent.IsGraphic(); break;// "Display/GraphicObject",
case 1: bVal = rParent.IsTable(); break;// "Display/Table",
case 2: bVal = rParent.IsDraw(); break;// "Display/DrawingControl",
case 3: bVal = rParent.IsFldName(); break;// "Display/FieldCode",
case 4: bVal = rParent.IsPostIts(); break;// "Display/Note",
case 5: bVal = rParent.IsPreventTips(); break; // "Display/PreventTips"
case 6: bVal = rParent.IsViewMetaChars(); break; //"NonprintingCharacter/MetaCharacters"
case 7: bVal = rParent.IsParagraph(sal_True); break;// "NonprintingCharacter/ParagraphEnd",
case 8: bVal = rParent.IsSoftHyph(); break;// "NonprintingCharacter/OptionalHyphen",
case 9: bVal = rParent.IsBlank(sal_True); break;// "NonprintingCharacter/Space",
case 10: bVal = rParent.IsLineBreak(sal_True);break;// "NonprintingCharacter/Break",
case 11: bVal = rParent.IsHardBlank(); break;// "NonprintingCharacter/ProtectedSpace",
case 12: bVal = rParent.IsTab(sal_True); break;// "NonprintingCharacter/Tab",
case 13: bVal = rParent.IsShowHiddenField(); break;// "NonprintingCharacter/Fields: HiddenText",
case 14: bVal = rParent.IsShowHiddenPara(); break;// "NonprintingCharacter/Fields: HiddenParagraph",
case 15: bVal = rParent.IsShowHiddenChar(sal_True); break;// "NonprintingCharacter/HiddenCharacter",
case 16: pValues[nProp] <<= rParent.GetUpdateLinkMode(); break;// "Update/Link",
case 17: bVal = rParent.IsUpdateFields(); break;// "Update/Field",
case 18: bVal = rParent.IsUpdateCharts(); break;// "Update/Chart"
2000-09-18 16:15:01 +00:00
}
if(nProp != 16)
pValues[nProp].setValue(&bVal, ::getBooleanCppuType());
}
PutProperties(aNames, aValues);
}
/*-- 28.09.00 09:55:34---------------------------------------------------
2000-09-18 16:15:01 +00:00
-----------------------------------------------------------------------*/
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");
if(aValues.getLength() == aNames.getLength())
{
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
2000-09-18 16:15:01 +00:00
{
if(pValues[nProp].hasValue())
2000-09-18 16:15:01 +00:00
{
sal_Bool bSet = nProp != 16 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
switch(nProp)
2000-09-18 16:15:01 +00:00
{
case 0: rParent.SetGraphic(bSet); break;// "Display/GraphicObject",
case 1: rParent.SetTable(bSet); break;// "Display/Table",
case 2: rParent.SetDraw(bSet); break;// "Display/DrawingControl",
case 3: rParent.SetFldName(bSet); break;// "Display/FieldCode",
case 4: rParent.SetPostIts(bSet); break;// "Display/Note",
case 5: rParent.SetPreventTips(bSet); break;// "Display/PreventTips",
case 6: rParent.SetViewMetaChars(bSet); break; //"NonprintingCharacter/MetaCharacters"
case 7: rParent.SetParagraph(bSet); break;// "NonprintingCharacter/ParagraphEnd",
case 8: rParent.SetSoftHyph(bSet); break;// "NonprintingCharacter/OptionalHyphen",
case 9: rParent.SetBlank(bSet); break;// "NonprintingCharacter/Space",
case 10: rParent.SetLineBreak(bSet);break;// "NonprintingCharacter/Break",
case 11: rParent.SetHardBlank(bSet); break;// "NonprintingCharacter/ProtectedSpace",
case 12: rParent.SetTab(bSet); break;// "NonprintingCharacter/Tab",
case 13: rParent.SetShowHiddenField(bSet); break;// "NonprintingCharacter/Fields: HiddenText",
case 14: rParent.SetShowHiddenPara(bSet); break;// "NonprintingCharacter/Fields: HiddenParagraph",
case 15: rParent.SetShowHiddenChar(bSet); break;// "NonprintingCharacter/HiddenCharacter",
case 16:
{
sal_Int32 nSet = 0;
pValues[nProp] >>= nSet;
rParent.SetUpdateLinkMode(nSet, TRUE);
}
break;// "Update/Link",
case 17: rParent.SetUpdateFields(bSet, TRUE); break;// "Update/Field",
case 18: rParent.SetUpdateCharts(bSet, TRUE); break;// "Update/Chart"
2000-09-18 16:15:01 +00:00
}
}
}
}
}
/*-- 28.09.00 09:55:34---------------------------------------------------
2000-09-18 16:15:01 +00:00
-----------------------------------------------------------------------*/
Sequence<OUString> SwLayoutViewConfig::GetPropertyNames()
{
static const char* aPropNames[] =
2000-09-18 16:15:01 +00:00
{
"Line/Guide", // 0
"Line/SimpleControlPoint", // 1
"Line/LargeControlPoint", // 2
"Window/HorizontalScroll", // 3
"Window/VerticalScroll", // 4
"Window/ShowRulers", // 5
"Window/HorizontalRuler", // 6
"Window/VerticalRuler", // 7
"Window/HorizontalRulerUnit", // 8
"Window/VerticalRulerUnit", // 9
"Window/SmoothScroll", //10
"Zoom/Value", //11
"Zoom/Type", //12
"Other/MeasureUnit", //13
"Other/TabStop", //14
"Window/IsVerticalRulerRight", //15
"ViewLayout/Columns", //16
"ViewLayout/BookMode", //17
"Other/IsSquaredPageMode" //18
};
const int nCount = bWeb ? 14 : 19;
Sequence<OUString> aNames(nCount);
OUString* pNames = aNames.getArray();
for(int i = 0; i < nCount; i++)
{
pNames[i] = OUString::createFromAscii(aPropNames[i]);
2000-09-18 16:15:01 +00:00
}
return aNames;
2000-09-18 16:15:01 +00:00
}
/*-- 28.09.00 09:55:34---------------------------------------------------
2000-09-18 16:15:01 +00:00
-----------------------------------------------------------------------*/
SwLayoutViewConfig::SwLayoutViewConfig(BOOL bIsWeb, SwMasterUsrPref& rPar) :
ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Layout") : C2U("Office.Writer/Layout"),
CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
rParent(rPar),
bWeb(bIsWeb)
2000-09-18 16:15:01 +00:00
{
}
/*-- 28.09.00 09:55:35---------------------------------------------------
2000-09-18 16:15:01 +00:00
-----------------------------------------------------------------------*/
SwLayoutViewConfig::~SwLayoutViewConfig()
2000-09-18 16:15:01 +00:00
{
}
/*-- 28.09.00 09:55:36---------------------------------------------------
2000-09-18 16:15:01 +00:00
-----------------------------------------------------------------------*/
void SwLayoutViewConfig::Commit()
{
Sequence<OUString> aNames = GetPropertyNames();
2000-09-18 16:15:01 +00:00
Sequence<Any> aValues(aNames.getLength());
Any* pValues = aValues.getArray();
2000-09-18 16:15:01 +00:00
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
sal_Bool bSet;
switch(nProp)
{
case 0: bSet = rParent.IsCrossHair(); break;// "Line/Guide",
case 1: bSet = rParent.IsSolidMarkHdl(); break;// "Line/SimpleControlPoint",
case 2: bSet = rParent.IsBigMarkHdl(); break;// "Line/LargeControlPoint",
case 3: bSet = rParent.IsViewHScrollBar(); break;// "Window/HorizontalScroll",
case 4: bSet = rParent.IsViewVScrollBar(); break;// "Window/VerticalScroll",
case 5: bSet = rParent.IsViewAnyRuler(); break; // "Window/ShowRulers"
// #i14593# use IsView*Ruler(TRUE) instead of IsView*Ruler()
// this preserves the single ruler states even if "Window/ShowRulers" is off
case 6: bSet = rParent.IsViewHRuler(TRUE); break;// "Window/HorizontalRuler",
case 7: bSet = rParent.IsViewVRuler(TRUE); break;// "Window/VerticalRuler",
case 8:
if(rParent.bIsHScrollMetricSet)
pValues[nProp] <<= (sal_Int32)rParent.eHScrollMetric; // "Window/HorizontalRulerUnit"
break;
case 9:
if(rParent.bIsVScrollMetricSet)
pValues[nProp] <<= (sal_Int32)rParent.eVScrollMetric; // "Window/VerticalRulerUnit"
break;
case 10: bSet = rParent.IsSmoothScroll(); break;// "Window/SmoothScroll",
case 11: pValues[nProp] <<= (sal_Int32)rParent.GetZoom(); break;// "Zoom/Value",
case 12: pValues[nProp] <<= (sal_Int32)rParent.GetZoomType(); break;// "Zoom/Type",
case 13: pValues[nProp] <<= (sal_Int32)rParent.GetMetric(); break;// "Other/MeasureUnit",
case 14: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(rParent.GetDefTab())); break;// "Other/TabStop",
case 15: bSet = rParent.IsVRulerRight(); break;// "Window/IsVerticalRulerRight",
case 16: pValues[nProp] <<= (sal_Int32)rParent.GetViewLayoutColumns(); break;// "ViewLayout/Columns",
case 17: bSet = rParent.IsViewLayoutBookMode(); break;// "ViewLayout/BookMode",
case 18: bSet = rParent.IsSquaredPageMode(); break;// "Other/IsSquaredPageMode",
}
if(nProp < 8 || nProp == 10 || nProp == 15 || nProp == 17 || nProp == 18 )
pValues[nProp].setValue(&bSet, ::getBooleanCppuType());
}
PutProperties(aNames, aValues);
}
/*-- 28.09.00 09:55:36---------------------------------------------------
2000-09-18 16:15:01 +00:00
-----------------------------------------------------------------------*/
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");
if(aValues.getLength() == aNames.getLength())
{
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
if(pValues[nProp].hasValue())
{
sal_Bool bSet = nProp < 8 || nProp == 10 || nProp == 17 || nProp == 18 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
switch(nProp)
{
case 0: rParent.SetCrossHair(bSet); break;// "Line/Guide",
case 1: rParent.SetSolidMarkHdl(bSet); break;// "Line/SimpleControlPoint",
case 2: rParent.SetBigMarkHdl(bSet); break;// "Line/LargeControlPoint",
case 3: rParent.SetViewHScrollBar(bSet); break;// "Window/HorizontalScroll",
case 4: rParent.SetViewVScrollBar(bSet); break;// "Window/VerticalScroll",
case 5: rParent.SetViewAnyRuler(bSet);break; // "Window/ShowRulers"
case 6: rParent.SetViewHRuler(bSet); break;// "Window/HorizontalRuler",
case 7: rParent.SetViewVRuler(bSet); break;// "Window/VerticalRuler",
case 8:
{
rParent.bIsHScrollMetricSet = sal_True;
sal_Int32 nUnit = 0;
pValues[nProp] >>= nUnit;
rParent.eHScrollMetric = ((FieldUnit)nUnit); // "Window/HorizontalRulerUnit"
}
break;
case 9:
{
rParent.bIsVScrollMetricSet = sal_True;
sal_Int32 nUnit = 0;
pValues[nProp] >>= nUnit;
rParent.eVScrollMetric = ((FieldUnit)nUnit); // "Window/VerticalRulerUnit"
}
break;
case 10: rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll",
case 11:
{
sal_Int32 nVal = 0;
pValues[nProp] >>= nVal;
rParent.SetZoom( static_cast< USHORT >(nVal) );
}
break;// "Zoom/Value",
case 12:
{
sal_Int32 nVal = 0;
pValues[nProp] >>= nVal;
rParent.SetZoomType( static_cast< SvxZoomType >(nVal) );
}
break;// "Zoom/Type",
case 13:
{
sal_Int32 nUnit = 0;
pValues[nProp] >>= nUnit;
rParent.SetMetric((FieldUnit)nUnit, TRUE);
}
break;// "Other/MeasureUnit",
case 14:
{
sal_Int32 nTab = 0;
pValues[nProp] >>= nTab;
2002-08-13 14:00:05 +00:00
rParent.SetDefTab(MM100_TO_TWIP(nTab), TRUE);
}
break;// "Other/TabStop",
case 15: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight",
case 16:
{
sal_Int32 nColumns = 0;
pValues[nProp] >>= nColumns;
rParent.SetViewLayoutColumns( static_cast<USHORT>(nColumns) );
}
break;// "ViewLayout/Columns",
case 17: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode",
CWS-TOOLING: integrate CWS sw31bf02 2009-01-26 08:39:59 +0100 fme r266900 : #i93190# placeholder field should be checked in IsEqualsFlags as well 2009-01-21 17:32:32 +0100 ama r266695 : CWS-TOOLING: rebase CWS sw31bf02 to trunk@266428 (milestone: DEV300:m39) 2009-01-19 09:26:02 +0100 ama r266475 : Fix #i96109#: Bracket mismatch 2009-01-19 09:08:47 +0100 ama r266473 : Fix #i96391#: Wrong default parameter 2009-01-19 09:07:13 +0100 ama r266472 : Fix #i96112#: Bracket mismatch 2009-01-19 08:51:42 +0100 ama r266471 : Fix #i96113#: Bracket mismatch 2009-01-16 15:07:01 +0100 ama r266421 : Fix #i93105#: export 0x14 2009-01-16 09:07:02 +0100 ama r266400 : Fix #i96111#: Wrong condition 2009-01-16 08:49:47 +0100 ama r266399 : Fix #i99110#: Wrong condition 2009-01-12 15:54:46 +0100 ama r266164 : Fix #i17949#: Ctrl+A if document starts with a section 2009-01-09 15:39:44 +0100 ama r266091 : Fix #i93144#: Crash during update of TOC 2009-01-09 14:40:20 +0100 ama r266086 : Fix #i90072#: Shorten undo strings 2008-12-10 16:34:57 +0100 fme r265203 : #i73332# Crash with section endnotes 2008-12-10 15:04:29 +0100 fme r265194 : #i93190# Omit painting of placeholder fields during pdf export 2008-12-09 16:46:54 +0100 fme r265115 : #i96167# haggi - reset view options before disposing view 2008-12-09 16:17:13 +0100 fme r265114 : #i96167# Added missing word coun invalidation on splitting node in second half 2008-12-09 15:49:19 +0100 fme r265108 : #i91740# Write actual text only for hyphen portions 2008-12-09 14:52:13 +0100 fme r265090 : #91483# Disable some Insert menu entries in case cursor is located in hidden text
2009-02-13 11:19:56 +00:00
case 18: rParent.SetDefaultPageMode(bSet,TRUE); break;// "Other/IsSquaredPageMode",
}
}
}
}
}
2001-01-19 11:45:03 +00:00
/* -----------------------------19.01.01 13:07--------------------------------
---------------------------------------------------------------------------*/
Sequence<OUString> SwGridConfig::GetPropertyNames()
{
static const char* aPropNames[] =
{
"Option/SnapToGrid", // 0
"Option/VisibleGrid", // 1
"Option/Synchronize", // 2
"Resolution/XAxis", // 3
"Resolution/YAxis", // 4
"Subdivision/XAxis", // 5
"Subdivision/YAxis" // 6
};
const int nCount = 7;
Sequence<OUString> aNames(nCount);
OUString* pNames = aNames.getArray();
for(int i = 0; i < nCount; i++)
{
pNames[i] = OUString::createFromAscii(aPropNames[i]);
}
return aNames;
}
/* -----------------------------19.01.01 13:07--------------------------------
---------------------------------------------------------------------------*/
SwGridConfig::SwGridConfig(BOOL bIsWeb, SwMasterUsrPref& rPar) :
ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Grid") : C2U("Office.Writer/Grid"),
CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
2001-01-19 11:45:03 +00:00
rParent(rPar),
bWeb(bIsWeb)
{
}
/* -----------------------------19.01.01 13:07--------------------------------
---------------------------------------------------------------------------*/
SwGridConfig::~SwGridConfig()
{
}
/* -----------------------------19.01.01 13:07--------------------------------
---------------------------------------------------------------------------*/
void SwGridConfig::Commit()
{
Sequence<OUString> aNames = GetPropertyNames();
Sequence<Any> aValues(aNames.getLength());
Any* pValues = aValues.getArray();
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
sal_Bool bSet;
switch(nProp)
{
case 0: bSet = rParent.IsSnap(); break;// "Option/SnapToGrid",
case 1: bSet = rParent.IsGridVisible(); break;//"Option/VisibleGrid",
case 2: bSet = rParent.IsSynchronize(); break;// "Option/Synchronize",
case 3: pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100(rParent.GetSnapSize().Width()); break;// "Resolution/XAxis",
case 4: pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100(rParent.GetSnapSize().Height()); break;// "Resolution/YAxis",
case 5: pValues[nProp] <<= (sal_Int16)rParent.GetDivisionX(); break;// "Subdivision/XAxis",
case 6: pValues[nProp] <<= (sal_Int16)rParent.GetDivisionY(); break;// "Subdivision/YAxis"
}
if(nProp < 3)
pValues[nProp].setValue(&bSet, ::getBooleanCppuType());
}
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");
2001-01-19 11:45:03 +00:00
if(aValues.getLength() == aNames.getLength())
{
Size aSnap(rParent.GetSnapSize());
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
if(pValues[nProp].hasValue())
{
sal_Bool bSet = nProp < 3 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
sal_Int32 nSet = 0;
2001-01-19 11:45:03 +00:00
if(nProp >= 3)
pValues[nProp] >>= nSet;
switch(nProp)
{
case 0: rParent.SetSnap(bSet); break;// "Option/SnapToGrid",
case 1: rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid",
case 2: rParent.SetSynchronize(bSet); break;// "Option/Synchronize",
case 3: aSnap.Width() = MM100_TO_TWIP(nSet); break;// "Resolution/XAxis",
case 4: aSnap.Height() = MM100_TO_TWIP(nSet); break;// "Resolution/YAxis",
case 5: rParent.SetDivisionX((short)nSet); break;// "Subdivision/XAxis",
case 6: rParent.SetDivisionY((short)nSet); break;// "Subdivision/YAxis"
2001-01-19 11:45:03 +00:00
}
}
}
rParent.SetSnapSize(aSnap);
}
}
2001-01-24 15:08:03 +00:00
/* -----------------------------19.01.01 13:07--------------------------------
---------------------------------------------------------------------------*/
Sequence<OUString> SwCursorConfig::GetPropertyNames()
{
static const char* aPropNames[] =
{
"DirectCursor/UseDirectCursor", // 0
"DirectCursor/Insert", // 1
"Option/ProtectedArea" // 2
2001-01-24 15:08:03 +00:00
};
const int nCount = 3;
2001-01-24 15:08:03 +00:00
Sequence<OUString> aNames(nCount);
OUString* pNames = aNames.getArray();
for(int i = 0; i < nCount; i++)
pNames[i] = C2U(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),
2001-01-24 15:08:03 +00:00
rParent(rPar)
{
}
/* -----------------------------19.01.01 13:07--------------------------------
---------------------------------------------------------------------------*/
SwCursorConfig::~SwCursorConfig()
{
}
/* -----------------------------19.01.01 13:07--------------------------------
---------------------------------------------------------------------------*/
void SwCursorConfig::Commit()
{
Sequence<OUString> aNames = GetPropertyNames();
Sequence<Any> aValues(aNames.getLength());
Any* pValues = aValues.getArray();
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
sal_Bool bSet;
switch(nProp)
{
case 0: bSet = rParent.IsShadowCursor(); break;// "DirectCursor/UseDirectCursor",
2001-02-28 10:51:43 +00:00
case 1: pValues[nProp] <<= (sal_Int32)rParent.GetShdwCrsrFillMode(); break;// "DirectCursor/Insert",
case 2: bSet = rParent.IsCursorInProtectedArea(); break;// "Option/ProtectedArea"
2001-01-24 15:08:03 +00:00
}
if(nProp != 1 )
2001-01-24 15:08:03 +00:00
pValues[nProp].setValue(&bSet, ::getBooleanCppuType());
}
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");
2001-01-24 15:08:03 +00:00
if(aValues.getLength() == aNames.getLength())
{
2001-02-28 10:51:43 +00:00
2001-01-24 15:08:03 +00:00
for(int nProp = 0; nProp < aNames.getLength(); nProp++)
{
if(pValues[nProp].hasValue())
{
sal_Bool bSet = sal_False;
sal_Int32 nSet = 0;
if(nProp != 1 )
2001-01-24 15:08:03 +00:00
bSet = *(sal_Bool*)pValues[nProp].getValue();
else
pValues[nProp] >>= nSet;
switch(nProp)
{
case 0: rParent.SetShadowCursor(bSet); break;// "DirectCursor/UseDirectCursor",
case 1: rParent.SetShdwCrsrFillMode((BYTE)nSet); break;// "DirectCursor/Insert",
case 2: rParent.SetCursorInProtectedArea(bSet); break;// "Option/ProtectedArea"
2001-01-24 15:08:03 +00:00
}
}
}
2001-02-28 10:51:43 +00:00
2001-01-24 15:08:03 +00:00
}
}
2001-02-13 08:52:11 +00:00
/*-- 28.09.00 09:55:33---------------------------------------------------
-----------------------------------------------------------------------*/
SwWebColorConfig::SwWebColorConfig(SwMasterUsrPref& rPar) :
ConfigItem(C2U("Office.WriterWeb/Background"),
CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
2001-02-13 08:52:11 +00:00
rParent(rPar),
aPropNames(1)
{
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());
Any* pValues = aValues.getArray();
for(int nProp = 0; nProp < aPropNames.getLength(); nProp++)
{
switch(nProp)
{
case 0: pValues[nProp] <<= (sal_Int32)rParent.GetRetoucheColor().GetColor(); break;// "Color",
}
}
PutProperties(aPropNames, aValues);
}
/*-- 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");
2001-02-13 08:52:11 +00:00
if(aValues.getLength() == aPropNames.getLength())
{
for(int nProp = 0; nProp < aPropNames.getLength(); nProp++)
{
if(pValues[nProp].hasValue())
{
switch(nProp)
{
case 0:
sal_Int32 nSet = 0;
pValues[nProp] >>= nSet; rParent.SetRetoucheColor(nSet);
2001-02-13 08:52:11 +00:00
break;// "Color",
}
}
}
}
}
2001-01-24 15:08:03 +00:00