diff options
Diffstat (limited to 'sw/source/ui/config')
26 files changed, 12615 insertions, 0 deletions
diff --git a/sw/source/ui/config/barcfg.cxx b/sw/source/ui/config/barcfg.cxx new file mode 100644 index 000000000000..5fb403da58ce --- /dev/null +++ b/sw/source/ui/config/barcfg.cxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#include <tools/debug.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <wrtsh.hxx> +#include "barcfg.hxx" + +#include <unomid.h> + +using namespace utl; +using rtl::OUString; +using namespace com::sun::star::uno; + +#define SEL_TYPE_TABLE_TEXT 0 +#define SEL_TYPE_LIST_TEXT 1 +#define SEL_TYPE_TABLE_LIST 2 +#define SEL_TYPE_BEZIER 3 +#define SEL_TYPE_GRAPHIC 4 + +/* --------------------------------------------------------------------------- + + ---------------------------------------------------------------------------*/ +SwToolbarConfigItem::SwToolbarConfigItem( BOOL bWeb ) : + ConfigItem(bWeb ? C2U("Office.WriterWeb/ObjectBar") : C2U("Office.Writer/ObjectBar"), + CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE) +{ + for(USHORT i = 0; i <= SEL_TYPE_GRAPHIC; i++ ) + aTbxIdArray[i] = -1; + + 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_Int32 nVal = 0; + pValues[nProp] >>= nVal; + aTbxIdArray[nProp] = nVal; + } + } + } +} +/* --------------------------------------------------------------------------- + + ---------------------------------------------------------------------------*/ +SwToolbarConfigItem::~SwToolbarConfigItem() +{ +} +/* --------------------------------------------------------------------------- + + ---------------------------------------------------------------------------*/ +sal_Int32 lcl_getArrayIndex(int nSelType) +{ + sal_Int32 nRet = -1; + if(nSelType & nsSelectionType::SEL_NUM) + { + if(nSelType & nsSelectionType::SEL_TBL) + nRet = SEL_TYPE_TABLE_LIST; + else + nRet = SEL_TYPE_LIST_TEXT; + } + else if(nSelType & nsSelectionType::SEL_TBL) + nRet = SEL_TYPE_TABLE_TEXT; + else if(nSelType & nsSelectionType::SEL_BEZ) + nRet = SEL_TYPE_BEZIER; + else if(nSelType & nsSelectionType::SEL_GRF) + nRet = SEL_TYPE_GRAPHIC; + return nRet; +} +/* -----------------------------10.10.00 14:38-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwToolbarConfigItem::SetTopToolbar( sal_Int32 nSelType, sal_Int32 nBarId ) +{ + sal_Int32 nProp = lcl_getArrayIndex(nSelType); + if(nProp >= 0) + { + aTbxIdArray[nProp] = nBarId; + SetModified(); + } +} +/* -----------------------------10.10.00 13:33-------------------------------- + + ---------------------------------------------------------------------------*/ +Sequence<OUString> SwToolbarConfigItem::GetPropertyNames() +{ + static const char* aPropNames[] = + { + "Selection/Table", // SEL_TYPE_TABLE_TEXT + "Selection/NumberedList", // SEL_TYPE_LIST_TEXT + "Selection/NumberedList_InTable", // SEL_TYPE_TABLE_LIST + "Selection/BezierObject", // SEL_TYPE_BEZIER + "Selection/Graphic" //SEL_TYPE_GRAPHIC + }; + const int nCount = 5; + Sequence<OUString> aNames(nCount); + OUString* pNames = aNames.getArray(); + for(int i = 0; i < nCount; i++) + pNames[i] = OUString::createFromAscii(aPropNames[i]); + return aNames; +} +/* -----------------------------10.10.00 13:36-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwToolbarConfigItem::Commit() +{ + Sequence<OUString> aNames = GetPropertyNames(); + + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + pValues[nProp] <<= aTbxIdArray[nProp]; + PutProperties(aNames, aValues); +} + +void SwToolbarConfigItem::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + diff --git a/sw/source/ui/config/caption.cxx b/sw/source/ui/config/caption.cxx new file mode 100644 index 000000000000..d60361e49453 --- /dev/null +++ b/sw/source/ui/config/caption.cxx @@ -0,0 +1,182 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#include <tools/debug.hxx> + +#include "numrule.hxx" +#include "caption.hxx" + +#define VERSION_01 1 +#define CAPTION_VERSION VERSION_01 + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +InsCaptionOpt::InsCaptionOpt(const SwCapObjType eType, const SvGlobalName* pOleId) : + bUseCaption(FALSE), + eObjType(eType), + nNumType(SVX_NUM_ARABIC), + sNumberSeparator( ::rtl::OUString::createFromAscii(". ") ), + nPos(1), + nLevel(0), + sSeparator( String::CreateFromAscii( ": " ) ), + bIgnoreSeqOpts(FALSE), + bCopyAttributes(FALSE) +{ + if (pOleId) + aOleId = *pOleId; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +InsCaptionOpt::InsCaptionOpt(const InsCaptionOpt& rOpt) +{ + *this = rOpt; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +InsCaptionOpt::~InsCaptionOpt() +{ +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +InsCaptionOpt& InsCaptionOpt::operator=( const InsCaptionOpt& rOpt ) +{ + bUseCaption = rOpt.bUseCaption; + eObjType = rOpt.eObjType; + aOleId = rOpt.aOleId; + sCategory = rOpt.sCategory; + nNumType = rOpt.nNumType; + sNumberSeparator = rOpt.sNumberSeparator; + sCaption = rOpt.sCaption; + nPos = rOpt.nPos; + nLevel = rOpt.nLevel; + sSeparator = rOpt.sSeparator; + bIgnoreSeqOpts = rOpt.bIgnoreSeqOpts; + sCharacterStyle = rOpt.sCharacterStyle; + bCopyAttributes = rOpt.bCopyAttributes; + + return *this; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +BOOL InsCaptionOpt::operator==( const InsCaptionOpt& rOpt ) const +{ + return (eObjType == rOpt.eObjType && + aOleId == rOpt.aOleId); // Damit gleiche Ole-IDs nicht mehrfach eingefuegt + // werden koennen, auf nichts weiteres vergleichen + + +/* && + sCategory == rOpt.sCategory && + nNumType == rOpt.nNumType && + sCaption == rOpt.sCaption && + nPos == rOpt.nPos && + nLevel == rOpt.nLevel && + cSeparator == rOpt.cSeparator);*/ +} + +/************************************************************************* +|* +|* InsCaptionOpt::operator>>() +|* +|* Beschreibung Stream-Leseoperator +|* +*************************************************************************/ + +/*SvStream& operator>>( SvStream& rIStream, InsCaptionOpt& rCapOpt ) +{ + rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding(); + UINT16 nVal; + BYTE cVal; + BYTE nVersion; + + rIStream >> nVersion; + rIStream >> cVal; rCapOpt.UseCaption() = cVal != 0; + rIStream >> nVal; rCapOpt.eObjType = (SwCapObjType)nVal; + rIStream >> rCapOpt.aOleId; + + rIStream.ReadByteString( rCapOpt.sCategory, eEncoding ); + rIStream >> nVal; rCapOpt.nNumType = nVal; + rIStream.ReadByteString( rCapOpt.sCaption, eEncoding ); + rIStream >> nVal; rCapOpt.nPos = nVal; + rIStream >> nVal; rCapOpt.nLevel = nVal; + + rIStream >> cVal; + rCapOpt.sSeparator = UniString( + ByteString(static_cast< char >(cVal)) , eEncoding).GetChar(0); + + return rIStream; +} +*/ +/************************************************************************* +|* +|* InsCaptionOpt::operator<<() +|* +|* Beschreibung Stream-Schreiboperator +|* +*************************************************************************/ + +/*SvStream& operator<<( SvStream& rOStream, const InsCaptionOpt& rCapOpt ) +{ + rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding(); + rOStream << (BYTE)CAPTION_VERSION + << (BYTE)rCapOpt.UseCaption() + << (UINT16)rCapOpt.eObjType + << rCapOpt.aOleId; + + rOStream.WriteByteString( rCapOpt.sCategory, eEncoding ); + + rOStream << (UINT16)rCapOpt.nNumType; + + rOStream.WriteByteString( rCapOpt.sCaption, eEncoding ); + + BYTE cSep = ByteString(rCapOpt.sSeparator, eEncoding).GetChar(0); + rOStream << (UINT16)rCapOpt.nPos + << (UINT16)rCapOpt.nLevel + << cSep; + + return rOStream; +} +*/ + diff --git a/sw/source/ui/config/cfgitems.cxx b/sw/source/ui/config/cfgitems.cxx new file mode 100644 index 000000000000..3a462ce452b2 --- /dev/null +++ b/sw/source/ui/config/cfgitems.cxx @@ -0,0 +1,461 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#ifndef __SBX_SBXVARIABLE_HXX //autogen +#include <basic/sbxvar.hxx> +#endif + +#ifndef _SVX_SVXIDS_HRC //autogen +#include <svx/svxids.hrc> +#endif +#include <editeng/svxenum.hxx> + + +#include "viewopt.hxx" +#include "swtypes.hxx" +#include "cmdid.h" +#include "prtopt.hxx" +#include "cfgitems.hxx" +#include "crstate.hxx" + + + +TYPEINIT1_AUTOFACTORY(SwDocDisplayItem, SfxPoolItem) +TYPEINIT1_AUTOFACTORY(SwElemItem, SfxPoolItem) +TYPEINIT1_AUTOFACTORY(SwAddPrinterItem, SfxPoolItem) +TYPEINIT1_AUTOFACTORY(SwShadowCursorItem, SfxPoolItem) + + +SwDocDisplayItem::SwDocDisplayItem( USHORT _nWhich ) : + SfxPoolItem(_nWhich), + aIndexBackgrndCol(COL_GRAY) +{ + bParagraphEnd = + bTab = + bSpace = + bNonbreakingSpace = + bSoftHyphen = + bFldHiddenText = + bCharHiddenText = + bManualBreak = + bShowHiddenPara = FALSE; + +}; + +/*------------OS 12.01.95 ------------------------------------------- + Item fuer Einstellungsdialog, Seite Dokumentansicht +--------------------------------------------------------------------*/ + +SwDocDisplayItem::SwDocDisplayItem( const SwDocDisplayItem& rDocDisplayItem ): + SfxPoolItem(rDocDisplayItem) +{ + *this = rDocDisplayItem; +}; + +/*----------------------- ------------------------------------------- + +--------------------------------------------------------------------*/ + +SwDocDisplayItem::SwDocDisplayItem(const SwViewOption& rVOpt, USHORT _nWhich ) : + SfxPoolItem( _nWhich ) +{ + bParagraphEnd = rVOpt.IsParagraph(TRUE); + bTab = rVOpt.IsTab(TRUE); + bSpace = rVOpt.IsBlank(TRUE); + bNonbreakingSpace = rVOpt.IsHardBlank(); + bSoftHyphen = rVOpt.IsSoftHyph(); + bCharHiddenText = rVOpt.IsShowHiddenChar(TRUE); + bFldHiddenText = rVOpt.IsShowHiddenField(); + bManualBreak = rVOpt.IsLineBreak(TRUE); + bShowHiddenPara = rVOpt.IsShowHiddenPara(); + +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SfxPoolItem* SwDocDisplayItem::Clone( SfxItemPool* ) const +{ + return new SwDocDisplayItem( *this ); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +int SwDocDisplayItem::operator==( const SfxPoolItem& rAttr ) const +{ + DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" ); + + const SwDocDisplayItem& rItem = (SwDocDisplayItem&)rAttr; + + return ( bParagraphEnd == rItem.bParagraphEnd && + bTab == rItem.bTab && + bSpace == rItem.bSpace && + bNonbreakingSpace == rItem.bNonbreakingSpace && + bSoftHyphen == rItem.bSoftHyphen && + bCharHiddenText == rItem.bCharHiddenText && + bFldHiddenText == rItem.bFldHiddenText && + bManualBreak == rItem.bManualBreak && + bShowHiddenPara == rItem.bShowHiddenPara ); +} + + +/*-----------------31.08.96 14.14------------------- + +--------------------------------------------------*/ + + +void SwDocDisplayItem::operator=( const SwDocDisplayItem& rDocDisplayItem) +{ + bParagraphEnd = rDocDisplayItem.bParagraphEnd ; + bTab = rDocDisplayItem.bTab ; + bSpace = rDocDisplayItem.bSpace ; + bNonbreakingSpace = rDocDisplayItem.bNonbreakingSpace ; + bSoftHyphen = rDocDisplayItem.bSoftHyphen ; + bCharHiddenText = rDocDisplayItem.bCharHiddenText ; + bFldHiddenText = rDocDisplayItem.bFldHiddenText ; + bManualBreak = rDocDisplayItem.bManualBreak ; + bShowHiddenPara = rDocDisplayItem.bShowHiddenPara ; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ +void SwDocDisplayItem::FillViewOptions( SwViewOption& rVOpt) const +{ + rVOpt.SetParagraph (bParagraphEnd ); + rVOpt.SetTab (bTab ); + rVOpt.SetBlank (bSpace ); + rVOpt.SetHardBlank (bNonbreakingSpace ); + rVOpt.SetSoftHyph (bSoftHyphen ); + rVOpt.SetShowHiddenChar(bCharHiddenText ); + rVOpt.SetShowHiddenField(bFldHiddenText ); + rVOpt.SetLineBreak (bManualBreak ); + rVOpt.SetShowHiddenPara(bShowHiddenPara ); +} + + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ +SwElemItem::SwElemItem( USHORT _nWhich ) : + SfxPoolItem(_nWhich) +{ + bHorzScrollbar = + bVertScrollbar = + bAnyRuler = + bHorzRuler = + bVertRuler = + bVertRulerRight= + bCrosshair = + bHandles = + bBigHandles = + bSmoothScroll = + bTable = + bGraphic = + bDrawing = + bFieldName = + bNotes = FALSE; +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SwElemItem::SwElemItem( const SwElemItem& rElemItem ): + SfxPoolItem(rElemItem) +{ + *this = rElemItem; +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SwElemItem::SwElemItem(const SwViewOption& rVOpt, USHORT _nWhich) : + SfxPoolItem( _nWhich ) +{ + bHorzScrollbar = rVOpt.IsViewHScrollBar(); + bVertScrollbar = rVOpt.IsViewVScrollBar(); + bAnyRuler = rVOpt.IsViewAnyRuler(); + bHorzRuler = rVOpt.IsViewHRuler(TRUE); + bVertRuler = rVOpt.IsViewVRuler(TRUE); + bVertRulerRight = rVOpt.IsVRulerRight(); + bCrosshair = rVOpt.IsCrossHair(); + bHandles = rVOpt.IsSolidMarkHdl(); + bBigHandles = rVOpt.IsBigMarkHdl(); + bSmoothScroll = rVOpt.IsSmoothScroll(); + bTable = rVOpt.IsTable(); + bGraphic = rVOpt.IsGraphic(); + bDrawing = rVOpt.IsDraw() && rVOpt.IsControl(); + bFieldName = rVOpt.IsFldName(); + bNotes = rVOpt.IsPostIts(); + +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SfxPoolItem* SwElemItem::Clone( SfxItemPool* ) const +{ + return new SwElemItem( *this ); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +int SwElemItem::operator==( const SfxPoolItem& rAttr ) const +{ + DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" ); + + const SwElemItem& rItem = (SwElemItem&)rAttr; + + return ( bHorzScrollbar == rItem.bHorzScrollbar && + bVertScrollbar == rItem.bVertScrollbar && + bAnyRuler == rItem.bAnyRuler && + bHorzRuler == rItem.bHorzRuler && + bVertRuler == rItem.bVertRuler && + bVertRulerRight == rItem.bVertRulerRight&& + bCrosshair == rItem.bCrosshair && + bHandles == rItem.bHandles && + bBigHandles == rItem.bBigHandles && + bSmoothScroll == rItem.bSmoothScroll && + bTable == rItem.bTable && + bGraphic == rItem.bGraphic && + bDrawing == rItem.bDrawing && + bFieldName == rItem.bFieldName && + bNotes == rItem.bNotes ); +} + +/*-----------------31.08.96 14.13------------------- + +--------------------------------------------------*/ + + +void SwElemItem::operator=( const SwElemItem& rElemItem) +{ + bHorzScrollbar = rElemItem. bHorzScrollbar ; + bVertScrollbar = rElemItem. bVertScrollbar ; + bAnyRuler = rElemItem. bAnyRuler; + bHorzRuler = rElemItem. bHorzRuler ; + bVertRuler = rElemItem. bVertRuler ; + bVertRulerRight = rElemItem. bVertRulerRight ; + bCrosshair = rElemItem. bCrosshair ; + bHandles = rElemItem. bHandles ; + bBigHandles = rElemItem. bBigHandles ; + bSmoothScroll = rElemItem. bSmoothScroll ; + bTable = rElemItem.bTable ; + bGraphic = rElemItem.bGraphic ; + bDrawing = rElemItem.bDrawing ; + bFieldName = rElemItem.bFieldName ; + bNotes = rElemItem.bNotes ; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +void SwElemItem::FillViewOptions( SwViewOption& rVOpt) const +{ + rVOpt.SetViewHScrollBar(bHorzScrollbar ); + rVOpt.SetViewVScrollBar(bVertScrollbar ); + rVOpt.SetViewAnyRuler(bAnyRuler); + rVOpt.SetViewHRuler(bHorzRuler ); + rVOpt.SetViewVRuler(bVertRuler ); + rVOpt.SetVRulerRight(bVertRulerRight ); + rVOpt.SetCrossHair(bCrosshair ); + rVOpt.SetSolidMarkHdl(bHandles ); + rVOpt.SetBigMarkHdl(bBigHandles ); + rVOpt.SetSmoothScroll(bSmoothScroll); + rVOpt.SetTable (bTable ); + rVOpt.SetGraphic (bGraphic ); + rVOpt.SetDraw (bDrawing ); + rVOpt.SetControl (bDrawing ); + rVOpt.SetFldName (bFieldName ); + rVOpt.SetPostIts (bNotes ); +} + + +/*-------------------------------------------------------------------- + Beschreibung: CopyCTOR + --------------------------------------------------------------------*/ + +SwAddPrinterItem::SwAddPrinterItem( const SwAddPrinterItem& rAddPrinterItem ): + SfxPoolItem(rAddPrinterItem), + SwPrintData( rAddPrinterItem ) +{ +} + +/*-------------------------------------------------------------------- + Beschreibung: CTOR fuer leeres Item + --------------------------------------------------------------------*/ + +SwAddPrinterItem::SwAddPrinterItem( USHORT _nWhich): + SfxPoolItem(_nWhich) +{ +} +/*-------------------------------------------------------------------- + Beschreibung: CTOR aus SwPrintOptions + --------------------------------------------------------------------*/ + +SwAddPrinterItem::SwAddPrinterItem( USHORT _nWhich, const SwPrintData& rPrtData ) : + SfxPoolItem(_nWhich) +{ + SwPrintData::operator=(rPrtData); +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SfxPoolItem* SwAddPrinterItem::Clone( SfxItemPool* ) const +{ + return new SwAddPrinterItem( *this ); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +int SwAddPrinterItem::operator==( const SfxPoolItem& rAttr ) const +{ + DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" ); + + const SwAddPrinterItem& rItem = (SwAddPrinterItem&)rAttr; + + return SwPrintData::operator==(rItem); +} +/*-----------------03.11.97 10:00------------------- + Item fuer Einstellungsdialog, ShadowCursorSeite +--------------------------------------------------*/ + +SwShadowCursorItem::SwShadowCursorItem( USHORT _nWhich ) + : SfxPoolItem( _nWhich ), + eMode( FILL_TAB ) + ,bOn( FALSE ) +{ +} + +SwShadowCursorItem::SwShadowCursorItem( const SwShadowCursorItem& rCpy ) + : SfxPoolItem( rCpy.Which() ), + eMode( rCpy.GetMode() ) + ,bOn( rCpy.IsOn() ) + +{ +} + +SwShadowCursorItem::SwShadowCursorItem( const SwViewOption& rVOpt, USHORT _nWhich ) + : SfxPoolItem( _nWhich ), + eMode( rVOpt.GetShdwCrsrFillMode() ) + ,bOn( rVOpt.IsShadowCursor() ) + +{ +} + +SfxPoolItem* SwShadowCursorItem::Clone( SfxItemPool* ) const +{ + return new SwShadowCursorItem( *this ); +} + +int SwShadowCursorItem::operator==( const SfxPoolItem& rCmp ) const +{ + return IsOn() == ((SwShadowCursorItem&)rCmp).IsOn() && + GetMode() == ((SwShadowCursorItem&)rCmp).GetMode(); +} + +void SwShadowCursorItem::operator=( const SwShadowCursorItem& rCpy ) +{ + SetOn( rCpy.IsOn() ); + SetMode( rCpy.GetMode() ); +} + + +void SwShadowCursorItem::FillViewOptions( SwViewOption& rVOpt ) const +{ + rVOpt.SetShadowCursor( bOn ); + rVOpt.SetShdwCrsrFillMode( eMode ); +} + +#ifdef DBG_UTIL +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SwTestItem::SwTestItem( const SwTestItem& rTestItem ): + SfxPoolItem(rTestItem) +{ + bTest1=rTestItem.bTest1; + bTest2=rTestItem.bTest2; + bTest3=rTestItem.bTest3; + bTest4=rTestItem.bTest4; + bTest5=rTestItem.bTest5; + bTest6=rTestItem.bTest6; + bTest7=rTestItem.bTest7; + bTest8=rTestItem.bTest8; + bTest9=rTestItem.bTest9; + bTest10=rTestItem.bTest10; +}; + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SfxPoolItem* SwTestItem::Clone( SfxItemPool* ) const +{ + return new SwTestItem( *this ); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +int SwTestItem::operator==( const SfxPoolItem& rAttr ) const +{ + DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" ); + + const SwTestItem& rItem = (const SwTestItem&) rAttr; + + return ( bTest1==rItem.bTest1&& + bTest2==rItem.bTest2&& + bTest3==rItem.bTest3&& + bTest4==rItem.bTest4&& + bTest5==rItem.bTest5&& + bTest6==rItem.bTest6&& + bTest7==rItem.bTest7&& + bTest8==rItem.bTest8&& + bTest9==rItem.bTest9&& + bTest10==rItem.bTest10); +} + +#endif + + + diff --git a/sw/source/ui/config/config.hrc b/sw/source/ui/config/config.hrc new file mode 100644 index 000000000000..197e6482d7a1 --- /dev/null +++ b/sw/source/ui/config/config.hrc @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _CONFIG_HRC +#define _CONFIG_HRC + +#include "rcid.hrc" + +// Dialoge fuer die Konfiguration + +// Strings fuer die Konfiguration +#define STR_CFG_SIGNATUR (RC_CONFIG_BEGIN + 0) +#define DLG_CONFIG_VIEW (RC_CONFIG_BEGIN + 1) +#define DLG_CONFIG_MISC (RC_CONFIG_BEGIN + 2) +#define DLG_CONFIG_SAVE (RC_CONFIG_BEGIN + 3) +#define DLG_CONFIG_PATH (RC_CONFIG_BEGIN + 4) +#define DLG_CONFIG_MENU (RC_CONFIG_BEGIN + 5) +#define DLG_CONFIG_KEY (RC_CONFIG_BEGIN + 6) +#define DLG_CONFIG_TOOLBOX (RC_CONFIG_BEGIN + 7) +#define DLG_CONFIG_COLOR (RC_CONFIG_BEGIN + 8) +#define DLG_TBSEL (RC_CONFIG_BEGIN + 9) +#define DLG_CFGSEL (RC_CONFIG_BEGIN + 10) +#define DLG_CONFIG (RC_CONFIG_BEGIN + 11) +#define DLG_MAC_ASSIGN (RC_CONFIG_BEGIN + 12) + +#define MSG_DOUBLE_MENU_ID (RC_CONFIG_BEGIN + 13) +#define MSG_DOUBLE_ID (RC_CONFIG_BEGIN + 14) +#define DLG_SYMBOL_SELECT (RC_CONFIG_BEGIN + 15) +#define DLG_CONFIG_GRID (RC_CONFIG_BEGIN + 16) +#define DLG_CONFIG_ADDR (RC_CONFIG_BEGIN + 17) + +#define DLG_MM_TESTACCOUNTSETTINGS (RC_CONFIG_BEGIN + 19) +#define DLG_MM_SERVERAUTHENTICATION (RC_CONFIG_BEGIN + 20) + +#define STR_ERROR_PATH (RC_CONFIG_BEGIN + 25) +#define STR_ARR_METRIC (RC_CONFIG_BEGIN + 26) +#define CONFIG_ACT_END STR_ARR_METRIC + +#if CONFIG_ACT_END > RC_CONFIG_END +#error Resource-Id Ueberlauf in #file, #line +#endif + + +#endif diff --git a/sw/source/ui/config/dbconfig.cxx b/sw/source/ui/config/dbconfig.cxx new file mode 100644 index 000000000000..ade5163a5921 --- /dev/null +++ b/sw/source/ui/config/dbconfig.cxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#include <dbconfig.hxx> +#include <tools/debug.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <swdbdata.hxx> + +#include <unomid.h> + +using namespace utl; +using rtl::OUString; +using namespace com::sun::star::uno; + +/*-------------------------------------------------------------------- + Beschreibung: Ctor + --------------------------------------------------------------------*/ + +const Sequence<OUString>& SwDBConfig::GetPropertyNames() +{ + static Sequence<OUString> aNames; + if(!aNames.getLength()) + { + static const char* aPropNames[] = + { + "AddressBook/DataSourceName", // 0 + "AddressBook/Command", // 1 + "AddressBook/CommandType", // 2 + "Bibliography/CurrentDataSource/DataSourceName", // 4 + "Bibliography/CurrentDataSource/Command", // 5 + "Bibliography/CurrentDataSource/CommandType" // 6 + }; + const int nCount = sizeof(aPropNames)/sizeof(const char*); + aNames.realloc(nCount); + OUString* pNames = aNames.getArray(); + for(int i = 0; i < nCount; i++) + pNames[i] = OUString::createFromAscii(aPropNames[i]); + } + return aNames; +} +/* -----------------------------06.09.00 16:44-------------------------------- + + ---------------------------------------------------------------------------*/ +SwDBConfig::SwDBConfig() : + ConfigItem(C2U("Office.DataAccess"), + CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE), + pAdrImpl(0), + pBibImpl(0) +{ +}; +/* -----------------------------06.09.00 16:50-------------------------------- + + ---------------------------------------------------------------------------*/ +SwDBConfig::~SwDBConfig() +{ + delete pAdrImpl; + delete pBibImpl; +} +/* -----------------------------20.02.01 12:32-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwDBConfig::Load() +{ + const Sequence<OUString>& rNames = GetPropertyNames(); + if(!pAdrImpl) + { + + pAdrImpl = new SwDBData; + pAdrImpl->nCommandType = 0; + pBibImpl = new SwDBData; + pBibImpl->nCommandType = 0; + } + Sequence<Any> aValues = GetProperties(rNames); + const Any* pValues = aValues.getConstArray(); + DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed"); + if(aValues.getLength() == rNames.getLength()) + { + for(int nProp = 0; nProp < rNames.getLength(); nProp++) + { + switch(nProp) + { + case 0: pValues[nProp] >>= pAdrImpl->sDataSource; break; + case 1: pValues[nProp] >>= pAdrImpl->sCommand; break; + case 2: pValues[nProp] >>= pAdrImpl->nCommandType; break; + case 3: pValues[nProp] >>= pBibImpl->sDataSource; break; + case 4: pValues[nProp] >>= pBibImpl->sCommand; break; + case 5: pValues[nProp] >>= pBibImpl->nCommandType; break; + } + } + } +} +/* -----------------------------20.02.01 12:36-------------------------------- + + ---------------------------------------------------------------------------*/ +const SwDBData& SwDBConfig::GetAddressSource() +{ + if(!pAdrImpl) + Load(); + return *pAdrImpl; +} +/* -----------------29.11.2002 11:43----------------- + * + * --------------------------------------------------*/ +const SwDBData& SwDBConfig::GetBibliographySource() +{ + if(!pBibImpl) + Load(); + return *pBibImpl; +} + +void SwDBConfig::Commit() {} +void SwDBConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + + diff --git a/sw/source/ui/config/fontcfg.cxx b/sw/source/ui/config/fontcfg.cxx new file mode 100644 index 000000000000..e1b951c1c879 --- /dev/null +++ b/sw/source/ui/config/fontcfg.cxx @@ -0,0 +1,359 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#include <fontcfg.hxx> +#include <i18npool/mslangid.hxx> +#include <vcl/outdev.hxx> +#include <unotools/lingucfg.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/i18n/ScriptType.hpp> +#include <swtypes.hxx> + +#include <unomid.h> + +using namespace utl; +using rtl::OUString; +using namespace com::sun::star::uno; + +/* -----------------07.10.2002 12:15----------------- + * + * --------------------------------------------------*/ +inline LanguageType lcl_LanguageOfType(sal_Int16 nType, sal_Int16 eWestern, sal_Int16 eCJK, sal_Int16 eCTL) +{ + return LanguageType( + nType < FONT_STANDARD_CJK ? eWestern : + nType >= FONT_STANDARD_CTL ? eCTL : eCJK); +} +/* -----------------------------08.09.00 15:52-------------------------------- + + ---------------------------------------------------------------------------*/ +Sequence<OUString> SwStdFontConfig::GetPropertyNames() +{ + Sequence<OUString> aNames; + if(!aNames.getLength()) + { + static const char* aPropNames[] = + { + "DefaultFont/Standard", // 0 + "DefaultFont/Heading", // 1 + "DefaultFont/List", // 2 + "DefaultFont/Caption", // 3 + "DefaultFont/Index", // 4 + "DefaultFontCJK/Standard", // 5 + "DefaultFontCJK/Heading", // 6 + "DefaultFontCJK/List", // 7 + "DefaultFontCJK/Caption", // 8 + "DefaultFontCJK/Index", // 9 + "DefaultFontCTL/Standard", // 10 + "DefaultFontCTL/Heading", // 11 + "DefaultFontCTL/List", // 12 + "DefaultFontCTL/Caption", // 13 + "DefaultFontCTL/Index", // 14 + "DefaultFont/StandardHeight", // 15 + "DefaultFont/HeadingHeight", // 16 + "DefaultFont/ListHeight", // 17 + "DefaultFont/CaptionHeight", // 18 + "DefaultFont/IndexHeight", // 19 + "DefaultFontCJK/StandardHeight", // 20 + "DefaultFontCJK/HeadingHeight", // 21 + "DefaultFontCJK/ListHeight", // 22 + "DefaultFontCJK/CaptionHeight", // 23 + "DefaultFontCJK/IndexHeight", // 24 + "DefaultFontCTL/StandardHeight", // 25 + "DefaultFontCTL/HeadingHeight", // 26 + "DefaultFontCTL/ListHeight", // 27 + "DefaultFontCTL/CaptionHeight", // 28 + "DefaultFontCTL/IndexHeight" // 29 + }; + const int nCount = sizeof(aPropNames)/sizeof(const char*); + aNames.realloc(nCount); + OUString* pNames = aNames.getArray(); + for(int i = 0; i < nCount; i++) + { + pNames[i] = OUString::createFromAscii(aPropNames[i]); + } + } + return aNames; +} +/*-----------------03.09.96 15.00------------------- + +--------------------------------------------------*/ + +SwStdFontConfig::SwStdFontConfig() : + utl::ConfigItem(C2U("Office.Writer")) +{ + SvtLinguOptions aLinguOpt; + + SvtLinguConfig().GetOptions( aLinguOpt ); + + sal_Int16 eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN), + eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN), + eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX); + + for(sal_Int16 i = 0; i < DEF_FONT_COUNT; i++) + { + sDefaultFonts[i] = GetDefaultFor(i, + lcl_LanguageOfType(i, eWestern, eCJK, eCTL)); + nDefaultFontHeight[i] = -1; + } + + 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()) + { + if( nProp < DEF_FONT_COUNT) + { + OUString sVal; + pValues[nProp] >>= sVal; + sDefaultFonts[nProp] = sVal; + } + else + { + pValues[nProp] >>= nDefaultFontHeight[nProp - DEF_FONT_COUNT]; + nDefaultFontHeight[nProp - DEF_FONT_COUNT] = MM100_TO_TWIP(nDefaultFontHeight[nProp - DEF_FONT_COUNT]); + } + } + } + } +} +/* -----------------------------08.09.00 15:58-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwStdFontConfig::Commit() +{ + Sequence<OUString> aNames = GetPropertyNames(); + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + SvtLinguOptions aLinguOpt; + + SvtLinguConfig().GetOptions( aLinguOpt ); + + sal_Int16 eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN), + eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN), + eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX); + + for(sal_uInt16 nProp = 0; + nProp < sal::static_int_cast< sal_uInt16, sal_Int32 >( aNames.getLength() ); + nProp++) + { + if( nProp < DEF_FONT_COUNT ) + { + if(GetDefaultFor(nProp, lcl_LanguageOfType(nProp, eWestern, eCJK, eCTL)) != sDefaultFonts[nProp]) + pValues[nProp] <<= OUString(sDefaultFonts[nProp]); + } + else + { + if(nDefaultFontHeight[nProp - DEF_FONT_COUNT] > 0) + pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(nDefaultFontHeight[nProp - DEF_FONT_COUNT])); + } + } + PutProperties(aNames, aValues); +} +/* -----------------------------08.09.00 15:56-------------------------------- + + ---------------------------------------------------------------------------*/ +SwStdFontConfig::~SwStdFontConfig() +{} +/*-----------------18.01.97 10.05------------------- + +--------------------------------------------------*/ +BOOL SwStdFontConfig::IsFontDefault(USHORT nFontType) const +{ + BOOL bSame = sal_False; + SvtLinguOptions aLinguOpt; + + SvtLinguConfig().GetOptions( aLinguOpt ); + + sal_Int16 eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN), + eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN), + eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX); + + String sDefFont(GetDefaultFor(FONT_STANDARD, eWestern)); + String sDefFontCJK(GetDefaultFor(FONT_STANDARD_CJK, eCJK)); + String sDefFontCTL(GetDefaultFor(FONT_STANDARD_CTL, eCTL)); + LanguageType eLang = lcl_LanguageOfType(nFontType, eWestern, eCJK, eCTL); + switch( nFontType ) + { + case FONT_STANDARD: + bSame = sDefaultFonts[nFontType] == sDefFont; + break; + case FONT_STANDARD_CJK: + bSame = sDefaultFonts[nFontType] == sDefFontCJK; + break; + case FONT_STANDARD_CTL: + bSame = sDefaultFonts[nFontType] == sDefFontCTL; + break; + case FONT_OUTLINE : + case FONT_OUTLINE_CJK : + case FONT_OUTLINE_CTL : + bSame = sDefaultFonts[nFontType] == + GetDefaultFor(nFontType, eLang); + break; + case FONT_LIST : + case FONT_CAPTION : + case FONT_INDEX : + bSame = sDefaultFonts[nFontType] == sDefFont && + sDefaultFonts[FONT_STANDARD] == sDefFont; + break; + case FONT_LIST_CJK : + case FONT_CAPTION_CJK : + case FONT_INDEX_CJK : + { + BOOL b1 = sDefaultFonts[FONT_STANDARD_CJK] == sDefFontCJK; + bSame = b1 && sDefaultFonts[nFontType] == sDefFontCJK; + } + break; + case FONT_LIST_CTL : + case FONT_CAPTION_CTL : + case FONT_INDEX_CTL : + { + BOOL b1 = sDefaultFonts[FONT_STANDARD_CJK] == sDefFontCTL; + bSame = b1 && sDefaultFonts[nFontType] == sDefFontCTL; + } + break; + } + return bSame; +} + +/* -----------------11.01.99 13:16------------------- + * Standards auslesen + * --------------------------------------------------*/ +String SwStdFontConfig::GetDefaultFor(USHORT nFontType, LanguageType eLang) +{ + String sRet; + USHORT nFontId; + switch( nFontType ) + { + case FONT_OUTLINE : + nFontId = DEFAULTFONT_LATIN_HEADING; + break; + case FONT_OUTLINE_CJK : + nFontId = DEFAULTFONT_CJK_HEADING; + break; + case FONT_OUTLINE_CTL : + nFontId = DEFAULTFONT_CTL_HEADING; + break; + case FONT_STANDARD_CJK: + case FONT_LIST_CJK : + case FONT_CAPTION_CJK : + case FONT_INDEX_CJK : + nFontId = DEFAULTFONT_CJK_TEXT; + break; + case FONT_STANDARD_CTL: + case FONT_LIST_CTL : + case FONT_CAPTION_CTL : + case FONT_INDEX_CTL : + nFontId = DEFAULTFONT_CTL_TEXT; + break; +// case FONT_STANDARD: +// case FONT_LIST : +// case FONT_CAPTION : +// case FONT_INDEX : + default: + nFontId = DEFAULTFONT_LATIN_TEXT; + } + Font aFont = OutputDevice::GetDefaultFont(nFontId, eLang, DEFAULTFONT_FLAGS_ONLYONE); + return aFont.GetName(); +} + +/*-- 11.10.2005 10:43:43--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Int32 SwStdFontConfig::GetDefaultHeightFor(USHORT nFontType, LanguageType eLang) +{ + sal_Int32 nRet = FONTSIZE_DEFAULT; + switch( nFontType ) + { + case FONT_OUTLINE: + case FONT_OUTLINE_CJK: + case FONT_OUTLINE_CTL: + nRet = FONTSIZE_OUTLINE; + break; + } + if( eLang == LANGUAGE_THAI && nFontType >= FONT_STANDARD_CTL ) + { + nRet = nRet * 4 / 3; + } + return nRet; +} + +/*-- 11.10.2005 10:50:06--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwStdFontConfig::ChangeInt( USHORT nFontType, sal_Int32 nHeight ) +{ + DBG_ASSERT( nFontType < DEF_FONT_COUNT, "invalid index in SwStdFontConfig::ChangInt()"); + if( nFontType < DEF_FONT_COUNT && nDefaultFontHeight[nFontType] != nHeight) + { + SvtLinguOptions aLinguOpt; + SvtLinguConfig().GetOptions( aLinguOpt ); + + sal_Int16 eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN), + eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN), + eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX); + + // #i92090# default height value sets back to -1 + const sal_Int32 nDefaultHeight = GetDefaultHeightFor(nFontType, lcl_LanguageOfType(nFontType, eWestern, eCJK, eCTL)); + const bool bIsDefaultHeight = nHeight == nDefaultHeight; + if( bIsDefaultHeight && nDefaultFontHeight[nFontType] > 0 ) + { + SetModified(); + nDefaultFontHeight[nFontType] = -1; + } + else if( !bIsDefaultHeight && nHeight != nDefaultFontHeight[nFontType] ) + { + SetModified(); + nDefaultFontHeight[nFontType] = nHeight; + } + } +} + +/*-- 08.11.2005 14:18:26--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Int32 SwStdFontConfig::GetFontHeight( sal_uInt8 nFont, sal_uInt8 nScriptType, LanguageType eLang ) +{ + DBG_ASSERT(nFont + FONT_PER_GROUP * nScriptType < DEF_FONT_COUNT, "wrong index in SwStdFontConfig::GetFontHeight()"); + sal_Int32 nRet = nDefaultFontHeight[nFont + FONT_PER_GROUP * nScriptType]; + if(nRet <= 0) + return GetDefaultHeightFor(nFont + FONT_PER_GROUP * nScriptType, eLang); + return nRet; +} + +void SwStdFontConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx new file mode 100644 index 000000000000..5fa03de5e0a5 --- /dev/null +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -0,0 +1,622 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include <swtypes.hxx> +#include <mailconfigpage.hxx> +#include <svtools/svmedit.hxx> +#include <svtools/stdctrl.hxx> +#include <svtools/svtabbx.hxx> +#include <svtools/headbar.hxx> +#include <mmconfigitem.hxx> +#include <mailmergehelper.hxx> +#ifndef _CMDID_H +#include <cmdid.h> +#endif +#include <vcl/svapp.hxx> +#include <comphelper/processfactory.hxx> +#include "com/sun/star/mail/MailServiceType.hpp" +#include "com/sun/star/mail/XMailService.hpp" +#include "com/sun/star/mail/MailServiceProvider.hpp" +#include <vcl/msgbox.hxx> +#include <globals.hrc> +#include <mailconfigpage.hrc> +#include <config.hrc> +#include <helpid.h> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::mail; +using namespace ::com::sun::star::beans; +using ::rtl::OUString; +/*-- 06.05.2004 12:04:11--------------------------------------------------- + + -----------------------------------------------------------------------*/ +class SwTestAccountSettingsDialog : public SfxModalDialog +{ + FixedInfo m_aInfoFI; + + HeaderBar m_aStatusHB; + SvTabListBox m_aStatusLB; + + FixedInfo m_aErrorFI; + MultiLineEdit m_eErrorsED; + + FixedLine m_aSeparatorFL; + PushButton m_aStopPB; + CancelButton m_aCancelPB; + HelpButton m_aHelpPB; + + ImageList m_aImageList; + + String m_sTask ; + String m_sStatus ; + String m_sEstablish ; + String m_sFindServer ; + String m_sCompleted ; + String m_sFailed ; + String m_sErrorNetwork; + String m_sErrorServer ; + + SwMailConfigPage* m_pParent; + + bool m_bStop; + + void Test(); + DECL_LINK(StopHdl, PushButton*); + DECL_STATIC_LINK(SwTestAccountSettingsDialog, TestHdl, void*); +public: + SwTestAccountSettingsDialog(SwMailConfigPage* pParent); + ~SwTestAccountSettingsDialog(); +}; +/*-- 19.08.2004 14:27:33--------------------------------------------------- + + -----------------------------------------------------------------------*/ +class SwAuthenticationSettingsDialog : public SfxModalDialog +{ + CheckBox m_aAuthenticationCB; + + RadioButton m_aSeparateAuthenticationRB; + RadioButton m_aSMTPAfterPOPRB; + + FixedInfo m_aOutgoingServerFT; + FixedText m_aUserNameFT; + Edit m_aUserNameED; + FixedText m_aOutPasswordFT; + Edit m_aOutPasswordED; + + FixedInfo m_aIncomingServerFT; + FixedText m_aServerFT; + Edit m_aServerED; + FixedText m_aPortFT; + NumericField m_aPortNF; + FixedText m_aProtocolFT; + RadioButton m_aPOP3RB; + RadioButton m_aIMAPRB; + FixedText m_aInUsernameFT; + Edit m_aInUsernameED; + FixedText m_aInPasswordFT; + Edit m_aInPasswordED; + + FixedLine m_aSeparatorFL; + + OKButton m_aOKPB; + CancelButton m_aCancelPB; + HelpButton m_aHelpPB; + + SwMailMergeConfigItem& rConfigItem; + + DECL_LINK( OKHdl_Impl, OKButton*); + DECL_LINK( CheckBoxHdl_Impl, CheckBox*); + DECL_LINK( RadioButtonHdl_Impl, RadioButton*); + + +public: + SwAuthenticationSettingsDialog(SwMailConfigPage* pParent, SwMailMergeConfigItem& rItem); + ~SwAuthenticationSettingsDialog(); +}; + +/*-- 06.05.2004 10:59:40--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwMailConfigPage::SwMailConfigPage( Window* pParent, const SfxItemSet& rSet ) : + SfxTabPage(pParent, SW_RES(TP_MAILCONFIG), rSet), +#ifdef MSC +#pragma warning (disable : 4355) +#endif + m_aIdentityFL( this, SW_RES( FL_IDENTITY)), + m_aDisplayNameFT( this, SW_RES( FT_DISPLAYNAME)), + m_aDisplayNameED( this, SW_RES( ED_DISPLAYNAME)), + m_aAddressFT( this, SW_RES( FT_ADDRESS)), + m_aAddressED( this, SW_RES( ED_ADDRESS)), + m_aReplyToCB( this, SW_RES( CB_REPLYTO)), + m_aReplyToFT( this, SW_RES( FT_REPLYTO)), + m_aReplyToED( this, SW_RES( ED_REPLYTO)), + m_aSMTPFL( this, SW_RES( FL_SMTP)), + m_aServerFT( this, SW_RES( FT_SERVER)), + m_aServerED( this, SW_RES( ED_SERVER)), + m_aPortFT( this, SW_RES( FT_PORT)), + m_aPortNF( this, SW_RES( NF_PORT)), + m_aSecureCB( this, SW_RES( CB_SECURE)), + m_aServerAuthenticationPB( this, SW_RES( PB_AUTHENTICATION )), + m_aSeparatorFL( this, SW_RES( FL_SEPARATOR )), + m_aTestPB( this, SW_RES( PB_TEST)), +#ifdef MSC +#pragma warning (default : 4355) +#endif + m_pConfigItem( new SwMailMergeConfigItem ) +{ + FreeResource(); + m_aReplyToCB.SetClickHdl(LINK(this, SwMailConfigPage, ReplyToHdl)); + m_aServerAuthenticationPB.SetClickHdl(LINK(this, SwMailConfigPage, AuthenticationHdl)); + m_aTestPB.SetClickHdl(LINK(this, SwMailConfigPage, TestHdl)); +} +/*-- 06.05.2004 10:59:40--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwMailConfigPage::~SwMailConfigPage() +{ + delete m_pConfigItem; +} +/*-- 06.05.2004 10:59:40--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxTabPage* SwMailConfigPage::Create( Window* pParent, const SfxItemSet& rAttrSet) +{ + return new SwMailConfigPage(pParent, rAttrSet); +} +/*-- 06.05.2004 10:59:41--------------------------------------------------- + + -----------------------------------------------------------------------*/ +BOOL SwMailConfigPage::FillItemSet( SfxItemSet& /*rSet*/ ) +{ + if(m_aDisplayNameED.GetText() != m_aDisplayNameED.GetSavedValue()) + m_pConfigItem->SetMailDisplayName(m_aDisplayNameED.GetText()); + if(m_aAddressED.GetText() != m_aAddressED.GetSavedValue()) + m_pConfigItem->SetMailAddress(m_aAddressED.GetText()); + String sReplyTo; + if( m_aReplyToCB.GetSavedValue() != m_aReplyToCB.IsChecked()) + m_pConfigItem->SetMailReplyTo(m_aReplyToCB.IsChecked()); + if(m_aReplyToED.GetText() != m_aReplyToED.GetSavedValue()) + m_pConfigItem->SetMailReplyTo(m_aReplyToED.GetText()); + if(m_aServerED.GetText() != m_aServerED.GetSavedValue()) + m_pConfigItem->SetMailServer(m_aServerED.GetText()); + + if(m_aPortNF.IsModified()) + m_pConfigItem->SetMailPort((sal_Int16)m_aPortNF.GetValue()); + + m_pConfigItem->SetSecureConnection(m_aSecureCB.IsChecked()); + + m_pConfigItem->Commit(); + return sal_True; +} +/*-- 06.05.2004 10:59:41--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwMailConfigPage::Reset( const SfxItemSet& /*rSet*/ ) +{ + m_aDisplayNameED.SetText(m_pConfigItem->GetMailDisplayName()); + m_aAddressED.SetText(m_pConfigItem->GetMailAddress()); + + m_aReplyToED.SetText(m_pConfigItem->GetMailReplyTo()) ; + m_aReplyToCB.Check(m_pConfigItem->IsMailReplyTo()); + m_aReplyToCB.GetClickHdl().Call(&m_aReplyToCB); + + m_aServerED.SetText(m_pConfigItem->GetMailServer()); + m_aPortNF.SetValue(m_pConfigItem->GetMailPort()); + + m_aSecureCB.Check(m_pConfigItem->IsSecureConnection()); + + m_aDisplayNameED.SaveValue(); + m_aAddressED .SaveValue(); + m_aReplyToCB .SaveValue(); + m_aReplyToED .SaveValue(); + m_aServerED .SaveValue(); + m_aPortNF .SaveValue(); + m_aSecureCB .SaveValue(); +} +/*-- 06.05.2004 10:59:41--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK(SwMailConfigPage, ReplyToHdl, CheckBox*, pBox) +{ + sal_Bool bEnable = pBox->IsChecked(); + m_aReplyToFT.Enable(bEnable); + m_aReplyToED.Enable(bEnable); + return 0; +} +/*-- 06.05.2004 10:59:41--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK(SwMailConfigPage, AuthenticationHdl, PushButton*, EMPTYARG) +{ + SwAuthenticationSettingsDialog aDlg(this, *m_pConfigItem); + aDlg.Execute(); + return 0; +} +/*-- 06.05.2004 10:59:42--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK(SwMailConfigPage, TestHdl, PushButton*, EMPTYARG) +{ + SwTestAccountSettingsDialog(this).Execute(); + return 0; +} +/*-- 06.05.2004 12:11:13--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwTestAccountSettingsDialog::SwTestAccountSettingsDialog(SwMailConfigPage* pParent) : + SfxModalDialog(pParent, SW_RES(DLG_MM_TESTACCOUNTSETTINGS)), +#ifdef MSC +#pragma warning (disable : 4355) +#endif + m_aInfoFI( this, SW_RES( FI_INFO )), + m_aStatusHB( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER), + m_aStatusLB( this, SW_RES( LB_STATUS )), + m_aErrorFI( this, SW_RES( FI_ERROR )), + m_eErrorsED( this, SW_RES( ED_ERROR )), + m_aSeparatorFL( this, SW_RES( FL_SEPAPARATOR )), + m_aStopPB( this, SW_RES( PB_STOP )), + m_aCancelPB( this, SW_RES( PB_CANCEL )), + m_aHelpPB( this, SW_RES( PB_HELP )), +#ifdef MSC +#pragma warning (default : 4355) +#endif + m_aImageList( SW_RES( GetSettings().GetStyleSettings().GetHighContrastMode() ? ILIST_HC : ILIST) ), + m_sTask( SW_RES( ST_TASK )), + m_sStatus( SW_RES( ST_STATUS )), + m_sEstablish( SW_RES( ST_ESTABLISH )), + m_sFindServer( SW_RES( ST_FINDSERVER )), + m_sCompleted( SW_RES( ST_COMPLETED )), + m_sFailed( SW_RES( ST_FAILED )), + m_sErrorServer( SW_RES( ST_ERROR_SERVER )), + m_pParent(pParent), + m_bStop(false) +{ + FreeResource(); + m_aStopPB.SetClickHdl(LINK(this, SwTestAccountSettingsDialog, StopHdl)); + + Size aLBSize(m_aStatusLB.GetOutputSizePixel()); + m_aStatusHB.SetSizePixel(aLBSize); + Size aHeadSize(m_aStatusHB.CalcWindowSizePixel()); + aHeadSize.Width() = aLBSize.Width(); + m_aStatusHB.SetSizePixel(aHeadSize); + Point aLBPos(m_aStatusLB.GetPosPixel()); + m_aStatusHB.SetPosPixel(aLBPos); + aLBPos.Y() += aHeadSize.Height(); + aLBSize.Height() -= aHeadSize.Height(); + m_aStatusLB.SetPosSizePixel(aLBPos, aLBSize); + + Size aSz(m_aStatusHB.GetOutputSizePixel()); + m_aStatusHB.InsertItem( 1, m_sTask, + aSz.Width()/2, + HIB_LEFT | HIB_VCENTER ); + m_aStatusHB.InsertItem( 2, m_sStatus, + aSz.Width()/2, + HIB_LEFT | HIB_VCENTER ); + + m_aStatusHB.SetHelpId(HID_MM_TESTACCOUNTSETTINGS_HB ); + m_aStatusHB.Show(); + + m_aStatusLB.SetHelpId(HID_MM_TESTACCOUNTSETTINGS_TLB); + static long nTabs[] = {2, 0, aSz.Width()/2 }; + m_aStatusLB.SetWindowBits( WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ); + m_aStatusLB.SetSelectionMode( SINGLE_SELECTION ); + m_aStatusLB.SetTabs(&nTabs[0], MAP_PIXEL); + short nEntryHeight = m_aStatusLB.GetEntryHeight(); + m_aStatusLB.SetEntryHeight( nEntryHeight * 15 / 10 ); + + Application::PostUserEvent( STATIC_LINK( this, SwTestAccountSettingsDialog, TestHdl ), this ); +} +/*-- 06.05.2004 12:11:13--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwTestAccountSettingsDialog::~SwTestAccountSettingsDialog() +{ +} +/*-- 06.05.2004 12:15:43--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK(SwTestAccountSettingsDialog, StopHdl, PushButton*, EMPTYARG) +{ + m_bStop = true; + return 0; +} +/*-- 07.06.2004 12:44:50--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_STATIC_LINK(SwTestAccountSettingsDialog, TestHdl, void*, EMPTYARG) +{ + pThis->EnterWait(); + pThis->Test(); + pThis->LeaveWait(); + return 0; +} +/*-- 07.06.2004 12:45:45--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwTestAccountSettingsDialog::Test() +{ + uno::Reference<XMultiServiceFactory> rMgr = ::comphelper::getProcessServiceFactory(); + + bool bIsLoggedIn = false; + bool bIsServer = false; + if (rMgr.is()) + { + try + { + uno::Reference< mail::XMailService > xInMailService; + uno::Reference< mail::XMailServiceProvider > xMailServiceProvider = + mail::MailServiceProvider::create(getCurrentCmpCtx(rMgr)); + uno::Reference< mail::XMailService > xMailService = + xMailServiceProvider->create( + mail::MailServiceType_SMTP); + if(m_bStop) + return; + uno::Reference<XConnectionListener> xConnectionListener(new SwConnectionListener()); + + if(m_pParent->m_pConfigItem->IsAuthentication() && + m_pParent->m_pConfigItem->IsSMTPAfterPOP()) + { + xInMailService = xMailServiceProvider->create( + m_pParent->m_pConfigItem->IsInServerPOP() ? + mail::MailServiceType_POP3 : mail::MailServiceType_IMAP); + if(m_bStop) + return; + //authenticate at the POP or IMAP server first + uno::Reference<XAuthenticator> xAuthenticator = + new SwAuthenticator( + m_pParent->m_pConfigItem->GetInServerUserName(), + m_pParent->m_pConfigItem->GetInServerPassword(), + this); + + xInMailService->addConnectionListener(xConnectionListener); + //check connection + uno::Reference< uno::XCurrentContext> xConnectionContext = + new SwConnectionContext( + m_pParent->m_pConfigItem->GetInServerName(), + m_pParent->m_pConfigItem->GetInServerPort(), + ::rtl::OUString::createFromAscii( "Insecure" )); + xInMailService->connect(xConnectionContext, xAuthenticator); + } + if(m_bStop) + return; + uno::Reference<XAuthenticator> xAuthenticator; + if(m_pParent->m_pConfigItem->IsAuthentication() && + !m_pParent->m_pConfigItem->IsSMTPAfterPOP() && + m_pParent->m_pConfigItem->GetMailUserName().getLength()) + xAuthenticator = + new SwAuthenticator( + m_pParent->m_pConfigItem->GetMailUserName(), + m_pParent->m_pConfigItem->GetMailPassword(), + this); + else + xAuthenticator = new SwAuthenticator(); + + xMailService->addConnectionListener(xConnectionListener); + if(m_bStop) + return; + //just to check if the server exists + xMailService->getSupportedConnectionTypes(); + if(m_bStop) + return; + bIsServer = true; + //check connection + uno::Reference< uno::XCurrentContext> xConnectionContext = + new SwConnectionContext( + m_pParent->m_aServerED.GetText(), + sal::static_int_cast< sal_Int16, sal_Int64 >(m_pParent->m_aPortNF.GetValue()), + ::rtl::OUString::createFromAscii( + m_pParent->m_aSecureCB.IsChecked() ? "Ssl" : "Insecure")); + xMailService->connect(xConnectionContext, xAuthenticator); + bIsLoggedIn = xMailService->isConnected(); + if( xInMailService.is() ) + xInMailService->disconnect(); + if( xMailService->isConnected()) + xMailService->disconnect(); + } + catch(uno::Exception&) + { + DBG_ERROR("exception caught"); + } + } + + Image aFailedImg = m_aImageList.GetImage( FN_FORMULA_CANCEL ); + Image aCompletedImg = m_aImageList.GetImage( FN_FORMULA_APPLY ); + + String sTmp(m_sEstablish); + sTmp += '\t'; + sTmp += bIsServer ? m_sCompleted : m_sFailed; + m_aStatusLB.InsertEntry(sTmp, + bIsServer ? aCompletedImg : aFailedImg, + bIsServer ? aCompletedImg : aFailedImg); + + sTmp = m_sFindServer; + sTmp += '\t'; + sTmp += bIsLoggedIn ? m_sCompleted : m_sFailed; + m_aStatusLB.InsertEntry(sTmp, + bIsLoggedIn ? aCompletedImg : aFailedImg, + bIsLoggedIn ? aCompletedImg : aFailedImg); + + if(!bIsServer || !bIsLoggedIn ) + { + m_eErrorsED.SetText( m_sErrorServer ); + } +} +/*-- 18.08.2004 12:18:38--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwMailConfigDlg::SwMailConfigDlg(Window* pParent, SfxItemSet& rSet ) : + SfxSingleTabDialog(pParent, rSet, 0) +{ + // TabPage erzeugen + SetTabPage(SwMailConfigPage::Create( this, rSet )); +} +/*-- 18.08.2004 12:18:38--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwMailConfigDlg::~SwMailConfigDlg() +{ +} +/*-- 19.08.2004 14:33:58--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwAuthenticationSettingsDialog::SwAuthenticationSettingsDialog( + SwMailConfigPage* pParent, SwMailMergeConfigItem& rItem) : + SfxModalDialog(pParent, SW_RES(DLG_MM_SERVERAUTHENTICATION)), +#ifdef MSC +#pragma warning (disable : 4355) +#endif + m_aAuthenticationCB( this, SW_RES( CB_AUTHENTICATION )), + m_aSeparateAuthenticationRB( this, SW_RES( RB_SEP_AUTHENTICATION )), + m_aSMTPAfterPOPRB( this, SW_RES( RB_SMPTAFTERPOP )), + m_aOutgoingServerFT( this, SW_RES( FT_OUTGOINGSERVER )), + m_aUserNameFT( this, SW_RES( FT_USERNAME )), + m_aUserNameED( this, SW_RES( ED_USERNAME )), + m_aOutPasswordFT( this, SW_RES( FT_OUTPASSWORD )), + m_aOutPasswordED( this, SW_RES( ED_OUTPASSWORD )), + m_aIncomingServerFT( this, SW_RES( FT_INCOMINGSERVER )), + m_aServerFT( this, SW_RES( FT_SERVER )), + m_aServerED( this, SW_RES( ED_SERVER )), + m_aPortFT( this, SW_RES( FT_PORT )), + m_aPortNF( this, SW_RES( NF_PORT )), + m_aProtocolFT( this, SW_RES( FT_PROTOCOL )), + m_aPOP3RB( this, SW_RES( RB_POP3 )), + m_aIMAPRB( this, SW_RES( RB_IMAP )), + m_aInUsernameFT( this, SW_RES( FT_INUSERNAME )), + m_aInUsernameED( this, SW_RES( ED_INUSERNAME )), + m_aInPasswordFT( this, SW_RES( FT_INPASSWORD )), + m_aInPasswordED( this, SW_RES( ED_INPASSWORD )), + m_aSeparatorFL( this, SW_RES( FL_SEPARATOR )), + m_aOKPB( this, SW_RES( PB_OK )), + m_aCancelPB( this, SW_RES( PB_CANCEL )), + m_aHelpPB( this, SW_RES( PB_HELP )), +#ifdef MSC +#pragma warning (default : 4355) +#endif + rConfigItem( rItem ) +{ + FreeResource(); + + m_aAuthenticationCB.SetClickHdl( LINK( this, SwAuthenticationSettingsDialog, CheckBoxHdl_Impl)); + Link aRBLink = LINK( this, SwAuthenticationSettingsDialog, RadioButtonHdl_Impl ); + m_aSeparateAuthenticationRB.SetClickHdl( aRBLink ); + m_aSMTPAfterPOPRB.SetClickHdl( aRBLink ); + m_aOKPB.SetClickHdl( LINK( this, SwAuthenticationSettingsDialog, OKHdl_Impl)); + + m_aAuthenticationCB.Check( rConfigItem.IsAuthentication() ); + if(rConfigItem.IsSMTPAfterPOP()) + m_aSMTPAfterPOPRB.Check(); + else + m_aSeparateAuthenticationRB.Check(); + m_aUserNameED.SetText( rConfigItem.GetMailUserName() ); + m_aOutPasswordED.SetText( rConfigItem.GetMailPassword() ); + + m_aServerED.SetText( rConfigItem.GetInServerName() ); + m_aPortNF.SetValue( rConfigItem.GetInServerPort() ); + if(rConfigItem.IsInServerPOP()) + m_aPOP3RB.Check(); + else + m_aIMAPRB.Check(); + m_aInUsernameED.SetText( rConfigItem.GetInServerUserName()); + m_aInPasswordED.SetText( rConfigItem.GetInServerPassword() ); + + CheckBoxHdl_Impl( &m_aAuthenticationCB ); +} +/*-- 19.08.2004 14:33:58--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwAuthenticationSettingsDialog::~SwAuthenticationSettingsDialog() +{ +} +/*-- 19.08.2004 14:33:59--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SwAuthenticationSettingsDialog, OKHdl_Impl, OKButton*, EMPTYARG) +{ + rConfigItem.SetAuthentication( m_aAuthenticationCB.IsChecked() ); + rConfigItem.SetSMTPAfterPOP(m_aSMTPAfterPOPRB.IsChecked()); + rConfigItem.SetMailUserName(m_aUserNameED.GetText()); + rConfigItem.SetMailPassword(m_aOutPasswordED.GetText()); + rConfigItem.SetInServerName(m_aServerED.GetText()); + rConfigItem.SetInServerPort(sal::static_int_cast< sal_Int16, sal_Int64 >(m_aPortNF.GetValue( ) )); + rConfigItem.SetInServerPOP(m_aPOP3RB.IsChecked()); + rConfigItem.SetInServerUserName(m_aInUsernameED.GetText()); + + rConfigItem.SetInServerPassword(m_aInPasswordED.GetText()); + EndDialog(RET_OK); + return 0; +} +/*-- 19.08.2004 14:33:59--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SwAuthenticationSettingsDialog, CheckBoxHdl_Impl, CheckBox*, pBox) +{ + sal_Bool bChecked = pBox->IsChecked(); + m_aSeparateAuthenticationRB.Enable(bChecked); + m_aSMTPAfterPOPRB.Enable(bChecked); + RadioButtonHdl_Impl( 0 ); + + return 0; +} +/*-- 19.08.2004 14:33:59--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SwAuthenticationSettingsDialog, RadioButtonHdl_Impl, RadioButton*, EMPTYARG) +{ + sal_Bool bSeparate = m_aSeparateAuthenticationRB.IsChecked(); + sal_Bool bIsEnabled = m_aSeparateAuthenticationRB.IsEnabled(); + sal_Bool bNotSeparate = !bSeparate & bIsEnabled; + bSeparate &= bIsEnabled; + + m_aOutgoingServerFT.Enable(bSeparate); + m_aUserNameFT.Enable(bSeparate); + m_aUserNameED.Enable(bSeparate); + m_aOutPasswordFT.Enable(bSeparate); + m_aOutPasswordED.Enable(bSeparate); + + m_aIncomingServerFT.Enable(bNotSeparate); + m_aServerFT.Enable(bNotSeparate); + m_aServerED.Enable(bNotSeparate); + m_aPortFT.Enable(bNotSeparate); + m_aPortNF.Enable(bNotSeparate); + m_aInUsernameFT.Enable(bNotSeparate); + m_aInUsernameED.Enable(bNotSeparate); + m_aProtocolFT.Enable(bNotSeparate); + m_aPOP3RB.Enable(bNotSeparate); + m_aIMAPRB.Enable(bNotSeparate); + m_aInPasswordFT.Enable(bNotSeparate); + m_aInPasswordED.Enable(bNotSeparate); + + return 0; +} diff --git a/sw/source/ui/config/mailconfigpage.hrc b/sw/source/ui/config/mailconfigpage.hrc new file mode 100644 index 000000000000..a7115878ccf5 --- /dev/null +++ b/sw/source/ui/config/mailconfigpage.hrc @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef _MAILCONFIGPAGE_HRC +#define _MAILCONFIGPAGE_HRC + +#define FL_IDENTITY 1 +#define FT_DISPLAYNAME 2 +#define ED_DISPLAYNAME 3 +#define FT_ADDRESS 4 +#define ED_ADDRESS 5 +#define CB_REPLYTO 6 +#define FT_REPLYTO 7 +#define ED_REPLYTO 8 +#define FL_SMTP 9 +#define FT_SERVER 10 +#define ED_SERVER 11 +#define FT_PORT 12 +#define NF_PORT 13 +#define CB_SECURE 14 +#define PB_AUTHENTICATION 16 +#define FL_SEPARATOR 17 +#define PB_TEST 21 + +#define FI_INFO 31 +#define LB_STATUS 32 +#define FI_ERROR 33 +#define ED_ERROR 34 +#define FL_SEPAPARATOR 35 +#define PB_STOP 36 +#define PB_CANCEL 37 +#define PB_HELP 38 +#define ST_TASK 39 +#define ST_STATUS 40 +#define ST_ESTABLISH 41 +#define ST_FINDSERVER 42 +#define ST_COMPLETED 43 +#define ST_FAILED 44 +#define ST_ERROR_SERVER 46 +#define ILIST 47 +#define ILIST_HC 48 + +#define CB_AUTHENTICATION 50 +#define RB_SEP_AUTHENTICATION 51 +#define RB_SMPTAFTERPOP 52 +#define FT_OUTGOINGSERVER 53 +#define FT_USERNAME 54 +#define ED_USERNAME 55 +#define FT_OUTPASSWORD 56 +#define ED_OUTPASSWORD 57 +#define FT_INCOMINGSERVER 58 +#define FT_INUSERNAME 59 +#define ED_INUSERNAME 60 +#define FT_INPASSWORD 63 +#define ED_INPASSWORD 64 +#define PB_OK 65 +#define FT_PROTOCOL 66 +#define RB_POP3 67 +#define RB_IMAP 68 +#endif diff --git a/sw/source/ui/config/mailconfigpage.src b/sw/source/ui/config/mailconfigpage.src new file mode 100644 index 000000000000..1ad1378222c0 --- /dev/null +++ b/sw/source/ui/config/mailconfigpage.src @@ -0,0 +1,421 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include <mailconfigpage.hrc> +#include <config.hrc> +#include <helpid.h> +#include <cmdid.h> +#include <globals.hrc> + +TabPage TP_MAILCONFIG +{ + HelpID = HID_TP_MAILCONFIG; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + + Text[ en-US ] = "Mail Merge E-mail"; + + FixedLine FL_IDENTITY + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text[ en-US ] = "User information"; + }; + FixedText FT_DISPLAYNAME + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 74 , 8 ) ; + Text[ en-US ] = "~Your name"; + }; + Edit ED_DISPLAYNAME + { + Pos = MAP_APPFONT ( 88 , 14 ) ; + Size = MAP_APPFONT ( 160 , 12 ) ; + Border = TRUE; + }; + FixedText FT_ADDRESS + { + Pos = MAP_APPFONT ( 12 , 31 ) ; + Size = MAP_APPFONT ( 74 , 8 ) ; + Text[ en-US ] = "~E-Mail address"; + }; + Edit ED_ADDRESS + { + Pos = MAP_APPFONT ( 88 , 29 ) ; + Size = MAP_APPFONT ( 160 , 12 ) ; + Border = TRUE; + }; + CheckBox CB_REPLYTO + { + Pos = MAP_APPFONT ( 12 , 45 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Text[ en-US ] = "Send replies to ~different e-mail address"; + }; + FixedText FT_REPLYTO + { + Pos = MAP_APPFONT ( 18 , 60 ) ; + Size = MAP_APPFONT ( 68 , 8 ) ; + Text[ en-US ] = "~Reply address"; + }; + Edit ED_REPLYTO + { + Pos = MAP_APPFONT ( 88 , 58 ) ; + Size = MAP_APPFONT ( 160 , 12 ) ; + Border = TRUE; + }; + FixedLine FL_SMTP + { + Pos = MAP_APPFONT ( 6 , 76 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text[ en-US ] = "Outgoing server (SMTP) Settings"; + }; + FixedText FT_SERVER + { + Pos = MAP_APPFONT ( 12 , 89 ) ; + Size = MAP_APPFONT ( 74 , 8 ) ; + Text[ en-US ] = "~Server name"; + }; + Edit ED_SERVER + { + Pos = MAP_APPFONT ( 88 , 87 ) ; + Size = MAP_APPFONT ( 105 , 12 ) ; + Border = TRUE; + }; + FixedText FT_PORT + { + Pos = MAP_APPFONT ( 197 , 89 ) ; + Size = MAP_APPFONT ( 24 , 8 ) ; + Right = TRUE; + Text[ en-US ] = "~Port"; + }; + NumericField NF_PORT + { + Pos = MAP_APPFONT ( 223 , 87 ) ; + Size = MAP_APPFONT ( 25 , 12 ) ; + Border = TRUE; + Left = TRUE ; + First = 1 ; + Minimum = 1 ; + Maximum = 65535; + Repeat = TRUE ; + Spin = FALSE ; + TabStop = TRUE ; + }; + CheckBox CB_SECURE + { + Pos = MAP_APPFONT ( 12 , 104 ) ; + Size = MAP_APPFONT ( 242 , 10 ) ; + Text[ en-US ] = "~Use secure connection (SSL)"; + }; + PushButton PB_AUTHENTICATION + { + Pos = MAP_APPFONT ( 88 , 118 ) ; + Size = MAP_APPFONT ( 105 , 14 ) ; + Text[ en-US ] = "Server Au~thentication"; + }; + FixedLine FL_SEPARATOR + { + Pos = MAP_APPFONT ( 6 , 156 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + }; + PushButton PB_TEST + { + Pos = MAP_APPFONT ( 88 , 164 ) ; + Size = MAP_APPFONT ( 105 , 14 ) ; + Text[ en-US ] = "Test S~ettings..."; + }; +}; +ModalDialog DLG_MM_TESTACCOUNTSETTINGS +{ + OutputSize = TRUE ; + SVLook = TRUE ; + HelpID = HID_MM_TESTACCOUNTSETTINGS; + Size = MAP_APPFONT ( 250 , 176 ) ; + Moveable = TRUE ; + + Text[ en-US ] = "Test Account Settings"; + + FixedText FI_INFO + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 238 , 8 ) ; + Text[ en-US ] = "%PRODUCTNAME is testing the e-mail account settings..."; + }; + Control LB_STATUS + { + Pos = MAP_APPFONT ( 6, 14 ) ; + Size = MAP_APPFONT ( 238 , 50 ) ; + Border = TRUE; + }; + FixedText FI_ERROR + { + Pos = MAP_APPFONT ( 6 , 68 ) ; + Size = MAP_APPFONT ( 238 , 8 ) ; + Text[ en-US ] = "Errors"; + }; + MultiLineEdit ED_ERROR + { + Pos = MAP_APPFONT ( 6 , 79 ) ; + Size = MAP_APPFONT ( 238 , 60 ) ; + Border = TRUE; + Readonly = TRUE; + }; + FixedLine FL_SEPAPARATOR + { + Pos = MAP_APPFONT ( 0 , 145 ) ; + Size = MAP_APPFONT ( 250 , 8 ) ; + }; + PushButton PB_STOP + { + Pos = MAP_APPFONT ( 85 , 156 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text[ en-US ] = "~Stop"; + }; + CancelButton PB_CANCEL + { + Pos = MAP_APPFONT ( 138 , 156 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + HelpButton PB_HELP + { + Pos = MAP_APPFONT ( 194 , 156 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + #define IMGLIST_IDS\ + IdList = \ + { \ + FN_FORMULA_CANCEL ;\ + FN_FORMULA_APPLY ;\ + }; \ + IdCount = 2 + + ImageList ILIST + { + Prefix = "sc"; + MaskColor = IMAGE_MASK_COLOR; + IMGLIST_IDS; + }; + + ImageList ILIST_HC + { + Prefix = "sch"; + MaskColor = IMAGE_MASK_COLOR ; + IMGLIST_IDS; + }; + String ST_TASK + { + Text[ en-US ] = "Task"; + }; + String ST_STATUS + { + Text[ en-US ] = "Status"; + }; + String ST_ESTABLISH + { + Text[ en-US ] = "Establish network connection"; + }; + String ST_FINDSERVER + { + Text[ en-US ] = "Find outgoing mail server"; + }; + String ST_COMPLETED + { + Text[ en-US ] = "Successful"; + }; + String ST_FAILED + { + Text[ en-US ] = "Failed"; + }; + String ST_ERROR_SERVER + { + Text[ en-US ] = "%PRODUCTNAME could not connect to the outgoing mail server. Check your system's settings and the settings in %PRODUCTNAME. Check the server name, the port and the secure connections settings"; + }; + +}; +ModalDialog DLG_MM_SERVERAUTHENTICATION +{ + OutputSize = TRUE ; + SVLook = TRUE ; + HelpID = HID_MM_SERVERAUTHENTICATION; + Size = MAP_APPFONT ( 250 , 211 ) ; + Moveable = TRUE ; + + Text[ en-US ] = "Server Authentication"; + + CheckBox CB_AUTHENTICATION + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 238 , 10 ) ; + Text[ en-US ] = "The outgoing mail server (SMTP) requires au~thentication"; + }; + RadioButton RB_SEP_AUTHENTICATION + { + Pos = MAP_APPFONT ( 12 , 17 ) ; + Size = MAP_APPFONT ( 232 , 10 ) ; + Text[ en-US ] = "The outgoing mail server (SMTP) requires ~separate authentication"; + }; + FixedText FT_OUTGOINGSERVER + { + Pos = MAP_APPFONT ( 18 , 31 ) ; + Size = MAP_APPFONT ( 200 , 8 ) ; + Text[ en-US ] = "Outgoing mail server:"; + }; + FixedText FT_USERNAME + { + Pos = MAP_APPFONT ( 18 , 44 ) ; + Size = MAP_APPFONT ( 53 , 8 ) ; + Text[ en-US ] = "~User name"; + }; + Edit ED_USERNAME + { + Pos = MAP_APPFONT ( 78 , 42 ) ; + Size = MAP_APPFONT ( 115 , 12 ) ; + Border = TRUE; + }; + FixedText FT_OUTPASSWORD + { + Pos = MAP_APPFONT ( 18 , 59 ) ; + Size = MAP_APPFONT ( 53 , 8 ) ; + Text[ en-US ] = "~Password"; + }; + Edit ED_OUTPASSWORD + { + Pos = MAP_APPFONT ( 78 , 57 ) ; + Size = MAP_APPFONT ( 115 , 12 ) ; + Border = TRUE; + PassWord = TRUE; + }; + RadioButton RB_SMPTAFTERPOP + { + Pos = MAP_APPFONT ( 12 , 73 ) ; + Size = MAP_APPFONT ( 232 , 20 ) ; + WordBreak = TRUE; + Text[ en-US ] = "The outgoing mail server uses the same authentication as the ~incoming mail server. Enter the settings of the incoming mail server."; + }; + FixedText FT_INCOMINGSERVER + { + Pos = MAP_APPFONT ( 18 , 97 ) ; + Size = MAP_APPFONT ( 230 , 8 ) ; + Text[ en-US ] = "Incoming mail server:"; + }; + FixedText FT_SERVER + { + Pos = MAP_APPFONT ( 18 , 110 ) ; + Size = MAP_APPFONT ( 53 , 8 ) ; + Text[ en-US ] = "Server ~name"; + }; + Edit ED_SERVER + { + Pos = MAP_APPFONT ( 78 , 108 ) ; + Size = MAP_APPFONT ( 115 , 12 ) ; + Border = TRUE; + }; + FixedText FT_PORT + { + Pos = MAP_APPFONT ( 195 , 110 ) ; + Size = MAP_APPFONT ( 20 , 10 ) ; + Right = TRUE; + Text[ en-US ] = "P~ort"; + }; + NumericField NF_PORT + { + Pos = MAP_APPFONT ( 219 , 108 ) ; + Size = MAP_APPFONT ( 25 , 12 ) ; + Border = TRUE; + Left = TRUE ; + First = 1 ; + Minimum = 1 ; + Maximum = 65535; + Repeat = TRUE ; + Spin = FALSE ; + TabStop = TRUE ; + }; + FixedText FT_PROTOCOL + { + Pos = MAP_APPFONT ( 18 , 126 ) ; + Size = MAP_APPFONT ( 53 , 8 ) ; + Text[ en-US ] = "Type"; + }; + RadioButton RB_POP3 + { + Pos = MAP_APPFONT ( 78 , 125 ) ; + Size = MAP_APPFONT ( 115 , 10 ) ; + Text[ en-US ] = "~POP 3"; + }; + RadioButton RB_IMAP + { + Pos = MAP_APPFONT ( 78 , 138 ) ; + Size = MAP_APPFONT ( 115 , 10 ) ; + Text[ en-US ] = "~IMAP"; + }; + FixedText FT_INUSERNAME + { + Pos = MAP_APPFONT ( 18 , 152 ) ; + Size = MAP_APPFONT ( 53 , 8 ) ; + Text[ en-US ] = "Us~er name"; + }; + Edit ED_INUSERNAME + { + Pos = MAP_APPFONT ( 78 , 150 ) ; + Size = MAP_APPFONT ( 115 , 12 ) ; + Border = TRUE; + }; + FixedText FT_INPASSWORD + { + Pos = MAP_APPFONT ( 18 , 167 ) ; + Size = MAP_APPFONT ( 53 , 8 ) ; + Text[ en-US ] = "Pass~word"; + }; + Edit ED_INPASSWORD + { + Pos = MAP_APPFONT ( 78 , 165 ) ; + Size = MAP_APPFONT ( 115 , 12 ) ; + Border = TRUE; + PassWord = TRUE; + }; + FixedLine FL_SEPARATOR + { + Pos = MAP_APPFONT ( 0 , 183 ) ; + Size = MAP_APPFONT ( 250 , 8 ) ; + }; + OKButton PB_OK + { + Pos = MAP_APPFONT ( 85 , 191 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + CancelButton PB_CANCEL + { + Pos = MAP_APPFONT ( 138 , 191 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + HelpButton PB_HELP + { + Pos = MAP_APPFONT ( 194 , 191 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; +}; + diff --git a/sw/source/ui/config/makefile.mk b/sw/source/ui/config/makefile.mk new file mode 100644 index 000000000000..4b8ed01ca90e --- /dev/null +++ b/sw/source/ui/config/makefile.mk @@ -0,0 +1,87 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# 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. +# +# 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). +# +# 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. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=sw +TARGET=config +LIBTARGET=NO +# --- Settings ----------------------------------------------------- + +.INCLUDE : $(PRJ)$/inc$/swpre.mk +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/inc$/sw.mk + +# --- Files -------------------------------------------------------- +IMGLST_SRS=$(SRS)$/config.srs +BMP_IN=$(PRJ)$/win/imglst + +SRS1NAME=$(TARGET) +SRC1FILES = \ + mailconfigpage.src \ + optdlg.src \ + optload.src \ + optcomp.src \ + redlopt.src + +EXCEPTIONSFILES = \ + $(SLO)$/mailconfigpage.obj \ + $(SLO)$/optcomp.obj \ + $(SLO)$/optload.obj + +SLOFILES = \ + $(EXCEPTIONSFILES) \ + $(SLO)$/barcfg.obj \ + $(SLO)$/caption.obj \ + $(SLO)$/cfgitems.obj \ + $(SLO)$/dbconfig.obj \ + $(SLO)$/fontcfg.obj \ + $(SLO)$/modcfg.obj \ + $(SLO)$/optpage.obj \ + $(SLO)$/prtopt.obj \ + $(SLO)$/uinums.obj \ + $(SLO)$/usrpref.obj \ + $(SLO)$/viewopt.obj + +LIB1TARGET= $(SLB)$/$(TARGET).lib + +LIB1OBJFILES = \ + $(SLO)$/barcfg.obj \ + $(SLO)$/caption.obj \ + $(SLO)$/cfgitems.obj \ + $(SLO)$/dbconfig.obj \ + $(SLO)$/fontcfg.obj \ + $(SLO)$/modcfg.obj \ + $(SLO)$/prtopt.obj \ + $(SLO)$/uinums.obj \ + $(SLO)$/usrpref.obj \ + $(SLO)$/viewopt.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/sw/source/ui/config/modcfg.cxx b/sw/source/ui/config/modcfg.cxx new file mode 100644 index 000000000000..ec0e47393eb2 --- /dev/null +++ b/sw/source/ui/config/modcfg.cxx @@ -0,0 +1,1392 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#include <hintids.hxx> +#include <sot/clsids.hxx> +#include <tools/stream.hxx> +#include <vcl/svapp.hxx> +#include <svl/mailenum.hxx> +#ifndef _SVX_SVXIDS_HRC //autogen +#include <svx/svxids.hrc> +#endif +#include <editeng/svxenum.hxx> +#include <tools/debug.hxx> + +#include <tools/globname.hxx> +#include <swtypes.hxx> +#include <itabenum.hxx> +#ifndef _MODCFG_HXX +#include <modcfg.hxx> +#endif +#include <fldupde.hxx> +#include <unotools/syslocaleoptions.hxx> +#include <caption.hxx> +#include <com/sun/star/uno/Any.hxx> + +#include <unomid.h> + +using namespace utl; +using rtl::OUString; +using namespace com::sun::star::uno; + +#define GLOB_NAME_CALC 0 +#define GLOB_NAME_IMPRESS 1 +#define GLOB_NAME_DRAW 2 +#define GLOB_NAME_MATH 3 +#define GLOB_NAME_CHART 4 + +SV_IMPL_PTRARR_SORT(InsCapOptArr, InsCaptionOptPtr) +/* -----------------03.11.98 13:46------------------- + * + * --------------------------------------------------*/ +InsCaptionOpt* InsCaptionOptArr::Find(const SwCapObjType eType, const SvGlobalName *pOleId) const +{ + for (USHORT i = 0; i < Count(); i++ ) + { + InsCaptionOpt* pObj = GetObject(i); + if (pObj->GetObjType() == eType && + (eType != OLE_CAP || + (pOleId && + pObj->GetOleId() == *pOleId))) + return pObj; + } + + return 0; +} + +/* -----------------03.11.98 15:05------------------- + * + * --------------------------------------------------*/ + +const InsCaptionOpt* SwModuleOptions::GetCapOption( + BOOL bHTML, const SwCapObjType eType, const SvGlobalName *pOleId) +{ + if(bHTML) + { + DBG_ERROR("no caption option in sw/web!"); + return 0; + } + else + { + sal_Bool bFound = FALSE; + if(eType == OLE_CAP && pOleId) + { + for( USHORT nId = 0; nId <= GLOB_NAME_CHART && !bFound; nId++) + bFound = *pOleId == aInsertConfig.aGlobalNames[nId ]; + if(!bFound) + return aInsertConfig.pOLEMiscOpt; + } + return aInsertConfig.pCapOptions->Find(eType, pOleId); + } +} + +/* -----------------03.11.98 15:05------------------- + * + * --------------------------------------------------*/ + +BOOL SwModuleOptions::SetCapOption(BOOL bHTML, const InsCaptionOpt* pOpt) +{ + BOOL bRet = FALSE; + + if(bHTML) + { + DBG_ERROR("no caption option in sw/web!"); + } + else if (pOpt) + { + sal_Bool bFound = FALSE; + if(pOpt->GetObjType() == OLE_CAP && &pOpt->GetOleId()) + { + for( USHORT nId = 0; nId <= GLOB_NAME_CHART; nId++) + bFound = pOpt->GetOleId() == aInsertConfig.aGlobalNames[nId ]; + if(!bFound) + { + if(aInsertConfig.pOLEMiscOpt) + *aInsertConfig.pOLEMiscOpt = *pOpt; + else + aInsertConfig.pOLEMiscOpt = new InsCaptionOpt(*pOpt); + } + } + + InsCaptionOptArr& rArr = *aInsertConfig.pCapOptions; + InsCaptionOpt *pObj = rArr.Find(pOpt->GetObjType(), &pOpt->GetOleId()); + + if (pObj) + { + *pObj = *pOpt; + } + else + rArr.Insert(new InsCaptionOpt(*pOpt)); + + aInsertConfig.SetModified(); + bRet = TRUE; + } + + return bRet; +} +/*-----------------13.01.97 12.44------------------- + +--------------------------------------------------*/ +SwModuleOptions::SwModuleOptions() : + aInsertConfig(FALSE), + aWebInsertConfig(TRUE), + aTableConfig(FALSE), + aWebTableConfig(TRUE), + bHideFieldTips(FALSE) +{ +} +/* -----------------------------19.01.01 12:26-------------------------------- + + ---------------------------------------------------------------------------*/ +String SwModuleOptions::ConvertWordDelimiter(const String& rDelim, BOOL bFromUI) +{ + String sReturn; + if(bFromUI) + { + String sChar; + + xub_StrLen i = 0; + sal_Unicode c; + + while (i < rDelim.Len()) + { + c = rDelim.GetChar(i++); + + if (c == '\\') + { + c = rDelim.GetChar(i++); + + switch (c) + { + case 'n': sReturn += '\n'; break; + case 't': sReturn += '\t'; break; + case '\\': sReturn += '\\'; break; + + case 'x': + { + sal_Unicode nVal, nChar; + BOOL bValidData = TRUE; + xub_StrLen n; + for( n = 0, nChar = 0; n < 2 && i < rDelim.Len(); ++n, ++i ) + { + if( ((nVal = rDelim.GetChar( i )) >= '0') && ( nVal <= '9') ) + nVal -= '0'; + else if( (nVal >= 'A') && (nVal <= 'F') ) + nVal -= 'A' - 10; + else if( (nVal >= 'a') && (nVal <= 'f') ) + nVal -= 'a' - 10; + else + { + DBG_ERROR( "ungueltiger Hex-Wert" ); + bValidData = FALSE; + break; + } + + (nChar <<= 4 ); + nChar = nChar + nVal; + } + if( bValidData ) + sReturn += nChar; + break; + } + + default: // Unbekannt, daher nur Backslash einfuegen + sReturn += '\\'; + i--; + break; + } + } + else + sReturn += c; + } + } + else + { + for (xub_StrLen i = 0; i < rDelim.Len(); i++) + { + sal_Unicode c = rDelim.GetChar(i); + + switch (c) + { + case '\n': sReturn.AppendAscii(RTL_CONSTASCII_STRINGPARAM("\\n")); break; + case '\t': sReturn.AppendAscii(RTL_CONSTASCII_STRINGPARAM("\\t")); break; + case '\\': sReturn.AppendAscii(RTL_CONSTASCII_STRINGPARAM("\\\\")); break; + + default: + if( c <= 0x1f || c >= 0x7f ) + { + sReturn.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\\x" )) + += String::CreateFromInt32( c, 16 ); + } + else + sReturn += c; + } + } + } + return sReturn; +} +/* -----------------------------10.10.00 16:22-------------------------------- + + ---------------------------------------------------------------------------*/ +const Sequence<OUString>& SwRevisionConfig::GetPropertyNames() +{ + static Sequence<OUString> aNames; + if(!aNames.getLength()) + { + const int nCount = 8; + aNames.realloc(nCount); + static const char* aPropNames[] = + { + "TextDisplay/Insert/Attribute", // 0 + "TextDisplay/Insert/Color", // 1 + "TextDisplay/Delete/Attribute", // 2 + "TextDisplay/Delete/Color", // 3 + "TextDisplay/ChangedAttribute/Attribute", // 4 + "TextDisplay/ChangedAttribute/Color", // 5 + "LinesChanged/Mark", // 6 + "LinesChanged/Color" // 7 + }; + OUString* pNames = aNames.getArray(); + for(int i = 0; i < nCount; i++) + pNames[i] = OUString::createFromAscii(aPropNames[i]); + } + return aNames; +} +/*-- 10.10.00 16:22:22--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwRevisionConfig::SwRevisionConfig() : + ConfigItem(C2U("Office.Writer/Revision"), + CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE) +{ + aInsertAttr.nItemId = SID_ATTR_CHAR_UNDERLINE; + aInsertAttr.nAttr = UNDERLINE_SINGLE; + aInsertAttr.nColor = COL_TRANSPARENT; + aDeletedAttr.nItemId = SID_ATTR_CHAR_STRIKEOUT; + aDeletedAttr.nAttr = STRIKEOUT_SINGLE; + aDeletedAttr.nColor = COL_TRANSPARENT; + aFormatAttr.nItemId = SID_ATTR_CHAR_WEIGHT; + aFormatAttr.nAttr = WEIGHT_BOLD; + aFormatAttr.nColor = COL_BLACK; + + Load(); +} +/*-- 10.10.00 16:22:23--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwRevisionConfig::~SwRevisionConfig() +{ +} +/*-- 10.10.00 16:22:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Int32 lcl_ConvertAttrToCfg(const AuthorCharAttr& rAttr) +{ + sal_Int32 nRet = 0; + switch(rAttr.nItemId) + { + case SID_ATTR_CHAR_WEIGHT: nRet = 1; break; + case SID_ATTR_CHAR_POSTURE: nRet = 2; break; + case SID_ATTR_CHAR_UNDERLINE: nRet = UNDERLINE_SINGLE == rAttr.nAttr ? 3 : 4; break; + case SID_ATTR_CHAR_STRIKEOUT: nRet = 3; break; + case SID_ATTR_CHAR_CASEMAP: + { + switch(rAttr.nAttr) + { + case SVX_CASEMAP_VERSALIEN : nRet = 5;break; + case SVX_CASEMAP_GEMEINE : nRet = 6;break; + case SVX_CASEMAP_KAPITAELCHEN: nRet = 7;break; + case SVX_CASEMAP_TITEL : nRet = 8;break; + } + } + break; + case SID_ATTR_BRUSH : nRet = 9; break; + } + return nRet; +} +//----------------------------------------------------------------------------- +void SwRevisionConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + +void SwRevisionConfig::Commit() +{ + const Sequence<OUString>& aNames = GetPropertyNames(); + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + sal_Int32 nVal = -1; + switch(nProp) + { + case 0 : nVal = lcl_ConvertAttrToCfg(aInsertAttr); break; + case 1 : nVal = aInsertAttr.nColor ; break; + case 2 : nVal = lcl_ConvertAttrToCfg(aDeletedAttr); break; + case 3 : nVal = aDeletedAttr.nColor ; break; + case 4 : nVal = lcl_ConvertAttrToCfg(aFormatAttr); break; + case 5 : nVal = aFormatAttr.nColor ; break; + case 6 : nVal = nMarkAlign ; break; + case 7 : nVal = aMarkColor.GetColor(); break; + } + pValues[nProp] <<= nVal; + } + PutProperties(aNames, aValues); +} +/*-- 10.10.00 16:22:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void lcl_ConvertCfgToAttr(sal_Int32 nVal, AuthorCharAttr& rAttr, sal_Bool bDelete = sal_False) +{ + rAttr.nItemId = rAttr.nAttr = 0; + switch(nVal) + { + case 1: rAttr.nItemId = SID_ATTR_CHAR_WEIGHT; rAttr.nAttr = WEIGHT_BOLD ; break; + case 2: rAttr.nItemId = SID_ATTR_CHAR_POSTURE; rAttr.nAttr = ITALIC_NORMAL ; break; + case 3: if(bDelete) + { + rAttr.nItemId = SID_ATTR_CHAR_STRIKEOUT; + rAttr.nAttr = STRIKEOUT_SINGLE; + } + else + { + rAttr.nItemId = SID_ATTR_CHAR_UNDERLINE; + rAttr.nAttr = UNDERLINE_SINGLE; + } + break; + case 4: rAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;rAttr.nAttr = UNDERLINE_DOUBLE ; break; + case 5: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_VERSALIEN ; break; + case 6: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_GEMEINE ; break; + case 7: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_KAPITAELCHEN ; break; + case 8: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_TITEL ; break; + case 9: rAttr.nItemId = SID_ATTR_BRUSH; break; + } +} +void SwRevisionConfig::Load() +{ + const 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_Int32 nVal = 0; + pValues[nProp] >>= nVal; + switch(nProp) + { + case 0 : lcl_ConvertCfgToAttr(nVal, aInsertAttr); break; + case 1 : aInsertAttr.nColor = nVal; break; + case 2 : lcl_ConvertCfgToAttr(nVal, aDeletedAttr, sal_True); break; + case 3 : aDeletedAttr.nColor = nVal; break; + case 4 : lcl_ConvertCfgToAttr(nVal, aFormatAttr); break; + case 5 : aFormatAttr.nColor = nVal; break; + case 6 : nMarkAlign = sal::static_int_cast< sal_uInt16, sal_Int32>(nVal); break; + case 7 : aMarkColor.SetColor(nVal); break; + } + } + } + } +} +/* -----------------------------10.10.00 16:22-------------------------------- + + ---------------------------------------------------------------------------*/ +enum InsertConfigProp +{ + INS_PROP_TABLE_HEADER = 0, + INS_PROP_TABLE_REPEATHEADER, // 1 + INS_PROP_TABLE_BORDER, // 2 + INS_PROP_TABLE_SPLIT, // 3 from here not in writer/web + INS_PROP_CAP_AUTOMATIC, // 4 + INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST, // 5 + INS_PROP_CAP_OBJECT_TABLE_ENABLE, // 6 + INS_PROP_CAP_OBJECT_TABLE_CATEGORY, // 7 + INS_PROP_CAP_OBJECT_TABLE_NUMBERING, // 8 + INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR, // 9 + INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT, //10 + INS_PROP_CAP_OBJECT_TABLE_DELIMITER, //11 + INS_PROP_CAP_OBJECT_TABLE_LEVEL, //12 + INS_PROP_CAP_OBJECT_TABLE_POSITION, //13 + INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE, //14 + INS_PROP_CAP_OBJECT_FRAME_ENABLE, //15 + INS_PROP_CAP_OBJECT_FRAME_CATEGORY, //16 + INS_PROP_CAP_OBJECT_FRAME_NUMBERING, //17 + INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR, //18 + INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT, //19 + INS_PROP_CAP_OBJECT_FRAME_DELIMITER, //20 + INS_PROP_CAP_OBJECT_FRAME_LEVEL, //21 + INS_PROP_CAP_OBJECT_FRAME_POSITION, //22 + INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE, //23 + INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE, //24 + INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY, //25 + INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING, //26 + INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR, //27 + INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT, //28 + INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER, //29 + INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL, //30 + INS_PROP_CAP_OBJECT_GRAPHIC_POSITION, //31 + INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE, //32 + INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES, //33 + INS_PROP_CAP_OBJECT_CALC_ENABLE, //34 + INS_PROP_CAP_OBJECT_CALC_CATEGORY, //35 + INS_PROP_CAP_OBJECT_CALC_NUMBERING, //36 + INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR, //37 + INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT, //38 + INS_PROP_CAP_OBJECT_CALC_DELIMITER, //39 + INS_PROP_CAP_OBJECT_CALC_LEVEL, //40 + INS_PROP_CAP_OBJECT_CALC_POSITION, //41 + INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE, //42 + INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES, //43 + INS_PROP_CAP_OBJECT_IMPRESS_ENABLE, //44 + INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY, //45 + INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING, //46 + INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR, //47 + INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT, //48 + INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER, //49 + INS_PROP_CAP_OBJECT_IMPRESS_LEVEL, //50 + INS_PROP_CAP_OBJECT_IMPRESS_POSITION, //51 + INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE, //52 + INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES, //53 + INS_PROP_CAP_OBJECT_CHART_ENABLE, //54 + INS_PROP_CAP_OBJECT_CHART_CATEGORY, //55 + INS_PROP_CAP_OBJECT_CHART_NUMBERING, //56 + INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR, //57 + INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT, //58 + INS_PROP_CAP_OBJECT_CHART_DELIMITER, //59 + INS_PROP_CAP_OBJECT_CHART_LEVEL, //60 + INS_PROP_CAP_OBJECT_CHART_POSITION, //61 + INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE, //62 + INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES, //63 + INS_PROP_CAP_OBJECT_FORMULA_ENABLE, //64 + INS_PROP_CAP_OBJECT_FORMULA_CATEGORY, //65 + INS_PROP_CAP_OBJECT_FORMULA_NUMBERING, //66 + INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR, //67 + INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT, //68 + INS_PROP_CAP_OBJECT_FORMULA_DELIMITER, //69 + INS_PROP_CAP_OBJECT_FORMULA_LEVEL, //70 + INS_PROP_CAP_OBJECT_FORMULA_POSITION, //71 + INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE, //72 + INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES, //73 + INS_PROP_CAP_OBJECT_DRAW_ENABLE, //74 + INS_PROP_CAP_OBJECT_DRAW_CATEGORY, //75 + INS_PROP_CAP_OBJECT_DRAW_NUMBERING, //76 + INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR, //77 + INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT, //78 + INS_PROP_CAP_OBJECT_DRAW_DELIMITER, //79 + INS_PROP_CAP_OBJECT_DRAW_LEVEL, //80 + INS_PROP_CAP_OBJECT_DRAW_POSITION, //81 + INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE, //82 + INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES, //83 + INS_PROP_CAP_OBJECT_OLEMISC_ENABLE, //84 + INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY, //85 + INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING, //86 + INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR, //87 + INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT, //88 + INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER, //89 + INS_PROP_CAP_OBJECT_OLEMISC_LEVEL, //90 + INS_PROP_CAP_OBJECT_OLEMISC_POSITION, //91 + INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE, //92 + INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES //93 +}; +const Sequence<OUString>& SwInsertConfig::GetPropertyNames() +{ + static Sequence<OUString> aNames; + static Sequence<OUString> aWebNames; + if(!aNames.getLength()) + { + static const char* aPropNames[] = + { + "Table/Header", // 0 + "Table/RepeatHeader", // 1 + "Table/Border", // 2 + "Table/Split", // 3 from here not in writer/web + "Caption/Automatic", // 4 + "Caption/CaptionOrderNumberingFirst", // 5 + "Caption/WriterObject/Table/Enable", // 6 + "Caption/WriterObject/Table/Settings/Category", // 7 + "Caption/WriterObject/Table/Settings/Numbering", // 8 + "Caption/WriterObject/Table/Settings/NumberingSeparator", // 9 + "Caption/WriterObject/Table/Settings/CaptionText", //10 + "Caption/WriterObject/Table/Settings/Delimiter", //11 + "Caption/WriterObject/Table/Settings/Level", //12 + "Caption/WriterObject/Table/Settings/Position", //13 + "Caption/WriterObject/Table/Settings/CharacterStyle", //14 + "Caption/WriterObject/Frame/Enable", //15 + "Caption/WriterObject/Frame/Settings/Category", //16 + "Caption/WriterObject/Frame/Settings/Numbering", //17 + "Caption/WriterObject/Frame/Settings/NumberingSeparator", //18 + "Caption/WriterObject/Frame/Settings/CaptionText", //19 + "Caption/WriterObject/Frame/Settings/Delimiter", //20 + "Caption/WriterObject/Frame/Settings/Level", //21 + "Caption/WriterObject/Frame/Settings/Position", //22 + "Caption/WriterObject/Frame/Settings/CharacterStyle", //23 + "Caption/WriterObject/Graphic/Enable", //24 + "Caption/WriterObject/Graphic/Settings/Category", //25 + "Caption/WriterObject/Graphic/Settings/Numbering", //26 + "Caption/WriterObject/Graphic/Settings/NumberingSeparator", //27 + "Caption/WriterObject/Graphic/Settings/CaptionText", //28 + "Caption/WriterObject/Graphic/Settings/Delimiter", //29 + "Caption/WriterObject/Graphic/Settings/Level", //30 + "Caption/WriterObject/Graphic/Settings/Position", //31 + "Caption/WriterObject/Graphic/Settings/CharacterStyle", //32 + "Caption/WriterObject/Graphic/Settings/ApplyAttributes", //33 + "Caption/OfficeObject/Calc/Enable", //34 + "Caption/OfficeObject/Calc/Settings/Category", //35 + "Caption/OfficeObject/Calc/Settings/Numbering", //36 + "Caption/OfficeObject/Calc/Settings/NumberingSeparator", //37 + "Caption/OfficeObject/Calc/Settings/CaptionText", //38 + "Caption/OfficeObject/Calc/Settings/Delimiter", //39 + "Caption/OfficeObject/Calc/Settings/Level", //40 + "Caption/OfficeObject/Calc/Settings/Position", //41 + "Caption/OfficeObject/Calc/Settings/CharacterStyle", //42 + "Caption/OfficeObject/Calc/Settings/ApplyAttributes", //43 + "Caption/OfficeObject/Impress/Enable", //44 + "Caption/OfficeObject/Impress/Settings/Category", //45 + "Caption/OfficeObject/Impress/Settings/Numbering", //46 + "Caption/OfficeObject/Impress/Settings/NumberingSeparator", //47 + "Caption/OfficeObject/Impress/Settings/CaptionText", //48 + "Caption/OfficeObject/Impress/Settings/Delimiter", //49 + "Caption/OfficeObject/Impress/Settings/Level", //50 + "Caption/OfficeObject/Impress/Settings/Position", //51 + "Caption/OfficeObject/Impress/Settings/CharacterStyle", //52 + "Caption/OfficeObject/Impress/Settings/ApplyAttributes", //53 + "Caption/OfficeObject/Chart/Enable", //54 + "Caption/OfficeObject/Chart/Settings/Category", //55 + "Caption/OfficeObject/Chart/Settings/Numbering", //56 + "Caption/OfficeObject/Chart/Settings/NumberingSeparator", //57 + "Caption/OfficeObject/Chart/Settings/CaptionText", //58 + "Caption/OfficeObject/Chart/Settings/Delimiter", //59 + "Caption/OfficeObject/Chart/Settings/Level", //60 + "Caption/OfficeObject/Chart/Settings/Position", //61 + "Caption/OfficeObject/Chart/Settings/CharacterStyle", //62 + "Caption/OfficeObject/Chart/Settings/ApplyAttributes", //63 + "Caption/OfficeObject/Formula/Enable", //64 + "Caption/OfficeObject/Formula/Settings/Category", //65 + "Caption/OfficeObject/Formula/Settings/Numbering", //66 + "Caption/OfficeObject/Formula/Settings/NumberingSeparator", //67 + "Caption/OfficeObject/Formula/Settings/CaptionText", //68 + "Caption/OfficeObject/Formula/Settings/Delimiter", //69 + "Caption/OfficeObject/Formula/Settings/Level", //70 + "Caption/OfficeObject/Formula/Settings/Position", //71 + "Caption/OfficeObject/Formula/Settings/CharacterStyle", //72 + "Caption/OfficeObject/Formula/Settings/ApplyAttributes", //73 + "Caption/OfficeObject/Draw/Enable", //74 + "Caption/OfficeObject/Draw/Settings/Category", //75 + "Caption/OfficeObject/Draw/Settings/Numbering", //76 + "Caption/OfficeObject/Draw/Settings/NumberingSeparator", //77 + "Caption/OfficeObject/Draw/Settings/CaptionText", //78 + "Caption/OfficeObject/Draw/Settings/Delimiter", //79 + "Caption/OfficeObject/Draw/Settings/Level", //80 + "Caption/OfficeObject/Draw/Settings/Position", //81 + "Caption/OfficeObject/Draw/Settings/CharacterStyle", //82 + "Caption/OfficeObject/Draw/Settings/ApplyAttributes", //83 + "Caption/OfficeObject/OLEMisc/Enable", //84 + "Caption/OfficeObject/OLEMisc/Settings/Category", //85 + "Caption/OfficeObject/OLEMisc/Settings/Numbering", //86 + "Caption/OfficeObject/OLEMisc/Settings/NumberingSeparator", //87 + "Caption/OfficeObject/OLEMisc/Settings/CaptionText", //88 + "Caption/OfficeObject/OLEMisc/Settings/Delimiter", //89 + "Caption/OfficeObject/OLEMisc/Settings/Level", //90 + "Caption/OfficeObject/OLEMisc/Settings/Position", //91 + "Caption/OfficeObject/OLEMisc/Settings/CharacterStyle", //92 + "Caption/OfficeObject/OLEMisc/Settings/ApplyAttributes" //93 + }; + const int nCount = INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES + 1; + const int nWebCount = INS_PROP_TABLE_BORDER + 1; + aNames.realloc(nCount); + aWebNames.realloc(nWebCount); + OUString* pNames = aNames.getArray(); + OUString* pWebNames = aWebNames.getArray(); + int i; + for(i = 0; i < nCount; i++) + pNames[i] = C2U(aPropNames[i]); + for(i = 0; i < nWebCount; i++) + pWebNames[i] = C2U(aPropNames[i]); + } + return bIsWeb ? aWebNames : aNames; +} +/*-- 10.10.00 16:22:22--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwInsertConfig::SwInsertConfig(sal_Bool bWeb) : + ConfigItem(bWeb ? C2U("Office.WriterWeb/Insert") : C2U("Office.Writer/Insert"), + CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE), + pCapOptions(0), + pOLEMiscOpt(0), + bInsWithCaption( sal_False ), + bCaptionOrderNumberingFirst( sal_False ), + aInsTblOpts(0,0), + bIsWeb(bWeb) +{ + aGlobalNames[GLOB_NAME_CALC ] = SvGlobalName(SO3_SC_CLASSID); + aGlobalNames[GLOB_NAME_IMPRESS] = SvGlobalName(SO3_SIMPRESS_CLASSID); + aGlobalNames[GLOB_NAME_DRAW ] = SvGlobalName(SO3_SDRAW_CLASSID); + aGlobalNames[GLOB_NAME_MATH ] = SvGlobalName(SO3_SM_CLASSID); + aGlobalNames[GLOB_NAME_CHART ] = SvGlobalName(SO3_SCH_CLASSID); + if(!bIsWeb) + pCapOptions = new InsCaptionOptArr; + + Load(); +} +/*-- 10.10.00 16:22:23--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwInsertConfig::~SwInsertConfig() +{ + delete pCapOptions; + delete pOLEMiscOpt; +} +/*-- 10.10.00 16:22:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void lcl_WriteOpt(const InsCaptionOpt& rOpt, Any* pValues, sal_Int32 nProp, sal_Int32 nOffset) +{ + switch(nOffset) + { + case 0: + { + sal_Bool bTemp = rOpt.UseCaption(); + pValues[nProp].setValue(&bTemp, ::getBooleanCppuType()); + } + break;//Enable + case 1: pValues[nProp] <<= OUString(rOpt.GetCategory()); break;//Category + case 2: pValues[nProp] <<= (sal_Int32)rOpt.GetNumType(); break;//Numbering", + case 3: pValues[nProp] <<= rOpt.GetNumSeparator(); break;//NumberingSeparator", + case 4: pValues[nProp] <<= OUString(rOpt.GetCaption()); break;//CaptionText", + case 5: pValues[nProp] <<= OUString(rOpt.GetSeparator());break;//Delimiter", + case 6: pValues[nProp] <<= (sal_Int32)rOpt.GetLevel(); break;//Level", + case 7: pValues[nProp] <<= (sal_Int32)rOpt.GetPos(); break;//Position", + case 8: pValues[nProp] <<= (::rtl::OUString&)rOpt.GetCharacterStyle(); break; //CharacterStyle + case 9: pValues[nProp] <<= rOpt.CopyAttributes(); break; //ApplyAttributes + } +} +//----------------------------------------------------------------------------- +void SwInsertConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + +void SwInsertConfig::Commit() +{ + const Sequence<OUString>& aNames = GetPropertyNames(); + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + const InsCaptionOpt* pWriterTableOpt = 0; + const InsCaptionOpt* pWriterFrameOpt = 0; + const InsCaptionOpt* pWriterGraphicOpt = 0; + const InsCaptionOpt* pOLECalcOpt = 0; + const InsCaptionOpt* pOLEImpressOpt = 0; + const InsCaptionOpt* pOLEChartOpt = 0; + const InsCaptionOpt* pOLEFormulaOpt = 0; + const InsCaptionOpt* pOLEDrawOpt = 0; + if(pCapOptions) + { + pWriterTableOpt = pCapOptions->Find(TABLE_CAP, 0); + pWriterFrameOpt = pCapOptions->Find(FRAME_CAP, 0); + pWriterGraphicOpt = pCapOptions->Find(GRAPHIC_CAP, 0); + pOLECalcOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]); + pOLEImpressOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]); + pOLEDrawOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW ]); + pOLEFormulaOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH ]); + pOLEChartOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART ]); + } + switch(nProp) + { + case INS_PROP_TABLE_HEADER: + { + sal_Bool bVal = 0 !=(aInsTblOpts.mnInsMode & tabopts::HEADLINE); pValues[nProp].setValue(&bVal, rType); + } + break;//"Table/Header", + case INS_PROP_TABLE_REPEATHEADER: + { + sal_Bool bVal = (aInsTblOpts.mnRowsToRepeat>0); pValues[nProp].setValue(&bVal, rType); + } + break;//"Table/RepeatHeader", + case INS_PROP_TABLE_BORDER: + { + sal_Bool bVal = 0 !=(aInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER ); pValues[nProp].setValue(&bVal, rType); + } + break;//"Table/Border", + case INS_PROP_TABLE_SPLIT: + { + sal_Bool bVal = 0 !=(aInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT); pValues[nProp].setValue(&bVal, rType); + } + break;//"Table/Split", + case INS_PROP_CAP_AUTOMATIC: pValues[nProp].setValue(&bInsWithCaption, rType);break;//"Caption/Automatic", + case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST: + pValues[nProp] <<= bCaptionOrderNumberingFirst; + break;//"Caption/CaptionOrderNumberingFirst" + + case INS_PROP_CAP_OBJECT_TABLE_ENABLE: + case INS_PROP_CAP_OBJECT_TABLE_CATEGORY: + case INS_PROP_CAP_OBJECT_TABLE_NUMBERING: + case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_TABLE_DELIMITER: + case INS_PROP_CAP_OBJECT_TABLE_LEVEL: + case INS_PROP_CAP_OBJECT_TABLE_POSITION: + case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE: + if(pWriterTableOpt) + lcl_WriteOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE); + break; + case INS_PROP_CAP_OBJECT_FRAME_ENABLE: + case INS_PROP_CAP_OBJECT_FRAME_CATEGORY: + case INS_PROP_CAP_OBJECT_FRAME_NUMBERING: + case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_FRAME_DELIMITER: + case INS_PROP_CAP_OBJECT_FRAME_LEVEL: + case INS_PROP_CAP_OBJECT_FRAME_POSITION: + case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE: + if(pWriterFrameOpt) + lcl_WriteOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE); + break; + case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE: + case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY: + case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING: + case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER: + case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL: + case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION: + case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES: + if(pWriterGraphicOpt) + lcl_WriteOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE); + break; + case INS_PROP_CAP_OBJECT_CALC_ENABLE: + case INS_PROP_CAP_OBJECT_CALC_CATEGORY: + case INS_PROP_CAP_OBJECT_CALC_NUMBERING: + case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_CALC_DELIMITER: + case INS_PROP_CAP_OBJECT_CALC_LEVEL: + case INS_PROP_CAP_OBJECT_CALC_POSITION: + case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES: + if(pOLECalcOpt) + lcl_WriteOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE); + break; + case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE: + case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY: + case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING: + case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER: + case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL: + case INS_PROP_CAP_OBJECT_IMPRESS_POSITION: + case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES: + if(pOLEImpressOpt) + lcl_WriteOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE); + break; + case INS_PROP_CAP_OBJECT_CHART_ENABLE: + case INS_PROP_CAP_OBJECT_CHART_CATEGORY: + case INS_PROP_CAP_OBJECT_CHART_NUMBERING: + case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_CHART_DELIMITER: + case INS_PROP_CAP_OBJECT_CHART_LEVEL: + case INS_PROP_CAP_OBJECT_CHART_POSITION: + case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES: + if(pOLEChartOpt) + lcl_WriteOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE); + break; + case INS_PROP_CAP_OBJECT_FORMULA_ENABLE: + case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY: + case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING: + case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER: + case INS_PROP_CAP_OBJECT_FORMULA_LEVEL: + case INS_PROP_CAP_OBJECT_FORMULA_POSITION: + case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES: + if(pOLEFormulaOpt) + lcl_WriteOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE); + break; + case INS_PROP_CAP_OBJECT_DRAW_ENABLE: + case INS_PROP_CAP_OBJECT_DRAW_CATEGORY: + case INS_PROP_CAP_OBJECT_DRAW_NUMBERING: + case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_DRAW_DELIMITER: + case INS_PROP_CAP_OBJECT_DRAW_LEVEL: + case INS_PROP_CAP_OBJECT_DRAW_POSITION: + case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES: + if(pOLEDrawOpt) + lcl_WriteOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE); + break; + case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE: + case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY: + case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING: + case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER: + case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL: + case INS_PROP_CAP_OBJECT_OLEMISC_POSITION: + case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES: + if(pOLEMiscOpt) + lcl_WriteOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE); + break; + + } + } + PutProperties(aNames, aValues); +} +/*-- 10.10.00 16:22:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void lcl_ReadOpt(InsCaptionOpt& rOpt, const Any* pValues, sal_Int32 nProp, sal_Int32 nOffset) +{ + switch(nOffset) + { + case 0: + rOpt.UseCaption() = *(sal_Bool*)pValues[nProp].getValue(); + break;//Enable + case 1: + { + OUString sTemp; pValues[nProp] >>= sTemp; + rOpt.SetCategory(sTemp); + } + break;//Category + case 2: + { + sal_Int32 nTemp = 0; + pValues[nProp] >>= nTemp; + rOpt.SetNumType(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp)); + } + break;//Numbering", + case 3: + { + OUString sTemp; pValues[nProp] >>= sTemp; + rOpt.SetNumSeparator(sTemp); + } + break;//NumberingSeparator", + case 4: + { + OUString sTemp; pValues[nProp] >>= sTemp; + rOpt.SetCaption(sTemp); + } + break;//CaptionText", + case 5: + { + OUString sTemp; + if(pValues[nProp] >>= sTemp) + rOpt.SetSeparator(sTemp); + } + break;//Delimiter", + case 6: + { + sal_Int32 nTemp = 0; + pValues[nProp] >>= nTemp; + rOpt.SetLevel(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp)); + } + break;//Level", + case 7: + { + sal_Int32 nTemp = 0; + pValues[nProp] >>= nTemp; + rOpt.SetPos(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp)); + } + break;//Position", + case 8 : //CharacterStyle + { + ::rtl::OUString sTemp; pValues[nProp] >>= sTemp; + rOpt.SetCharacterStyle( sTemp ); + } + break; + case 9 : //ApplyAttributes + { + pValues[nProp] >>= rOpt.CopyAttributes(); + } + break; + } +} +//----------------------------------------------------------------------------- +void SwInsertConfig::Load() +{ + const 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()) + { + InsCaptionOpt* pWriterTableOpt = 0; + InsCaptionOpt* pWriterFrameOpt = 0; + InsCaptionOpt* pWriterGraphicOpt = 0; + InsCaptionOpt* pOLECalcOpt = 0; + InsCaptionOpt* pOLEImpressOpt = 0; + InsCaptionOpt* pOLEChartOpt = 0; + InsCaptionOpt* pOLEFormulaOpt = 0; + InsCaptionOpt* pOLEDrawOpt = 0; + if(pCapOptions) + { + pWriterTableOpt = pCapOptions->Find(TABLE_CAP, 0); + pWriterFrameOpt = pCapOptions->Find(FRAME_CAP, 0); + pWriterGraphicOpt = pCapOptions->Find(GRAPHIC_CAP, 0); + pOLECalcOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]); + pOLEImpressOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]); + pOLEDrawOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW ]); + pOLEFormulaOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH ]); + pOLEChartOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART ]); + } + else if(!bIsWeb) + return; + + USHORT nInsTblFlags = 0; + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + if(pValues[nProp].hasValue()) + { + sal_Bool bBool = nProp < INS_PROP_CAP_OBJECT_TABLE_ENABLE ? *(sal_Bool*)pValues[nProp].getValue() : sal_False; + switch(nProp) + { + case INS_PROP_TABLE_HEADER: + { + if(bBool) + nInsTblFlags|= tabopts::HEADLINE; + } + break;//"Table/Header", + case INS_PROP_TABLE_REPEATHEADER: + { + aInsTblOpts.mnRowsToRepeat = bBool? 1 : 0; + + } + break;//"Table/RepeatHeader", + case INS_PROP_TABLE_BORDER: + { + if(bBool) + nInsTblFlags|= tabopts::DEFAULT_BORDER; + } + break;//"Table/Border", + case INS_PROP_TABLE_SPLIT: + { + if(bBool) + nInsTblFlags|= tabopts::SPLIT_LAYOUT; + } + break;//"Table/Split", + case INS_PROP_CAP_AUTOMATIC: + bInsWithCaption = bBool; + break; + case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST: bCaptionOrderNumberingFirst = bBool; break; + case INS_PROP_CAP_OBJECT_TABLE_ENABLE: + case INS_PROP_CAP_OBJECT_TABLE_CATEGORY: + case INS_PROP_CAP_OBJECT_TABLE_NUMBERING: + case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_TABLE_DELIMITER: + case INS_PROP_CAP_OBJECT_TABLE_LEVEL: + case INS_PROP_CAP_OBJECT_TABLE_POSITION: + case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE: + if(!pWriterTableOpt) + { + pWriterTableOpt = new InsCaptionOpt(TABLE_CAP); + pCapOptions->Insert(pWriterTableOpt); + } + lcl_ReadOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE); + break; + case INS_PROP_CAP_OBJECT_FRAME_ENABLE: + case INS_PROP_CAP_OBJECT_FRAME_CATEGORY: + case INS_PROP_CAP_OBJECT_FRAME_NUMBERING: + case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_FRAME_DELIMITER: + case INS_PROP_CAP_OBJECT_FRAME_LEVEL: + case INS_PROP_CAP_OBJECT_FRAME_POSITION: + case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE: + if(!pWriterFrameOpt) + { + pWriterFrameOpt = new InsCaptionOpt(FRAME_CAP); + pCapOptions->Insert(pWriterFrameOpt); + } + lcl_ReadOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE); + break; + case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE: + case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY: + case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING: + case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER: + case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL: + case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION: + case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES: + if(!pWriterGraphicOpt) + { + pWriterGraphicOpt = new InsCaptionOpt(GRAPHIC_CAP); + pCapOptions->Insert(pWriterGraphicOpt); + } + lcl_ReadOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE); + break; + case INS_PROP_CAP_OBJECT_CALC_ENABLE: + case INS_PROP_CAP_OBJECT_CALC_CATEGORY: + case INS_PROP_CAP_OBJECT_CALC_NUMBERING: + case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_CALC_DELIMITER: + case INS_PROP_CAP_OBJECT_CALC_LEVEL: + case INS_PROP_CAP_OBJECT_CALC_POSITION: + case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES: + if(!pOLECalcOpt) + { + pOLECalcOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]); + pCapOptions->Insert(pOLECalcOpt); + } + lcl_ReadOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE); + break; + case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE: + case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY: + case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING: + case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER: + case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL: + case INS_PROP_CAP_OBJECT_IMPRESS_POSITION: + case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES: + if(!pOLEImpressOpt) + { + pOLEImpressOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]); + pCapOptions->Insert(pOLEImpressOpt); + } + lcl_ReadOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE); + break; + case INS_PROP_CAP_OBJECT_CHART_ENABLE: + case INS_PROP_CAP_OBJECT_CHART_CATEGORY: + case INS_PROP_CAP_OBJECT_CHART_NUMBERING: + case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_CHART_DELIMITER: + case INS_PROP_CAP_OBJECT_CHART_LEVEL: + case INS_PROP_CAP_OBJECT_CHART_POSITION: + case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES: + if(!pOLEChartOpt) + { + pOLEChartOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART]); + pCapOptions->Insert(pOLEChartOpt); + } + lcl_ReadOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE); + break; + case INS_PROP_CAP_OBJECT_FORMULA_ENABLE: + case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY: + case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING: + case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER: + case INS_PROP_CAP_OBJECT_FORMULA_LEVEL: + case INS_PROP_CAP_OBJECT_FORMULA_POSITION: + case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES: + if(!pOLEFormulaOpt) + { + pOLEFormulaOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH]); + pCapOptions->Insert(pOLEFormulaOpt); + } + lcl_ReadOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE); + break; + case INS_PROP_CAP_OBJECT_DRAW_ENABLE: + case INS_PROP_CAP_OBJECT_DRAW_CATEGORY: + case INS_PROP_CAP_OBJECT_DRAW_NUMBERING: + case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_DRAW_DELIMITER: + case INS_PROP_CAP_OBJECT_DRAW_LEVEL: + case INS_PROP_CAP_OBJECT_DRAW_POSITION: + case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES: + if(!pOLEDrawOpt) + { + pOLEDrawOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW]); + pCapOptions->Insert(pOLEDrawOpt); + } + lcl_ReadOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE); + break; + case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE: + case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY: + case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING: + case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR: + case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT: + case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER: + case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL: + case INS_PROP_CAP_OBJECT_OLEMISC_POSITION: + case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE: + case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES: + if(!pOLEMiscOpt) + { + pOLEMiscOpt = new InsCaptionOpt(OLE_CAP); + } + lcl_ReadOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE); + break; + } + } + else if(nProp == INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST) + { + //#i61007# initialize caption order, right now only HUNGARIAN seems to need a different order + SvtSysLocaleOptions aSysLocaleOptions; + OUString sLang = aSysLocaleOptions.GetLocaleConfigString(); + bCaptionOrderNumberingFirst = ( sLang.getLength() && sLang.matchAsciiL( "hu", 2 )) ? sal_True : sal_False; + } + + } + aInsTblOpts.mnInsMode = nInsTblFlags; + } +} +/* -----------------------------10.10.00 16:22-------------------------------- + + ---------------------------------------------------------------------------*/ +const Sequence<OUString>& SwTableConfig::GetPropertyNames() +{ + const int nCount = 8; + static Sequence<OUString> aNames(nCount); + static const char* aPropNames[] = + { + "Shift/Row", // 0 + "Shift/Column", // 1 + "Insert/Row", // 2 + "Insert/Column", // 3 + "Change/Effect", // 4 + "Input/NumberRecognition", // 5 + "Input/NumberFormatRecognition",// 6 + "Input/Alignment" // 7 + }; + OUString* pNames = aNames.getArray(); + for(int i = 0; i < nCount; i++) + pNames[i] = OUString::createFromAscii(aPropNames[i]); + return aNames; +} +/*-- 10.10.00 16:22:22--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwTableConfig::SwTableConfig(sal_Bool bWeb) : + ConfigItem(bWeb ? C2U("Office.WriterWeb/Table") : C2U("Office.Writer/Table"), + CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE) +{ + Load(); +} +/*-- 10.10.00 16:22:23--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwTableConfig::~SwTableConfig() +{ +} +/*-- 10.10.00 16:22:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwTableConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + +void SwTableConfig::Commit() +{ + const Sequence<OUString>& aNames = GetPropertyNames(); + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + switch(nProp) + { + case 0 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblHMove); break; //"Shift/Row", + case 1 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblVMove); break; //"Shift/Column", + case 2 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblHInsert); break; //"Insert/Row", + case 3 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblVInsert); break; //"Insert/Column", + case 4 : pValues[nProp] <<= (sal_Int32)eTblChgMode; break; //"Change/Effect", + case 5 : pValues[nProp].setValue(&bInsTblFormatNum, rType); break; //"Input/NumberRecognition", + case 6 : pValues[nProp].setValue(&bInsTblChangeNumFormat, rType); break; //"Input/NumberFormatRecognition", + case 7 : pValues[nProp].setValue(&bInsTblAlignNum, rType); break; //"Input/Alignment" + } + } + PutProperties(aNames, aValues); +} +/*-- 10.10.00 16:22:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwTableConfig::Load() +{ + const 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_Int32 nTemp = 0; + switch(nProp) + { + case 0 : pValues[nProp] >>= nTemp; nTblHMove = (USHORT)MM100_TO_TWIP(nTemp); break; //"Shift/Row", + case 1 : pValues[nProp] >>= nTemp; nTblVMove = (USHORT)MM100_TO_TWIP(nTemp); break; //"Shift/Column", + case 2 : pValues[nProp] >>= nTemp; nTblHInsert = (USHORT)MM100_TO_TWIP(nTemp); break; //"Insert/Row", + case 3 : pValues[nProp] >>= nTemp; nTblVInsert = (USHORT)MM100_TO_TWIP(nTemp); break; //"Insert/Column", + case 4 : pValues[nProp] >>= nTemp; eTblChgMode = (TblChgMode)nTemp; break; //"Change/Effect", + case 5 : bInsTblFormatNum = *(sal_Bool*)pValues[nProp].getValue(); break; //"Input/NumberRecognition", + case 6 : bInsTblChangeNumFormat = *(sal_Bool*)pValues[nProp].getValue(); break; //"Input/NumberFormatRecognition", + case 7 : bInsTblAlignNum = *(sal_Bool*)pValues[nProp].getValue(); break; //"Input/Alignment" + } + } + } + } +} +/*-- 18.01.01 17:02:47--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwMiscConfig::SwMiscConfig() : + ConfigItem(C2U("Office.Writer"), + CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE), + bDefaultFontsInCurrDocOnly(sal_False), + bShowIndexPreview(sal_False), + bGrfToGalleryAsLnk(sal_True), + bNumAlignSize(sal_True), + bSinglePrintJob(sal_False), + bIsNameFromColumn(sal_True), + bAskForMailMergeInPrint(sal_True), + nMailingFormats(0) +{ + Load(); +} +/*-- 18.01.01 17:02:47--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwMiscConfig::~SwMiscConfig() +{ +} +/*-- 18.01.01 17:02:47--------------------------------------------------- + + -----------------------------------------------------------------------*/ +const Sequence<OUString>& SwMiscConfig::GetPropertyNames() +{ + static Sequence<OUString> aNames; + if(!aNames.getLength()) + { + const int nCount = 12; + aNames.realloc(nCount); + static const char* aPropNames[] = + { + "Statistics/WordNumber/Delimiter", // 0 + "DefaultFont/Document", // 1 + "Index/ShowPreview", // 2 + "Misc/GraphicToGalleryAsLink", // 3 + "Numbering/Graphic/KeepRatio", // 4 + "FormLetter/PrintOutput/SinglePrintJobs", // 5 + "FormLetter/MailingOutput/Format", // 6 + "FormLetter/FileOutput/FileName/FromDatabaseField", // 7 + "FormLetter/FileOutput/Path", // 8 + "FormLetter/FileOutput/FileName/FromManualSetting", // 9 + "FormLetter/FileOutput/FileName/Generation",//10 + "FormLetter/PrintOutput/AskForMerge" //11 + }; + OUString* pNames = aNames.getArray(); + for(int i = 0; i < nCount; i++) + pNames[i] = C2U(aPropNames[i]); + } + return aNames; +} +/*-- 18.01.01 17:02:47--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwMiscConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + +void SwMiscConfig::Commit() +{ + const Sequence<OUString>& aNames = GetPropertyNames(); + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + switch(nProp) + { + case 0 : + pValues[nProp] <<= OUString( + SwModuleOptions::ConvertWordDelimiter(sWordDelimiter, sal_False)); + break; + case 1 : pValues[nProp].setValue(&bDefaultFontsInCurrDocOnly, rType); break; + case 2 : pValues[nProp].setValue(&bShowIndexPreview, rType) ; break; + case 3 : pValues[nProp].setValue(&bGrfToGalleryAsLnk, rType); break; + case 4 : pValues[nProp].setValue(&bNumAlignSize, rType); break; + case 5 : pValues[nProp].setValue(&bSinglePrintJob, rType); break; + case 6 : pValues[nProp] <<= nMailingFormats; break; + case 7 : pValues[nProp] <<= OUString(sNameFromColumn); break; + case 8 : pValues[nProp] <<= OUString(sMailingPath); break; + case 9 : pValues[nProp] <<= OUString(sMailName); break; + case 10: pValues[nProp].setValue(&bIsNameFromColumn, rType);break; + case 11: pValues[nProp] <<= bAskForMailMergeInPrint; break; + } + } + PutProperties(aNames, aValues); +} +/*-- 18.01.01 17:02:48--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwMiscConfig::Load() +{ + const 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()) + { + OUString sTmp; + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + if(pValues[nProp].hasValue()) + { + switch(nProp) + { + case 0 : pValues[nProp] >>= sTmp; + sWordDelimiter = SwModuleOptions::ConvertWordDelimiter(sTmp, sal_True); + break; + case 1 : bDefaultFontsInCurrDocOnly = *(sal_Bool*)pValues[nProp].getValue(); break; + case 2 : bShowIndexPreview = *(sal_Bool*)pValues[nProp].getValue(); break; + case 3 : bGrfToGalleryAsLnk = *(sal_Bool*)pValues[nProp].getValue(); break; + case 4 : bNumAlignSize = *(sal_Bool*)pValues[nProp].getValue(); break; + case 5 : bSinglePrintJob = *(sal_Bool*)pValues[nProp].getValue(); break; + case 6 : pValues[nProp] >>= nMailingFormats; ; break; + case 7 : pValues[nProp] >>= sTmp; sNameFromColumn = sTmp; break; + case 8 : pValues[nProp] >>= sTmp; sMailingPath = sTmp; break; + case 9 : pValues[nProp] >>= sTmp; sMailName = sTmp; break; + case 10: bIsNameFromColumn = *(sal_Bool*)pValues[nProp].getValue(); break; + case 11: pValues[nProp] >>= bAskForMailMergeInPrint; break; + } + } + } + } +} diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx new file mode 100644 index 000000000000..49c073103501 --- /dev/null +++ b/sw/source/ui/config/optcomp.cxx @@ -0,0 +1,628 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + +#include "optcomp.hxx" + +#include "docsh.hxx" +#include "swmodule.hxx" +#include "swtypes.hxx" +#include "uiitems.hxx" +#include "view.hxx" +#include "wrtsh.hxx" + +#include "optcomp.hrc" +#include "globals.hrc" +#include <tools/urlobj.hxx> +#ifndef _UTL__HXX_ +#include <unotools/configmgr.hxx> +#endif +#include <vcl/msgbox.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/fcontnr.hxx> +#include <IDocumentSettingAccess.hxx> + +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::document; +using namespace ::com::sun::star::uno; +using ::rtl::OUString; +using namespace ::std; + +#define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM( s ) ) +#define DEFAULT_ENTRY COMPATIBILITY_DEFAULT_NAME +#define USER_ENTRY ASCII_STR( "_user" ) +#define BUTTON_BORDER 2 + +// struct CompatibilityItem ---------------------------------------------- + +struct CompatibilityItem +{ + String m_sName; + String m_sModule; + bool m_bUsePrtMetrics; + bool m_bAddSpacing; + bool m_bAddSpacingAtPages; + bool m_bUseOurTabStops; + bool m_bNoExtLeading; + bool m_bUseLineSpacing; + bool m_bAddTableSpacing; + bool m_bUseObjPos; + bool m_bUseOurTextWrapping; + bool m_bConsiderWrappingStyle; + bool m_bExpandWordSpace; + bool m_bIsDefault; + bool m_bIsUser; + + CompatibilityItem( const String& _rName, const String& _rModule, + bool _bUsePrtMetrics, bool _bAddSpacing, bool _bAddSpacingAtPages, + bool _bUseOurTabStops, bool _bNoExtLeading, bool _bUseLineSpacing, + bool _bAddTableSpacing, bool _bUseObjPos, bool _bUseOurTextWrapping, + bool _bConsiderWrappingStyle, bool _bExpandWordSpace, + bool _bIsDefault, bool _bIsUser ) : + + m_sName ( _rName ), + m_sModule ( _rModule ), + m_bUsePrtMetrics ( _bUsePrtMetrics ), + m_bAddSpacing ( _bAddSpacing ), + m_bAddSpacingAtPages ( _bAddSpacingAtPages ), + m_bUseOurTabStops ( _bUseOurTabStops ), + m_bNoExtLeading ( _bNoExtLeading ), + m_bUseLineSpacing ( _bUseLineSpacing ), + m_bAddTableSpacing ( _bAddTableSpacing ), + m_bUseObjPos ( _bUseObjPos ), + m_bUseOurTextWrapping ( _bUseOurTextWrapping ), + m_bConsiderWrappingStyle( _bConsiderWrappingStyle ), + m_bExpandWordSpace ( _bExpandWordSpace ), + m_bIsDefault ( _bIsDefault ), + m_bIsUser ( _bIsUser ) {} +}; + +#include <vector> + +struct SwCompatibilityOptPage_Impl +{ + typedef vector< CompatibilityItem > SwCompatibilityItemList; + + SwCompatibilityItemList m_aList; +}; + +// class SwCompatibilityOptPage ------------------------------------------ + +SwCompatibilityOptPage::SwCompatibilityOptPage( Window* pParent, const SfxItemSet& rSet ) : + + SfxTabPage( pParent, SW_RES( TP_OPTCOMPATIBILITY_PAGE ), rSet ), + + m_aMainFL ( this, SW_RES( FL_MAIN ) ), + m_aFormattingFT ( this, SW_RES( FT_FORMATTING ) ), + m_aFormattingLB ( this, SW_RES( LB_FORMATTING ) ), + m_aOptionsFT ( this, SW_RES( FT_OPTIONS ) ), + m_aOptionsLB ( this, SW_RES( LB_OPTIONS ) ), + m_aResetPB ( this, SW_RES( PB_RESET ) ), + m_aDefaultPB ( this, SW_RES( PB_DEFAULT ) ), + m_sUserEntry ( SW_RES( STR_USERENTRY ) ), + m_sUseAsDefaultQuery( SW_RES( STR_QRYBOX_USEASDEFAULT ) ), + m_pWrtShell ( NULL ), + m_pImpl ( new SwCompatibilityOptPage_Impl ), + m_nSavedOptions ( 0 ) + +{ + // init options strings with local resource ids -> so do it before FreeResource() + for ( USHORT nResId = STR_COMP_OPTIONS_START; nResId < STR_COMP_OPTIONS_END; ++nResId ) + { + String sEntry = String( SW_RES( nResId ) ); + if ( STR_TAB_ALIGNMENT == nResId || + STR_LINE_SPACING == nResId || + STR_USE_OBJPOSITIONING == nResId || + STR_USE_OURTEXTWRAPPING == nResId ) + ReplaceFormatName( sEntry ); + SvLBoxEntry* pEntry = m_aOptionsLB.SvTreeListBox::InsertEntry( sEntry ); + if ( pEntry ) + { + m_aOptionsLB.SetCheckButtonState( pEntry, SV_BUTTON_UNCHECKED ); + pEntry->SetUserData( (void*)(ULONG)nResId ); + } + } + m_aOptionsLB.SetWindowBits( m_aOptionsLB.GetStyle() | WB_HSCROLL | WB_HIDESELECTION ); + m_aOptionsLB.SetHighlightRange(); + + FreeResource(); + + InitControls( rSet ); + + // set handler + m_aFormattingLB.SetSelectHdl( LINK( this, SwCompatibilityOptPage, SelectHdl ) ); + m_aDefaultPB.SetClickHdl( LINK( this, SwCompatibilityOptPage, UseAsDefaultHdl ) ); + + // hide some controls, will be implemented later!!! + m_aFormattingFT.Hide(); + m_aFormattingLB.Hide(); + m_aResetPB.Hide(); + // so move and resize the other controls + Point aMovePnt = m_aFormattingFT.GetPosPixel(); + Point aNewPnt = m_aOptionsFT.GetPosPixel(); + aNewPnt.Y() = aMovePnt.Y(); + m_aOptionsFT.SetPosPixel( aNewPnt ); + aMovePnt = m_aFormattingLB.GetPosPixel(); + aNewPnt = m_aOptionsLB.GetPosPixel(); + long nDelta = aNewPnt.Y() - aMovePnt.Y(); + aNewPnt.Y() = aMovePnt.Y(); + m_aOptionsLB.SetPosPixel( aNewPnt ); + Size aNewSz = m_aOptionsLB.GetSizePixel(); + aNewSz.Height() += nDelta; + m_aOptionsLB.SetSizePixel( aNewSz ); +} + +// ----------------------------------------------------------------------- + +SwCompatibilityOptPage::~SwCompatibilityOptPage() +{ + delete m_pImpl; +} + +// ----------------------------------------------------------------------- + +void SwCompatibilityOptPage::ReplaceFormatName( String& rEntry ) +{ + static const String sOpenOfficeName = String::CreateFromAscii("OpenOffice.org"); + static const String sAsianName = String::CreateFromAscii("StarSuite"); + + Any aAny = ::utl::ConfigManager:: + GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); + rtl::OUString sTmp; + if ( aAny >>= sTmp ) + { + String sFormatName = sTmp; + String sFormatVersion; + bool bOpenOffice = ( sOpenOfficeName == sFormatName ); + if ( bOpenOffice ) + sFormatVersion = String::CreateFromAscii("1.1"); + else + sFormatVersion = String::CreateFromAscii("6.0/7"); + if ( !bOpenOffice && ( sAsianName != sFormatName ) ) + sFormatName = String::CreateFromAscii("StarOffice"); + + rEntry.SearchAndReplace( String::CreateFromAscii("%FORMATNAME"), sFormatName ); + rEntry.SearchAndReplace( String::CreateFromAscii("%FORMATVERSION"), sFormatVersion ); + } +} + +// ----------------------------------------------------------------------- + +ULONG convertBools2Ulong_Impl +( + bool _bUsePrtMetrics, + bool _bAddSpacing, + bool _bAddSpacingAtPages, + bool _bUseOurTabStops, + bool _bNoExtLeading, + bool _bUseLineSpacing, + bool _bAddTableSpacing, + bool _bUseObjPos, + bool _bUseOurTextWrapping, + bool _bConsiderWrappingStyle, + bool _bExpandWordSpace +) +{ + ULONG nRet = 0; + ULONG nSetBit = 1; + + if ( _bUsePrtMetrics ) + nRet |= nSetBit; + nSetBit = nSetBit << 1; + if ( _bAddSpacing ) + nRet |= nSetBit; + nSetBit = nSetBit << 1; + if ( _bAddSpacingAtPages ) + nRet |= nSetBit; + nSetBit = nSetBit << 1; + if ( _bUseOurTabStops ) + nRet |= nSetBit; + nSetBit = nSetBit << 1; + if ( _bNoExtLeading ) + nRet |= nSetBit; + nSetBit = nSetBit << 1; + if ( _bUseLineSpacing ) + nRet |= nSetBit; + nSetBit = nSetBit << 1; + if ( _bAddTableSpacing ) + nRet |= nSetBit; + nSetBit = nSetBit << 1; + if ( _bUseObjPos ) + nRet |= nSetBit; + nSetBit = nSetBit << 1; + if ( _bUseOurTextWrapping ) + nRet |= nSetBit; + nSetBit = nSetBit << 1; + if ( _bConsiderWrappingStyle ) + nRet |= nSetBit; + nSetBit = nSetBit << 1; + if ( _bExpandWordSpace ) + nRet |= nSetBit; + + return nRet; +} + +// ----------------------------------------------------------------------- + +void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet ) +{ + // init objectshell and detect document name + String sDocTitle; + const SfxPoolItem* pItem = NULL; + SfxObjectShell* pObjShell = NULL; + if ( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_WRTSHELL, FALSE, &pItem ) ) + m_pWrtShell = (SwWrtShell*)( (const SwPtrItem*)pItem )->GetValue(); + if ( m_pWrtShell ) + { + pObjShell = m_pWrtShell->GetView().GetDocShell(); + if ( pObjShell ) + sDocTitle = pObjShell->GetTitle( SFX_TITLE_TITLE ); + } + else + { + m_aMainFL.Disable(); + m_aFormattingFT.Disable(); + m_aFormattingLB.Disable(); + m_aOptionsFT.Disable(); + m_aOptionsLB.Disable(); + m_aResetPB.Disable(); + m_aDefaultPB.Disable(); + } + String sText = m_aMainFL.GetText(); + sText.SearchAndReplace( String::CreateFromAscii("%DOCNAME"), sDocTitle ); + m_aMainFL.SetText( sText ); + + // loading file formats + Sequence< Sequence< PropertyValue > > aList = m_aConfigItem.GetList(); + OUString sName; + OUString sModule; + bool bUsePrtMetrics = false; + bool bAddSpacing = false; + bool bAddSpacingAtPages = false; + bool bUseOurTabStops = false; + bool bNoExtLeading = false; + bool bUseLineSpacing = false; + bool bAddTableSpacing = false; + bool bUseObjPos = false; + bool bUseOurTextWrapping = false; + bool bConsiderWrappingStyle = false; + bool bExpandWordSpace = false; + int i, j, nCount = aList.getLength(); + for ( i = 0; i < nCount; ++i ) + { + String sNewEntry; + const Sequence< PropertyValue >& rEntry = aList[i]; + for ( j = 0; j < rEntry.getLength(); j++ ) + { + PropertyValue aValue = rEntry[j]; + if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_NAME ) + aValue.Value >>= sName; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_MODULE ) + aValue.Value >>= sModule; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS ) + aValue.Value >>= bUsePrtMetrics; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDSPACING ) + aValue.Value >>= bAddSpacing; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES ) + aValue.Value >>= bAddSpacingAtPages; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS ) + aValue.Value >>= bUseOurTabStops; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_NOEXTLEADING ) + aValue.Value >>= bNoExtLeading; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USELINESPACING ) + aValue.Value >>= bUseLineSpacing; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING ) + aValue.Value >>= bAddTableSpacing; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING ) + aValue.Value >>= bUseObjPos; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING ) + aValue.Value >>= bUseOurTextWrapping; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE ) + aValue.Value >>= bConsiderWrappingStyle; + else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE ) + aValue.Value >>= bExpandWordSpace; + } + + CompatibilityItem aItem( + sName, sModule, bUsePrtMetrics, bAddSpacing, + bAddSpacingAtPages, bUseOurTabStops, bNoExtLeading, + bUseLineSpacing, bAddTableSpacing, bUseObjPos, + bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace, + ( sName.equals( DEFAULT_ENTRY ) != sal_False ), + ( sName.equals( USER_ENTRY ) != sal_False ) ); + m_pImpl->m_aList.push_back( aItem ); + + if ( aItem.m_bIsDefault ) + continue; + + if ( sName.equals( USER_ENTRY ) ) + sNewEntry = m_sUserEntry; + else if ( pObjShell && sName.getLength() > 0 ) + { + SfxFilterContainer* pFacCont = pObjShell->GetFactory().GetFilterContainer(); + const SfxFilter* pFilter = pFacCont->GetFilter4FilterName( sName ); + if ( pFilter ) + sNewEntry = pFilter->GetUIName(); + } + + if ( sNewEntry.Len() == 0 ) + sNewEntry = sName; + + USHORT nPos = m_aFormattingLB.InsertEntry( sNewEntry ); + ULONG nOptions = convertBools2Ulong_Impl( + bUsePrtMetrics, bAddSpacing, bAddSpacingAtPages, + bUseOurTabStops, bNoExtLeading, bUseLineSpacing, + bAddTableSpacing, bUseObjPos, bUseOurTextWrapping, + bConsiderWrappingStyle, bExpandWordSpace ); + m_aFormattingLB.SetEntryData( nPos, (void*)(long)nOptions ); + } + + m_aFormattingLB.SetDropDownLineCount( m_aFormattingLB.GetEntryCount() ); + + // check if the default button text is not too wide otherwise we have to stretch the button + // and move its position and the position of the reset button + long nTxtWidth = m_aDefaultPB.GetTextWidth( m_aDefaultPB.GetText() ); + Size aBtnSz = m_aDefaultPB.GetSizePixel(); + if ( nTxtWidth > aBtnSz.Width() ) + { + long nDelta = nTxtWidth - aBtnSz.Width() + 2 * BUTTON_BORDER; + aBtnSz.Width() += nDelta; + Point aBtnPnt = m_aDefaultPB.GetPosPixel(); + aBtnPnt.X() -= nDelta; + m_aDefaultPB.SetPosSizePixel( aBtnPnt, aBtnSz ); + aBtnPnt = m_aResetPB.GetPosPixel(); + aBtnPnt.X() -= 2 * nDelta; + m_aResetPB.SetPosSizePixel( aBtnPnt, aBtnSz ); + } +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SwCompatibilityOptPage, SelectHdl, ListBox*, EMPTYARG ) +{ + USHORT nPos = m_aFormattingLB.GetSelectEntryPos(); + ULONG nOptions = (ULONG)(void*)m_aFormattingLB.GetEntryData( nPos ); + SetCurrentOptions( nOptions ); + + return 0; +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SwCompatibilityOptPage, UseAsDefaultHdl, PushButton*, EMPTYARG ) +{ + QueryBox aBox( this, WinBits( WB_YES_NO | WB_DEF_YES ), m_sUseAsDefaultQuery ); + if ( aBox.Execute() == RET_YES ) + { + for ( vector< CompatibilityItem >::iterator pItem = m_pImpl->m_aList.begin(); + pItem != m_pImpl->m_aList.end(); ++pItem ) + { + if ( pItem->m_bIsDefault ) + { + USHORT nCount = static_cast< USHORT >( m_aOptionsLB.GetEntryCount() ); + for ( USHORT i = 0; i < nCount; ++i ) + { + bool bChecked = ( m_aOptionsLB.IsChecked(i) != FALSE ); + CompatibilityOptions eOption = static_cast< CompatibilityOptions >(i); + switch ( eOption ) + { + case COPT_USE_PRINTERDEVICE : pItem->m_bUsePrtMetrics = bChecked; break; + case COPT_ADD_SPACING : pItem->m_bAddSpacing = bChecked; break; + case COPT_ADD_SPACING_AT_PAGES : pItem->m_bAddSpacingAtPages = bChecked; break; + case COPT_USE_OUR_TABSTOPS : pItem->m_bUseOurTabStops = bChecked; break; + case COPT_NO_EXTLEADING : pItem->m_bNoExtLeading = bChecked; break; + case COPT_USE_LINESPACING : pItem->m_bUseLineSpacing = bChecked; break; + case COPT_ADD_TABLESPACING : pItem->m_bAddTableSpacing = bChecked; break; + case COPT_USE_OBJECTPOSITIONING: pItem->m_bUseObjPos = bChecked; break; + case COPT_USE_OUR_TEXTWRAPPING: pItem->m_bUseOurTextWrapping = bChecked; break; + case COPT_CONSIDER_WRAPPINGSTYLE: pItem->m_bConsiderWrappingStyle = bChecked; break; + case COPT_EXPAND_WORDSPACE: pItem->m_bExpandWordSpace = bChecked; break; + default: + { + DBG_ERRORFILE( "SwCompatibilityOptPage::UseAsDefaultHdl(): wrong option" ); + } + } + } + break; + } + } + + WriteOptions(); + } + + return 0; +} + +// ----------------------------------------------------------------------- + +void SwCompatibilityOptPage::SetCurrentOptions( ULONG nOptions ) +{ + ULONG nCount = m_aOptionsLB.GetEntryCount(); + DBG_ASSERT( nCount <= 32, "SwCompatibilityOptPage::Reset(): entry overflow" ); + for ( USHORT i = 0; i < nCount; ++i ) + { + BOOL bChecked = ( ( nOptions & 0x00000001 ) == 0x00000001 ); + m_aOptionsLB.CheckEntryPos( i, bChecked ); + nOptions = nOptions >> 1; + } +} + +// ----------------------------------------------------------------------- + +ULONG SwCompatibilityOptPage::GetDocumentOptions() const +{ + ULONG nRet = 0; + if ( m_pWrtShell ) + { + const IDocumentSettingAccess& rIDocumentSettingAccess = *m_pWrtShell->getIDocumentSettingAccess(); + nRet = convertBools2Ulong_Impl( + rIDocumentSettingAccess.get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) == sal_False, + rIDocumentSettingAccess.get(IDocumentSettingAccess::PARA_SPACE_MAX) != sal_False, + rIDocumentSettingAccess.get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES) != sal_False, + rIDocumentSettingAccess.get(IDocumentSettingAccess::TAB_COMPAT) == sal_False, + rIDocumentSettingAccess.get(IDocumentSettingAccess::ADD_EXT_LEADING) == sal_False, + rIDocumentSettingAccess.get(IDocumentSettingAccess::OLD_LINE_SPACING) != sal_False, + rIDocumentSettingAccess.get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS) != sal_False, + rIDocumentSettingAccess.get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS) != sal_False, + rIDocumentSettingAccess.get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING) != sal_False, + rIDocumentSettingAccess.get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) != sal_False, + rIDocumentSettingAccess.get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) != sal_True ); + } + return nRet; +} + +// ----------------------------------------------------------------------- + +void SwCompatibilityOptPage::WriteOptions() +{ + m_aConfigItem.Clear(); + for ( vector< CompatibilityItem >::const_iterator pItem = m_pImpl->m_aList.begin(); + pItem != m_pImpl->m_aList.end(); ++pItem ) + m_aConfigItem.AppendItem( + pItem->m_sName, pItem->m_sModule, pItem->m_bUsePrtMetrics, pItem->m_bAddSpacing, + pItem->m_bAddSpacingAtPages, pItem->m_bUseOurTabStops, + pItem->m_bNoExtLeading, pItem->m_bUseLineSpacing, + pItem->m_bAddTableSpacing, pItem->m_bUseObjPos, + pItem->m_bUseOurTextWrapping, pItem->m_bConsiderWrappingStyle, + pItem->m_bExpandWordSpace ); +} + +// ----------------------------------------------------------------------- + +SfxTabPage* SwCompatibilityOptPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) +{ + return new SwCompatibilityOptPage( pParent, rAttrSet ); +} + +// ----------------------------------------------------------------------- + +BOOL SwCompatibilityOptPage::FillItemSet( SfxItemSet& ) +{ + BOOL bModified = FALSE; + if ( m_pWrtShell ) + { + ULONG nSavedOptions = m_nSavedOptions; + ULONG nCount = m_aOptionsLB.GetEntryCount(); + DBG_ASSERT( nCount <= 32, "SwCompatibilityOptPage::Reset(): entry overflow" ); + + bool bSetParaSpaceMax = false; + + for ( USHORT i = 0; i < nCount; ++i ) + { + CompatibilityOptions nOption = static_cast< CompatibilityOptions >(i); + BOOL bChecked = m_aOptionsLB.IsChecked(i); + BOOL bSavedChecked = ( ( nSavedOptions & 0x00000001 ) == 0x00000001 ); + if ( bChecked != bSavedChecked ) + { + if ( COPT_USE_PRINTERDEVICE == nOption ) + { + m_pWrtShell->SetUseVirDev( !bChecked ); + bModified = TRUE; + } + else if ( ( COPT_ADD_SPACING == nOption || COPT_ADD_SPACING_AT_PAGES == nOption ) && !bSetParaSpaceMax ) + bSetParaSpaceMax = true; + else if ( COPT_USE_OUR_TABSTOPS == nOption ) + { + m_pWrtShell->SetTabCompat( !bChecked ); + bModified = TRUE; + } + else if ( COPT_NO_EXTLEADING == nOption ) + { + m_pWrtShell->SetAddExtLeading( !bChecked ); + bModified = TRUE; + } + else if ( COPT_USE_LINESPACING == nOption ) + { + m_pWrtShell->SetUseFormerLineSpacing( bChecked ); + bModified = TRUE; + } + else if ( COPT_ADD_TABLESPACING == nOption ) + { + m_pWrtShell->SetAddParaSpacingToTableCells( bChecked ); + bModified = TRUE; + } + else if ( COPT_ADD_TABLESPACING == nOption ) + { + m_pWrtShell->SetAddParaSpacingToTableCells( bChecked ); + bModified = TRUE; + } + else if ( COPT_USE_OBJECTPOSITIONING == nOption ) + { + m_pWrtShell->SetUseFormerObjectPositioning( bChecked ); + bModified = TRUE; + } + else if ( COPT_USE_OUR_TEXTWRAPPING == nOption ) + { + m_pWrtShell->SetUseFormerTextWrapping( bChecked ); + bModified = TRUE; + } + else if ( COPT_CONSIDER_WRAPPINGSTYLE == nOption ) + { + m_pWrtShell->SetConsiderWrapOnObjPos( bChecked ); + bModified = TRUE; + } + else if ( COPT_EXPAND_WORDSPACE == nOption ) + { + m_pWrtShell->SetDoNotJustifyLinesWithManualBreak( !bChecked ); + bModified = TRUE; + } + } + + nSavedOptions = nSavedOptions >> 1; + } + + if ( bSetParaSpaceMax ) + { + m_pWrtShell->SetParaSpaceMax( m_aOptionsLB.IsChecked( (USHORT)COPT_ADD_SPACING ) ); + m_pWrtShell->SetParaSpaceMaxAtPages( m_aOptionsLB.IsChecked( (USHORT)COPT_ADD_SPACING_AT_PAGES ) ); + bModified = TRUE; + } + } + + if ( bModified ) + WriteOptions(); + + return bModified; +} + +// ----------------------------------------------------------------------- + +void SwCompatibilityOptPage::Reset( const SfxItemSet& ) +{ + m_aOptionsLB.SelectEntryPos( 0 ); + + ULONG nOptions = GetDocumentOptions(); + SetCurrentOptions( nOptions ); + m_nSavedOptions = nOptions; +} + diff --git a/sw/source/ui/config/optcomp.hrc b/sw/source/ui/config/optcomp.hrc new file mode 100644 index 000000000000..4219724a9106 --- /dev/null +++ b/sw/source/ui/config/optcomp.hrc @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// the controls + +#define FL_MAIN 10 +#define FT_FORMATTING 11 +#define LB_FORMATTING 12 +#define FT_OPTIONS 13 +#define LB_OPTIONS 14 +#define PB_RESET 15 +#define PB_DEFAULT 16 + +// the option strings + +#define STR_USERENTRY 10 +#define STR_QRYBOX_USEASDEFAULT 11 + +#define STR_COMP_OPTIONS_START 100 +#define STR_PRINTER_METRICS (STR_COMP_OPTIONS_START + 0) +#define STR_MERGE_PARA_DIST (STR_COMP_OPTIONS_START + 1) +#define STR_MERGE_PARA_DIST_PAGESTART (STR_COMP_OPTIONS_START + 2) +#define STR_TAB_ALIGNMENT (STR_COMP_OPTIONS_START + 3) +#define STR_EXTERNAL_LEADING (STR_COMP_OPTIONS_START + 4) +#define STR_LINE_SPACING (STR_COMP_OPTIONS_START + 5) +#define STR_ADD_TABLESPACING (STR_COMP_OPTIONS_START + 6) +#define STR_USE_OBJPOSITIONING (STR_COMP_OPTIONS_START + 7) +#define STR_USE_OURTEXTWRAPPING (STR_COMP_OPTIONS_START + 8) +#define STR_CONSIDER_WRAPPINGSTYLE (STR_COMP_OPTIONS_START + 9) +#define STR_EXPAND_WORDSPACE (STR_COMP_OPTIONS_START + 10) +#define STR_COMP_OPTIONS_END (STR_EXPAND_WORDSPACE + 1) + diff --git a/sw/source/ui/config/optcomp.src b/sw/source/ui/config/optcomp.src new file mode 100644 index 000000000000..927eadc183a1 --- /dev/null +++ b/sw/source/ui/config/optcomp.src @@ -0,0 +1,140 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "optcomp.hrc" +#include "globals.hrc" +#include "helpid.h" + +// TabPage TP_OPTCOMPATIBILITY_PAGE -------------------------------------- + +TabPage TP_OPTCOMPATIBILITY_PAGE +{ + HelpID = HID_OPTCOMPATIBILITY_PAGE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_MAIN + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Compatibility options for %DOCNAME"; + }; + FixedText FT_FORMATTING + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 236 , 8 ) ; + Text [ en-US ] = "Recommended ~formatting options for"; + }; + ListBox LB_FORMATTING + { + Pos = MAP_APPFONT ( 12 , 25 ) ; + Size = MAP_APPFONT ( 118 , 24 ) ; + DropDown = TRUE; + }; + FixedText FT_OPTIONS + { + Pos = MAP_APPFONT ( 12 , 40 ) ; + Size = MAP_APPFONT ( 236 , 8 ) ; + Text [ en-US ] = "~Options"; + }; + Control LB_OPTIONS + { + HelpId = HID_COMPATIBILITY_OPTIONS_BOX ; + Pos = MAP_APPFONT ( 12 , 51 ) ; + Size = MAP_APPFONT ( 236 , 108 ) ; + Border = TRUE ; + TabStop = TRUE ; + }; + PushButton PB_RESET + { + Pos = MAP_APPFONT ( 125 , 165 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + Text [ en-US ] = "~Reset"; + }; + PushButton PB_DEFAULT + { + Pos = MAP_APPFONT ( 188 , 165 ) ; + Size = MAP_APPFONT ( 60 , 14 ) ; + Text [ en-US ] = "Use as ~Default"; + }; + + String STR_USERENTRY + { + Text [ en-US ] = "<User settings>"; + }; + + String STR_QRYBOX_USEASDEFAULT + { + Text [ en-US ] = "Do you want to change the compatibility options of the default template?\nThis will affect all new documents based on the default template."; + }; + +// the option strings ---------------------------------------------------- + + String STR_PRINTER_METRICS + { + Text [ en-US ] = "Use printer metrics for document formatting"; + }; + String STR_MERGE_PARA_DIST + { + Text [ en-US ] = "Add spacing between paragraphs and tables (in current document)"; + }; + String STR_MERGE_PARA_DIST_PAGESTART + { + Text [ en-US ] = "Add paragraph and table spacing at tops of pages (in current document)"; + }; + String STR_TAB_ALIGNMENT + { + Text [ en-US ] = "Use %WRITERCOMPATIBILITYVERSIONOOO11 tabstop formatting"; + }; + String STR_EXTERNAL_LEADING + { + Text [ en-US ] = "Do not add leading (extra space) between lines of text"; + }; + String STR_LINE_SPACING + { + Text [ en-US ] = "Use %WRITERCOMPATIBILITYVERSIONOOO11 line spacing"; + }; + String STR_ADD_TABLESPACING + { + Text [ en-US ] = "Add paragraph and table spacing at bottom of table cells"; + }; + String STR_USE_OBJPOSITIONING + { + Text [ en-US ] = "Use %WRITERCOMPATIBILITYVERSIONOOO11 object positioning"; + }; + String STR_USE_OURTEXTWRAPPING + { + Text [ en-US ] = "Use %WRITERCOMPATIBILITYVERSIONOOO11 text wrapping around objects"; + }; + String STR_CONSIDER_WRAPPINGSTYLE + { + Text [ en-US ] = "Consider wrapping style when positioning objects"; + }; + String STR_EXPAND_WORDSPACE + { + Text [ en-US ] = "Expand word space on lines with manual line breaks in justified paragraphs"; + }; +}; diff --git a/sw/source/ui/config/optdlg.hrc b/sw/source/ui/config/optdlg.hrc new file mode 100644 index 000000000000..4162b656d7e5 --- /dev/null +++ b/sw/source/ui/config/optdlg.hrc @@ -0,0 +1,205 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +/* TabPage Ansicht*/ +#define FL_DISP 1 +#define FL_NOPRINT 2 +#define FL_WINDOW 3 + +#define CB_GRF 1 +#define CB_TBL 2 +#define CB_DRWFAST 3 +#define CB_FIELD 4 +#define CB_PARA 5 +#define CB_TAB 6 +#define CB_SPACE 7 +#define CB_HSPACE 8 +#define CB_SHYPH 9 +#define CB_FLD_HIDDEN 10 +#define CB_BREAK 11 +#define CB_ANY_RULER 12 +#define CB_CROSS 14 +#define CB_HSCROLL 15 +#define CB_VSCROLL 16 +#define CB_HRULER 17 +#define CB_VRULER 18 +#define FL_LINE 22 +#define CB_POSTIT 23 +#define CB_VRULER_RIGHT 24 +#define CB_BIGHANDLE 25 + +#define FL_SETTINGS 26 +#define LB_METRIC 27 +#define FT_METRIC 28 + +//test tab page +#define CB_TEST1 25 +#define CB_TEST2 26 +#define CB_TEST3 27 +#define CB_TEST4 28 +#define CB_TEST5 29 +#define CB_TEST6 30 +#define CB_TEST7 31 +#define CB_TEST8 32 +#define CB_TEST9 33 +#define CB_TEST10 34 +#define FL_TEST 35 + +#define CB_FLD_HIDDEN_PARA 36 //Mittendrin, damit die HelpIds zum FPII kompatibel bleiben +#define CB_SMOOTH_SCROLL 37 + +#define BT_OK 38 +#define BT_CANCEL 39 +#define BT_MORE 40 +#define BT_GRID 41 +#define MF_HFRAME 42 +#define MF_VFRAME 43 + +#define CB_INDEX 44 + +#define LB_COLOR 50 +#define WIN_COLOR 52 +#define ED_COLORNAME 53 +#define BT_EDIT 55 +#define BT_NEW 56 +#define BT_DELETE 57 +#define BT_DEFAULT 58 +#define CB_HANDLE 59 +#define CB_SECT_BOUNDS 60 +#define CB_CHAR_HIDDEN 61 +// Print-Extra-Page +#define CB_PGRF 61 +//#define CB_PTAB 62 merged with CB_PGRF in printerpullpages +//#define CB_PDRAW 63 removed in printerpullpages +#define CB_LEFTP 64 +#define CB_RIGHTP 65 +//#define CB_REVERSE 66 removed in printerpullpages +#define CB_PROSPECT 67 +//#define CB_SINGLEJOBS 68 removed in printerpullpages +#define CB_CTRLFLD 69 +#define CB_PAPERFROMSETUP 70 +#define FL_1 71 +#define FL_2 72 +#define FL_3 73 +#define FL_4 74 +#define FT_FAX 76 +#define CB_BACKGROUND 79 + +#define RB_NO 80 +#define RB_ONLY 81 +#define RB_END 82 +#define RB_PAGEEND 83 +#define ST_NONE 84 +#define LB_FAX 86 +#define CB_BLACK_FONT 87 +#define LB_HMETRIC 88 +#define LB_VMETRIC 89 +#define FL_SEP_PRT_LEFT 90 +#define FL_SEP_PRT_RIGHT 91 +#define CB_PRINTEMPTYPAGES 92 +#define CB_HIDDEN_TEXT 93 +#define CB_TEXT_PLACEHOLDER 94 + + +// Tabpage Grundschriften +#define FT_STANDARD 90 +#define LB_STANDARD 91 +#define FT_TITLE 92 +#define LB_TITLE 93 +#define FT_LIST 94 +#define LB_LIST 95 +#define FT_LABEL 96 +#define LB_LABEL 97 +#define FT_IDX 98 +#define LB_IDX 99 +#define FL_STDCHR 100 +#define PB_STANDARD 101 +#define CB_DOCONLY 102 +#define ST_SCRIPT_WESTERN 103 +#define ST_SCRIPT_ASIAN 104 +#define ST_SCRIPT_CTL 105 +#define FT_TYPE 106 +#define FT_SIZE 107 +#define LB_STANDARD_SIZE 108 +#define LB_TITLE_SIZE 109 +#define LB_LIST_SIZE 110 +#define LB_LABEL_SIZE 111 +#define LB_INDEX_SIZE 112 + +//Tabpage Tabelle +#define CB_HEADER 101 +#define CB_REPEAT_HEADER 102 +#define CB_DONT_SPLIT 103 +#define CB_BORDER 104 +#define CB_NUMFORMATTING 105 +#define CB_NUMALIGNMENT 106 +#define FL_TABLE 107 +#define FL_TABLE_INSERT 108 +#define CB_NUMFMT_FORMATTING 109 +#define FL_MOVE 110 +#define FT_ROWMOVE 111 +#define MF_ROWMOVE 112 +#define FT_COLMOVE 113 +#define MF_COLMOVE 114 +#define FT_INSERT 115 +#define FT_ROWINSERT 116 +#define MF_ROWINSERT 117 +#define FT_COLINSERT 118 +#define MF_COLINSERT 119 +#define FT_HANDLING 120 +#define RB_FIX 121 +#define RB_FIXPROP 122 +#define RB_VAR 123 +#define FT_FIX 124 +#define FT_FIXPROP 125 +#define FT_VAR 126 + +#define FT_MOVE 128 +#define FL_COLOR 130 +#define FT_SGML 131 +#define LB_SGML 132 +#define FT_COMMENT 133 +#define LB_COMMENT 134 +#define FT_KEYWD 135 +#define LB_KEYWD 136 +#define FT_UNKNOWN 137 +#define LB_UNKNOWN 138 +#define FL_TABLE_SEPARATOR 139 +#define CB_PROSPECT_RTL 140 + +#define FL_SHDWCRSFLAG 1 +#define CB_SHDWCRSONOFF 2 +#define FL_SHDWCRSMODE 3 +#define FT_SHDWCRSFILLMODE 4 +#define RB_SHDWCRSFILLMARGIN 5 +#define RB_SHDWCRSFILLINDENT 6 +#define RB_SHDWCRSFILLTAB 7 +#define RB_SHDWCRSFILLSPACE 8 +#define CB_ALLOW_IN_PROT 12 +#define FL_CRSR_OPT 13 +#define FL_SEPARATOR_SHDW 14 + diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src new file mode 100755 index 000000000000..97f903557bda --- /dev/null +++ b/sw/source/ui/config/optdlg.src @@ -0,0 +1,997 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +/* StarView ressource file */ +#ifndef _SFX_HRC +#include <sfx2/sfx.hrc> +#endif +#ifndef _SVX_DIALOGS_HRC +#include <svx/dialogs.hrc> +#endif +#include "globals.hrc" +#include "config.hrc" +#include "optdlg.hrc" +#include "helpid.h" + +/**************************************************************************/ +/* */ +/* TabPage Ansicht/Inhalt */ +/* */ +/**************************************************************************/ +TabPage TP_CONTENT_OPT +{ + HelpID = HID_CONTENT_OPT ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_LINE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 118 , 8 ) ; + Group = TRUE ; + Text [ en-US ] = "Guides"; + }; + CheckBox CB_CROSS + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 118 , 10 ) ; + Text [ en-US ] = "Guides ~while moving"; + }; + CheckBox CB_HANDLE + { + Pos = MAP_APPFONT ( 12 , 27 ) ; + Size = MAP_APPFONT ( 118 , 10 ) ; + Text [ en-US ] = "Sim~ple handles"; + }; + CheckBox CB_BIGHANDLE + { + Pos = MAP_APPFONT ( 12 , 40 ) ; + Size = MAP_APPFONT ( 118 , 10 ) ; + Text [ en-US ] = "Large handles"; + }; + FixedLine FL_WINDOW + { + Pos = MAP_APPFONT ( 130 , 3 ) ; + Size = MAP_APPFONT ( 124 , 8 ) ; + Group = TRUE ; + Text [ en-US ] = "View"; + }; + CheckBox CB_HSCROLL + { + Pos = MAP_APPFONT ( 136 , 14 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "H~orizontal scrollbar" ; + }; + CheckBox CB_VSCROLL + { + Pos = MAP_APPFONT ( 136 , 27 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "~Vertical scrollbar" ; + }; + CheckBox CB_ANY_RULER + { + Pos = MAP_APPFONT ( 136 , 40 ) ; + Size = MAP_APPFONT ( 65 , 10 ) ; + Text [ en-US ] = "R~uler" ; + }; + CheckBox CB_HRULER + { + Pos = MAP_APPFONT ( 142 , 53 ) ; + Size = MAP_APPFONT ( 62 , 10 ) ; + Text [ en-US ] = "Hori~zontal ruler" ; + }; + ListBox LB_HMETRIC + { + Pos = MAP_APPFONT ( 206 , 51 ) ; + Size = MAP_APPFONT ( 45 , 60 ) ; + DropDown = TRUE; + }; + CheckBox CB_VRULER + { + Pos = MAP_APPFONT ( 142 , 66 ) ; + Size = MAP_APPFONT ( 62 , 10 ) ; + Text [ en-US ] = "Verti~cal ruler" ; + }; + CheckBox CB_VRULER_RIGHT + { + Pos = MAP_APPFONT ( 148 , 79 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "Right-aligned"; + }; + ListBox LB_VMETRIC + { + Pos = MAP_APPFONT ( 206 , 64 ) ; + Size = MAP_APPFONT ( 45 , 60 ) ; + DropDown = TRUE; + }; + CheckBox CB_SMOOTH_SCROLL + { + Pos = MAP_APPFONT ( 136 , 79 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "S~mooth scroll" ; + }; + FixedLine FL_DISP + { + Pos = MAP_APPFONT ( 6 , 56 ) ; + Size = MAP_APPFONT ( 118 , 8 ) ; + Text [ en-US ] = "Display" ; + Group = TRUE ; + }; + CheckBox CB_GRF + { + Pos = MAP_APPFONT ( 12 , 67 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "~Graphics and objects" ; + TabStop = TRUE ; + Group = TRUE ; + }; + CheckBox CB_TBL + { + Pos = MAP_APPFONT ( 12 , 80 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "~Tables " ; + }; + CheckBox CB_DRWFAST + { + Pos = MAP_APPFONT ( 12 , 93 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "Dra~wings and controls" ; + }; + CheckBox CB_FIELD + { + Pos = MAP_APPFONT ( 12 , 106 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "~Field codes" ; + }; + CheckBox CB_POSTIT + { + Pos = MAP_APPFONT ( 12 , 119 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "~Comments" ; + }; + FixedLine FL_SETTINGS + { + Pos = MAP_APPFONT ( 130 , 122 ) ; + Size = MAP_APPFONT ( 124 , 8 ) ; + Text [ en-US ] = "Settings"; + Hide = TRUE; + }; + FixedText FT_METRIC + { + Pos = MAP_APPFONT ( 136 , 135 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "Measurement unit"; + Hide = TRUE; + }; + ListBox LB_METRIC + { + Pos = MAP_APPFONT ( 199, 133 ) ; + Size = MAP_APPFONT ( 50 , 50 ) ; + Border = TRUE ; + DropDown = TRUE ; + Hide = TRUE; + }; +}; +/**************************************************************************/ +/* */ +/* */ +/* */ +/**************************************************************************/ +TabPage TP_OPTPRINT_PAGE +{ + HelpID = HID_OPTPRINT_PAGE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_1 + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 78 , 8 ) ; + Text [ en-US ] = "Contents" ; + Group = TRUE ; + }; + CheckBox CB_PGRF /*functionally merged with CB_PDRAW*/ + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "~Pictures and objects" ; + TabStop = TRUE ; + Group = TRUE ; + }; +/* + removed, tables now always get printed + CheckBox CB_PTAB + { + Pos = MAP_APPFONT ( 12 , 27 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "~Tables" ; + }; +*/ +/* + functionally merged with CB_PGRF (pictures and graphics) + CheckBox CB_PDRAW + { + Pos = MAP_APPFONT ( 12 , 40 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "Dra~wings" ; + }; +*/ + CheckBox CB_CTRLFLD + { + Pos = MAP_APPFONT ( 12 , 27 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "Form control~s" ; + }; + CheckBox CB_BACKGROUND + { + Pos = MAP_APPFONT ( 12 , 40 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "Page ba~ckground" ; + }; + CheckBox CB_BLACK_FONT + { + Pos = MAP_APPFONT ( 12 , 53 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "Print text in blac~k" ; + }; + CheckBox CB_HIDDEN_TEXT + { + Pos = MAP_APPFONT ( 12 , 66 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "Hidden te~xt" ; + }; + CheckBox CB_TEXT_PLACEHOLDER + { + Pos = MAP_APPFONT ( 12 , 79 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "Text ~placeholder" ; + }; + FixedLine FL_SEP_PRT_LEFT + { + Pos = MAP_APPFONT ( 85 , 14 ) ; + Size = MAP_APPFONT ( 4 , 78 ) ; + Vert = TRUE; + }; + FixedLine FL_2 + { + Pos = MAP_APPFONT ( 90 , 3 ) ; + Size = MAP_APPFONT ( 78 , 8 ) ; + Text [ en-US ] = "Pages" ; + Group = TRUE ; + }; + CheckBox CB_LEFTP + { + Pos = MAP_APPFONT ( 96 , 14 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "~Left pages" ; + TabStop = TRUE ; + Group = TRUE ; + }; + CheckBox CB_RIGHTP + { + Pos = MAP_APPFONT ( 96 , 27 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "~Right pages" ; + }; +/* + removed, noe handled by the new print dialog (i.e. vcl) itself + CheckBox CB_REVERSE + { + Pos = MAP_APPFONT ( 96 , 40 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "Re~versed" ; + }; +*/ + CheckBox CB_PROSPECT + { + Pos = MAP_APPFONT ( 96 , 40 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "Broch~ure" ; + }; + CheckBox CB_PROSPECT_RTL + { + Pos = MAP_APPFONT ( 103 , 53 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "Right to Left" ; + Text [ x-comment ] = " "; + }; + RadioButton RB_NO + { + Pos = MAP_APPFONT ( 180 , 14 ) ; + Size = MAP_APPFONT ( 74 , 10 ) ; + Text [ en-US ] = "~None" ; + TabStop = TRUE ; + Group = TRUE ; + }; + RadioButton RB_ONLY + { + Pos = MAP_APPFONT ( 180 , 27 ) ; + Size = MAP_APPFONT ( 74 , 10 ) ; + Text [ en-US ] = "Comments ~only" ; + }; + RadioButton RB_END + { + Pos = MAP_APPFONT ( 180 , 40 ) ; + Size = MAP_APPFONT ( 74 , 10 ) ; + Text [ en-US ] = "End of docu~ment" ; + }; + RadioButton RB_PAGEEND + { + Pos = MAP_APPFONT ( 180 , 53 ) ; + Size = MAP_APPFONT ( 74 , 10 ) ; + Text [ en-US ] = "~End of page" ; + }; + FixedLine FL_SEP_PRT_RIGHT + { + Pos = MAP_APPFONT ( 169 , 14 ) ; + Size = MAP_APPFONT ( 4 , 78 ) ; + Vert = TRUE; + }; + FixedLine FL_3 + { + Pos = MAP_APPFONT ( 174 , 3 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Text [ en-US ] = "Comments" ; + Group = TRUE ; + }; + FixedLine FL_4 + { + Pos = MAP_APPFONT ( 6 , 95 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Group = TRUE ; + Text [ en-US ] = "Other"; + }; + CheckBox CB_PRINTEMPTYPAGES + { + Pos = MAP_APPFONT ( 12 , 106 ) ; + Size = MAP_APPFONT ( 200 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Print ~automatically inserted blank pages"; + }; +/* + CheckBox CB_SINGLEJOBS + { + Pos = MAP_APPFONT ( 12 , 119 ) ; + Size = MAP_APPFONT ( 200 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Create s~ingle print jobs" ; + }; +*/ + CheckBox CB_PAPERFROMSETUP + { + Pos = MAP_APPFONT ( 12 , 119 ) ; + Size = MAP_APPFONT ( 200 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Paper tray from printer settings"; + }; + FixedText FT_FAX + { + Pos = MAP_APPFONT ( 12 , 134 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Group = TRUE ; + Text [ en-US ] = "~Fax"; + }; + ListBox LB_FAX + { + Border = TRUE ; + Pos = MAP_APPFONT ( 70 , 132 ) ; + Size = MAP_APPFONT ( 184 , 70 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Group = TRUE ; + }; + String ST_NONE + { + Text [ en-US ] = "<None>"; + }; +}; +/**************************************************************************/ +/* */ +/* */ +/* */ +/**************************************************************************/ +TabPage TP_STD_FONT +{ + HelpID = HID_STD_FONT ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_STDCHR + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Basic fonts (%1)"; + }; + FixedText FT_TYPE + { + Pos = MAP_APPFONT ( 63 , 14 ) ; + Size = MAP_APPFONT ( 100 , 8 ) ; + Text [ en-US ] = "Font"; + }; + FixedText FT_SIZE + { + Pos = MAP_APPFONT ( 204 , 14 ) ; + Size = MAP_APPFONT ( 30 , 8 ) ; + Text [ en-US ] = "Size"; + }; + MetricBox LB_STANDARD_SIZE + { + Pos = MAP_APPFONT ( 204 , 25 ) ; + Size = MAP_APPFONT ( 30 , 60 ) ; + Border = TRUE ; + DropDown = TRUE; + }; + MetricBox LB_TITLE_SIZE + { + Pos = MAP_APPFONT ( 204 , 42 ) ; + Size = MAP_APPFONT ( 30 , 60 ) ; + Border = TRUE ; + DropDown = TRUE; + }; + MetricBox LB_LIST_SIZE + { + Pos = MAP_APPFONT ( 204 , 59 ) ; + Size = MAP_APPFONT ( 30 , 60 ) ; + Border = TRUE ; + DropDown = TRUE; + }; + MetricBox LB_LABEL_SIZE + { + Pos = MAP_APPFONT ( 204 , 76 ) ; + Size = MAP_APPFONT ( 30 , 60 ) ; + Border = TRUE ; + DropDown = TRUE; + }; + MetricBox LB_INDEX_SIZE + { + Pos = MAP_APPFONT ( 204 , 93 ) ; + Size = MAP_APPFONT ( 30 , 60 ) ; + Border = TRUE ; + DropDown = TRUE; + }; + FixedText FT_STANDARD + { + Pos = MAP_APPFONT ( 12 , 26 ) ; + Size = MAP_APPFONT ( 48 , 10 ) ; + Left = TRUE ; + Text [ en-US ] = "De~fault" ; + }; + FixedText FT_TITLE + { + Pos = MAP_APPFONT ( 12 , 43 ) ; + Size = MAP_APPFONT ( 48 , 10 ) ; + Text [ en-US ] = "Headin~g" ; + Left = TRUE ; + }; + FixedText FT_LIST + { + Pos = MAP_APPFONT ( 12 , 60 ) ; + Size = MAP_APPFONT ( 48 , 10 ) ; + Text [ en-US ] = "~List" ; + Left = TRUE ; + }; + FixedText FT_LABEL + { + Pos = MAP_APPFONT ( 12 , 77 ) ; + Size = MAP_APPFONT ( 48 , 10 ) ; + Text [ en-US ] = "C~aption" ; + Left = TRUE ; + }; + FixedText FT_IDX + { + Pos = MAP_APPFONT ( 12 , 94 ) ; + Size = MAP_APPFONT ( 48 , 10 ) ; + Text [ en-US ] = "~Index" ; + Left = TRUE ; + }; + ComboBox LB_STANDARD + { + Pos = MAP_APPFONT ( 63 , 25 ) ; + Size = MAP_APPFONT ( 135 , 73 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + }; + ComboBox LB_TITLE + { + Pos = MAP_APPFONT ( 63 , 42 ) ; + Size = MAP_APPFONT ( 135, 73 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + }; + ComboBox LB_LIST + { + Pos = MAP_APPFONT ( 63 , 59 ) ; + Size = MAP_APPFONT ( 135 , 73 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + }; + ComboBox LB_LABEL + { + Pos = MAP_APPFONT ( 63 , 76 ) ; + Size = MAP_APPFONT ( 135 , 73 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + }; + ComboBox LB_IDX + { + Pos = MAP_APPFONT ( 63 , 94 ) ; + Size = MAP_APPFONT ( 135, 73 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + }; + CheckBox CB_DOCONLY + { + Pos = MAP_APPFONT ( 12 , 111 ) ; + Size = MAP_APPFONT ( 147 , 10 ) ; + Text [ en-US ] = "C~urrent document only" ; + }; + PushButton PB_STANDARD + { + Pos = MAP_APPFONT ( 204 , 165 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Default" ; + }; + String ST_SCRIPT_ASIAN + { + Text [ en-US ] = "Asian"; + }; + String ST_SCRIPT_CTL + { + Text [ en-US ] = "CTL"; + }; + String ST_SCRIPT_WESTERN + { + Text [ en-US ] = "Western"; + }; +}; +/**************************************************************************/ +/* */ +/* */ +/* */ +/**************************************************************************/ +TabPage TP_OPTTABLE_PAGE +{ + HelpID = HID_OPTTABLE_PAGE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_TABLE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 113 , 8 ) ; + Text [ en-US ] = "Default"; + }; + CheckBox CB_HEADER + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 107 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "H~eading"; + }; + CheckBox CB_REPEAT_HEADER + { + Pos = MAP_APPFONT ( 21 , 27 ) ; + Size = MAP_APPFONT ( 99 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Re~peat on each page"; + }; + CheckBox CB_DONT_SPLIT + { + Pos = MAP_APPFONT ( 12 , 40 ) ; + Size = MAP_APPFONT ( 107 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Do not split"; + }; + CheckBox CB_BORDER + { + Pos = MAP_APPFONT ( 12 , 53 ) ; + Size = MAP_APPFONT ( 107 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "B~order"; + }; + FixedLine FL_TABLE_SEPARATOR + { + Pos = MAP_APPFONT ( 120 , 14 ) ; + Size = MAP_APPFONT ( 4 , 52 ) ; + Vert = TRUE; + }; + FixedLine FL_TABLE_INSERT + { + Pos = MAP_APPFONT ( 125 , 3 ) ; + Size = MAP_APPFONT ( 129 , 8 ) ; + Text [ en-US ] = "Input in tables"; + }; + CheckBox CB_NUMFORMATTING + { + Pos = MAP_APPFONT ( 131 , 14 ) ; + Size = MAP_APPFONT ( 118 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Number recognition"; + }; + CheckBox CB_NUMFMT_FORMATTING + { + Pos = MAP_APPFONT ( 140 , 27 ) ; + Size = MAP_APPFONT ( 114 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Number format recognition"; + }; + CheckBox CB_NUMALIGNMENT + { + Pos = MAP_APPFONT ( 140 , 40 ) ; + Size = MAP_APPFONT ( 114 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Alignment"; + }; + FixedLine FL_MOVE + { + Pos = MAP_APPFONT ( 6 , 69 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Keyboard handling"; + }; + FixedText FT_MOVE + { + Pos = MAP_APPFONT ( 12 , 80) ; + Size = MAP_APPFONT ( 100 , 8 ) ; + Text [ en-US ] = "Move cells"; + }; + FixedText FT_ROWMOVE + { + Pos = MAP_APPFONT ( 21 , 93 ) ; + Size = MAP_APPFONT ( 51 , 8 ) ; + Text [ en-US ] = "~Row" ; + }; + MetricField MF_ROWMOVE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 83 , 91 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + SpinSize = 10 ; + Minimum = 25 ; + Maximum = 999 ; + First = 25 ; + Last = 2000 ; + }; + FixedText FT_COLMOVE + { + Pos = MAP_APPFONT ( 21 , 108 ) ; + Size = MAP_APPFONT ( 51 , 8 ) ; + Text [ en-US ] = "~Column" ; + }; + MetricField MF_COLMOVE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 83 , 106 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + SpinSize = 10 ; + Minimum = 25 ; + Maximum = 999 ; + First = 25 ; + Last = 2000 ; + }; + FixedText FT_INSERT + { + Pos = MAP_APPFONT ( 136 , 80 ) ; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Insert cell"; + }; + FixedText FT_ROWINSERT + { + Pos = MAP_APPFONT ( 145 , 93 ) ; + Size = MAP_APPFONT ( 51 , 8 ) ; + Text [ en-US ] = "Ro~w" ; + }; + MetricField MF_ROWINSERT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 211 , 91 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + SpinSize = 10 ; + Minimum = 25 ; + Maximum = 999 ; + First = 25 ; + Last = 2000 ; + }; + FixedText FT_COLINSERT + { + Pos = MAP_APPFONT ( 145 , 108 ) ; + Size = MAP_APPFONT ( 51 , 10 ) ; + Text [ en-US ] = "Colu~mn" ; + }; + MetricField MF_COLINSERT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 211 , 106 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + SpinSize = 10 ; + Minimum = 25 ; + Maximum = 999 ; + First = 25 ; + Last = 2000 ; + }; + FixedText FT_HANDLING + { + Pos = MAP_APPFONT ( 12 , 122 ) ; + Size = MAP_APPFONT ( 230 , 8 ) ; + Text [ en-US ] = "Behavior of rows/columns"; + }; + RadioButton RB_FIX + { + Pos = MAP_APPFONT ( 21 , 133 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "~Fixed" ; + }; + FixedText FT_FIX + { + Pos = MAP_APPFONT ( 93 , 133 ) ; + Size = MAP_APPFONT ( 155 , 16 ) ; + WordBreak = TRUE ; + Text [ en-US ] = "Changes affect the adjacent area only"; + }; + RadioButton RB_FIXPROP + { + Pos = MAP_APPFONT ( 21 , 151 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "Fi~xed, proportional" ; + }; + FixedText FT_FIXPROP + { + Pos = MAP_APPFONT ( 93 , 151 ) ; + Size = MAP_APPFONT ( 155 , 16 ) ; + WordBreak = TRUE ; + Text [ en-US ] = "Changes affect the entire table"; + }; + RadioButton RB_VAR + { + Pos = MAP_APPFONT ( 21 , 169 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "~Variable" ; + }; + FixedText FT_VAR + { + Pos = MAP_APPFONT ( 93 , 169 ) ; + Size = MAP_APPFONT ( 155 , 16 ) ; + WordBreak = TRUE ; + Text [ en-US ] = "Changes affect the table size"; + }; +}; +/**************************************************************************/ +/* */ +/* TabPage ShadowCursor */ +/* */ +/**************************************************************************/ +TabPage TP_OPTSHDWCRSR +{ + HelpID = HID_OPTSHDWCRSR ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + //_---------------------------- + FixedLine FL_NOPRINT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 118 , 8 ) ; + Group = TRUE ; + Text [ en-US ] = "Display of"; + }; + CheckBox CB_PARA + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "Pa~ragraph end" ; + TabStop = TRUE ; + Group = TRUE ; + }; + CheckBox CB_SHYPH + { + Pos = MAP_APPFONT ( 12 , 27 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "Custom h~yphens" ; + }; + CheckBox CB_SPACE + { + Pos = MAP_APPFONT ( 12 , 40 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "Spac~es" ; + }; + CheckBox CB_HSPACE + { + Pos = MAP_APPFONT ( 12 , 53 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "Non-breaking s~paces" ; + }; + CheckBox CB_TAB + { + Pos = MAP_APPFONT ( 12 , 66 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "Ta~bs" ; + }; + CheckBox CB_BREAK + { + Pos = MAP_APPFONT ( 12 , 79 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "Brea~ks" ; + }; + CheckBox CB_CHAR_HIDDEN + { + Pos = MAP_APPFONT ( 12 , 92 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "Hidden text" ; + }; + CheckBox CB_FLD_HIDDEN + { + Pos = MAP_APPFONT ( 12 , 105 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "Fields: Hidden te~xt" ; + }; + CheckBox CB_FLD_HIDDEN_PARA + { + Pos = MAP_APPFONT ( 12 , 118 ) ; + Size = MAP_APPFONT ( 108 , 10 ) ; + Text [ en-US ] = "Fields: Hidden p~aragraphs" ; + }; + FixedLine FL_SEPARATOR_SHDW + { + Pos = MAP_APPFONT ( 125 , 14 ) ; + Size = MAP_APPFONT ( 4 , 79 ) ; + Vert = TRUE; + }; + FixedLine FL_SHDWCRSFLAG + { + Pos = MAP_APPFONT ( 130 , 3 ) ; + Size = MAP_APPFONT ( 124 , 8 ) ; + Text [ en-US ] = "Direct cursor" ; + }; + CheckBox CB_SHDWCRSONOFF + { + Pos = MAP_APPFONT ( 136 , 14 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Group = TRUE ; + Text [ en-US ] = "~Direct cursor" ; + }; + FixedText FT_SHDWCRSFILLMODE + { + Pos = MAP_APPFONT ( 136 , 27 ) ; + Size = MAP_APPFONT ( 48 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Insert" ; + }; + RadioButton RB_SHDWCRSFILLMARGIN + { + Pos = MAP_APPFONT ( 145 , 39 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Group = TRUE ; + Text [ en-US ] = "Para~graph alignment" ; + }; + RadioButton RB_SHDWCRSFILLINDENT + { + Pos = MAP_APPFONT ( 145 , 52 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "~Left paragraph margin" ; + }; + RadioButton RB_SHDWCRSFILLTAB + { + Pos = MAP_APPFONT ( 145 , 66 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "~Tabs" ; + }; + RadioButton RB_SHDWCRSFILLSPACE + { + Pos = MAP_APPFONT ( 145 , 79 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "Tabs a~nd spaces" ; + }; + FixedLine FL_CRSR_OPT + { + Pos = MAP_APPFONT ( 130 , 96 ) ; + Size = MAP_APPFONT ( 124 , 8 ) ; + Text [ en-US ] = "Cursor in protected areas"; + }; + CheckBox CB_ALLOW_IN_PROT + { + Pos = MAP_APPFONT ( 136 , 107 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Group = TRUE ; + Text [ en-US ] = "Enable"; + }; +}; + + +StringArray STR_PRINTOPTUI +{ + ItemList [en-US] = + { + < "%PRODUCTNAME %s"; >; + < "Contents"; >; + < "Page ba~ckground"; >; + < "Specifies whether to include colors and objects that are inserted to the background of the page (Format - Page - Background) in the printed document."; >; + < "P~ictures and other graphic objects"; >; + < "Specifies whether the graphics and drawing or OLE objects of your text document are printed"; >; + < "Hidden te~xt"; >; + < "Enable this option to print text that is marked as hidden."; >; + < "~Text placeholders"; >; + < "Enable this option to print text placeholders. Disable this option to leave the text placeholders blank in the printout."; >; + < "Form control~s"; >; + < "Specifies whether the form control fields of the text document are printed"; >; + < "Color"; >; + < "Print text in blac~k"; >; + < "Specifies whether to always print text in black."; >; + < "Pages"; >; + < "Print ~automatically inserted blank pages"; >; + < "If this option is enabled automatically inserted blank pages are printed. This is best if you are printing double-sided. For example, in a book, a \"chapter\" paragraph style has been set to always start with an odd numbered page. If the previous chapter ends on an odd page, %PRODUCTNAME inserts an even numbered blank page. This option controls whether to print that even numbered page or not"; >; + < "~Use only paper tray from printer preferences"; >; + < "For printers with multiple trays this option specifies whether the paper tray used is specified by the system settings of the printer."; >; + < "Print"; >; + < "None (document only)"; >; + < "Comments only"; >; + < "Place at end of document"; >; + < "Place at end of page"; >; + < "Specify where to print comments (if any)."; >; + < "~Comments"; >; + < "Page sides";>; + < "All pages"; >; + < "Back sides / left pages"; >; + < "Front sides / right pages"; >; + < "Specify which pages to include in the output"; >; + < "Include"; >; + < "Broch~ure"; >; + < "Select the Brochure option to print the document in brochure format."; >; + < "Left-to-right script"; >; + < "Right-to-left script"; >; + < "Range and copies"; >; + < "~All pages"; >; + < "Print the whole document."; >; + < "Pa~ges"; >; + < "Print a range of pages of the document."; >; + < "~Selection"; >; + < "Print only the selected parts of the document"; >; + }; +}; + diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx new file mode 100644 index 000000000000..4a0c9c2a6b25 --- /dev/null +++ b/sw/source/ui/config/optload.cxx @@ -0,0 +1,983 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include <tools/shl.hxx> +#include <swtypes.hxx> +#ifndef _HELPID_H +#include <helpid.h> +#endif +#include <uiitems.hxx> +#ifndef _MODCFG_HXX +#include <modcfg.hxx> +#endif +#include "swmodule.hxx" +#include "usrpref.hxx" +#include "wrtsh.hxx" +#include "linkenum.hxx" +#include <uitool.hxx> +#include <view.hxx> + +#include "globals.hrc" +#include "cmdid.h" + +#include "optload.hrc" +#include "optload.hxx" +#include <svx/dlgutil.hxx> +#include <svx/htmlmode.hxx> +#include <fldmgr.hxx> +#include <poolfmt.hxx> +#include <expfld.hxx> +#include <caption.hxx> +#include <com/sun/star/document/PrinterIndependentLayout.hpp> + +#include <svtools/insdlg.hxx> +#include <sot/clsids.hxx> +#include <unotools/configmgr.hxx> +#include <docsh.hxx> +#ifndef _CONFIG_HRC +#include <config.hrc> +#endif +#include <SwStyleNameMapper.hxx> +#include <numrule.hxx> +#include <SwNodeNum.hxx> + +#include <doc.hxx> +#include <svl/cjkoptions.hxx> + +using namespace ::com::sun::star; + +/* -----------------22.10.98 15:12------------------- + * + * --------------------------------------------------*/ +SwLoadOptPage::SwLoadOptPage( Window* pParent, const SfxItemSet& rSet ) : + + SfxTabPage( pParent, SW_RES( TP_OPTLOAD_PAGE ), rSet ), + + aUpdateFL ( this, SW_RES( FL_UPDATE ) ), + aLinkFT ( this, SW_RES( FT_LINK ) ), + aAlwaysRB ( this, SW_RES( RB_ALWAYS ) ), + aRequestRB ( this, SW_RES( RB_REQUEST ) ), + aNeverRB ( this, SW_RES( RB_NEVER ) ), + + aFieldFT ( this, SW_RES( FT_FIELD ) ), + aAutoUpdateFields ( this, SW_RES( CB_AUTO_UPDATE_FIELDS ) ), + aAutoUpdateCharts ( this, SW_RES( CB_AUTO_UPDATE_CHARTS ) ), + + aSettingsFL ( this, SW_RES( FL_SETTINGS ) ), + aMetricFT ( this, SW_RES( FT_METRIC ) ), + aMetricLB ( this, SW_RES( LB_METRIC ) ), + aTabFT ( this, SW_RES( FT_TAB ) ), + aTabMF ( this, SW_RES( MF_TAB ) ), + aUseSquaredPageMode ( this, SW_RES( CB_USE_SQUARE_PAGE_MODE ) ), + + pWrtShell ( NULL ), + bHTMLMode ( FALSE ), + nLastTab ( 0 ), + nOldLinkMode( MANUAL ) + +{ + FreeResource(); + + SvxStringArray aMetricArr( SW_RES( STR_ARR_METRIC ) ); + for ( USHORT i = 0; i < aMetricArr.Count(); ++i ) + { + String sMetric = aMetricArr.GetStringByPos( i ); + FieldUnit eFUnit = (FieldUnit)aMetricArr.GetValue( i ); + + switch ( eFUnit ) + { + case FUNIT_MM: + case FUNIT_CM: + case FUNIT_POINT: + case FUNIT_PICA: + case FUNIT_INCH: + { + // nur diese Metriken benutzen + USHORT nPos = aMetricLB.InsertEntry( sMetric ); + aMetricLB.SetEntryData( nPos, (void*)(long)eFUnit ); + } + default:; //prevent warning + } + } + aMetricLB.SetSelectHdl(LINK(this, SwLoadOptPage, MetricHdl)); + + const SfxPoolItem* pItem; + if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem ) + && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON) + { + aTabFT.Hide(); + aTabMF.Hide(); + } + + SvtCJKOptions aCJKOptions; + if(!aCJKOptions.IsAsianTypographyEnabled()) + aUseSquaredPageMode.Hide(); +} + +/*-----------------18.01.97 12.43------------------- + +--------------------------------------------------*/ + +SwLoadOptPage::~SwLoadOptPage() +{ +} + +/*-----------------18.01.97 12.43------------------- + +--------------------------------------------------*/ + +SfxTabPage* __EXPORT SwLoadOptPage::Create( Window* pParent, + const SfxItemSet& rAttrSet ) +{ + return new SwLoadOptPage(pParent, rAttrSet ); +} + +/*-----------------18.01.97 12.42------------------- + +--------------------------------------------------*/ + +BOOL __EXPORT SwLoadOptPage::FillItemSet( SfxItemSet& rSet ) +{ + BOOL bRet = FALSE; + SwModule* pMod = SW_MOD(); + + USHORT nNewLinkMode = AUTOMATIC; + if (aNeverRB.IsChecked()) + nNewLinkMode = NEVER; + else if (aRequestRB.IsChecked()) + nNewLinkMode = MANUAL; + + SwFldUpdateFlags eFldFlags = aAutoUpdateFields.IsChecked() ? + aAutoUpdateCharts.IsChecked() ? AUTOUPD_FIELD_AND_CHARTS : AUTOUPD_FIELD_ONLY : AUTOUPD_OFF; + + if(aAutoUpdateFields.IsChecked() != aAutoUpdateFields.GetSavedValue() || + aAutoUpdateCharts.IsChecked() != aAutoUpdateCharts.GetSavedValue()) + { + pMod->ApplyFldUpdateFlags(eFldFlags); + if(pWrtShell) + { + pWrtShell->SetFldUpdateFlags(eFldFlags); + pWrtShell->SetModified(); + } + } + + if (nNewLinkMode != nOldLinkMode) + { + pMod->ApplyLinkMode(nNewLinkMode); + if (pWrtShell) + { + pWrtShell->SetLinkUpdMode( nNewLinkMode ); + pWrtShell->SetModified(); + } + + bRet = TRUE; + } + + const USHORT nMPos = aMetricLB.GetSelectEntryPos(); + if ( nMPos != aMetricLB.GetSavedValue() ) + { + // Doppel-Cast fuer VA3.0 + USHORT nFieldUnit = (USHORT)(long)aMetricLB.GetEntryData( nMPos ); + rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, (UINT16)nFieldUnit ) ); + bRet = TRUE; + } + + if(aTabMF.IsVisible() && aTabMF.GetText() != aTabMF.GetSavedValue()) + { + rSet.Put(SfxUInt16Item(SID_ATTR_DEFTABSTOP, + (USHORT)aTabMF.Denormalize(aTabMF.GetValue(FUNIT_TWIP)))); + bRet = TRUE; + } + + sal_Bool bIsSquaredPageModeFlag = aUseSquaredPageMode.IsChecked(); + if ( bIsSquaredPageModeFlag != aUseSquaredPageMode.GetSavedValue() ) + { + pMod->ApplyDefaultPageMode( bIsSquaredPageModeFlag ); + if ( pWrtShell ) + { + SwDoc* pDoc = pWrtShell->GetDoc(); + pDoc->SetDefaultPageMode( bIsSquaredPageModeFlag ); + pWrtShell->SetModified(); + } + bRet = TRUE; + } + + return bRet; +} +/*-----------------18.01.97 12.42------------------- + +--------------------------------------------------*/ +void __EXPORT SwLoadOptPage::Reset( const SfxItemSet& rSet) +{ + const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref(FALSE); + const SfxPoolItem* pItem; + + if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_WRTSHELL, FALSE, &pItem)) + pWrtShell = (SwWrtShell*)((const SwPtrItem*)pItem)->GetValue(); + + SwFldUpdateFlags eFldFlags = AUTOUPD_GLOBALSETTING; + nOldLinkMode = GLOBALSETTING; + if (pWrtShell) + { + eFldFlags = pWrtShell->GetFldUpdateFlags(TRUE); + nOldLinkMode = pWrtShell->GetLinkUpdMode(TRUE); + } + if(GLOBALSETTING == nOldLinkMode) + nOldLinkMode = pUsrPref->GetUpdateLinkMode(); + if(AUTOUPD_GLOBALSETTING == eFldFlags) + eFldFlags = pUsrPref->GetFldUpdateFlags(); + + aAutoUpdateFields.Check(eFldFlags != AUTOUPD_OFF); + aAutoUpdateCharts.Check(eFldFlags == AUTOUPD_FIELD_AND_CHARTS); + + switch (nOldLinkMode) + { + case NEVER: aNeverRB.Check(); break; + case MANUAL: aRequestRB.Check(); break; + case AUTOMATIC: aAlwaysRB.Check(); break; + } + + aAutoUpdateFields.SaveValue(); + aAutoUpdateCharts.SaveValue(); + aMetricLB.SetNoSelection(); + if ( rSet.GetItemState( SID_ATTR_METRIC ) >= SFX_ITEM_AVAILABLE ) + { + const SfxUInt16Item& rItem = (SfxUInt16Item&)rSet.Get( SID_ATTR_METRIC ); + FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue(); + + for ( USHORT i = 0; i < aMetricLB.GetEntryCount(); ++i ) + { + if ( (int)(sal_IntPtr)aMetricLB.GetEntryData( i ) == (int)eFieldUnit ) + { + aMetricLB.SelectEntryPos( i ); + break; + } + } + ::SetFieldUnit(aTabMF, eFieldUnit); + } + aMetricLB.SaveValue(); + if(SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, FALSE, &pItem)) + { + nLastTab = ((SfxUInt16Item*)pItem)->GetValue(); + aTabMF.SetValue(aTabMF.Normalize(nLastTab), FUNIT_TWIP); + } + aTabMF.SaveValue(); + + if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem)) + { + bHTMLMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON); + } + + //default page mode loading + if(pWrtShell) + { + sal_Bool bSquaredPageMode = pWrtShell->GetDoc()->IsSquaredPageMode(); + aUseSquaredPageMode.Check( bSquaredPageMode ); + aUseSquaredPageMode.SaveValue(); + } +} +/*-----------------13.01.97 14.44------------------- + Metric des Deftabstops umschalten +--------------------------------------------------*/ + +IMPL_LINK(SwLoadOptPage, MetricHdl, ListBox*, EMPTYARG) +{ + const USHORT nMPos = aMetricLB.GetSelectEntryPos(); + if(nMPos != USHRT_MAX) + { + // Doppel-Cast fuer VA3.0 + FieldUnit eFieldUnit = (FieldUnit)(long)aMetricLB.GetEntryData( nMPos ); + BOOL bModified = aTabMF.IsModified(); + long nVal = bModified ? + sal::static_int_cast<sal_Int32, sal_Int64 >( aTabMF.Denormalize( aTabMF.GetValue( FUNIT_TWIP ) )) : + nLastTab; + ::SetFieldUnit( aTabMF, eFieldUnit ); + aTabMF.SetValue( aTabMF.Normalize( nVal ), FUNIT_TWIP ); + if(!bModified) + aTabMF.ClearModifyFlag(); + } + + return 0; +} +/*********************************************************************/ +/* */ +/*********************************************************************/ + +IMPL_LINK(SwLoadOptPage, CaptionHdl, PushButton*, EMPTYARG) +{ + SwCaptionOptDlg aDlg(this, GetItemSet()); + aDlg.Execute(); + + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SwCaptionOptDlg::SwCaptionOptDlg(Window* pParent, const SfxItemSet& rSet) : + SfxSingleTabDialog(pParent, rSet, 0) +{ + // TabPage erzeugen + SetTabPage((SwCaptionOptPage*) SwCaptionOptPage::Create(this, rSet)); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SwCaptionOptDlg::~SwCaptionOptDlg() +{ +} + +/* -----------------22.10.98 15:12------------------- + * + * --------------------------------------------------*/ + +SwCaptionPreview::SwCaptionPreview( Window* pParent, const ResId& rResId ) + : Window( pParent, rResId ) +{ + maDrawPos = Point( 4, 6 ); + + Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() ); + SetBackground( aBack ); + SetFillColor( aBack.GetColor() ); + SetLineColor( aBack.GetColor() ); + SetBorderStyle( WINDOW_BORDER_MONO ); + Font aFont(GetFont()); + aFont.SetHeight(aFont.GetHeight() * 120 / 100 ); + SetFont(aFont); +} + +void SwCaptionPreview::SetPreviewText( const String& rText ) +{ + if( rText != maText ) + { + maText = rText; + Invalidate(); + } +} + +void SwCaptionPreview::Paint( const Rectangle& rRect ) +{ + Window::Paint( rRect ); + + DrawRect( Rectangle( Point( 0, 0 ), GetSizePixel() ) ); + DrawText( Point( 4, 6 ), maText ); +} + + +SwCaptionOptPage::SwCaptionOptPage( Window* pParent, const SfxItemSet& rSet ) + : SfxTabPage(pParent, SW_RES(TP_OPTCAPTION_PAGE), rSet), + aCheckFT (this, SW_RES(FT_OBJECTS )), + aCheckLB (this, SW_RES(CLB_OBJECTS )), + aFtCaptionOrder(this, SW_RES( FT_ORDER )), + aLbCaptionOrder(this, SW_RES( LB_ORDER )), + aPreview (this, SW_RES(WIN_PREVIEW )), + aSettingsGroupFL(this, SW_RES(FL_SETTINGS_2 )), + aCategoryText (this, SW_RES(TXT_CATEGORY )), + aCategoryBox (this, SW_RES(BOX_CATEGORY )), + aFormatText (this, SW_RES(TXT_FORMAT )), + aFormatBox (this, SW_RES(BOX_FORMAT )), + aNumberingSeparatorFT(this, SW_RES(FT_NUM_SEP )), + aNumberingSeparatorED(this, SW_RES(ED_NUM_SEP )), + aTextText (this, SW_RES(TXT_TEXT )), + aTextEdit (this, SW_RES(EDT_TEXT )), + aPosText (this, SW_RES(TXT_POS )), + aPosBox (this, SW_RES(BOX_POS )), + aNumCaptFL (this, SW_RES(FL_NUMCAPT )), + aFtLevel (this, SW_RES(FT_LEVEL )), + aLbLevel (this, SW_RES(LB_LEVEL )), + aFtDelim (this, SW_RES(FT_SEPARATOR )), + aEdDelim (this, SW_RES(ED_SEPARATOR )), + aCategoryFL (this, SW_RES(FL_CATEGORY )), + aCharStyleFT (this, SW_RES(FT_CHARSTYLE )), + aCharStyleLB (this, SW_RES(LB_CHARSTYLE )), + aApplyBorderCB (this, SW_RES(CB_APPLYBORDER)), + + sSWTable (SW_RES(STR_TABLE )), + sSWFrame (SW_RES(STR_FRAME )), + sSWGraphic (SW_RES(STR_GRAPHIC )), + sOLE (SW_RES(STR_OLE )), + + sBegin (SW_RESSTR(STR_BEGINNING )), + sEnd (SW_RESSTR(STR_END )), + sAbove (SW_RESSTR(STR_ABOVE )), + sBelow (SW_RESSTR(STR_CP_BELOW )), + sNone (SW_RESSTR( STR_CATEGORY_NONE )), + + pMgr (new SwFldMgr()), + bHTMLMode(FALSE) +{ + Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() ); + aPreview.SetBackground( aBack ); + + SwStyleNameMapper::FillUIName( RES_POOLCOLL_LABEL_ABB, sIllustration ); + SwStyleNameMapper::FillUIName( RES_POOLCOLL_LABEL_TABLE, sTable ); + SwStyleNameMapper::FillUIName( RES_POOLCOLL_LABEL_FRAME, sText ); + SwStyleNameMapper::FillUIName( RES_POOLCOLL_LABEL_DRAWING, sDrawing ); + + USHORT i, nCount; + SwWrtShell *pSh = ::GetActiveWrtShell(); + + // aFormatBox + USHORT nSelFmt = SVX_NUM_ARABIC; + if (pSh) + { + nCount = pMgr->GetFldTypeCount(); + SwFieldType* pFldType; + for ( i = nCount; i; ) + if( ( pFldType = pMgr->GetFldType(USHRT_MAX, --i))->GetName() == + aCategoryBox.GetText() ) + { + nSelFmt = (USHORT)((SwSetExpFieldType*)pFldType)->GetSeqFormat(); + break; + } + + ::FillCharStyleListBox( aCharStyleLB, pSh->GetView().GetDocShell(), TRUE, TRUE ); + } + + + nCount = pMgr->GetFormatCount(TYP_SEQFLD, FALSE); + for ( i = 0; i < nCount; ++i ) + { + aFormatBox.InsertEntry( pMgr->GetFormatStr(TYP_SEQFLD, i) ); + USHORT nFmtId = pMgr->GetFormatId(TYP_SEQFLD, i); + aFormatBox.SetEntryData( i, reinterpret_cast<void*>(nFmtId) ); + if( nFmtId == nSelFmt ) + aFormatBox.SelectEntryPos( i ); + } + + for (i = 0; i < MAXLEVEL; i++) + aLbLevel.InsertEntry(String::CreateFromInt32(i + 1)); + + sal_Unicode nLvl = MAXLEVEL; + String sDelim( String::CreateFromAscii( ": " ) ); + + if (pSh) + { + SwSetExpFieldType* pFldType = (SwSetExpFieldType*)pMgr->GetFldType( + RES_SETEXPFLD, aCategoryBox.GetText() ); + if( pFldType ) + { + sDelim = pFldType->GetDelimiter(); + nLvl = pFldType->GetOutlineLvl(); + } + } + + aLbLevel.SelectEntryPos( nLvl < MAXLEVEL ? nLvl + 1 : 0 ); + aEdDelim.SetText( sDelim ); + + aCheckLB.SetHelpId(HID_OPTCAPTION_CLB); + + FreeResource(); + + Link aLk = LINK( this, SwCaptionOptPage, ModifyHdl ); + aCategoryBox.SetModifyHdl( aLk ); + aNumberingSeparatorED.SetModifyHdl( aLk ); + aTextEdit .SetModifyHdl( aLk ); + + aLk = LINK(this, SwCaptionOptPage, SelectHdl); + aCategoryBox.SetSelectHdl( aLk ); + aFormatBox .SetSelectHdl( aLk ); + + aLbCaptionOrder.SetSelectHdl( LINK(this, SwCaptionOptPage, OrderHdl)); + + aCheckLB.SetSelectHdl( LINK(this, SwCaptionOptPage, ShowEntryHdl) ); + aCheckLB.SetCheckButtonHdl( LINK(this, SwCaptionOptPage, ShowEntryHdl) ); + aCheckLB.SetDeselectHdl( LINK(this, SwCaptionOptPage, SaveEntryHdl) ); +} + +/*-----------------18.01.97 12.43------------------- + +--------------------------------------------------*/ + +SwCaptionOptPage::~SwCaptionOptPage() +{ + DelUserData(); + delete pMgr; +} + +/*-----------------18.01.97 12.43------------------- + +--------------------------------------------------*/ + +SfxTabPage* SwCaptionOptPage::Create( Window* pParent, + const SfxItemSet& rAttrSet ) +{ + return new SwCaptionOptPage(pParent, rAttrSet ); +} + +/*-----------------18.01.97 12.42------------------- + +--------------------------------------------------*/ + +BOOL SwCaptionOptPage::FillItemSet( SfxItemSet& ) +{ + BOOL bRet = FALSE; + SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + + SaveEntry(aCheckLB.FirstSelected()); // Aktuellen Eintrag uebernehmen + + SvLBoxEntry* pEntry = aCheckLB.First(); + + while (pEntry) + { + InsCaptionOpt* pData = (InsCaptionOpt*)pEntry->GetUserData(); + bRet |= pModOpt->SetCapOption(bHTMLMode, pData); + pEntry = aCheckLB.Next(pEntry); + } + + USHORT nCheckCount = aCheckLB.GetCheckedEntryCount(); + pModOpt->SetInsWithCaption( bHTMLMode, nCheckCount > 0 ); + + sal_Int32 nPos = aLbCaptionOrder.GetSelectEntryPos(); + pModOpt->SetCaptionOrderNumberingFirst(nPos == 1 ? sal_True : sal_False ); + + return bRet; +} + +/*-----------------18.01.97 12.42------------------- + +--------------------------------------------------*/ + +void SwCaptionOptPage::Reset( const SfxItemSet& rSet) +{ + const SfxPoolItem* pItem; + if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem)) + { + bHTMLMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON); + } + + DelUserData(); + aCheckLB.GetModel()->Clear(); // remove all entries + + // Writer objects + USHORT nPos = 0; + aCheckLB.InsertEntry(sSWTable); + SetOptions(nPos++, TABLE_CAP); + aCheckLB.InsertEntry(sSWFrame); + SetOptions(nPos++, FRAME_CAP); + aCheckLB.InsertEntry(sSWGraphic); + SetOptions(nPos++, GRAPHIC_CAP); + + // get Productname and -version + String sComplete, sWithoutVersion; + ::rtl::OUString sTemp; + uno::Any aAny = + ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); + if ( aAny >>= sTemp ) + { + sComplete = sTemp; + sWithoutVersion = sTemp; + aAny = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION ); + if ( !( aAny >>= sTemp ) ) + { + DBG_ERRORFILE( "Couldn't get PRODUCTVERSION variable" ); + } + else + { + sComplete += ' '; + sComplete += String( sTemp ); + } + } + else + { + DBG_ERRORFILE( "Couldn't get PRODUCTNAME variable" ); + } + + SvObjectServerList aObjS; + aObjS.FillInsertObjects(); + aObjS.Remove( SvGlobalName( SO3_SW_CLASSID ) ); // remove Writer-ID + + for ( ULONG i = 0; i < aObjS.Count(); ++i ) + { + const SvGlobalName &rOleId = aObjS[i].GetClassName(); + const String* pClassName = &aObjS[i].GetHumanName(); + if ( rOleId == SvGlobalName( SO3_OUT_CLASSID ) ) + pClassName = &sOLE; + String sClass( *pClassName ); + // don't show product version + sClass.SearchAndReplace( sComplete, sWithoutVersion ); + aCheckLB.InsertEntry( sClass ); + SetOptions( nPos++, OLE_CAP, &rOleId ); + } + aLbCaptionOrder.SelectEntryPos( + SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst() ? 1 : 0); + ModifyHdl(); +} + +/*-----------------18.01.97 12.42------------------- + +--------------------------------------------------*/ + +void SwCaptionOptPage::SetOptions(const USHORT nPos, + const SwCapObjType eObjType, const SvGlobalName *pOleId) +{ + SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + const InsCaptionOpt* pOpt = pModOpt->GetCapOption(bHTMLMode, eObjType, pOleId); + + if (pOpt) + { + aCheckLB.SetEntryData(nPos, new InsCaptionOpt(*pOpt)); + aCheckLB.CheckEntryPos(nPos, pOpt->UseCaption()); + } + else + aCheckLB.SetEntryData(nPos, new InsCaptionOpt(eObjType, pOleId)); +} + +/*-----------------18.01.97 12.42------------------- + +--------------------------------------------------*/ + +void SwCaptionOptPage::DelUserData() +{ + SvLBoxEntry* pEntry = aCheckLB.First(); + + while (pEntry) + { + delete (InsCaptionOpt*)pEntry->GetUserData(); + pEntry->SetUserData(0); + pEntry = aCheckLB.Next(pEntry); + } +} + +/* -----------------26.10.98 11:06------------------- + * + * --------------------------------------------------*/ + +IMPL_LINK( SwCaptionOptPage, ShowEntryHdl, SvxCheckListBox *, EMPTYARG ) +{ + SvLBoxEntry* pSelEntry = aCheckLB.FirstSelected(); + + if (pSelEntry) + { + sal_Bool bChecked = aCheckLB.IsChecked((USHORT)aCheckLB.GetModel()->GetAbsPos(pSelEntry)); + + aSettingsGroupFL.Enable( bChecked ); + aCategoryText.Enable( bChecked ); + aCategoryBox.Enable( bChecked ); + aFormatText.Enable( bChecked ); + aFormatBox.Enable( bChecked ); + sal_Bool bNumSep = bChecked && aLbCaptionOrder.GetSelectEntryPos() == 1; + aNumberingSeparatorED.Enable( bNumSep ); + aNumberingSeparatorFT.Enable( bNumSep ); + aTextText.Enable( bChecked ); + aTextEdit.Enable( bChecked ); + aPosText.Enable( bChecked ); + aPosBox.Enable( bChecked ); + aNumCaptFL.Enable( bChecked ); + aFtLevel.Enable( bChecked ); + aLbLevel.Enable( bChecked ); + aFtDelim.Enable( bChecked ); + aEdDelim.Enable( bChecked ); + aCategoryFL.Enable( bChecked ); + aCharStyleFT.Enable( bChecked ); + aCharStyleLB.Enable( bChecked ); + aApplyBorderCB.Enable( bChecked ); + aPreview.Enable( bChecked ); + + SwWrtShell *pSh = ::GetActiveWrtShell(); + + InsCaptionOpt* pOpt = (InsCaptionOpt*)pSelEntry->GetUserData(); + + aCategoryBox.Clear(); + aCategoryBox.InsertEntry( sNone ); + if (pSh) + { + USHORT nCount = pMgr->GetFldTypeCount(); + + for (USHORT i = 0; i < nCount; i++) + { + SwFieldType *pType = pMgr->GetFldType( USHRT_MAX, i ); + if( pType->Which() == RES_SETEXPFLD && + ((SwSetExpFieldType *) pType)->GetType() & nsSwGetSetExpType::GSE_SEQ ) + aCategoryBox.InsertEntry(SwBoxEntry(pType->GetName())); + } + } + else + { + aCategoryBox.InsertEntry(SwBoxEntry(sIllustration)); + aCategoryBox.InsertEntry(SwBoxEntry(sTable)); + aCategoryBox.InsertEntry(SwBoxEntry(sText)); + aCategoryBox.InsertEntry(SwBoxEntry(sDrawing)); + } + + if(pOpt->GetCategory().Len()) + aCategoryBox.SetText(pOpt->GetCategory()); + else + aCategoryBox.SetText( sNone ); + if (pOpt->GetCategory().Len() && + aCategoryBox.GetEntryPos(pOpt->GetCategory()) == COMBOBOX_ENTRY_NOTFOUND) + aCategoryBox.InsertEntry(pOpt->GetCategory()); + if (!aCategoryBox.GetText().Len()) + { + USHORT nPos = 0; + switch(pOpt->GetObjType()) + { + case OLE_CAP: + case GRAPHIC_CAP: nPos = 1; break; + case TABLE_CAP: nPos = 2; break; + case FRAME_CAP: nPos = 3; break; + } + aCategoryBox.SetText(aCategoryBox.GetEntry(nPos).GetName()); + } + + for (USHORT i = 0; i < aFormatBox.GetEntryCount(); i++) + { + if (pOpt->GetNumType() == (USHORT)(ULONG)aFormatBox.GetEntryData(i)) + { + aFormatBox.SelectEntryPos(i); + break; + } + } + aTextEdit.SetText(pOpt->GetCaption()); + + aPosBox.Clear(); + switch (pOpt->GetObjType()) + { + case GRAPHIC_CAP: + case TABLE_CAP: + case OLE_CAP: + aPosBox.InsertEntry(sAbove); + aPosBox.InsertEntry(sBelow); + break; + case FRAME_CAP: + aPosBox.InsertEntry(sBegin); + aPosBox.InsertEntry(sEnd); + break; + } + aPosBox.SelectEntryPos(pOpt->GetPos()); + aPosBox.Enable( pOpt->GetObjType() != GRAPHIC_CAP && + pOpt->GetObjType() != OLE_CAP && + aPosText.IsEnabled() ); + aPosBox.SelectEntryPos(pOpt->GetPos()); + + USHORT nLevelPos = ( pOpt->GetLevel() < MAXLEVEL ) ? pOpt->GetLevel() + 1 : 0; + aLbLevel.SelectEntryPos( nLevelPos ); + aEdDelim.SetText(pOpt->GetSeparator()); + aNumberingSeparatorED.SetText( pOpt->GetNumSeparator() ); + if(pOpt->GetCharacterStyle().Len()) + aCharStyleLB.SelectEntry( pOpt->GetCharacterStyle() ); + else + aCharStyleLB.SelectEntryPos( 0 ); + aApplyBorderCB.Enable( aCategoryBox.IsEnabled() && + pOpt->GetObjType() != TABLE_CAP && pOpt->GetObjType() != FRAME_CAP ); + aApplyBorderCB.Check( pOpt->CopyAttributes() ); + } + + ModifyHdl(); + + return 0; +} + +/* -----------------26.10.98 11:06------------------- + * + * --------------------------------------------------*/ + +IMPL_LINK( SwCaptionOptPage, SaveEntryHdl, SvxCheckListBox *, EMPTYARG ) +{ + SvLBoxEntry* pEntry = aCheckLB.GetHdlEntry(); + + if (pEntry) // Alles speichern + SaveEntry(pEntry); + + return 0; +} + +/* -----------------05.11.98 16:23------------------- + * + * --------------------------------------------------*/ + +void SwCaptionOptPage::SaveEntry(SvLBoxEntry* pEntry) +{ + if (pEntry) + { + InsCaptionOpt* pOpt = (InsCaptionOpt*)pEntry->GetUserData(); + + pOpt->UseCaption() = aCheckLB.IsChecked((USHORT)aCheckLB.GetModel()->GetAbsPos(pEntry)); + String aName( aCategoryBox.GetText() ); + if(aName == sNone) + pOpt->SetCategory(aEmptyStr); + else + { + aName.EraseLeadingChars (' '); + aName.EraseTrailingChars(' '); + pOpt->SetCategory(aName); + } + pOpt->SetNumType((USHORT)(ULONG)aFormatBox.GetEntryData(aFormatBox.GetSelectEntryPos())); + pOpt->SetCaption(aTextEdit.IsEnabled() ? aTextEdit.GetText() : aEmptyStr ); + pOpt->SetPos(aPosBox.GetSelectEntryPos()); + USHORT nPos = aLbLevel.GetSelectEntryPos(); + USHORT nLevel = ( nPos > 0 && nPos != LISTBOX_ENTRY_NOTFOUND ) ? nPos - 1 : MAXLEVEL; + pOpt->SetLevel(nLevel); + pOpt->SetSeparator(aEdDelim.GetText()); + pOpt->SetNumSeparator( aNumberingSeparatorED.GetText()); + if(!aCharStyleLB.GetSelectEntryPos()) + pOpt->SetCharacterStyle(aEmptyStr); + else + pOpt->SetCharacterStyle(aCharStyleLB.GetSelectEntry()); + pOpt->CopyAttributes() = aApplyBorderCB.IsChecked(); + } +} + +/* -----------------26.10.98 11:06------------------- + * + * --------------------------------------------------*/ + +IMPL_LINK( SwCaptionOptPage, ModifyHdl, Edit *, EMPTYARG ) +{ + String sFldTypeName = aCategoryBox.GetText(); +/* + SwFieldType* pType = sFldTypeName.Len() ? pMgr->GetFldType(RES_SETEXPFLD, sFldTypeName) : 0; + + ((SfxSingleTabDialog*)GetParent())->GetOKButton()->Enable( (!pType || ((SwSetExpFieldType*)pType)->GetType() == GSE_SEQ) + && sFldTypeName.Len() != 0 ); +*/ + SfxSingleTabDialog *pDlg = (SfxSingleTabDialog *)GetParent(); + PushButton *pBtn = pDlg->GetOKButton(); + if (pBtn) + pBtn->Enable(sFldTypeName.Len() != 0); + sal_Bool bEnable = aCategoryBox.IsEnabled() && sFldTypeName != sNone; + + aFormatText.Enable(bEnable); + aFormatBox.Enable(bEnable); + aTextText.Enable(bEnable); + aTextEdit.Enable(bEnable); + + DrawSample(); + return 0; +} + +/* -----------------26.10.98 10:58------------------- + * + * --------------------------------------------------*/ + +IMPL_LINK_INLINE_START( SwCaptionOptPage, SelectHdl, ListBox *, EMPTYARG ) +{ + DrawSample(); + return 0; +} +IMPL_LINK_INLINE_END( SwCaptionOptPage, SelectHdl, ListBox *, EMPTYARG ) +/*-- 02.11.2007 10:00:36--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SwCaptionOptPage, OrderHdl, ListBox*, pBox ) +{ + DrawSample(); + sal_Int32 nPos = pBox->GetSelectEntryPos(); + aNumberingSeparatorFT.Enable( nPos == 1 ); + aNumberingSeparatorED.Enable( nPos == 1 ); + return 0; +} +/* -----------------26.10.98 10:58------------------- + * + * --------------------------------------------------*/ + +void SwCaptionOptPage::DrawSample() +{ + String aStr; + + if( aCategoryBox.GetText() != sNone) + { + //#i61007# order of captions + bool bOrderNumberingFirst = aLbCaptionOrder.GetSelectEntryPos() == 1; + // Nummer + USHORT nNumFmt = (USHORT)(ULONG)aFormatBox.GetEntryData( + aFormatBox.GetSelectEntryPos() ); + if( SVX_NUM_NUMBER_NONE != nNumFmt ) + { + //#i61007# order of captions + if( !bOrderNumberingFirst ) + { + // Kategorie + aStr += aCategoryBox.GetText(); + aStr += ' '; + } + + SwWrtShell *pSh = ::GetActiveWrtShell(); + String sFldTypeName( aCategoryBox.GetText() ); + if (pSh) + { + SwSetExpFieldType* pFldType = (SwSetExpFieldType*)pMgr->GetFldType( + RES_SETEXPFLD, sFldTypeName ); + if( pFldType && pFldType->GetOutlineLvl() < MAXLEVEL ) + { + BYTE nLvl = pFldType->GetOutlineLvl(); + SwNumberTree::tNumberVector aNumVector; + for( BYTE i = 0; i <= nLvl; ++i ) + aNumVector.push_back(1); + + String sNumber( pSh->GetOutlineNumRule()->MakeNumString( + aNumVector, FALSE )); + if( sNumber.Len() ) + (aStr += sNumber) += pFldType->GetDelimiter(); + } + } + + switch( nNumFmt ) + { + case SVX_NUM_CHARS_UPPER_LETTER: aStr += 'A'; break; + case SVX_NUM_CHARS_UPPER_LETTER_N: aStr += 'A'; break; + case SVX_NUM_CHARS_LOWER_LETTER: aStr += 'a'; break; + case SVX_NUM_CHARS_LOWER_LETTER_N: aStr += 'a'; break; + case SVX_NUM_ROMAN_UPPER: aStr += 'I'; break; + case SVX_NUM_ROMAN_LOWER: aStr += 'i'; break; + //case ARABIC: + default: aStr += '1'; break; + } + } + //#i61007# order of captions + if( bOrderNumberingFirst ) + { + aStr += aNumberingSeparatorED.GetText(); + aStr += aCategoryBox.GetText(); + } + aStr += aTextEdit.GetText(); + } + aPreview.SetPreviewText( aStr ); +} + +/*------------------------------------------------------------------------ + Beschreibung: ComboBox ohne Spaces +------------------------------------------------------------------------*/ + +void CaptionComboBox::KeyInput(const KeyEvent& rEvt) +{ + if( rEvt.GetKeyCode().GetCode() != KEY_SPACE ) + SwComboBox::KeyInput(rEvt); +} + + + diff --git a/sw/source/ui/config/optload.hrc b/sw/source/ui/config/optload.hrc new file mode 100644 index 000000000000..b396b2d9f9f0 --- /dev/null +++ b/sw/source/ui/config/optload.hrc @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// SwLoadOptPage -------------------------------- + +#define FL_UPDATE 10 +#define FT_LINK 11 +#define RB_ALWAYS 12 +#define RB_REQUEST 13 +#define RB_NEVER 14 +#define FT_FIELD 15 +#define CB_AUTO_UPDATE_FIELDS 16 +#define CB_AUTO_UPDATE_CHARTS 17 +#define FL_SETTINGS 18 +#define LB_METRIC 19 +#define FT_METRIC 20 +#define FT_TAB 21 +#define MF_TAB 22 +#define CB_USE_SQUARE_PAGE_MODE 23 + +// SwCaptionOptPage ----------------------------- + +#define FT_OBJECTS 10 +#define CLB_OBJECTS 11 +#define FL_SETTINGS_2 12 +#define TXT_CATEGORY 13 +#define BOX_CATEGORY 14 +#define TXT_FORMAT 15 +#define BOX_FORMAT 16 +#define TXT_TEXT 17 +#define EDT_TEXT 18 +#define TXT_POS 19 +#define BOX_POS 20 +#define FL_NUMCAPT 21 +#define FT_LEVEL 22 +#define LB_LEVEL 23 +#define FT_SEPARATOR 24 +#define ED_SEPARATOR 25 +#define FL_CATEGORY 26 +#define FT_CHARSTYLE 27 +#define LB_CHARSTYLE 28 +#define CB_APPLYBORDER 29 +#define WIN_PREVIEW 30 +#define STR_CATEGORY_NONE 31 +#define LB_ORDER 32 +#define FT_ORDER 33 +#define FT_NUM_SEP 34 +#define ED_NUM_SEP 35 + +#define STR_TABLE 10 +#define STR_FRAME 11 +#define STR_GRAPHIC 12 +#define STR_OLE 13 +#define STR_BEGINNING 14 +#define STR_END 15 +#define STR_ABOVE 16 +#define STR_CP_BELOW 17 + diff --git a/sw/source/ui/config/optload.src b/sw/source/ui/config/optload.src new file mode 100644 index 000000000000..febd2a6fc35f --- /dev/null +++ b/sw/source/ui/config/optload.src @@ -0,0 +1,399 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#include "globals.hrc" +#include "optload.hrc" +#include "helpid.h" +#include "config.hrc" + +/**************************************************************************/ +/* */ +/**************************************************************************/ + +TabPage TP_OPTLOAD_PAGE +{ + HelpID = HID_OPTLOAD_PAGE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_UPDATE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Update"; + }; + FixedText FT_LINK + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 115 , 8 ) ; + Text [ en-US ] = "Update links when loading"; + }; + RadioButton RB_ALWAYS + { + Pos = MAP_APPFONT ( 18 , 26 ) ; + Size = MAP_APPFONT ( 75 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Always"; + }; + RadioButton RB_REQUEST + { + Pos = MAP_APPFONT ( 18 , 39 ) ; + Size = MAP_APPFONT ( 75 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~On request"; + }; + RadioButton RB_NEVER + { + Pos = MAP_APPFONT ( 18 , 52 ) ; + Size = MAP_APPFONT ( 75 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Never"; + }; + FixedText FT_FIELD + { + Pos = MAP_APPFONT ( 130 , 14 ) ; + Size = MAP_APPFONT ( 124 , 8 ) ; + Text [ en-US ] = "Automatically"; + }; + CheckBox CB_AUTO_UPDATE_FIELDS + { + Pos = MAP_APPFONT ( 136 , 26) ; + Size = MAP_APPFONT ( 118 , 10 ) ; + Text [ en-US ] = "~Fields"; + }; + CheckBox CB_AUTO_UPDATE_CHARTS + { + Pos = MAP_APPFONT ( 136 , 39) ; + Size = MAP_APPFONT ( 109 , 10 ) ; + Text [ en-US ] = "~Charts"; + }; + FixedLine FL_SETTINGS + { + Pos = MAP_APPFONT ( 6 , 66 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Settings"; + }; + FixedText FT_METRIC + { + Pos = MAP_APPFONT ( 12 , 79 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "Measurement unit"; + }; + ListBox LB_METRIC + { + Pos = MAP_APPFONT ( 130, 77 ) ; + Size = MAP_APPFONT ( 50 , 50 ) ; + Border = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_TAB + { + Pos = MAP_APPFONT ( 12 , 95 ) ; + Size = MAP_APPFONT ( 73 , 8 ) ; + Text [ en-US ] = "Tab stops"; + Group = TRUE ; + }; + MetricField MF_TAB + { + Border = TRUE ; + Pos = MAP_APPFONT ( 130 , 93 ) ; + Size = MAP_APPFONT ( 50 , 12 ) ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + SpinSize = 10 ; + Minimum = 50 ; + Maximum = 9999 ; + First = 50 ; + Last = 9999 ; + }; + CheckBox CB_USE_SQUARE_PAGE_MODE + { + Pos = MAP_APPFONT ( 12 , 111) ; + Size = MAP_APPFONT ( 248 , 10 ) ; + Text [ en-US ] = "Use square page mode for text grid"; + Text [ zh-CN ] = "使用稿纸模式"; + }; +}; +/**************************************************************************/ +/* */ +/**************************************************************************/ + +TabPage TP_OPTCAPTION_PAGE +{ + HelpID = HID_OPTCAPTION_PAGE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + Text [ en-US ] = "Caption" ; + + FixedText FT_OBJECTS + { + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 106 , 20 ) ; + WordBreak = TRUE ; + Text [ en-US ] = "Add captions automatically\nwhen inserting:" ; + }; + Control CLB_OBJECTS + { + Pos = MAP_APPFONT ( 6 , 29 ) ; + Size = MAP_APPFONT ( 106 , 97 ) ; + Border = TRUE ; + TabStop = TRUE ; + }; + FixedText FT_ORDER + { + Pos = MAP_APPFONT ( 6 , 130 ) ; + Size = MAP_APPFONT ( 106 , 8 ) ; + Text [ en-US ] = "Caption order" ; + }; + ListBox LB_ORDER + { + Border = TRUE ; + Pos = MAP_APPFONT ( 6 , 141 ) ; + Size = MAP_APPFONT ( 106 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Category first" ; > ; + < "Numbering first" ; > ; + }; + }; + Window WIN_PREVIEW + { + Pos = MAP_APPFONT ( 6 , 159 ) ; + Size = MAP_APPFONT ( 106 , 20 ) ; + Border = TRUE; + }; + String STR_TABLE + { + Text [ en-US ] = "%PRODUCTNAME Writer Table"; + }; + String STR_FRAME + { + Text [ en-US ] = "%PRODUCTNAME Writer Frame"; + }; + String STR_GRAPHIC + { + Text [ en-US ] = "%PRODUCTNAME Writer Picture"; + }; + String STR_OLE + { + Text [ en-US ] = "Other OLE Objects"; + }; + + FixedLine FL_SETTINGS_2 + { + Pos = MAP_APPFONT ( 118 , 3 ) ; + Size = MAP_APPFONT ( 136 , 8 ) ; + Text [ en-US ] = "Caption" ; + }; + FixedText TXT_CATEGORY + { + Pos = MAP_APPFONT ( 125 , 16 ) ; + Size = MAP_APPFONT ( 59 , 10 ) ; + Text [ en-US ] = "Category" ; + Left = TRUE ; + }; + ComboBox BOX_CATEGORY + { + Pos = MAP_APPFONT ( 189 , 14 ) ; + Size = MAP_APPFONT ( 59 , 61 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + Sort = TRUE ; + }; + FixedText TXT_FORMAT + { + Pos = MAP_APPFONT ( 125 , 31 ) ; + Size = MAP_APPFONT ( 59 , 10 ) ; + Text [ en-US ] = "~Numbering" ; + Left = TRUE ; + }; + ListBox BOX_FORMAT + { + Border = TRUE ; + Pos = MAP_APPFONT ( 189 , 29 ) ; + Size = MAP_APPFONT ( 59 , 61 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + }; + FixedText FT_NUM_SEP + { + Pos = MAP_APPFONT ( 125 , 46 ) ; + Size = MAP_APPFONT ( 61 , 8 ) ; + Text [ en-US ] = "Numbering separator" ; + Left = TRUE ; + }; + Edit ED_NUM_SEP + { + Pos = MAP_APPFONT ( 189 , 44 ) ; + Size = MAP_APPFONT ( 59 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Text = ". " ; + }; + FixedText TXT_TEXT + { + Pos = MAP_APPFONT ( 125 , 60 ) ; + Size = MAP_APPFONT ( 59 , 10 ) ; + Text [ en-US ] = "Separator" ; + Left = TRUE ; + }; + Edit EDT_TEXT + { + Pos = MAP_APPFONT ( 189 , 59 ) ; + Size = MAP_APPFONT ( 59 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + }; + FixedText TXT_POS + { + Pos = MAP_APPFONT ( 125 , 75 ) ; + Size = MAP_APPFONT ( 59 , 10 ) ; + Left = TRUE ; + Text [ en-US ] = "Position" ; + }; + ListBox BOX_POS + { + Pos = MAP_APPFONT ( 189 , 74 ) ; + Size = MAP_APPFONT ( 59 , 61 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + Border = TRUE ; + }; + + FixedLine FL_NUMCAPT + { + Pos = MAP_APPFONT ( 118 , 89 ) ; + Size = MAP_APPFONT ( 136 , 8 ) ; + Text [ en-US ] = "Numbering captions by chapter" ; + }; + FixedText FT_LEVEL + { + Pos = MAP_APPFONT ( 125 , 102 ) ; + Size = MAP_APPFONT ( 59 , 10 ) ; + Text [ en-US ] = "Level" ; + }; + ListBox LB_LEVEL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 189 , 100 ) ; + Size = MAP_APPFONT ( 59 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "None" ; > ; + }; + }; + FixedText FT_SEPARATOR + { + Pos = MAP_APPFONT ( 125 , 117 ) ; + Size = MAP_APPFONT ( 59 , 10 ) ; + Text [ en-US ] = "Separator" ; + }; + Edit ED_SEPARATOR + { + Pos = MAP_APPFONT ( 189 , 115 ) ; + Size = MAP_APPFONT ( 59 , 12 ) ; + Border = TRUE ; + MaxTextLength = 1 ; + TEXT = "." ; + }; + FixedLine FL_CATEGORY + { + Pos = MAP_APPFONT ( 118 , 130 ) ; + Size = MAP_APPFONT ( 136 , 8 ) ; + Text [ en-US ] = "Category and frame format" ; + }; + FixedText FT_CHARSTYLE + { + Pos = MAP_APPFONT ( 125 , 143 ) ; + Size = MAP_APPFONT ( 59 , 10 ) ; + Text [ en-US ] = "Character style" ; + }; + ListBox LB_CHARSTYLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 189 , 141 ) ; + Size = MAP_APPFONT ( 59 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "None" ; > ; + }; + }; + CheckBox CB_APPLYBORDER + { + Pos = MAP_APPFONT ( 125 , 158 ) ; + Size = MAP_APPFONT ( 124 , 10 ) ; + Text [ en-US ] = "Apply border and shadow" ; + }; + + String STR_BEGINNING + { + Text [ en-US ] = "At the beginning" ; + }; + String STR_END + { + Text [ en-US ] = "At the end" ; + }; + String STR_ABOVE + { + Text [ en-US ] = "Above" ; + }; + String STR_CP_BELOW + { + Text [ en-US ] = "Below" ; + }; + String STR_CATEGORY_NONE + { + Text [ en-US ] = "<None>" ; + }; +}; + +StringArray STR_ARR_METRIC +{ + ItemList [ en-US ] = + { + < "Millimeter" ; FUNIT_MM ; > ; + < "Centimeter" ; FUNIT_CM ; > ; + < "Meter" ; FUNIT_M ; > ; + < "Kilometer" ; FUNIT_KM ; > ; + < "Inch" ; FUNIT_INCH ; > ; + < "Foot" ; FUNIT_FOOT ; > ; + < "Miles" ; FUNIT_MILE ; > ; + < "Pica" ; FUNIT_PICA ; > ; + < "Point" ; FUNIT_POINT ; > ; + }; +}; + diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx new file mode 100755 index 000000000000..921d2a652002 --- /dev/null +++ b/sw/source/ui/config/optpage.cxx @@ -0,0 +1,2618 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include <hintids.hxx> +#ifndef _CMDID_H +#include <cmdid.h> +#endif +#include <vcl/svapp.hxx> +#ifndef _SVSTDARR_HXX +#define _SVSTDARR_STRINGSDTOR +#include <svl/svstdarr.hxx> +#endif +#include <svl/cjkoptions.hxx> +#include <svtools/ctrltool.hxx> +#include <svl/eitem.hxx> +#include <svx/htmlmode.hxx> +#include <sfx2/printer.hxx> +#include <sfx2/bindings.hxx> +#include <svx/xtable.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/langitem.hxx> +#include <svx/dlgutil.hxx> +#include <fmtcol.hxx> +#include <charatr.hxx> +#include <swtypes.hxx> +#ifndef _VIEW_HXX +#include <view.hxx> +#endif +#ifndef _DOCSH_HXX +#include <docsh.hxx> +#endif +#ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED +#include <IDocumentDeviceAccess.hxx> +#endif +#include <swmodule.hxx> +#include <wrtsh.hxx> +#include <uitool.hxx> +#include <cfgitems.hxx> //Items fuer Sw-Seiten +#include <poolfmt.hxx> +#include <uiitems.hxx> +#include <initui.hxx> +#include <optpage.hxx> +#include <swprtopt.hxx> +#ifndef _MODCFG_HXX +#include <modcfg.hxx> +#endif +#ifndef _SRCVIEW_HXX +#include <srcview.hxx> +#endif +#include <crstate.hxx> +#include <viewopt.hxx> +#ifndef _GLOBALS_HRC +#include <globals.hrc> +#endif +#ifndef _CONFIG_HRC +#include <config.hrc> +#endif +#ifndef _REDLOPT_HRC +#include <redlopt.hrc> +#endif +#ifndef _OPTDLG_HRC +#include <optdlg.hrc> +#endif +#include <svx/strarray.hxx> +#include <svl/slstitm.hxx> +#include <sfx2/request.hxx> +#include <swwrtshitem.hxx> +#include <svl/ctloptions.hxx> + +#include <unomid.h> + + +using namespace ::com::sun::star; + + +/******************************************************* + ******************************************************/ + +/*-----------------31.08.96 10.16------------------- + TabPage Anzeige/Inhalt +--------------------------------------------------*/ + +SwContentOptPage::SwContentOptPage( Window* pParent, + const SfxItemSet& rCoreSet ) : + SfxTabPage( pParent, SW_RES( TP_CONTENT_OPT ), rCoreSet ), + aLineFL ( this, SW_RES( FL_LINE ) ), + aCrossCB ( this, SW_RES( CB_CROSS ) ), + aSolidHandleCB( this, SW_RES( CB_HANDLE ) ), + aBigHandleCB ( this, SW_RES( CB_BIGHANDLE) ), + + aWindowFL ( this, SW_RES( FL_WINDOW ) ), + aHScrollBox ( this, SW_RES( CB_HSCROLL ) ), + aVScrollBox ( this, SW_RES( CB_VSCROLL ) ), + aAnyRulerCB ( this, SW_RES( CB_ANY_RULER ) ), + aHRulerCBox ( this, SW_RES( CB_HRULER ) ), + aHMetric ( this, SW_RES( LB_HMETRIC ) ), + aVRulerCBox ( this, SW_RES( CB_VRULER ) ), + aVRulerRightCBox( this, SW_RES( CB_VRULER_RIGHT ) ), + aVMetric ( this, SW_RES( LB_VMETRIC ) ), + aSmoothCBox ( this, SW_RES( CB_SMOOTH_SCROLL ) ), + + aDispFL ( this, SW_RES( FL_DISP ) ), + aGrfCB ( this, SW_RES( CB_GRF ) ), + aTblCB ( this, SW_RES( CB_TBL ) ), + aDrwCB ( this, SW_RES( CB_DRWFAST ) ), + aFldNameCB ( this, SW_RES( CB_FIELD ) ), + aPostItCB ( this, SW_RES( CB_POSTIT ) ), + + aSettingsFL ( this, SW_RES( FL_SETTINGS ) ), + aMetricFT ( this, SW_RES( FT_METRIC ) ), + aMetricLB ( this, SW_RES( LB_METRIC ) ) +{ + FreeResource(); + const SfxPoolItem* pItem; + if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_HTML_MODE, FALSE, &pItem ) + && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON) + { + aMetricLB.Show(); + aSettingsFL.Show(); + aMetricFT.Show(); + } + SvtCJKOptions aCJKOptions; + if(aCJKOptions.IsVerticalTextEnabled() ) + { + Point aSmoothPos(aSmoothCBox.GetPosPixel()); + aSmoothPos.Y() += aSmoothPos.Y() - aVRulerCBox.GetPosPixel().Y(); + aSmoothCBox.SetPosPixel(aSmoothPos); + } + else + aVRulerRightCBox.Hide(); + aVRulerCBox.SetClickHdl(LINK(this, SwContentOptPage, VertRulerHdl )); + aAnyRulerCB.SetClickHdl(LINK(this, SwContentOptPage, AnyRulerHdl)); + + SvxStringArray aMetricArr( SW_RES( STR_ARR_METRIC ) ); + for ( USHORT i = 0; i < aMetricArr.Count(); ++i ) + { + String sMetric = aMetricArr.GetStringByPos( i ); + FieldUnit eFUnit = (FieldUnit)aMetricArr.GetValue( i ); + + switch ( eFUnit ) + { + case FUNIT_MM: + case FUNIT_CM: + case FUNIT_POINT: + case FUNIT_PICA: + case FUNIT_INCH: + { + // nur diese Metriken benutzen + USHORT nPos = aMetricLB.InsertEntry( sMetric ); + aMetricLB.SetEntryData( nPos, (void*)(long)eFUnit ); + aVMetric.InsertEntry( sMetric ); + aVMetric.SetEntryData( nPos, (void*)(long)eFUnit ); + aHMetric.InsertEntry( sMetric ); + aHMetric.SetEntryData( nPos, (void*)(long)eFUnit ); + } + default:;//prevent warning + } + } +} + +/*-----------------31.08.96 13.58------------------- + +--------------------------------------------------*/ +SwContentOptPage::~SwContentOptPage() +{ +} + +/*-----------------31.08.96 13.58------------------- + +--------------------------------------------------*/ +SfxTabPage* SwContentOptPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + return new SwContentOptPage(pParent, rAttrSet); +} +/* -----------------------------07.04.01 16:57-------------------------------- + + ---------------------------------------------------------------------------*/ +static void lcl_SelectMetricLB(ListBox& rMetric, USHORT nSID, const SfxItemSet& rSet) +{ + const SfxPoolItem* pItem; + if( rSet.GetItemState( nSID, FALSE, &pItem ) >= SFX_ITEM_AVAILABLE ) + { + FieldUnit eFieldUnit = (FieldUnit)((SfxUInt16Item*)pItem)->GetValue(); + for ( USHORT i = 0; i < rMetric.GetEntryCount(); ++i ) + { + if ( (int)(sal_IntPtr)rMetric.GetEntryData( i ) == (int)eFieldUnit ) + { + rMetric.SelectEntryPos( i ); + break; + } + } + } + rMetric.SaveValue(); +} +/*-----------------31.08.96 13.58------------------- + +--------------------------------------------------*/ +void SwContentOptPage::Reset(const SfxItemSet& rSet) +{ + const SwElemItem* pElemAttr = 0; + + rSet.GetItemState( FN_PARAM_ELEM , FALSE, + (const SfxPoolItem**)&pElemAttr ); + if(pElemAttr) + { + aTblCB .Check (pElemAttr->bTable ); + aGrfCB .Check (pElemAttr->bGraphic ); + aDrwCB .Check (pElemAttr->bDrawing ); + aFldNameCB .Check (pElemAttr->bFieldName ); + aPostItCB .Check (pElemAttr->bNotes ); + aCrossCB .Check( pElemAttr->bCrosshair ); + aSolidHandleCB.Check( !pElemAttr->bHandles ); + aBigHandleCB.Check(pElemAttr->bBigHandles ); + aHScrollBox.Check( pElemAttr->bHorzScrollbar ); + aVScrollBox.Check( pElemAttr->bVertScrollbar ); + aAnyRulerCB.Check( pElemAttr->bAnyRuler ); + aHRulerCBox.Check( pElemAttr->bHorzRuler ); + aVRulerCBox.Check( pElemAttr->bVertRuler ); + aVRulerRightCBox.Check(pElemAttr->bVertRulerRight); + aSmoothCBox.Check( pElemAttr->bSmoothScroll ); + } + aMetricLB.SetNoSelection(); + lcl_SelectMetricLB(aMetricLB, SID_ATTR_METRIC, rSet); + lcl_SelectMetricLB(aHMetric, FN_HSCROLL_METRIC, rSet); + lcl_SelectMetricLB(aVMetric, FN_VSCROLL_METRIC, rSet); + AnyRulerHdl(&aAnyRulerCB); +} + +/*-----------------31.08.96 13.58------------------- + +--------------------------------------------------*/ +BOOL SwContentOptPage::FillItemSet(SfxItemSet& rSet) +{ + const SwElemItem* pOldAttr = (const SwElemItem*) + GetOldItem(GetItemSet(), FN_PARAM_ELEM); + + SwElemItem aElem; + if(pOldAttr) + aElem = *pOldAttr; + aElem.bTable = aTblCB .IsChecked(); + aElem.bGraphic = aGrfCB .IsChecked(); + aElem.bDrawing = aDrwCB .IsChecked(); + aElem.bFieldName = aFldNameCB .IsChecked(); + aElem.bNotes = aPostItCB .IsChecked(); + aElem.bCrosshair = aCrossCB .IsChecked(); + aElem.bHandles = !aSolidHandleCB.IsChecked(); + aElem.bBigHandles = aBigHandleCB.IsChecked(); + aElem.bHorzScrollbar = aHScrollBox.IsChecked(); + aElem.bVertScrollbar = aVScrollBox.IsChecked(); + aElem.bAnyRuler = aAnyRulerCB.IsChecked(); + aElem.bHorzRuler = aHRulerCBox.IsChecked(); + aElem.bVertRuler = aVRulerCBox.IsChecked(); + aElem.bVertRulerRight= aVRulerRightCBox.IsChecked(); + aElem.bSmoothScroll = aSmoothCBox.IsChecked(); + + + BOOL bRet = !pOldAttr || aElem != *pOldAttr; + if(bRet) + bRet = 0 != rSet.Put(aElem); + USHORT nMPos = aMetricLB.GetSelectEntryPos(); + USHORT nGlobalMetricPos = nMPos; + if ( nMPos != aMetricLB.GetSavedValue() ) + { + // Doppel-Cast fuer VA3.0 + USHORT nFieldUnit = (USHORT)(long)aMetricLB.GetEntryData( nMPos ); + rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, (UINT16)nFieldUnit ) ); + bRet = TRUE; + } + + nMPos = aHMetric.GetSelectEntryPos(); + if ( nMPos != aHMetric.GetSavedValue() || nMPos != nGlobalMetricPos ) + { + // Doppel-Cast fuer VA3.0 + USHORT nFieldUnit = (USHORT)(long)aHMetric.GetEntryData( nMPos ); + rSet.Put( SfxUInt16Item( FN_HSCROLL_METRIC, (UINT16)nFieldUnit ) ); + bRet = TRUE; + } + nMPos = aVMetric.GetSelectEntryPos(); + if ( nMPos != aVMetric.GetSavedValue() || nMPos != nGlobalMetricPos ) + { + // Doppel-Cast fuer VA3.0 + USHORT nFieldUnit = (USHORT)(long)aVMetric.GetEntryData( nMPos ); + rSet.Put( SfxUInt16Item( FN_VSCROLL_METRIC, (UINT16)nFieldUnit ) ); + bRet = TRUE; + } + return bRet; +} +/* -----------------------------05.03.2002 15:07------------------------------ + + ---------------------------------------------------------------------------*/ +IMPL_LINK(SwContentOptPage, VertRulerHdl, CheckBox*, pBox) +{ + aVRulerRightCBox.Enable(pBox->IsEnabled() && pBox->IsChecked()); + return 0; +} +/* -----------------20.09.2002 11:30----------------- + * + * --------------------------------------------------*/ +IMPL_LINK( SwContentOptPage, AnyRulerHdl, CheckBox*, pBox) +{ + BOOL bChecked = pBox->IsChecked(); + aHRulerCBox .Enable(bChecked); + aHMetric .Enable(bChecked); + aVRulerCBox .Enable(bChecked); + aVMetric .Enable(bChecked); + VertRulerHdl(&aVRulerCBox); + return 0; +} +/*----------------- OS 27.01.95 ----------------------- + TabPage Drucker Zusatzeinstellungen +-------------------------------------------------------*/ +SwAddPrinterTabPage::SwAddPrinterTabPage( Window* pParent, + const SfxItemSet& rCoreSet) : + SfxTabPage( pParent, SW_RES( TP_OPTPRINT_PAGE ), rCoreSet), + aFL1 (this, SW_RES(FL_1)), + aGrfCB (this, SW_RES(CB_PGRF)), +// aTabCB (this, SW_RES(CB_PTAB)), +// aDrawCB (this, SW_RES(CB_PDRAW)), + aCtrlFldCB (this, SW_RES(CB_CTRLFLD)), + aBackgroundCB (this, SW_RES(CB_BACKGROUND)), + aBlackFontCB (this, SW_RES(CB_BLACK_FONT)), + aPrintHiddenTextCB(this, SW_RES(CB_HIDDEN_TEXT)), + aPrintTextPlaceholderCB(this, SW_RES(CB_TEXT_PLACEHOLDER)), + aSeparatorLFL (this, SW_RES(FL_SEP_PRT_LEFT )), + aFL2 (this, SW_RES(FL_2)), + aLeftPageCB (this, SW_RES(CB_LEFTP)), + aRightPageCB (this, SW_RES(CB_RIGHTP)), +// aReverseCB (this, SW_RES(CB_REVERSE)), + aProspectCB (this, SW_RES(CB_PROSPECT)), + aProspectCB_RTL (this, SW_RES(CB_PROSPECT_RTL)), + aSeparatorRFL (this, SW_RES(FL_SEP_PRT_RIGHT)), + aNoRB (this, SW_RES(RB_NO)), + aOnlyRB (this, SW_RES(RB_ONLY)), + aEndRB (this, SW_RES(RB_END)), + aEndPageRB (this, SW_RES(RB_PAGEEND)), + aFL3 (this, SW_RES(FL_3)), + aFL4 (this, SW_RES(FL_4)), + aPrintEmptyPagesCB(this, SW_RES(CB_PRINTEMPTYPAGES)), +// aSingleJobsCB (this, SW_RES(CB_SINGLEJOBS)), + aPaperFromSetupCB(this, SW_RES(CB_PAPERFROMSETUP)), + aFaxFT (this, SW_RES(FT_FAX)), + aFaxLB (this, SW_RES(LB_FAX)), + sNone(SW_RES(ST_NONE)), + bAttrModified( FALSE ), + bPreview ( FALSE ) +{ + Init(); + FreeResource(); + Link aLk = LINK( this, SwAddPrinterTabPage, AutoClickHdl); + aGrfCB.SetClickHdl( aLk ); + aRightPageCB.SetClickHdl( aLk ); + aLeftPageCB.SetClickHdl( aLk ); +// aTabCB.SetClickHdl( aLk ); +// aDrawCB.SetClickHdl( aLk ); + aCtrlFldCB.SetClickHdl( aLk ); + aBackgroundCB.SetClickHdl( aLk ); + aBlackFontCB.SetClickHdl( aLk ); + aPrintHiddenTextCB.SetClickHdl( aLk ); + aPrintTextPlaceholderCB.SetClickHdl( aLk ); +// aReverseCB.SetClickHdl( aLk ); + aProspectCB.SetClickHdl( aLk ); + aProspectCB_RTL.SetClickHdl( aLk ); + aPaperFromSetupCB.SetClickHdl( aLk ); + aPrintEmptyPagesCB.SetClickHdl( aLk ); + aEndPageRB.SetClickHdl( aLk ); + aEndRB.SetClickHdl( aLk ); + aOnlyRB.SetClickHdl( aLk ); + aNoRB.SetClickHdl( aLk ); +// aSingleJobsCB.SetClickHdl( aLk ); + aFaxLB.SetSelectHdl( LINK( this, SwAddPrinterTabPage, SelectHdl ) ); + + const SfxPoolItem* pItem; + if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_HTML_MODE, FALSE, &pItem ) + && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON) + { +// aDrawCB .Hide(); + aLeftPageCB .Hide(); + aRightPageCB .Hide(); + aPrintHiddenTextCB.Hide(); + aPrintTextPlaceholderCB.Hide(); +// aReverseCB.SetPosPixel(aLeftPageCB.GetPosPixel()); + aProspectCB.SetPosPixel(aLeftPageCB.GetPosPixel()); + Point aPt( aRightPageCB.GetPosPixel() ); + aPt.setX(aPt.getX() + 15); // indent + aProspectCB_RTL.SetPosPixel(aPt); +// aBlackFontCB.SetPosPixel(aBackgroundCB.GetPosPixel()); +// aPrintHiddenTextCB.SetPosPixel(aBlackFontCB.GetPosPixel()); +// aBackgroundCB.SetPosPixel(aCtrlFldCB.GetPosPixel()); +// aCtrlFldCB.SetPosPixel(aDrawCB.GetPosPixel()); + + // hide aPrintEmptyPagesCB and move everything below up accordingly + long nDeltaY = aPaperFromSetupCB.GetPosPixel().getY() - aPrintEmptyPagesCB.GetPosPixel().getY(); + aPrintEmptyPagesCB.Hide(); + aPt = aPaperFromSetupCB.GetPosPixel(); + aPt.setY( aPt.getY() - nDeltaY ); + aPaperFromSetupCB.SetPosPixel( aPt ); + aPt = aFaxFT.GetPosPixel(); + aPt.setY( aPt.getY() - nDeltaY ); + aFaxFT.SetPosPixel( aPt ); + aPt = aFaxLB.GetPosPixel(); + aPt.setY( aPt.getY() - nDeltaY ); + aFaxLB.SetPosPixel( aPt ); + } + aProspectCB_RTL.Disable(); + SvtCTLOptions aCTLOptions; + aProspectCB_RTL.Show(aCTLOptions.IsCTLFontEnabled()); +} + +//------------------------------------------------------------------------ + +void SwAddPrinterTabPage::SetPreview(BOOL bPrev) +{ + bPreview = bPrev; + + if (bPreview) + { + aLeftPageCB.Disable(); + aRightPageCB.Disable(); + aProspectCB.Disable(); + aProspectCB_RTL.Disable(); + aFL3.Disable(); + aNoRB.Disable(); + aOnlyRB.Disable(); + aEndRB.Disable(); + aEndPageRB.Disable(); + } +} + +//------------------------------------------------------------------------ + +SfxTabPage* SwAddPrinterTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet ) +{ + return ( new SwAddPrinterTabPage( pParent, rAttrSet ) ); +} +//------------------------------------------------------------------------ + + +BOOL SwAddPrinterTabPage::FillItemSet( SfxItemSet& rCoreSet ) +{ + if ( bAttrModified ) + { + SwAddPrinterItem aAddPrinterAttr (FN_PARAM_ADDPRINTER); + aAddPrinterAttr.bPrintGraphic = aGrfCB.IsChecked(); + aAddPrinterAttr.bPrintTable = TRUE; // always enabled since CWS printerpullgpages /*aTabCB.IsChecked();*/ + aAddPrinterAttr.bPrintDraw = aGrfCB.IsChecked(); // UI merged with aGrfCB in CWS printerpullgpages /*aDrawCB.IsChecked()*/; + aAddPrinterAttr.bPrintControl = aCtrlFldCB.IsChecked(); + aAddPrinterAttr.bPrintPageBackground = aBackgroundCB.IsChecked(); + aAddPrinterAttr.bPrintBlackFont = aBlackFontCB.IsChecked(); + aAddPrinterAttr.bPrintHiddenText = aPrintHiddenTextCB.IsChecked(); + aAddPrinterAttr.bPrintTextPlaceholder = aPrintTextPlaceholderCB.IsChecked(); + + aAddPrinterAttr.bPrintLeftPages = aLeftPageCB.IsChecked(); + aAddPrinterAttr.bPrintRightPages = aRightPageCB.IsChecked(); + aAddPrinterAttr.bPrintReverse = FALSE; // handled by vcl itself since CWS printerpullpages /*aReverseCB.IsChecked()*/; + aAddPrinterAttr.bPrintProspect = aProspectCB.IsChecked(); + aAddPrinterAttr.bPrintProspectRTL = aProspectCB_RTL.IsChecked(); + aAddPrinterAttr.bPaperFromSetup = aPaperFromSetupCB.IsChecked(); + aAddPrinterAttr.bPrintEmptyPages = aPrintEmptyPagesCB.IsChecked(); + aAddPrinterAttr.bPrintSingleJobs = TRUE; // handled by vcl in new print dialog since CWS printerpullpages /*aSingleJobsCB.IsChecked()*/; + + if (aNoRB.IsChecked()) aAddPrinterAttr.nPrintPostIts = + POSTITS_NONE; + if (aOnlyRB.IsChecked()) aAddPrinterAttr.nPrintPostIts = + POSTITS_ONLY; + if (aEndRB.IsChecked()) aAddPrinterAttr.nPrintPostIts = + POSTITS_ENDDOC; + if (aEndPageRB.IsChecked()) aAddPrinterAttr.nPrintPostIts = + POSTITS_ENDPAGE; + + String sFax = aFaxLB.GetSelectEntry(); + aAddPrinterAttr.sFaxName = sNone == sFax ? aEmptyStr : sFax; + rCoreSet.Put(aAddPrinterAttr); + } + return bAttrModified; +} +//------------------------------------------------------------------------ + + +void SwAddPrinterTabPage::Reset( const SfxItemSet& ) +{ + const SfxItemSet& rSet = GetItemSet(); + const SwAddPrinterItem* pAddPrinterAttr = 0; + + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER , FALSE, + (const SfxPoolItem**)&pAddPrinterAttr )) + { + aGrfCB.Check( pAddPrinterAttr->bPrintGraphic || pAddPrinterAttr->bPrintDraw ); +// aTabCB.Check( pAddPrinterAttr->bPrintTable); +// aDrawCB.Check( pAddPrinterAttr->bPrintDraw); + aCtrlFldCB.Check( pAddPrinterAttr->bPrintControl); + aBackgroundCB.Check( pAddPrinterAttr->bPrintPageBackground); + aBlackFontCB.Check( pAddPrinterAttr->bPrintBlackFont); + aPrintHiddenTextCB.Check( pAddPrinterAttr->bPrintHiddenText); + aPrintTextPlaceholderCB.Check(pAddPrinterAttr->bPrintTextPlaceholder); + aLeftPageCB.Check( pAddPrinterAttr->bPrintLeftPages); + aRightPageCB.Check( pAddPrinterAttr->bPrintRightPages); +// aReverseCB.Check( pAddPrinterAttr->bPrintReverse); + aPaperFromSetupCB.Check(pAddPrinterAttr->bPaperFromSetup); + aPrintEmptyPagesCB.Check(pAddPrinterAttr->bPrintEmptyPages); + aProspectCB.Check( pAddPrinterAttr->bPrintProspect); + aProspectCB_RTL.Check( pAddPrinterAttr->bPrintProspectRTL); +// aSingleJobsCB.Check( pAddPrinterAttr->bPrintSingleJobs); + + aNoRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_NONE ) ; + aOnlyRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ONLY ) ; + aEndRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDDOC ) ; + aEndPageRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDPAGE ) ; + aFaxLB.SelectEntry( pAddPrinterAttr->sFaxName ); + } + if (aProspectCB.IsChecked()) + { + aProspectCB_RTL.Enable(TRUE); + aNoRB.Enable( FALSE ); + aOnlyRB.Enable( FALSE ); + aEndRB.Enable( FALSE ); + aEndPageRB.Enable( FALSE ); + } + else + aProspectCB_RTL.Enable( FALSE ); +} +//----------------------------------------------------------------------- + + +void SwAddPrinterTabPage::Init() +{ + +} +//------------------------------------------------------------------------ + + +IMPL_LINK_INLINE_START( SwAddPrinterTabPage, AutoClickHdl, CheckBox *, EMPTYARG ) +{ + bAttrModified = TRUE; + bool bIsProspect = aProspectCB.IsChecked(); + if (!bIsProspect) + aProspectCB_RTL.Check( FALSE ); + aProspectCB_RTL.Enable( bIsProspect ); + aNoRB.Enable( !bIsProspect ); + aOnlyRB.Enable( !bIsProspect ); + aEndRB.Enable( !bIsProspect ); + aEndPageRB.Enable( !bIsProspect ); + return 0; +} +IMPL_LINK_INLINE_END( SwAddPrinterTabPage, AutoClickHdl, CheckBox *, EMPTYARG ) + +//------------------------------------------------------------------------ + + +void SwAddPrinterTabPage::SetFax( const SvStringsDtor& rFaxLst ) +{ + aFaxLB.InsertEntry(sNone); + for ( USHORT i = 0; i < rFaxLst.Count(); ++i ) + aFaxLB.InsertEntry( *rFaxLst.GetObject(i) ); + aFaxLB.SelectEntryPos(0); +} + +//------------------------------------------------------------------------ + + +IMPL_LINK_INLINE_START( SwAddPrinterTabPage, SelectHdl, ListBox *, EMPTYARG ) +{ + bAttrModified=TRUE; + return 0; +} +IMPL_LINK_INLINE_END( SwAddPrinterTabPage, SelectHdl, ListBox *, EMPTYARG ) + +void SwAddPrinterTabPage::PageCreated (SfxAllItemSet aSet) +{ + //SFX_ITEMSET_ARG (&aSet,pListItem,SfxStringListItem,SID_FAX_LIST,sal_False); + SFX_ITEMSET_ARG (&aSet,pListItem,SfxBoolItem,SID_FAX_LIST,sal_False); + SFX_ITEMSET_ARG (&aSet,pPreviewItem,SfxBoolItem,SID_PREVIEWFLAG_TYPE,sal_False); + if (pPreviewItem) + { + SetPreview(pPreviewItem->GetValue()); + Reset(aSet); + } + if (pListItem && pListItem->GetValue()) + { + SvStringsDtor aFaxList; + const std::vector<rtl::OUString>& rPrinters = Printer::GetPrinterQueues(); + for (unsigned int i = 0; i < rPrinters.size(); ++i) + { + String* pString = new String( rPrinters[i] ); + String* &rpString = pString; + aFaxList.Insert(rpString, 0); + } + SetFax( aFaxList ); +/* SvStringsDtor aFaxList; + const List *pList = (pListItem)->GetList(); + sal_uInt32 nCount = pList->Count(); + for(sal_uInt32 i = 0; i < nCount ; i++) + { + String* pString = (String*)(pList->GetObject(i)); + String* &rpString = pString; + aFaxList.Insert(rpString, 0 ); + } + SetFax(aFaxList); +*/ + } +} +/*-----------------03.09.96 11.53------------------- + Tabpage Standardfonts +--------------------------------------------------*/ + + +SwStdFontTabPage::SwStdFontTabPage( Window* pParent, + const SfxItemSet& rSet ) : + SfxTabPage( pParent, SW_RES( TP_STD_FONT ), rSet), + aStdChrFL (this, SW_RES(FL_STDCHR )), + aTypeFT( this, SW_RES( FT_TYPE )), + + aStandardLbl(this, SW_RES(FT_STANDARD)), + aStandardBox(this, SW_RES(LB_STANDARD)), + + aHeightFT( this, SW_RES( FT_SIZE )), + aStandardHeightLB(this, SW_RES( LB_STANDARD_SIZE )), + + aTitleLbl (this, SW_RES(FT_TITLE )), + aTitleBox (this, SW_RES(LB_TITLE )), + aTitleHeightLB( this, SW_RES( LB_TITLE_SIZE )), + + aListLbl (this, SW_RES(FT_LIST )), + aListBox (this, SW_RES(LB_LIST )), + aListHeightLB( this, SW_RES( LB_LIST_SIZE )), + + aLabelLbl (this, SW_RES(FT_LABEL )), + aLabelBox (this, SW_RES(LB_LABEL )), + aLabelHeightLB( this, SW_RES( LB_LABEL_SIZE )), + + aIdxLbl (this, SW_RES(FT_IDX )), + aIdxBox (this, SW_RES(LB_IDX )), + aIndexHeightLB( this, SW_RES( LB_INDEX_SIZE )), + + aDocOnlyCB (this, SW_RES(CB_DOCONLY )), + aStandardPB (this, SW_RES(PB_STANDARD)), + pPrt(0), + pFontList(0), + pFontConfig(0), + pWrtShell(0), + eLanguage( GetAppLanguage() ), + + bListDefault(FALSE), + bSetListDefault(TRUE), + bLabelDefault(FALSE), + bSetLabelDefault(TRUE), + bIdxDefault(FALSE), + bSetIdxDefault(TRUE), + bDeletePrinter(FALSE), + + bListHeightDefault (FALSE), + bSetListHeightDefault (FALSE), + bLabelHeightDefault (FALSE), + bSetLabelHeightDefault(FALSE), + bIndexHeightDefault (FALSE), + bSetIndexHeightDefault (FALSE), + + nFontGroup(FONT_GROUP_DEFAULT), + + sScriptWestern(SW_RES(ST_SCRIPT_WESTERN)), + sScriptAsian(SW_RES(ST_SCRIPT_ASIAN)), + sScriptComplex(SW_RES(ST_SCRIPT_CTL)) +{ + FreeResource(); + aStandardPB.SetClickHdl(LINK(this, SwStdFontTabPage, StandardHdl)); + aStandardBox.SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl)); + aListBox .SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl)); + aLabelBox .SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl)); + aIdxBox .SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl)); + Link aFocusLink = LINK( this, SwStdFontTabPage, LoseFocusHdl); + aStandardBox.SetLoseFocusHdl( aFocusLink ); + aTitleBox .SetLoseFocusHdl( aFocusLink ); + aListBox .SetLoseFocusHdl( aFocusLink ); + aLabelBox .SetLoseFocusHdl( aFocusLink ); + aIdxBox .SetLoseFocusHdl( aFocusLink ); + + Link aModifyHeightLink( LINK( this, SwStdFontTabPage, ModifyHeightHdl)); + aStandardHeightLB.SetModifyHdl( aModifyHeightLink ); + aTitleHeightLB. SetModifyHdl( aModifyHeightLink ); + aListHeightLB. SetModifyHdl( aModifyHeightLink ); + aLabelHeightLB. SetModifyHdl( aModifyHeightLink ); + aIndexHeightLB. SetModifyHdl( aModifyHeightLink ); + + aDocOnlyCB.Check(SW_MOD()->GetModuleConfig()->IsDefaultFontInCurrDocOnly()); +} + +/*-----------------03.09.96 11.53------------------- + +--------------------------------------------------*/ + +SwStdFontTabPage::~SwStdFontTabPage() +{ + if(bDeletePrinter) + delete pPrt; +} + +/*-----------------03.09.96 11.53------------------- + +--------------------------------------------------*/ +SfxTabPage* SwStdFontTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet ) +{ + return new SwStdFontTabPage(pParent, rAttrSet); +} + +/*-----------------03.09.96 11.53------------------- + +--------------------------------------------------*/ +void lcl_SetColl(SwWrtShell* pWrtShell, USHORT nType, + SfxPrinter* pPrt, const String& rStyle, + USHORT nFontWhich) +{ + BOOL bDelete = FALSE; + const SfxFont* pFnt = pPrt ? pPrt->GetFontByName(rStyle): 0; + if(!pFnt) + { + pFnt = new SfxFont(FAMILY_DONTKNOW, rStyle); + bDelete = TRUE; + } + SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(nType); + pColl->SetFmtAttr(SvxFontItem(pFnt->GetFamily(), pFnt->GetName(), + aEmptyStr, pFnt->GetPitch(), pFnt->GetCharSet(), nFontWhich)); + if(bDelete) + { + delete (SfxFont*) pFnt; + } +} +/*-- 11.10.2005 15:47:52--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void lcl_SetColl(SwWrtShell* pWrtShell, USHORT nType, + sal_Int32 nHeight, USHORT nFontHeightWhich) +{ + float fSize = (float)nHeight / 10; + nHeight = CalcToUnit( fSize, SFX_MAPUNIT_TWIP ); + SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(nType); + pColl->SetFmtAttr(SvxFontHeightItem(nHeight, 100, nFontHeightWhich)); +} +/*-----------------03.09.96 11.53------------------- + +--------------------------------------------------*/ +BOOL SwStdFontTabPage::FillItemSet( SfxItemSet& ) +{ + BOOL bNotDocOnly = !aDocOnlyCB.IsChecked(); + SW_MOD()->GetModuleConfig()->SetDefaultFontInCurrDocOnly(!bNotDocOnly); + + String sStandard = aStandardBox.GetText(); + String sTitle = aTitleBox .GetText(); + String sList = aListBox .GetText(); + String sLabel = aLabelBox .GetText(); + String sIdx = aIdxBox .GetText(); + String sStandardBak = aStandardBox.GetSavedValue(); + String sTitleBak = aTitleBox .GetSavedValue(); + String sListBak = aListBox .GetSavedValue(); + String sLabelBak = aLabelBox .GetSavedValue(); + String sIdxBak = aIdxBox .GetSavedValue(); + + bool bStandardHeightChanged = aStandardHeightLB.GetSavedValue() != aStandardHeightLB.GetText(); + bool bTitleHeightChanged = aTitleHeightLB.GetSavedValue() != aTitleHeightLB.GetText(); + bool bListHeightChanged = aListHeightLB.GetSavedValue() != aListHeightLB.GetText() && (!bListHeightDefault || !bSetListHeightDefault ); + bool bLabelHeightChanged = aLabelHeightLB.GetSavedValue() != aLabelHeightLB.GetText() && (!bLabelHeightDefault || !bSetLabelHeightDefault ); + bool bIndexHeightChanged = aIndexHeightLB.GetSavedValue() != aIndexHeightLB.GetText() && (!bIndexHeightDefault || !bSetIndexHeightDefault ); + if(bNotDocOnly) + { + pFontConfig->SetFontStandard(sStandard, nFontGroup); + pFontConfig->SetFontOutline(sTitle, nFontGroup); + pFontConfig->SetFontList(sList, nFontGroup); + pFontConfig->SetFontCaption(sLabel, nFontGroup); + pFontConfig->SetFontIndex(sIdx, nFontGroup); + if(bStandardHeightChanged) + { + float fSize = (float)aStandardHeightLB.GetValue() / 10; + pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_STANDARD, nFontGroup ); + } + if(bTitleHeightChanged) + { + float fSize = (float)aTitleHeightLB.GetValue() / 10; + pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_OUTLINE, nFontGroup ); + } + if(bListHeightChanged) + { + float fSize = (float)aListHeightLB.GetValue() / 10; + pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_LIST, nFontGroup ); + } + if(bLabelHeightChanged) + { + float fSize = (float)aLabelHeightLB.GetValue() / 10; + pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_CAPTION, nFontGroup ); + } + if(bIndexHeightChanged) + { + float fSize = (float)aIndexHeightLB.GetValue() / 10; + pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_INDEX, nFontGroup ); + } + } + if(pWrtShell) + { + pWrtShell->StartAllAction(); + SfxPrinter* pPrinter = pWrtShell->getIDocumentDeviceAccess()->getPrinter( false ); + BOOL bMod = FALSE; + USHORT nFontWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >( + nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONT : + FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONT : RES_CHRATR_CTL_FONT); + USHORT nFontHeightWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >( + nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONTSIZE : + FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONTSIZE : RES_CHRATR_CTL_FONTSIZE); + if(sStandard != sShellStd) + { + BOOL bDelete = FALSE; + const SfxFont* pFnt = pPrinter ? pPrinter->GetFontByName(sStandard): 0; + if(!pFnt) + { + pFnt = new SfxFont(FAMILY_DONTKNOW, sStandard); + bDelete = TRUE; + } + pWrtShell->SetDefault(SvxFontItem(pFnt->GetFamily(), pFnt->GetName(), + aEmptyStr, pFnt->GetPitch(), pFnt->GetCharSet(), nFontWhich)); + SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD); + pColl->ResetFmtAttr(nFontWhich); + if(bDelete) + { + delete (SfxFont*) pFnt; + bDelete = FALSE; + } +// lcl_SetColl(pWrtShell, RES_POOLCOLL_STANDARD, pPrinter, sStandard); + bMod = TRUE; + } + if(bStandardHeightChanged) + { + float fSize = (float)aStandardHeightLB.GetValue() / 10; + pWrtShell->SetDefault(SvxFontHeightItem( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), 100, nFontHeightWhich ) ); + SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD); + pColl->ResetFmtAttr(nFontHeightWhich); + bMod = TRUE; + } + + if(sTitle != sShellTitle ) + { + lcl_SetColl(pWrtShell, RES_POOLCOLL_HEADLINE_BASE, pPrinter, sTitle, nFontWhich); + bMod = TRUE; + } + if(bTitleHeightChanged) + { + lcl_SetColl(pWrtShell, RES_POOLCOLL_HEADLINE_BASE, + sal::static_int_cast< sal_uInt16, sal_Int64 >(aTitleHeightLB.GetValue()), nFontHeightWhich); + bMod = TRUE; + } + if(sList != sShellList && (!bListDefault || !bSetListDefault )) + { + lcl_SetColl(pWrtShell, RES_POOLCOLL_NUMBUL_BASE, pPrinter, sList, nFontWhich); + bMod = TRUE; + } + if(bListHeightChanged) + { + lcl_SetColl(pWrtShell, RES_POOLCOLL_NUMBUL_BASE, + sal::static_int_cast< sal_uInt16, sal_Int64 >(aListHeightLB.GetValue()), nFontHeightWhich); + bMod = TRUE; + } + if(sLabel != sShellLabel && (!bLabelDefault || !bSetLabelDefault)) + { + lcl_SetColl(pWrtShell, RES_POOLCOLL_LABEL, pPrinter, sLabel, nFontWhich); + bMod = TRUE; + } + if(bLabelHeightChanged) + { + lcl_SetColl(pWrtShell, RES_POOLCOLL_LABEL, + sal::static_int_cast< sal_uInt16, sal_Int64 >(aLabelHeightLB.GetValue()), nFontHeightWhich); + bMod = TRUE; + } + if(sIdx != sShellIndex && (!bIdxDefault || !bSetIdxDefault)) + { + lcl_SetColl(pWrtShell, RES_POOLCOLL_REGISTER_BASE, pPrinter, sIdx, nFontWhich); + bMod = TRUE; + } + if(bIndexHeightChanged) + { + lcl_SetColl(pWrtShell, RES_POOLCOLL_REGISTER_BASE, + sal::static_int_cast< sal_uInt16, sal_Int64 >(aIndexHeightLB.GetValue()), nFontHeightWhich); + bMod = TRUE; + } + if ( bMod ) + pWrtShell->SetModified(); + pWrtShell->EndAllAction(); + } + + return FALSE; +} + +/*-----------------03.09.96 11.53------------------- + +--------------------------------------------------*/ +void SwStdFontTabPage::Reset( const SfxItemSet& rSet) +{ + const SfxPoolItem* pLang; + USHORT nLangSlot = nFontGroup == FONT_GROUP_DEFAULT ? SID_ATTR_LANGUAGE : + FONT_GROUP_CJK == nFontGroup ? SID_ATTR_CHAR_CJK_LANGUAGE : SID_ATTR_CHAR_CTL_LANGUAGE; + + + if( SFX_ITEM_SET == rSet.GetItemState(nLangSlot, FALSE, &pLang)) + eLanguage = ((const SvxLanguageItem*)pLang)->GetValue(); + + String sTmp(aStdChrFL.GetText()); + String sToReplace = sScriptWestern; + if(FONT_GROUP_CJK == nFontGroup ) + sToReplace = sScriptAsian; + else if(FONT_GROUP_CTL == nFontGroup ) + sToReplace = sScriptComplex; + + sTmp.SearchAndReplaceAscii("%1", sToReplace); + aStdChrFL.SetText(sTmp); + const SfxPoolItem* pItem; + + if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_PRINTER, FALSE, &pItem)) + { + pPrt = (SfxPrinter*)((const SwPtrItem*)pItem)->GetValue(); + } + else + { + SfxItemSet* pPrinterSet = new SfxItemSet( *rSet.GetPool(), + SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, + SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, + 0 ); + pPrt = new SfxPrinter(pPrinterSet); + bDeletePrinter = TRUE; + } + pFontList = new FontList( pPrt ); + // #i94536# prevent duplication of font entries when 'reset' button is pressed + if( !aStandardBox.GetEntryCount() ) + { + const USHORT nCount = pPrt->GetFontCount(); + for (USHORT i = 0; i < nCount; ++i) + { + const String &rString = pPrt->GetFont(i)->GetName(); + aStandardBox.InsertEntry( rString ); + aTitleBox .InsertEntry( rString ); + aListBox .InsertEntry( rString ); + aLabelBox .InsertEntry( rString ); + aIdxBox .InsertEntry( rString ); + } + } + if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_STDFONTS, FALSE, &pItem)) + { + pFontConfig = (SwStdFontConfig*)((const SwPtrItem*)pItem)->GetValue(); + } + + if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_WRTSHELL, FALSE, &pItem)) + { + pWrtShell = (SwWrtShell*)((const SwPtrItem*)pItem)->GetValue(); + } + String sStdBackup; + String sOutBackup; + String sListBackup; + String sCapBackup; + String sIdxBackup; + sal_Int32 nStandardHeight = -1; + sal_Int32 nTitleHeight = -1; + sal_Int32 nListHeight = -1; + sal_Int32 nLabelHeight = -1; + sal_Int32 nIndexHeight = -1; + + if(!pWrtShell) + { + sStdBackup = pFontConfig->GetFontStandard(nFontGroup); + sOutBackup = pFontConfig->GetFontOutline(nFontGroup); + sListBackup= pFontConfig->GetFontList(nFontGroup); + sCapBackup = pFontConfig->GetFontCaption(nFontGroup); + sIdxBackup = pFontConfig->GetFontIndex(nFontGroup); + nStandardHeight = pFontConfig->GetFontHeight( FONT_STANDARD, nFontGroup, eLanguage ); + nTitleHeight = pFontConfig->GetFontHeight( FONT_OUTLINE , nFontGroup, eLanguage ); + nListHeight = pFontConfig->GetFontHeight( FONT_LIST , nFontGroup, eLanguage ); + nLabelHeight = pFontConfig->GetFontHeight( FONT_CAPTION , nFontGroup, eLanguage ); + nIndexHeight = pFontConfig->GetFontHeight( FONT_INDEX , nFontGroup, eLanguage ); + if( nStandardHeight <= 0) + nStandardHeight = pFontConfig->GetDefaultHeightFor( FONT_STANDARD + nFontGroup * FONT_PER_GROUP, eLanguage); + if( nTitleHeight <= 0) + nTitleHeight = pFontConfig->GetDefaultHeightFor( FONT_OUTLINE + nFontGroup * FONT_PER_GROUP, eLanguage); + if( nListHeight <= 0) + nListHeight = pFontConfig->GetDefaultHeightFor( FONT_LIST + nFontGroup * FONT_PER_GROUP, eLanguage); + if( nLabelHeight <= 0) + nLabelHeight = pFontConfig->GetDefaultHeightFor( FONT_CAPTION + nFontGroup * FONT_PER_GROUP, eLanguage); + if( nIndexHeight <= 0) + nIndexHeight = pFontConfig->GetDefaultHeightFor( FONT_INDEX + nFontGroup * FONT_PER_GROUP, eLanguage); + + aDocOnlyCB.Enable(FALSE); + } + else + { + SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD); + const SvxFontItem& rFont = !nFontGroup ? pColl->GetFont() : + FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont(); + sShellStd = sStdBackup = rFont.GetFamilyName(); + + USHORT nFontHeightWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >( + nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONTSIZE : + FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONTSIZE : RES_CHRATR_CTL_FONTSIZE ); + const SvxFontHeightItem& rFontHeightStandard = (const SvxFontHeightItem& )pColl->GetFmtAttr(nFontHeightWhich); + nStandardHeight = (sal_Int32)rFontHeightStandard.GetHeight(); + + pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_HEADLINE_BASE); + const SvxFontItem& rFontHL = !nFontGroup ? pColl->GetFont() : + FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont(); + sShellTitle = sOutBackup = rFontHL.GetFamilyName(); + + const SvxFontHeightItem& rFontHeightTitle = (const SvxFontHeightItem&)pColl->GetFmtAttr( nFontHeightWhich, sal_True ); + nTitleHeight = (sal_Int32)rFontHeightTitle.GetHeight(); + + USHORT nFontWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >( + nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONT : + FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONT : RES_CHRATR_CTL_FONT); + pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_NUMBUL_BASE); + const SvxFontItem& rFontLS = !nFontGroup ? pColl->GetFont() : + FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont(); + bListDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, FALSE); + sShellList = sListBackup = rFontLS.GetFamilyName(); + + const SvxFontHeightItem& rFontHeightList = (const SvxFontHeightItem&)pColl->GetFmtAttr(nFontHeightWhich, sal_True); + nListHeight = (sal_Int32)rFontHeightList.GetHeight(); + bListHeightDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, FALSE); + + + pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_LABEL); + bLabelDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, FALSE); + const SvxFontItem& rFontCP = !nFontGroup ? pColl->GetFont() : + FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont(); + sShellLabel = sCapBackup = rFontCP.GetFamilyName(); + const SvxFontHeightItem& rFontHeightLabel = (const SvxFontHeightItem&)pColl->GetFmtAttr(nFontHeightWhich, sal_True); + nLabelHeight = (sal_Int32)rFontHeightLabel.GetHeight(); + bLabelHeightDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, FALSE); + + pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_REGISTER_BASE); + bIdxDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, FALSE); + const SvxFontItem& rFontIDX = !nFontGroup ? pColl->GetFont() : + FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont(); + sShellIndex = sIdxBackup = rFontIDX.GetFamilyName(); + const SvxFontHeightItem& rFontHeightIndex = (const SvxFontHeightItem&)pColl->GetFmtAttr(nFontHeightWhich, sal_True); + nIndexHeight = (sal_Int32)rFontHeightIndex.GetHeight(); + bIndexHeightDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, FALSE); + } + aStandardBox.SetText(sStdBackup ); + aTitleBox .SetText(sOutBackup ); + aListBox .SetText(sListBackup); + aLabelBox .SetText(sCapBackup ); + aIdxBox .SetText(sIdxBackup ); + + FontInfo aFontInfo( pFontList->Get(sStdBackup, sStdBackup) ); + aStandardHeightLB.Fill( &aFontInfo, pFontList ); + aFontInfo = pFontList->Get(sOutBackup, sOutBackup ); + aTitleHeightLB.Fill( &aFontInfo, pFontList ); + aFontInfo = pFontList->Get(sListBackup,sListBackup); + aListHeightLB.Fill( &aFontInfo, pFontList ); + aFontInfo = pFontList->Get(sCapBackup, sCapBackup ); + aLabelHeightLB.Fill( &aFontInfo, pFontList ); + aFontInfo = pFontList->Get(sIdxBackup, sIdxBackup ); + aIndexHeightLB.Fill( &aFontInfo, pFontList ); + + aStandardHeightLB.SetValue( CalcToPoint( nStandardHeight, SFX_MAPUNIT_TWIP, 10 ) ); + aTitleHeightLB. SetValue( CalcToPoint( nTitleHeight , SFX_MAPUNIT_TWIP, 10 ) ); + aListHeightLB. SetValue( CalcToPoint( nListHeight , SFX_MAPUNIT_TWIP, 10 ) ); + aLabelHeightLB. SetValue( CalcToPoint( nLabelHeight , SFX_MAPUNIT_TWIP, 10 )); + aIndexHeightLB. SetValue( CalcToPoint( nIndexHeight , SFX_MAPUNIT_TWIP, 10 )); + + aStandardBox.SaveValue(); + aTitleBox .SaveValue(); + aListBox .SaveValue(); + aLabelBox .SaveValue(); + aIdxBox .SaveValue(); + + aStandardHeightLB.SaveValue(); + aTitleHeightLB. SaveValue(); + aListHeightLB. SaveValue(); + aLabelHeightLB. SaveValue(); + aIndexHeightLB. SaveValue(); +} + +/*-----------------07.09.96 12.28------------------- + +--------------------------------------------------*/ + + +IMPL_LINK( SwStdFontTabPage, StandardHdl, PushButton *, EMPTYARG ) +{ + sal_uInt8 nFontOffset = nFontGroup * FONT_PER_GROUP; + aStandardBox.SetText(SwStdFontConfig::GetDefaultFor(FONT_STANDARD + nFontOffset, eLanguage)); + aTitleBox .SetText(SwStdFontConfig::GetDefaultFor(FONT_OUTLINE + nFontOffset, eLanguage)); + aListBox .SetText(SwStdFontConfig::GetDefaultFor(FONT_LIST + nFontOffset, eLanguage)); + aLabelBox .SetText(SwStdFontConfig::GetDefaultFor(FONT_CAPTION + nFontOffset, eLanguage)); + aIdxBox .SetText(SwStdFontConfig::GetDefaultFor(FONT_INDEX + nFontOffset, eLanguage)); + + aStandardBox.SaveValue(); + aTitleBox .SaveValue(); + aListBox .SaveValue(); + aLabelBox .SaveValue(); + aIdxBox .SaveValue(); + + aStandardHeightLB.SetValue( CalcToPoint( + SwStdFontConfig::GetDefaultHeightFor(FONT_STANDARD + nFontOffset, eLanguage), + SFX_MAPUNIT_TWIP, 10 ) ); + aTitleHeightLB .SetValue(CalcToPoint( + SwStdFontConfig::GetDefaultHeightFor(FONT_OUTLINE + + nFontOffset, eLanguage), SFX_MAPUNIT_TWIP, 10 )); + aListHeightLB .SetValue(CalcToPoint( + SwStdFontConfig::GetDefaultHeightFor(FONT_LIST + nFontOffset, eLanguage), + SFX_MAPUNIT_TWIP, 10 )); + aLabelHeightLB .SetValue(CalcToPoint( + SwStdFontConfig::GetDefaultHeightFor(FONT_CAPTION + nFontOffset, eLanguage), + SFX_MAPUNIT_TWIP, 10 )); + aIndexHeightLB .SetValue(CalcToPoint( + SwStdFontConfig::GetDefaultHeightFor(FONT_INDEX + nFontOffset, eLanguage), + SFX_MAPUNIT_TWIP, 10 )); + + return 0; +} +/*-----------------17.01.97 15.43------------------- + +--------------------------------------------------*/ + +IMPL_LINK( SwStdFontTabPage, ModifyHdl, ComboBox*, pBox ) +{ + if(pBox == &aStandardBox) + { + String sEntry = pBox->GetText(); + if(bSetListDefault && bListDefault) + aListBox.SetText(sEntry); + if(bSetLabelDefault && bLabelDefault) + aLabelBox.SetText(sEntry); + if(bSetIdxDefault && bIdxDefault) + aIdxBox.SetText(sEntry); + } + else if(pBox == &aListBox) + { + bSetListDefault = FALSE; + } + else if(pBox == &aLabelBox) + { + bSetLabelDefault = FALSE; + } + else if(pBox == &aIdxBox) + { + bSetIdxDefault = FALSE; + } + return 0; +} + +/*-- 11.10.2005 15:11:23--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SwStdFontTabPage, ModifyHeightHdl, FontSizeBox*, pBox ) +{ + if(pBox == &aStandardHeightLB) + { + sal_Int64 nValue = pBox->GetValue(FUNIT_TWIP); + if(bSetListHeightDefault && bListHeightDefault) + aListHeightLB.SetValue(nValue, FUNIT_TWIP); + if(bSetLabelHeightDefault && bLabelHeightDefault) + aLabelHeightLB.SetValue(nValue, FUNIT_TWIP); + if(bSetIndexHeightDefault && bIndexHeightDefault) + aIndexHeightLB.SetValue(nValue, FUNIT_TWIP); + } + else if(pBox == &aListHeightLB) + { + bSetListHeightDefault = FALSE; + } + else if(pBox == &aLabelHeightLB) + { + bSetLabelHeightDefault = FALSE; + } + else if(pBox == &aIndexHeightLB) + { + bSetIndexHeightDefault = FALSE; + } + return 0; +} + +/*-- 28.09.2005 13:22:36--------------------------------------------------- + + -----------------------------------------------------------------------*/ +IMPL_LINK( SwStdFontTabPage, LoseFocusHdl, ComboBox*, pBox ) +{ + FontSizeBox* pHeightLB = 0; + String sEntry = pBox->GetText(); + if(pBox == &aStandardBox) + { + pHeightLB = &aStandardHeightLB; + } + else if(pBox == &aTitleBox) + { + pHeightLB = &aTitleHeightLB; + } + else if(pBox == &aListBox) + { + pHeightLB = &aListHeightLB; + } + else if(pBox == &aLabelBox) + { + pHeightLB = &aLabelHeightLB; + } + else /*if(pBox == &aIdxBox)*/ + { + pHeightLB = &aIndexHeightLB; + } + FontInfo aFontInfo( pFontList->Get(sEntry, sEntry) ); + pHeightLB->Fill( &aFontInfo, pFontList ); + + return 0; +} + + +void SwStdFontTabPage::PageCreated (SfxAllItemSet aSet) +{ + SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt16Item, SID_FONTMODE_TYPE, sal_False); + if (pFlagItem) + SetFontMode(sal::static_int_cast< sal_uInt8, sal_uInt16>( pFlagItem->GetValue())); +} +/*-----------------18.01.97 12.14------------------- + Optionen Tabelle +--------------------------------------------------*/ + +SwTableOptionsTabPage::SwTableOptionsTabPage( Window* pParent, const SfxItemSet& rSet ) : + SfxTabPage(pParent, SW_RES(TP_OPTTABLE_PAGE), rSet), + aTableFL (this, SW_RES(FL_TABLE )), + aHeaderCB (this, SW_RES(CB_HEADER )), + aRepeatHeaderCB (this, SW_RES(CB_REPEAT_HEADER )), + aDontSplitCB (this, SW_RES(CB_DONT_SPLIT )), + aBorderCB (this, SW_RES(CB_BORDER )), + + aSeparatorFL (this, SW_RES(FL_TABLE_SEPARATOR)), + + aTableInsertFL (this, SW_RES(FL_TABLE_INSERT )), + aNumFormattingCB(this, SW_RES(CB_NUMFORMATTING )), + aNumFmtFormattingCB(this, SW_RES(CB_NUMFMT_FORMATTING )), + aNumAlignmentCB (this, SW_RES(CB_NUMALIGNMENT )), + + aMoveFL( this, SW_RES(FL_MOVE )), + aMoveFT( this, SW_RES(FT_MOVE )), + aRowMoveFT( this, SW_RES(FT_ROWMOVE )), + aRowMoveMF( this, SW_RES(MF_ROWMOVE )), + aColMoveFT( this, SW_RES(FT_COLMOVE )), + aColMoveMF( this, SW_RES(MF_COLMOVE )), + + aInsertFT( this, SW_RES(FT_INSERT )), + aRowInsertFT( this, SW_RES(FT_ROWINSERT)), + aRowInsertMF( this, SW_RES(MF_ROWINSERT)), + aColInsertFT( this, SW_RES(FT_COLINSERT)), + aColInsertMF( this, SW_RES(MF_COLINSERT)), + + aHandlingFT( this, SW_RES(FT_HANDLING )), + aFixRB( this, SW_RES(RB_FIX )), + aFixPropRB( this, SW_RES(RB_FIXPROP )), + aVarRB( this, SW_RES(RB_VAR )), + aFixFT( this, SW_RES(FT_FIX )), + aFixPropFT( this, SW_RES(FT_FIXPROP )), + aVarFT( this, SW_RES(FT_VAR )), + pWrtShell(0), + bHTMLMode(FALSE) +{ + FreeResource(); + + Link aLnk(LINK(this, SwTableOptionsTabPage, CheckBoxHdl)); + aNumFormattingCB.SetClickHdl(aLnk); + aNumFmtFormattingCB.SetClickHdl(aLnk); + aHeaderCB.SetClickHdl(aLnk); +} + +/*-----------------18.01.97 12.43------------------- + +--------------------------------------------------*/ + +SwTableOptionsTabPage::~SwTableOptionsTabPage() +{ +} + +/*-----------------18.01.97 12.43------------------- + +--------------------------------------------------*/ + +SfxTabPage* SwTableOptionsTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet ) +{ + return new SwTableOptionsTabPage(pParent, rAttrSet ); +} + +/*-----------------18.01.97 12.42------------------- + +--------------------------------------------------*/ + +BOOL SwTableOptionsTabPage::FillItemSet( SfxItemSet& ) +{ + BOOL bRet = FALSE; + SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + + if(aRowMoveMF.IsModified()) + pModOpt->SetTblHMove( (USHORT)aRowMoveMF.Denormalize( aRowMoveMF.GetValue(FUNIT_TWIP))); + + if(aColMoveMF.IsModified()) + pModOpt->SetTblVMove( (USHORT)aColMoveMF.Denormalize( aColMoveMF.GetValue(FUNIT_TWIP))); + + if(aRowInsertMF.IsModified()) + pModOpt->SetTblHInsert((USHORT)aRowInsertMF.Denormalize( aRowInsertMF.GetValue(FUNIT_TWIP))); + + if(aColInsertMF.IsModified()) + pModOpt->SetTblVInsert((USHORT)aColInsertMF.Denormalize( aColInsertMF.GetValue(FUNIT_TWIP))); + + TblChgMode eMode; + if(aFixRB.IsChecked()) + eMode = TBLFIX_CHGABS; + else if(aFixPropRB.IsChecked()) + eMode = TBLFIX_CHGPROP; + else + eMode = TBLVAR_CHGABS; + if(eMode != pModOpt->GetTblMode()) + { + pModOpt->SetTblMode(eMode); + // der Tabellen-Tastatur-Modus hat sich geaendert, das soll + // jetzt auch die aktuelle Tabelle erfahren + if(pWrtShell && nsSelectionType::SEL_TBL & pWrtShell->GetSelectionType()) + { + pWrtShell->SetTblChgMode(eMode); + static USHORT __READONLY_DATA aInva[] = + { FN_TABLE_MODE_FIX, + FN_TABLE_MODE_FIX_PROP, + FN_TABLE_MODE_VARIABLE, + 0 + }; + pWrtShell->GetView().GetViewFrame()->GetBindings().Invalidate( aInva ); + } + + bRet = TRUE; + } + + SwInsertTableOptions aInsOpts( 0, 0 ); + + if (aHeaderCB.IsChecked()) + aInsOpts.mnInsMode |= tabopts::HEADLINE; + + if (aRepeatHeaderCB.IsEnabled() ) + aInsOpts.mnRowsToRepeat = aRepeatHeaderCB.IsChecked()? 1 : 0; + + if (!aDontSplitCB.IsChecked()) + aInsOpts.mnInsMode |= tabopts::SPLIT_LAYOUT; + + if (aBorderCB.IsChecked()) + aInsOpts.mnInsMode |= tabopts::DEFAULT_BORDER; + + if (aHeaderCB.GetSavedValue() != aHeaderCB.GetState() || + aRepeatHeaderCB.GetSavedValue() != aRepeatHeaderCB.GetState() || + aDontSplitCB.GetSavedValue() != aDontSplitCB.GetState() || + aBorderCB.GetSavedValue() != aBorderCB.GetState()) + { + pModOpt->SetInsTblFlags(bHTMLMode, aInsOpts); + } + + if (aNumFormattingCB.GetSavedValue() != aNumFormattingCB.GetState()) + { + pModOpt->SetInsTblFormatNum(bHTMLMode, aNumFormattingCB.IsChecked()); + bRet = TRUE; + } + + if (aNumFmtFormattingCB.GetSavedValue() != aNumFmtFormattingCB.GetState()) + { + pModOpt->SetInsTblChangeNumFormat(bHTMLMode, aNumFmtFormattingCB.IsChecked()); + bRet = TRUE; + } + + if (aNumAlignmentCB.GetSavedValue() != aNumAlignmentCB.GetState()) + { + pModOpt->SetInsTblAlignNum(bHTMLMode, aNumAlignmentCB.IsChecked()); + bRet = TRUE; + } + + return bRet; +} +/*-----------------18.01.97 12.42------------------- + +--------------------------------------------------*/ +void SwTableOptionsTabPage::Reset( const SfxItemSet& rSet) +{ + const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); + if ( rSet.GetItemState( SID_ATTR_METRIC ) >= SFX_ITEM_AVAILABLE ) + { + const SfxUInt16Item& rItem = (SfxUInt16Item&)rSet.Get( SID_ATTR_METRIC ); + FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue(); + ::SetFieldUnit( aRowMoveMF, eFieldUnit ); + ::SetFieldUnit( aColMoveMF, eFieldUnit ); + ::SetFieldUnit( aRowInsertMF, eFieldUnit ); + ::SetFieldUnit( aColInsertMF, eFieldUnit ); + } + + aRowMoveMF .SetValue(aRowMoveMF.Normalize(pModOpt->GetTblHMove()), FUNIT_TWIP); + aColMoveMF .SetValue(aColMoveMF.Normalize(pModOpt->GetTblVMove()), FUNIT_TWIP); + aRowInsertMF.SetValue(aRowInsertMF.Normalize(pModOpt->GetTblHInsert()), FUNIT_TWIP); + aColInsertMF.SetValue(aColInsertMF.Normalize(pModOpt->GetTblVInsert()), FUNIT_TWIP); + + switch(pModOpt->GetTblMode()) + { + case TBLFIX_CHGABS: aFixRB.Check(); break; + case TBLFIX_CHGPROP: aFixPropRB.Check(); break; + case TBLVAR_CHGABS: aVarRB.Check(); break; + } + const SfxPoolItem* pItem; + if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem)) + { + bHTMLMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON); + } + + //bestimmte Controls fuer HTML verstecken + if(bHTMLMode) + { +/* Point aPos(aCaptionFL.GetPosPixel()); + long nYDiff = aTableFL.GetPosPixel().Y() - aPos.Y(); + aTableFL.SetPosPixel(aPos); + + aPos = aHeaderCB.GetPosPixel(); + aPos.Y() -= nYDiff; + aHeaderCB.SetPosPixel(aPos); + + aPos = aRepeatHeaderCB.GetPosPixel(); + aPos.Y() -= nYDiff; + aRepeatHeaderCB.SetPosPixel(aPos); + + aPos = aDontSplitCB.GetPosPixel(); // hier muss eine Luecke geschlossen werden + aPos.Y() -= nYDiff; + aBorderCB.SetPosPixel(aPos); + + aPos = aTableInsertFL.GetPosPixel(); + aPos.Y() -= nYDiff; + aTableInsertFL.SetPosPixel(aPos); + + aPos = aNumFormattingCB.GetPosPixel(); + aPos.Y() -= nYDiff; + aNumFormattingCB.SetPosPixel(aPos); + + aPos = aNumFmtFormattingCB.GetPosPixel(); + aPos.Y() -= nYDiff; + aNumFmtFormattingCB.SetPosPixel(aPos); + + aPos = aNumAlignmentCB.GetPosPixel(); + aPos.Y() -= nYDiff; + aNumAlignmentCB.SetPosPixel(aPos); + + aCaptionFL.Hide(); + aCaptionCB.Hide(); + aCaptionFT.Hide(); + aCaptionPB.Hide(); +*/ + aDontSplitCB.Hide(); + } + + SwInsertTableOptions aInsOpts = pModOpt->GetInsTblFlags(bHTMLMode); + USHORT nInsTblFlags = aInsOpts.mnInsMode; + + aHeaderCB.Check(0 != (nInsTblFlags & tabopts::HEADLINE)); + aRepeatHeaderCB.Check(aInsOpts.mnRowsToRepeat > 0); + aDontSplitCB.Check(!(nInsTblFlags & tabopts::SPLIT_LAYOUT)); + aBorderCB.Check(0 != (nInsTblFlags & tabopts::DEFAULT_BORDER)); + + aNumFormattingCB.Check(pModOpt->IsInsTblFormatNum(bHTMLMode)); + aNumFmtFormattingCB.Check(pModOpt->IsInsTblChangeNumFormat(bHTMLMode)); + aNumAlignmentCB.Check(pModOpt->IsInsTblAlignNum(bHTMLMode)); + + aHeaderCB.SaveValue(); + aRepeatHeaderCB.SaveValue(); + aDontSplitCB.SaveValue(); + aBorderCB.SaveValue(); + aNumFormattingCB.SaveValue(); + aNumFmtFormattingCB.SaveValue(); + aNumAlignmentCB.SaveValue(); + + CheckBoxHdl(0); +} +/*-----------------18.01.97 12.42------------------- + +--------------------------------------------------*/ +IMPL_LINK(SwTableOptionsTabPage, CheckBoxHdl, CheckBox*, EMPTYARG) +{ + aNumFmtFormattingCB.Enable(aNumFormattingCB.IsChecked()); + aNumAlignmentCB.Enable(aNumFormattingCB.IsChecked()); + aRepeatHeaderCB.Enable(aHeaderCB.IsChecked()); + return 0; +} +void SwTableOptionsTabPage::PageCreated (SfxAllItemSet aSet) +{ + SFX_ITEMSET_ARG (&aSet,pWrtSh,SwWrtShellItem,SID_WRT_SHELL,sal_False); + if (pWrtSh) + SetWrtShell(pWrtSh->GetValue()); +} +/* */ + +/*-----------------31.10.97 17:55------------------- + TabPage fuer ShadowCrsr +--------------------------------------------------*/ + +SwShdwCrsrOptionsTabPage::SwShdwCrsrOptionsTabPage( Window* pParent, + const SfxItemSet& rSet ) + : SfxTabPage(pParent, SW_RES(TP_OPTSHDWCRSR), rSet), + aUnprintFL ( this, SW_RES( FL_NOPRINT ) ), + aParaCB ( this, SW_RES( CB_PARA ) ), + aSHyphCB ( this, SW_RES( CB_SHYPH ) ), + aSpacesCB ( this, SW_RES( CB_SPACE ) ), + aHSpacesCB ( this, SW_RES( CB_HSPACE ) ), + aTabCB ( this, SW_RES( CB_TAB ) ), + aBreakCB ( this, SW_RES( CB_BREAK ) ), + aCharHiddenCB ( this, SW_RES( CB_CHAR_HIDDEN ) ), + aFldHiddenCB ( this, SW_RES( CB_FLD_HIDDEN ) ), + aFldHiddenParaCB ( this, SW_RES( CB_FLD_HIDDEN_PARA ) ), + + aSeparatorFL( this, SW_RES( FL_SEPARATOR_SHDW)), + + aFlagFL( this, SW_RES( FL_SHDWCRSFLAG )), + aOnOffCB( this, SW_RES( CB_SHDWCRSONOFF )), + + aFillModeFT( this, SW_RES( FT_SHDWCRSFILLMODE )), + aFillMarginRB( this, SW_RES( RB_SHDWCRSFILLMARGIN )), + aFillIndentRB( this, SW_RES( RB_SHDWCRSFILLINDENT )), + aFillTabRB( this, SW_RES( RB_SHDWCRSFILLTAB )), + aFillSpaceRB( this, SW_RES( RB_SHDWCRSFILLSPACE )), + aCrsrOptFL ( this, SW_RES( FL_CRSR_OPT)), + aCrsrInProtCB( this, SW_RES( CB_ALLOW_IN_PROT )) +{ + FreeResource(); + const SfxPoolItem* pItem = 0; + SwShadowCursorItem aOpt; + + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem )) + aOpt = *(SwShadowCursorItem*)pItem; + + aOnOffCB.Check( aOpt.IsOn() ); + + BYTE eMode = aOpt.GetMode(); + aFillIndentRB.Check( FILL_INDENT == eMode ); + aFillMarginRB.Check( FILL_MARGIN == eMode ); + aFillTabRB.Check( FILL_TAB == eMode ); + aFillSpaceRB.Check( FILL_SPACE == eMode ); + + if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem ) + && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON) + { + aTabCB .Hide(); + aCharHiddenCB.Hide(); + aFldHiddenCB .Hide(); + aFldHiddenParaCB.Hide(); + aBreakCB.SetPosPixel(aTabCB.GetPosPixel()); + aFlagFL .Hide(); + aOnOffCB .Hide(); + aFillModeFT .Hide(); + aFillMarginRB .Hide(); + aFillIndentRB .Hide(); + aFillTabRB .Hide(); + aFillSpaceRB .Hide(); + aCrsrOptFL .Hide(); + aCrsrInProtCB .Hide(); + aSeparatorFL.Hide(); + long nWidth = aFlagFL.GetSizePixel().Width() + aFlagFL.GetPosPixel().X() + - aUnprintFL.GetPosPixel().X(); + Size aSize(aUnprintFL.GetSizePixel()); + aSize.Width() = nWidth; + aUnprintFL.SetSizePixel(aSize); + } +} + +SwShdwCrsrOptionsTabPage::~SwShdwCrsrOptionsTabPage() +{ +} + + +SfxTabPage* SwShdwCrsrOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet ) +{ + return new SwShdwCrsrOptionsTabPage( pParent, rSet ); +} + +BOOL SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet ) +{ + SwShadowCursorItem aOpt; + aOpt.SetOn( aOnOffCB.IsChecked() ); + + BYTE eMode; + if( aFillIndentRB.IsChecked() ) + eMode= FILL_INDENT; + else if( aFillMarginRB.IsChecked() ) + eMode = FILL_MARGIN; + else if( aFillTabRB.IsChecked() ) + eMode = FILL_TAB; + else + eMode = FILL_SPACE; + aOpt.SetMode( eMode ); + + BOOL bRet = FALSE; + const SfxPoolItem* pItem = 0; + if( SFX_ITEM_SET != rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem ) + || ((SwShadowCursorItem&)*pItem) != aOpt ) + { + rSet.Put( aOpt ); + bRet = TRUE; + } + + if( aCrsrInProtCB.IsChecked() != aCrsrInProtCB.GetSavedValue()) + { + rSet.Put(SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aCrsrInProtCB.IsChecked())); + bRet |= TRUE; + } + + const SwDocDisplayItem* pOldAttr = (const SwDocDisplayItem*) + GetOldItem(GetItemSet(), FN_PARAM_DOCDISP); + + SwDocDisplayItem aDisp; + if(pOldAttr) + aDisp = *pOldAttr; + // + aDisp.bParagraphEnd = aParaCB .IsChecked(); + aDisp.bTab = aTabCB .IsChecked(); + aDisp.bSpace = aSpacesCB .IsChecked(); + aDisp.bNonbreakingSpace = aHSpacesCB .IsChecked(); + aDisp.bSoftHyphen = aSHyphCB .IsChecked(); + aDisp.bFldHiddenText = aFldHiddenCB .IsChecked(); + aDisp.bCharHiddenText = aCharHiddenCB.IsChecked(); + aDisp.bShowHiddenPara = aFldHiddenParaCB .IsChecked(); + aDisp.bManualBreak = aBreakCB .IsChecked(); + + bRet |= (!pOldAttr || aDisp != *pOldAttr); + if(bRet) + bRet = 0 != rSet.Put(aDisp); + + return bRet; +} + +void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet ) +{ + const SfxPoolItem* pItem = 0; + SwShadowCursorItem aOpt; + + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem )) + aOpt = *(SwShadowCursorItem*)pItem; + + aOnOffCB.Check( aOpt.IsOn() ); + + BYTE eMode = aOpt.GetMode(); + aFillIndentRB.Check( FILL_INDENT == eMode ); + aFillMarginRB.Check( FILL_MARGIN == eMode ); + aFillTabRB.Check( FILL_TAB == eMode ); + aFillSpaceRB.Check( FILL_SPACE == eMode ); + + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, FALSE, &pItem )) + aCrsrInProtCB.Check(((const SfxBoolItem*)pItem)->GetValue()); + aCrsrInProtCB.SaveValue(); + + const SwDocDisplayItem* pDocDisplayAttr = 0; + + rSet.GetItemState( FN_PARAM_DOCDISP, FALSE, + (const SfxPoolItem**)&pDocDisplayAttr ); + if(pDocDisplayAttr) + { + aParaCB .Check (pDocDisplayAttr->bParagraphEnd ); + aTabCB .Check (pDocDisplayAttr->bTab ); + aSpacesCB .Check (pDocDisplayAttr->bSpace ); + aHSpacesCB .Check (pDocDisplayAttr->bNonbreakingSpace ); + aSHyphCB .Check (pDocDisplayAttr->bSoftHyphen ); + aCharHiddenCB.Check (pDocDisplayAttr->bCharHiddenText ); + aFldHiddenCB .Check (pDocDisplayAttr->bFldHiddenText ); + aFldHiddenParaCB.Check (pDocDisplayAttr->bShowHiddenPara ); + aBreakCB .Check (pDocDisplayAttr->bManualBreak ); + } +} + +/*-----------------31.10.97 17:55------------------- + TabPage fuer Redlining +--------------------------------------------------*/ + +struct CharAttr +{ + USHORT nItemId; + USHORT nAttr; +}; + +// Editieren entspricht Einfuegen-Attributen +static CharAttr __FAR_DATA aRedlineAttr[] = +{ + { SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_NOT_MAPPED }, + { SID_ATTR_CHAR_WEIGHT, WEIGHT_BOLD }, + { SID_ATTR_CHAR_POSTURE, ITALIC_NORMAL }, + { SID_ATTR_CHAR_UNDERLINE, UNDERLINE_SINGLE }, + { SID_ATTR_CHAR_UNDERLINE, UNDERLINE_DOUBLE }, + { SID_ATTR_CHAR_STRIKEOUT, STRIKEOUT_SINGLE }, + { SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_VERSALIEN }, + { SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_GEMEINE }, + { SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_KAPITAELCHEN }, + { SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_TITEL }, + { SID_ATTR_BRUSH, 0 } +}; +// Items from aRedlineAttr relevant for InsertAttr: strikethrough is +// not used +static USHORT aInsertAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 }; + +// Items from aRedlineAttr relevant for DeleteAttr: underline and +// double underline is not used +static USHORT aDeletedAttrMap[] = { 0, 1, 2, 5, 6, 7, 8, 9, 10 }; + +// Items from aRedlineAttr relevant for ChangeAttr: strikethrough is +// not used +static USHORT aChangedAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 }; + +/*----------------------------------------------------------------------- + Beschreibung: Markierungsvorschau + -----------------------------------------------------------------------*/ + +SwMarkPreview::SwMarkPreview( Window *pParent, const ResId& rResID ) : + + Window(pParent, rResID), + m_aTransCol( COL_TRANSPARENT ), + m_aMarkCol( COL_LIGHTRED ), + nMarkPos(0) + +{ + InitColors(); + SetMapMode(MAP_PIXEL); + + const Size aSz(GetOutputSizePixel()); + + // Seite + aPage.SetSize(Size(aSz.Width() - 3, aSz.Height() - 3)); + + ULONG nOutWPix = aPage.GetWidth(); + ULONG nOutHPix = aPage.GetHeight(); + + // PrintArea + ULONG nLBorder = 8; + ULONG nRBorder = 8; + ULONG nTBorder = 4; + ULONG nBBorder = 4; + + aLeftPagePrtArea = Rectangle(Point(nLBorder, nTBorder), Point((nOutWPix - 1) - nRBorder, (nOutHPix - 1) - nBBorder)); + USHORT nWidth = (USHORT)aLeftPagePrtArea.GetWidth(); + USHORT nKorr = (nWidth & 1) != 0 ? 0 : 1; + aLeftPagePrtArea.SetSize(Size(nWidth / 2 - (nLBorder + nRBorder) / 2 + nKorr, aLeftPagePrtArea.GetHeight())); + + aRightPagePrtArea = aLeftPagePrtArea; + aRightPagePrtArea.Move(aLeftPagePrtArea.GetWidth() + nLBorder + nRBorder + 1, 0); +} + +SwMarkPreview::~SwMarkPreview() +{ +} + +void SwMarkPreview::InitColors( void ) +{ + // m_aTransCol and m_aMarkCol are _not_ changed because they are set from outside! + + const StyleSettings& rSettings = GetSettings().GetStyleSettings(); + m_aBgCol = Color( rSettings.GetWindowColor() ); + + BOOL bHC = rSettings.GetHighContrastMode(); + m_aLineCol = bHC? SwViewOption::GetFontColor() : Color( COL_BLACK ); + m_aShadowCol = bHC? m_aBgCol : rSettings.GetShadowColor(); + m_aTxtCol = bHC? SwViewOption::GetFontColor() : Color( COL_GRAY ); + m_aPrintAreaCol = m_aTxtCol; +} + +void SwMarkPreview::DataChanged( const DataChangedEvent& rDCEvt ) +{ + Window::DataChanged( rDCEvt ); + + if( rDCEvt.GetType() == DATACHANGED_SETTINGS && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) + InitColors(); +} + +void SwMarkPreview::Paint(const Rectangle &/*rRect*/) +{ + // Schatten zeichnen + Rectangle aShadow(aPage); + aShadow += Point(3, 3); + DrawRect( aShadow, m_aShadowCol, m_aTransCol ); + + // Seite zeichnen + DrawRect( aPage, m_aBgCol, m_aLineCol ); + + // Separator zeichnen + Rectangle aPageSeparator(aPage); + aPageSeparator.SetSize(Size(2, aPageSeparator.GetHeight())); + aPageSeparator.Move(aPage.GetWidth() / 2 - 1, 0); + DrawRect( aPageSeparator, m_aLineCol, m_aTransCol ); + + PaintPage(aLeftPagePrtArea); + PaintPage(aRightPagePrtArea); + + Rectangle aLeftMark(Point(aPage.Left() + 2, aLeftPagePrtArea.Top() + 4), Size(aLeftPagePrtArea.Left() - 4, 2)); + Rectangle aRightMark(Point(aRightPagePrtArea.Right() + 2, aRightPagePrtArea.Bottom() - 6), Size(aLeftPagePrtArea.Left() - 4, 2)); + + switch (nMarkPos) + { + case 1: // Links + aRightMark.SetPos(Point(aRightPagePrtArea.Left() - 2 - aRightMark.GetWidth(), aRightMark.Top())); + break; + + case 2: // Rechts + aLeftMark.SetPos(Point(aLeftPagePrtArea.Right() + 2, aLeftMark.Top())); + break; + + case 3: // Aussen + break; + + case 4: // Innen + aLeftMark.SetPos(Point(aLeftPagePrtArea.Right() + 2, aLeftMark.Top())); + aRightMark.SetPos(Point(aRightPagePrtArea.Left() - 2 - aRightMark.GetWidth(), aRightMark.Top())); + break; + + case 0: // Keine + default: + return; + } + DrawRect( aLeftMark, m_aMarkCol, m_aTransCol ); + DrawRect( aRightMark, m_aMarkCol, m_aTransCol ); +} + +void SwMarkPreview::PaintPage(const Rectangle &rRect) +{ + // PrintArea zeichnen + DrawRect(rRect, m_aTransCol, m_aPrintAreaCol ); + + // Testabsatz zeichnen + ULONG nLTxtBorder = 4; + ULONG nRTxtBorder = 4; + ULONG nTTxtBorder = 4; + + Rectangle aTextLine = rRect; + aTextLine.SetSize(Size(aTextLine.GetWidth(), 2)); + aTextLine.Left() += nLTxtBorder; + aTextLine.Right() -= nRTxtBorder; + aTextLine.Move(0, nTTxtBorder); + + sal_Int32 nStep; + USHORT nLines; + + nStep = aTextLine.GetHeight() + 2; + nLines = (USHORT)(rRect.GetHeight() / (aTextLine.GetHeight() + 2)) - 1; + + // Text simulieren + // + for (USHORT i = 0; i < nLines; ++i) + { + if (i == (nLines - 1)) + aTextLine.SetSize(Size(aTextLine.GetWidth() / 2, aTextLine.GetHeight())); + + if (aPage.IsInside(aTextLine)) + DrawRect(aTextLine, m_aTxtCol, m_aTransCol ); + + aTextLine.Move(0, nStep); + } + aTextLine.Move(0, -nStep); +} + +void SwMarkPreview::DrawRect(const Rectangle &rRect, const Color &rFillColor, const Color &rLineColor) +{ + SetFillColor(rFillColor); + SetLineColor(rLineColor); + Window::DrawRect(rRect); +} + +namespace +{ + void lcl_FillRedlineAttrListBox( + ListBox& rLB, const AuthorCharAttr& rAttrToSelect, + const USHORT* pAttrMap, const USHORT nAttrMapSize) + { + for (USHORT i = 0; i != nAttrMapSize; ++i) + { + CharAttr& rAttr(aRedlineAttr[pAttrMap[i]]); + rLB.SetEntryData(i, &rAttr); + if (rAttr.nItemId == rAttrToSelect.nItemId && + rAttr.nAttr == rAttrToSelect.nAttr) + rLB.SelectEntryPos(i); + } + } +} + +SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( Window* pParent, + const SfxItemSet& rSet ) + : SfxTabPage(pParent, SW_RES(TP_REDLINE_OPT), rSet), + + aInsertFL( this, SW_RES( FL_TE )), + + aInsertFT( this, SW_RES( FT_CHG_INSERT )), + aInsertAttrFT( this, SW_RES( FT_INS_ATTR )), + aInsertLB( this, SW_RES( LB_INS_ATTR )), + aInsertColorFT( this, SW_RES( FT_INS_COL )), + aInsertColorLB( this, SW_RES( LB_INS_COL )), + aInsertedPreviewWN( this, SW_RES( WIN_INS )), + + aDeletedFT( this, SW_RES( FT_CHG_DELETE )), + aDeletedAttrFT( this, SW_RES( FT_DEL_ATTR )), + aDeletedLB( this, SW_RES( LB_DEL_ATTR )), + aDeletedColorFT( this, SW_RES( FT_DEL_COL )), + aDeletedColorLB( this, SW_RES( LB_DEL_COL )), + aDeletedPreviewWN( this, SW_RES( WIN_DEL )), + + aChangedFT( this, SW_RES( FT_CHG_CHANGE )), + aChangedAttrFT( this, SW_RES( FT_CHG_ATTR )), + aChangedLB( this, SW_RES( LB_CHG_ATTR )), + aChangedColorFT( this, SW_RES( FT_CHG_COL )), + aChangedColorLB( this, SW_RES( LB_CHG_COL )), + aChangedPreviewWN( this, SW_RES( WIN_CHG )), + + aChangedFL ( this, SW_RES( FL_LC )), + + aMarkPosFT ( this, SW_RES( FT_MARKPOS )), + aMarkPosLB ( this, SW_RES( LB_MARKPOS )), + aMarkColorFT ( this, SW_RES( FT_LC_COL )), + aMarkColorLB ( this, SW_RES( LB_LC_COL )), + aMarkPreviewWN ( this, SW_RES( WIN_MARK )), + + sAuthor ( SW_RES( STR_AUTHOR )), + sNone ( SW_RES( STR_NOTHING )) + +{ + FreeResource(); + + for(USHORT i = 0; i < aInsertLB.GetEntryCount(); i++) + { + String sEntry(aInsertLB.GetEntry(i)); + aDeletedLB.InsertEntry(sEntry); + aChangedLB.InsertEntry(sEntry); + }; + + // remove strikethrough from insert and change and underline + double + // underline from delete + aInsertLB.RemoveEntry(5); + aChangedLB.RemoveEntry(5); + aDeletedLB.RemoveEntry(4); + aDeletedLB.RemoveEntry(3); + + Link aLk = LINK(this, SwRedlineOptionsTabPage, AttribHdl); + aInsertLB.SetSelectHdl( aLk ); + aDeletedLB.SetSelectHdl( aLk ); + aChangedLB.SetSelectHdl( aLk ); + + aLk = LINK(this, SwRedlineOptionsTabPage, ColorHdl); + aInsertColorLB.SetSelectHdl( aLk ); + aDeletedColorLB.SetSelectHdl( aLk ); + aChangedColorLB.SetSelectHdl( aLk ); + + aLk = LINK(this, SwRedlineOptionsTabPage, ChangedMaskPrevHdl); + aMarkPosLB.SetSelectHdl( aLk ); + aMarkColorLB.SetSelectHdl( aLk ); +} + +SwRedlineOptionsTabPage::~SwRedlineOptionsTabPage() +{ +} + +SfxTabPage* SwRedlineOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet) +{ + return new SwRedlineOptionsTabPage( pParent, rSet ); +} + +BOOL SwRedlineOptionsTabPage::FillItemSet( SfxItemSet& ) +{ + CharAttr *pAttr; + SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig(); + + AuthorCharAttr aInsertedAttr; + AuthorCharAttr aDeletedAttr; + AuthorCharAttr aChangedAttr; + + AuthorCharAttr aOldInsertAttr(pOpt->GetInsertAuthorAttr()); + AuthorCharAttr aOldDeletedAttr(pOpt->GetDeletedAuthorAttr()); + AuthorCharAttr aOldChangedAttr(pOpt->GetFormatAuthorAttr()); + + ColorData nOldMarkColor = pOpt->GetMarkAlignColor().GetColor(); + USHORT nOldMarkMode = pOpt->GetMarkAlignMode(); + + USHORT nPos = aInsertLB.GetSelectEntryPos(); + if (nPos != LISTBOX_ENTRY_NOTFOUND) + { + pAttr = (CharAttr *)aInsertLB.GetEntryData(nPos); + aInsertedAttr.nItemId = pAttr->nItemId; + aInsertedAttr.nAttr = pAttr->nAttr; + + nPos = aInsertColorLB.GetSelectEntryPos(); + + switch (nPos) + { + case 0: + aInsertedAttr.nColor = COL_NONE; + break; + case 1: + case LISTBOX_ENTRY_NOTFOUND: + aInsertedAttr.nColor = COL_TRANSPARENT; + break; + default: + aInsertedAttr.nColor = aInsertColorLB.GetEntryColor(nPos).GetColor(); + break; + } + + pOpt->SetInsertAuthorAttr(aInsertedAttr); + } + + nPos = aDeletedLB.GetSelectEntryPos(); + if (nPos != LISTBOX_ENTRY_NOTFOUND) + { + pAttr = (CharAttr *)aDeletedLB.GetEntryData(nPos); + aDeletedAttr.nItemId = pAttr->nItemId; + aDeletedAttr.nAttr = pAttr->nAttr; + + nPos = aDeletedColorLB.GetSelectEntryPos(); + + switch (nPos) + { + case 0: + aDeletedAttr.nColor = COL_NONE; + break; + case 1: + case LISTBOX_ENTRY_NOTFOUND: + aDeletedAttr.nColor = COL_TRANSPARENT; + break; + default: + aDeletedAttr.nColor = aDeletedColorLB.GetEntryColor(nPos).GetColor(); + break; + } + + pOpt->SetDeletedAuthorAttr(aDeletedAttr); + } + + nPos = aChangedLB.GetSelectEntryPos(); + if (nPos != LISTBOX_ENTRY_NOTFOUND) + { + pAttr = (CharAttr *)aChangedLB.GetEntryData(nPos); + aChangedAttr.nItemId = pAttr->nItemId; + aChangedAttr.nAttr = pAttr->nAttr; + + nPos = aChangedColorLB.GetSelectEntryPos(); + + switch (nPos) + { + case 0: + aChangedAttr.nColor = COL_NONE; + break; + case 1: + case LISTBOX_ENTRY_NOTFOUND: + aChangedAttr.nColor = COL_TRANSPARENT; + break; + default: + aChangedAttr.nColor = aChangedColorLB.GetEntryColor(nPos).GetColor(); + break; + } + + pOpt->SetFormatAuthorAttr(aChangedAttr); + } + + nPos = 0; + switch (aMarkPosLB.GetSelectEntryPos()) + { + case 0: nPos = text::HoriOrientation::NONE; break; + case 1: nPos = text::HoriOrientation::LEFT; break; + case 2: nPos = text::HoriOrientation::RIGHT; break; + case 3: nPos = text::HoriOrientation::OUTSIDE; break; + case 4: nPos = text::HoriOrientation::INSIDE; break; + } + pOpt->SetMarkAlignMode(nPos); + + pOpt->SetMarkAlignColor(aMarkColorLB.GetSelectEntryColor()); + + if (!(aInsertedAttr == aOldInsertAttr) || + !(aDeletedAttr == aOldDeletedAttr) || + !(aChangedAttr == aOldChangedAttr) || + nOldMarkColor != pOpt->GetMarkAlignColor().GetColor() || + nOldMarkMode != pOpt->GetMarkAlignMode()) + { + // Alle Dokumente aktualisieren + TypeId aType(TYPE(SwDocShell)); + SwDocShell* pDocShell = (SwDocShell*)SfxObjectShell::GetFirst(&aType); + + while( pDocShell ) + { + pDocShell->GetWrtShell()->UpdateRedlineAttr(); + pDocShell = (SwDocShell*)SfxObjectShell::GetNext(*pDocShell, &aType); + } + } + + return FALSE; +} + +void SwRedlineOptionsTabPage::Reset( const SfxItemSet& ) +{ + const SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig(); + + const AuthorCharAttr &rInsertAttr = pOpt->GetInsertAuthorAttr(); + const AuthorCharAttr &rDeletedAttr = pOpt->GetDeletedAuthorAttr(); + const AuthorCharAttr &rChangedAttr = pOpt->GetFormatAuthorAttr(); + + // Preview initialisieren + InitFontStyle(aInsertedPreviewWN); + InitFontStyle(aDeletedPreviewWN); + InitFontStyle(aChangedPreviewWN); + + // Farblistboxen initialisieren + String sColor; + aInsertColorLB.SetUpdateMode(FALSE); + aDeletedColorLB.SetUpdateMode(FALSE); + aChangedColorLB.SetUpdateMode(FALSE); + aMarkColorLB.SetUpdateMode(FALSE); + + aInsertColorLB.InsertEntry(sNone); + aDeletedColorLB.InsertEntry(sNone); + aChangedColorLB.InsertEntry(sNone); + + aInsertColorLB.InsertEntry(sAuthor); + aDeletedColorLB.InsertEntry(sAuthor); + aChangedColorLB.InsertEntry(sAuthor); + + XColorTable* pColorTbl = XColorTable::GetStdColorTable(); + USHORT i; + for( i = 0; i < pColorTbl->Count(); ++i ) + { + XColorEntry* pEntry = pColorTbl->GetColor( i ); + Color aColor = pEntry->GetColor(); + String sName = pEntry->GetName(); + + aInsertColorLB.InsertEntry( aColor, sName ); + aDeletedColorLB.InsertEntry( aColor, sName ); + aChangedColorLB.InsertEntry( aColor, sName ); + aMarkColorLB.InsertEntry( aColor, sName ); + } + aInsertColorLB.SetUpdateMode( TRUE ); + aDeletedColorLB.SetUpdateMode( TRUE ); + aChangedColorLB.SetUpdateMode( TRUE ); + aMarkColorLB.SetUpdateMode( TRUE ); + + ColorData nColor = rInsertAttr.nColor; + + switch (nColor) + { + case COL_TRANSPARENT: + aInsertColorLB.SelectEntryPos(1); + break; + case COL_NONE: + aInsertColorLB.SelectEntryPos(0); + break; + default: + aInsertColorLB.SelectEntry(Color(nColor)); + } + + nColor = rDeletedAttr.nColor; + + switch (nColor) + { + case COL_TRANSPARENT: + aDeletedColorLB.SelectEntryPos(1); + break; + case COL_NONE: + aDeletedColorLB.SelectEntryPos(0); + break; + default: + aDeletedColorLB.SelectEntry(Color(nColor)); + } + + nColor = rChangedAttr.nColor; + + switch (nColor) + { + case COL_TRANSPARENT: + aChangedColorLB.SelectEntryPos(1); + break; + case COL_NONE: + aChangedColorLB.SelectEntryPos(0); + break; + default: + aChangedColorLB.SelectEntry(Color(nColor)); + } + + aMarkColorLB.SelectEntry(pOpt->GetMarkAlignColor()); + + aInsertLB.SelectEntryPos(0); + aDeletedLB.SelectEntryPos(0); + aChangedLB.SelectEntryPos(0); + + lcl_FillRedlineAttrListBox(aInsertLB, rInsertAttr, aInsertAttrMap, + sizeof(aInsertAttrMap) / sizeof(USHORT)); + lcl_FillRedlineAttrListBox(aDeletedLB, rDeletedAttr, aDeletedAttrMap, + sizeof(aDeletedAttrMap) / sizeof(USHORT)); + lcl_FillRedlineAttrListBox(aChangedLB, rChangedAttr, aChangedAttrMap, + sizeof(aChangedAttrMap) / sizeof(USHORT)); + + USHORT nPos = 0; + switch (pOpt->GetMarkAlignMode()) + { + case text::HoriOrientation::NONE: nPos = 0; break; + case text::HoriOrientation::LEFT: nPos = 1; break; + case text::HoriOrientation::RIGHT: nPos = 2; break; + case text::HoriOrientation::OUTSIDE: nPos = 3; break; + case text::HoriOrientation::INSIDE: nPos = 4; break; + } + aMarkPosLB.SelectEntryPos(nPos); + + // Einstellungen in Preview anzeigen + AttribHdl(&aInsertLB); + ColorHdl(&aInsertColorLB); + AttribHdl(&aDeletedLB); + ColorHdl(&aInsertColorLB); + AttribHdl(&aChangedLB); + ColorHdl(&aChangedColorLB); + + ChangedMaskPrevHdl(); +} + +IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox *, pLB ) +{ + SvxFontPrevWindow *pPrev = 0; + ColorListBox *pColorLB; + + if (pLB == &aInsertLB) + { + pColorLB = &aInsertColorLB; + pPrev = &aInsertedPreviewWN; + } + else if (pLB == &aDeletedLB) + { + pColorLB = &aDeletedColorLB; + pPrev = &aDeletedPreviewWN; + } + else + { + pColorLB = &aChangedColorLB; + pPrev = &aChangedPreviewWN; + } + + SvxFont& rFont = pPrev->GetFont(); + SvxFont& rCJKFont = pPrev->GetCJKFont(); + + rFont.SetWeight(WEIGHT_NORMAL); + rCJKFont.SetWeight(WEIGHT_NORMAL); + rFont.SetItalic(ITALIC_NONE); + rCJKFont.SetItalic(ITALIC_NONE); + rFont.SetUnderline(UNDERLINE_NONE); + rCJKFont.SetUnderline(UNDERLINE_NONE); + rFont.SetStrikeout(STRIKEOUT_NONE); + rCJKFont.SetStrikeout(STRIKEOUT_NONE); + rFont.SetCaseMap(SVX_CASEMAP_NOT_MAPPED); + rCJKFont.SetCaseMap(SVX_CASEMAP_NOT_MAPPED); + + USHORT nPos = pColorLB->GetSelectEntryPos(); + + switch( nPos ) + { + case 0: + rFont.SetColor( Color( COL_BLACK ) ); + rCJKFont.SetColor( Color( COL_BLACK ) ); + break; + case 1: + case LISTBOX_ENTRY_NOTFOUND: + rFont.SetColor( Color( COL_RED ) ); + rCJKFont.SetColor( Color( COL_RED ) ); + break; + default: + rFont.SetColor( pColorLB->GetEntryColor( nPos ) ); + rCJKFont.SetColor( pColorLB->GetEntryColor( nPos ) ); + break; + } + + nPos = pLB->GetSelectEntryPos(); + if( nPos == LISTBOX_ENTRY_NOTFOUND ) + nPos = 0; + + CharAttr* pAttr = ( CharAttr* ) pLB->GetEntryData( nPos ); + //switch off preview background color + pPrev->ResetColor(); + switch (pAttr->nItemId) + { + case SID_ATTR_CHAR_WEIGHT: + rFont.SetWeight( ( FontWeight ) pAttr->nAttr ); + rCJKFont.SetWeight( ( FontWeight ) pAttr->nAttr ); + break; + + case SID_ATTR_CHAR_POSTURE: + rFont.SetItalic( ( FontItalic ) pAttr->nAttr ); + rCJKFont.SetItalic( ( FontItalic ) pAttr->nAttr ); + break; + + case SID_ATTR_CHAR_UNDERLINE: + rFont.SetUnderline( ( FontUnderline ) pAttr->nAttr ); + rCJKFont.SetUnderline( ( FontUnderline ) pAttr->nAttr ); + break; + + case SID_ATTR_CHAR_STRIKEOUT: + rFont.SetStrikeout( ( FontStrikeout ) pAttr->nAttr ); + rCJKFont.SetStrikeout( ( FontStrikeout ) pAttr->nAttr ); + break; + + case SID_ATTR_CHAR_CASEMAP: + rFont.SetCaseMap( ( SvxCaseMap ) pAttr->nAttr ); + rCJKFont.SetCaseMap( ( SvxCaseMap ) pAttr->nAttr ); + break; + + case SID_ATTR_BRUSH: + { + nPos = pColorLB->GetSelectEntryPos(); + if( nPos ) + pPrev->SetColor( pColorLB->GetSelectEntryColor() ); + else + pPrev->SetColor( Color( COL_LIGHTGRAY ) ); + + rFont.SetColor( Color( COL_BLACK ) ); + rCJKFont.SetColor( Color( COL_BLACK ) ); + } + break; + } + + pPrev->Invalidate(); + + return 0; +} + +IMPL_LINK( SwRedlineOptionsTabPage, ColorHdl, ColorListBox *, pColorLB ) +{ + SvxFontPrevWindow *pPrev = 0; + ListBox* pLB; + + if (pColorLB == &aInsertColorLB) + { + pLB = &aInsertLB; + pPrev = &aInsertedPreviewWN; + } + else if (pColorLB == &aDeletedColorLB) + { + pLB = &aDeletedLB; + pPrev = &aDeletedPreviewWN; + } + else + { + pLB = &aChangedLB; + pPrev = &aChangedPreviewWN; + } + + SvxFont& rFont = pPrev->GetFont(); + SvxFont& rCJKFont = pPrev->GetCJKFont(); + USHORT nPos = pLB->GetSelectEntryPos(); + if( nPos == LISTBOX_ENTRY_NOTFOUND ) + nPos = 0; + + CharAttr* pAttr = ( CharAttr* ) pLB->GetEntryData( nPos ); + + if( pAttr->nItemId == SID_ATTR_BRUSH ) + { + rFont.SetColor( Color( COL_BLACK ) ); + rCJKFont.SetColor( Color( COL_BLACK ) ); + nPos = pColorLB->GetSelectEntryPos(); + if( nPos && nPos != LISTBOX_ENTRY_NOTFOUND ) + pPrev->SetColor( pColorLB->GetSelectEntryColor() ); + else + pPrev->SetColor( Color( COL_LIGHTGRAY ) ); + } + else + { + nPos = pColorLB->GetSelectEntryPos(); + + switch( nPos ) + { + case 0: + rFont.SetColor( Color( COL_BLACK ) ); + rCJKFont.SetColor( Color( COL_BLACK ) ); + break; + case 1: + case LISTBOX_ENTRY_NOTFOUND: + rFont.SetColor( Color( COL_RED ) ); + rCJKFont.SetColor( Color( COL_RED ) ); + break; + default: + rFont.SetColor( pColorLB->GetEntryColor( nPos ) ); + rCJKFont.SetColor( pColorLB->GetEntryColor( nPos ) ); + break; + } + } + + pPrev->Invalidate(); + + return 0; +} + +IMPL_LINK( SwRedlineOptionsTabPage, ChangedMaskPrevHdl, ListBox *, EMPTYARG ) +{ + aMarkPreviewWN.SetMarkPos(aMarkPosLB.GetSelectEntryPos()); + aMarkPreviewWN.SetColor(aMarkColorLB.GetSelectEntryColor().GetColor()); + + aMarkPreviewWN.Invalidate(); + + return 0; +} + +void SwRedlineOptionsTabPage::InitFontStyle(SvxFontPrevWindow& rExampleWin) +{ + const AllSettings& rAllSettings = Application::GetSettings(); + LanguageType eLangType = rAllSettings.GetUILanguage(); + Color aBackCol( rAllSettings.GetStyleSettings().GetWindowColor() ); + SvxFont& rFont = rExampleWin.GetFont(); + SvxFont& rCJKFont = rExampleWin.GetCJKFont(); + SvxFont& rCTLFont = rExampleWin.GetCTLFont(); + + Font aFont( OutputDevice::GetDefaultFont( DEFAULTFONT_SERIF, eLangType, + DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) ); + Font aCJKFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_TEXT, eLangType, + DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) ); + Font aCTLFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_TEXT, eLangType, + DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) ); + const Size aDefSize( 0, 12 ); + aFont.SetSize( aDefSize ); + aCJKFont.SetSize( aDefSize ); + aCTLFont.SetSize( aDefSize ); + + aFont.SetFillColor( aBackCol ); + aCJKFont.SetFillColor( aBackCol ); + aCTLFont.SetFillColor( aBackCol ); + + aFont.SetWeight( WEIGHT_NORMAL ); + aCJKFont.SetWeight( WEIGHT_NORMAL ); + aCTLFont.SetWeight( WEIGHT_NORMAL ); + + rFont = aFont; + rCJKFont = aCJKFont; + rCTLFont = aCTLFont; + + const Size aNewSize( 0, rExampleWin.GetOutputSize().Height() * 2 / 3 ); + rFont.SetSize( aNewSize ); + rCJKFont.SetSize( aNewSize ); + + rExampleWin.SetFont( rFont, rCJKFont,rCTLFont ); + + rExampleWin.UseResourceText(); + + Wallpaper aWall( aBackCol ); + rExampleWin.SetBackground( aWall ); + rExampleWin.Invalidate(); +} + + +#ifdef DBG_UTIL +/******************************************************* + ******************************************************/ +/*----------------- OS 11.01.95 ----------------------- + TabPage Testeinstellungen +-------------------------------------------------------*/ + +void lcl_SetPosSize(Window& rWin, Point aPos, Size aSize) +{ + aPos = rWin.LogicToPixel(aPos, MAP_APPFONT); + aSize = rWin.OutputDevice::LogicToPixel(aSize, MAP_APPFONT); + rWin.SetPosSizePixel(aPos, aSize); +} + +SwTestTabPage::SwTestTabPage( Window* pParent, + const SfxItemSet& rCoreSet) : + SfxTabPage( pParent, WB_HIDE, rCoreSet), + aTestFL ( this, WB_GROUP ), + aTest1CBox ( this, 0 ), + aTest2CBox ( this, 0 ), + aTest3CBox ( this, 0 ), + aTest4CBox ( this, 0 ), + aTest5CBox ( this, 0 ), + aTest6CBox ( this, 0 ), + aTest7CBox ( this, 0 ), + aTest8CBox ( this, 0 ), + aTest9CBox ( this, 0 ), + aTest10CBox ( this, 0 ), + bAttrModified( FALSE ) +{ + lcl_SetPosSize(*this, Point(0,0), Size(260 , 135)); + lcl_SetPosSize(aTestFL, Point(6,2), Size(209,8)); + lcl_SetPosSize(aTest1CBox , Point(12 , 14), Size(74 , 10)); + lcl_SetPosSize(aTest2CBox , Point(12 , 27), Size(74 , 10)); + lcl_SetPosSize(aTest3CBox , Point(12 , 40), Size(74 , 10)); + lcl_SetPosSize(aTest4CBox , Point(12 , 53), Size(74 , 10)); + lcl_SetPosSize(aTest5CBox , Point(12 , 66), Size(74 , 10)); + lcl_SetPosSize(aTest6CBox , Point(116, 14), Size(74 , 10)); + lcl_SetPosSize(aTest7CBox , Point(116, 27), Size(74 , 10)); + lcl_SetPosSize(aTest8CBox , Point(116, 40), Size(74 , 10)); + lcl_SetPosSize(aTest9CBox , Point(116, 53), Size(74 , 10)); + lcl_SetPosSize(aTest10CBox , Point(116, 66), Size(74 , 10)); + + aTestFL.SetText( String(ByteString("Einstellungen nur f\xFCr Testzwecke" ), RTL_TEXTENCODING_MS_1252)); + aTest1CBox .SetText( C2S("unused")); + aTest2CBox .SetText( C2S("dynamic")); + aTest3CBox .SetText( C2S("No calm" )); + aTest4CBox .SetText( C2S("WYSIWYG debug" )); + aTest5CBox .SetText( C2S("No idle format" )); + aTest6CBox .SetText( C2S("No screen adj" )); + aTest7CBox .SetText( C2S("win format" )); + aTest8CBox .SetText( C2S("No Scroll" )); + aTest9CBox .SetText( C2S("DrawingLayerNotLoading")); + aTest10CBox.SetText( C2S("AutoFormat by Input" )); + aTestFL.Show(); + aTest1CBox .Show(); + aTest2CBox .Show(); + aTest3CBox .Show(); + aTest4CBox .Show(); + aTest5CBox .Show(); + aTest6CBox .Show(); + aTest7CBox .Show(); + aTest8CBox .Show(); + aTest9CBox .Show(); + aTest10CBox.Show(); + Init(); + +} + + +//------------------------------------------------------------------------ + + +SfxTabPage* SwTestTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet ) +{ + return ( new SwTestTabPage( pParent, rAttrSet ) ); +} +//------------------------------------------------------------------------ + + +BOOL SwTestTabPage::FillItemSet( SfxItemSet& rCoreSet ) +{ + + if ( bAttrModified ) + { + SwTestItem aTestItem(FN_PARAM_SWTEST); + aTestItem.bTest1=aTest1CBox.IsChecked(); + aTestItem.bTest2=aTest2CBox.IsChecked(); + aTestItem.bTest3=aTest3CBox.IsChecked(); + aTestItem.bTest4=aTest4CBox.IsChecked(); + aTestItem.bTest5=aTest5CBox.IsChecked(); + aTestItem.bTest6=aTest6CBox.IsChecked(); + aTestItem.bTest7=aTest7CBox.IsChecked(); + aTestItem.bTest8=aTest8CBox.IsChecked(); + aTestItem.bTest9=aTest9CBox.IsChecked(); + aTestItem.bTest10=aTest10CBox.IsChecked(); + rCoreSet.Put(aTestItem); + } + return bAttrModified; +} +//------------------------------------------------------------------------ + + +void SwTestTabPage::Reset( const SfxItemSet& ) +{ + const SfxItemSet& rSet = GetItemSet(); + const SwTestItem* pTestAttr = 0; + + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SWTEST , FALSE, + (const SfxPoolItem**)&pTestAttr )) + { + aTest1CBox.Check(pTestAttr->bTest1); + aTest2CBox.Check(pTestAttr->bTest2); + aTest3CBox.Check(pTestAttr->bTest3); + aTest4CBox.Check(pTestAttr->bTest4); + aTest5CBox.Check(pTestAttr->bTest5); + aTest6CBox.Check(pTestAttr->bTest6); + aTest7CBox.Check(pTestAttr->bTest7); + aTest8CBox.Check(pTestAttr->bTest8); + aTest9CBox.Check(pTestAttr->bTest9); + aTest10CBox.Check(pTestAttr->bTest10); + } +} +//------------------------------------------------------------------------ + + +void SwTestTabPage::Init() +{ + // handler + Link aLk = LINK( this, SwTestTabPage, AutoClickHdl ); + aTest1CBox.SetClickHdl( aLk ); + aTest2CBox.SetClickHdl( aLk ); + aTest3CBox.SetClickHdl( aLk ); + aTest4CBox.SetClickHdl( aLk ); + aTest5CBox.SetClickHdl( aLk ); + aTest6CBox.SetClickHdl( aLk ); + aTest7CBox.SetClickHdl( aLk ); + aTest8CBox.SetClickHdl( aLk ); + aTest9CBox.SetClickHdl( aLk ); + aTest10CBox.SetClickHdl( aLk ); +} +//------------------------------------------------------------------------ + + +IMPL_LINK_INLINE_START( SwTestTabPage, AutoClickHdl, CheckBox *, EMPTYARG ) +{ + bAttrModified = TRUE; + return 0; +} +IMPL_LINK_INLINE_END( SwTestTabPage, AutoClickHdl, CheckBox *, EMPTYARG ) +#endif + + + diff --git a/sw/source/ui/config/prtopt.cxx b/sw/source/ui/config/prtopt.cxx new file mode 100644 index 000000000000..a07c2c154696 --- /dev/null +++ b/sw/source/ui/config/prtopt.cxx @@ -0,0 +1,198 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#include <unotools/configmgr.hxx> +#include <prtopt.hxx> +#include <swprtopt.hxx> +#include <tools/debug.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <unomid.h> + +using namespace utl; +using rtl::OUString; +using namespace com::sun::star::uno; + +/*-------------------------------------------------------------------- + Beschreibung: Ctor + --------------------------------------------------------------------*/ + +Sequence<OUString> SwPrintOptions::GetPropertyNames() +{ + static const char* aPropNames[] = + { + "Content/Graphic", // 0 + "Content/Table", // 1 + "Content/Control", // 2 + "Content/Background", // 3 + "Content/PrintBlack", // 4 + "Content/Note", // 5 + "Page/Reversed", // 6 + "Page/Brochure", // 7 + "Page/BrochureRightToLeft", // 8 + "Output/SinglePrintJob", // 9 + "Output/Fax", // 10 + "Papertray/FromPrinterSetup", // 11 + "Content/Drawing", // 12 not in SW/Web + "Page/LeftPage", // 13 not in SW/Web + "Page/RightPage", // 14 not in SW/Web + "EmptyPages", // 15 not in SW/Web + "Content/PrintPlaceholders", // 16 not in Sw/Web + "Content/PrintHiddenText" // 17 not in Sw/Web + }; + const int nCount = bIsWeb ? 12 : 18; + Sequence<OUString> aNames(nCount); + OUString* pNames = aNames.getArray(); + for(int i = 0; i < nCount; i++) + { + pNames[i] = OUString::createFromAscii(aPropNames[i]); + } + return aNames; +} +/* -----------------------------06.09.00 16:44-------------------------------- + + ---------------------------------------------------------------------------*/ +SwPrintOptions::SwPrintOptions(sal_Bool bWeb) : + ConfigItem(bWeb ? C2U("Office.WriterWeb/Print") : C2U("Office.Writer/Print"), + CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE), + bIsWeb(bWeb) +{ + bPrintPageBackground = !bWeb; + bPrintBlackFont = bWeb; + bPrintTextPlaceholder = bPrintHiddenText = sal_False; + if (bWeb) + bPrintEmptyPages = sal_False; + + 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()) + { + switch(nProp) + { + case 0: bPrintGraphic = *(sal_Bool*)pValues[nProp].getValue(); break; + case 1: bPrintTable = *(sal_Bool*)pValues[nProp].getValue(); break; + case 2: bPrintControl = *(sal_Bool*)pValues[nProp].getValue() ; break; + case 3: bPrintPageBackground= *(sal_Bool*)pValues[nProp].getValue(); break; + case 4: bPrintBlackFont = *(sal_Bool*)pValues[nProp].getValue(); break; + case 5: + { + sal_Int32 nTmp = 0; + pValues[nProp] >>= nTmp; + nPrintPostIts = (sal_Int16)nTmp; + } + break; + case 6: bPrintReverse = *(sal_Bool*)pValues[nProp].getValue(); break; + case 7: bPrintProspect = *(sal_Bool*)pValues[nProp].getValue(); break; + case 8: bPrintProspectRTL = *(sal_Bool*)pValues[nProp].getValue(); break; + case 9: bPrintSingleJobs = *(sal_Bool*)pValues[nProp].getValue(); break; + case 10: pValues[nProp] >>= sFaxName; break; + case 11: bPaperFromSetup = *(sal_Bool*)pValues[nProp].getValue(); break; + case 12: bPrintDraw = *(sal_Bool*)pValues[nProp].getValue() ; break; + case 13: bPrintLeftPages = *(sal_Bool*)pValues[nProp].getValue(); break; + case 14: bPrintRightPages = *(sal_Bool*)pValues[nProp].getValue(); break; + case 15: bPrintEmptyPages = *(sal_Bool*)pValues[nProp].getValue(); break; + case 16: bPrintTextPlaceholder = *(sal_Bool*)pValues[nProp].getValue(); break; + case 17: bPrintHiddenText = *(sal_Bool*)pValues[nProp].getValue(); break; + } + } + } + } + + // currently there is just one checkbox for print drawings and print graphics + // In the UI. (File/Print dialog and Tools/Options/.../Print) + // And since print graphics is the only available in Writer and WrtierWeb ... + + bPrintDraw = bPrintGraphic; +} +/* -----------------------------06.09.00 16:50-------------------------------- + + ---------------------------------------------------------------------------*/ +SwPrintOptions::~SwPrintOptions() +{ +} +/* -----------------------------06.09.00 16:43-------------------------------- + + ---------------------------------------------------------------------------*/ + +void SwPrintOptions::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + +void SwPrintOptions::Commit() +{ + Sequence<OUString> aNames = GetPropertyNames(); + + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + const Type& rType = ::getBooleanCppuType(); + BOOL bVal; + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + switch(nProp) + { + case 0: bVal = bPrintGraphic; pValues[nProp].setValue(&bVal, rType);break; + case 1: bVal = bPrintTable ;pValues[nProp].setValue(&bVal, rType); break; + case 2: bVal = bPrintControl ; pValues[nProp].setValue(&bVal, rType); break; + case 3: bVal = bPrintPageBackground; pValues[nProp].setValue(&bVal, rType); break; + case 4: bVal = bPrintBlackFont ; pValues[nProp].setValue(&bVal, rType); break; + case 5: pValues[nProp] <<= (sal_Int32)nPrintPostIts ; break; + case 6: bVal = bPrintReverse ; pValues[nProp].setValue(&bVal, rType); break; + case 7: bVal = bPrintProspect ; pValues[nProp].setValue(&bVal, rType); break; + case 8: bVal = bPrintProspectRTL ; pValues[nProp].setValue(&bVal, rType); break; + case 9: bVal = bPrintSingleJobs ; pValues[nProp].setValue(&bVal, rType); break; + case 10: pValues[nProp] <<= sFaxName; break; + case 11: bVal = bPaperFromSetup ; pValues[nProp].setValue(&bVal, rType); break; + case 12: bVal = bPrintDraw ; pValues[nProp].setValue(&bVal, rType); break; + case 13: bVal = bPrintLeftPages ; pValues[nProp].setValue(&bVal, rType); break; + case 14: bVal = bPrintRightPages ; pValues[nProp].setValue(&bVal, rType); break; + case 15: bVal = bPrintEmptyPages ; pValues[nProp].setValue(&bVal, rType); break; + case 16: bVal = bPrintTextPlaceholder; pValues[nProp].setValue(&bVal, rType); break; + case 17: bVal = bPrintHiddenText; pValues[nProp].setValue(&bVal, rType); break; + } + } + + // currently there is just one checkbox for print drawings and print graphics + // In the UI. (File/Print dialog and Tools/Options/.../Print) + // And since print graphics is the only available in Writer and WrtierWeb ... + bPrintDraw = bPrintGraphic; + + PutProperties(aNames, aValues); +} + + + + diff --git a/sw/source/ui/config/redlopt.hrc b/sw/source/ui/config/redlopt.hrc new file mode 100644 index 000000000000..877f23d75c4c --- /dev/null +++ b/sw/source/ui/config/redlopt.hrc @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#define FT_INS_ATTR 1 +#define LB_INS_ATTR 2 +#define FT_INS_COL 3 +#define LB_INS_COL 4 +#define WIN_INS 5 +#define FT_DEL_ATTR 6 +#define LB_DEL_ATTR 7 +#define FT_DEL_COL 8 +#define LB_DEL_COL 9 +#define WIN_DEL 10 +#define FT_CHG_ATTR 11 +#define LB_CHG_ATTR 12 +#define FT_CHG_COL 13 +#define LB_CHG_COL 14 +#define WIN_CHG 15 +#define FL_TE 16 + +#define FT_MARKPOS 17 +#define LB_MARKPOS 18 +#define FT_LC_COL 19 +#define LB_LC_COL 20 +#define WIN_MARK 21 +#define FL_LC 22 +#define STR_AUTHOR 23 +#define STR_NOTHING 24 +#define FT_CHG_CHANGE 25 +#define FT_CHG_DELETE 26 +#define FT_CHG_INSERT 27 diff --git a/sw/source/ui/config/redlopt.src b/sw/source/ui/config/redlopt.src new file mode 100644 index 000000000000..4d6816dcec23 --- /dev/null +++ b/sw/source/ui/config/redlopt.src @@ -0,0 +1,279 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +/* StarView ressource file */ + +#ifndef _SFX_HRC +#include <sfx2/sfx.hrc> +#endif +#ifndef _SVX_DIALOGS_HRC +#include <svx/dialogs.hrc> +#endif +#include "globals.hrc" +#include "config.hrc" +#include "redlopt.hrc" +#include "helpid.h" +/**************************************************************************/ +/* */ +/**************************************************************************/ +TabPage TP_REDLINE_OPT +{ + HelpID = HID_REDLINE_OPT ; + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedLine FL_TE + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Text display" ; + }; + FixedText FT_CHG_INSERT + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Insertions"; + }; + FixedText FT_INS_ATTR + { + Pos = MAP_APPFONT ( 18 , 25 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Attributes"; + }; + ListBox LB_INS_ATTR + { + Pos = MAP_APPFONT ( 90 , 25 ) ; + Size = MAP_APPFONT ( 80 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "[None]" ; > ; + < "Bold" ; > ; + < "Italic" ; > ; + < "Underlined" ; > ; + < "Underlined: double" ; > ; + < "Strikethrough" ; > ; + < "Uppercase" ; > ; + < "Lowercase" ; > ; + < "Small caps" ; > ; + < "Title font" ; > ; + < "Background color" ; > ; + }; + }; + FixedText FT_INS_COL + { + Pos = MAP_APPFONT ( 18 , 42 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Color" ; + }; + ListBox LB_INS_COL + { + Pos = MAP_APPFONT ( 90 , 40 ) ; + Size = MAP_APPFONT ( 80 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + Window WIN_INS + { + Border = TRUE ; + Pos = MAP_APPFONT ( 178 , 25 ) ; + Size = MAP_APPFONT ( 70 , 27 ) ; + Text [ en-US ] = "Insert"; + }; + FixedText FT_CHG_DELETE + { + Pos = MAP_APPFONT ( 12 , 58 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Deletions"; + }; + FixedText FT_DEL_ATTR + { + Pos = MAP_APPFONT ( 18 , 69 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Attributes"; + }; + ListBox LB_DEL_ATTR + { + Pos = MAP_APPFONT ( 90 , 67 ) ; + Size = MAP_APPFONT ( 80 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_DEL_COL + { + Pos = MAP_APPFONT ( 18 , 84 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Color"; + }; + ListBox LB_DEL_COL + { + Pos = MAP_APPFONT ( 90 , 82 ) ; + Size = MAP_APPFONT ( 80 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + Window WIN_DEL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 178 , 67 ) ; + Size = MAP_APPFONT ( 70 , 27 ) ; + Text [ en-US ] = "Delete"; + }; + FixedText FT_CHG_CHANGE + { + Pos = MAP_APPFONT ( 12 , 100 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Changed attributes"; + }; + FixedText FT_CHG_ATTR + { + Pos = MAP_APPFONT ( 18 , 113 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Attributes"; + }; + ListBox LB_CHG_ATTR + { + Pos = MAP_APPFONT ( 90 , 111 ) ; + Size = MAP_APPFONT ( 80 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_CHG_COL + { + Pos = MAP_APPFONT ( 18 , 128 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Color"; + }; + ListBox LB_CHG_COL + { + Pos = MAP_APPFONT ( 90 , 126 ) ; + Size = MAP_APPFONT ( 80 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + Window WIN_CHG + { + Border = TRUE ; + Pos = MAP_APPFONT ( 178 , 111 ) ; + Size = MAP_APPFONT ( 70 , 27 ) ; + Text [ en-US ] = "Attributes"; + }; + FixedLine FL_LC + { + Pos = MAP_APPFONT ( 6 , 144 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Lines changed" ; + }; + FixedText FT_MARKPOS + { + Pos = MAP_APPFONT ( 12 , 157 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "Mar~k" ; + }; + ListBox LB_MARKPOS + { + Pos = MAP_APPFONT ( 90 , 155 ) ; + Size = MAP_APPFONT ( 80 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "[None]" ; > ; + < "Left margin" ; > ; + < "Right margin" ; > ; + < "Outer margin" ; > ; + < "Inner margin" ; > ; + }; + }; + FixedText FT_LC_COL + { + Pos = MAP_APPFONT ( 12 , 172 ) ; + Size = MAP_APPFONT ( 70 , 8 ) ; + Text [ en-US ] = "~Color" ; + }; + ListBox LB_LC_COL + { + Pos = MAP_APPFONT ( 90 , 170 ) ; + Size = MAP_APPFONT ( 80 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + Window WIN_MARK + { + Pos = MAP_APPFONT ( 178 , 155 ) ; + Size = MAP_APPFONT ( 70 , 27 ) ; + }; + String STR_AUTHOR + { + Text [ en-US ] = "By author" ; + }; + String STR_NOTHING + { + Text [ en-US ] = "[None]" ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/config/uinums.cxx b/sw/source/ui/config/uinums.cxx new file mode 100644 index 000000000000..40d56b3b6507 --- /dev/null +++ b/sw/source/ui/config/uinums.cxx @@ -0,0 +1,673 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + + + +#include <hintids.hxx> +#include <svl/urihelper.hxx> +#include <unotools/pathoptions.hxx> +#include <tools/stream.hxx> +#ifndef _SFX_INIMGR_HXX +#endif +#include <sfx2/docfile.hxx> +#include <svl/itemiter.hxx> +#include <editeng/brshitem.hxx> + + +#include <tools/resid.hxx> +#include <fmtornt.hxx> +#include <swtypes.hxx> // Leerstring +#include <wrtsh.hxx> +#include <uinums.hxx> +#include <poolfmt.hxx> +#include <charfmt.hxx> +#include <frmatr.hxx> + +#include <unomid.h> + +using namespace ::com::sun::star; + + +#define VERSION_30B ((USHORT)250) +#define VERSION_31B ((USHORT)326) +#define VERSION_40A ((USHORT)364) +#define VERSION_50A ((USHORT)373) +#define VERSION_53A ((USHORT)596) +#define ACT_NUM_VERSION VERSION_53A + +#define NUMRULE_FILENAME "numrule.cfg" +#define CHAPTER_FILENAME "chapter.cfg" + +/*------------------------------------------------------------------------ + Beschreibung: Ops. zum Laden / Speichern +------------------------------------------------------------------------*/ + + +SV_IMPL_PTRARR( _SwNumFmtsAttrs, SfxPoolItem* ) + + +// SwNumRulesWithName ---------------------------------------------------- +// PUBLIC METHODES ------------------------------------------------------- +/*------------------------------------------------------------------------ + Beschreibung: Speichern einer Regel + Parameter: rCopy -- die zu speichernde Regel + nIdx -- Position, an der die Regel zu speichern ist. + Eine alte Regel an dieser Position wird ueberschrieben. +------------------------------------------------------------------------*/ + +SwBaseNumRules::SwBaseNumRules( const String& rFileName ) + : + sFileName( rFileName ), + nVersion(0), + bModified( FALSE ) +{ + Init(); +} + +/*-----------------26.06.97 08.30------------------- + +--------------------------------------------------*/ +SwBaseNumRules::~SwBaseNumRules() +{ + if( bModified ) + { + SvtPathOptions aPathOpt; + String sNm( aPathOpt.GetUserConfigPath() ); + sNm += INET_PATH_TOKEN; + sNm += sFileName; + INetURLObject aTempObj(sNm); + sNm = aTempObj.GetFull(); + SfxMedium aStrm( sNm, STREAM_WRITE | STREAM_TRUNC | + STREAM_SHARE_DENYALL, TRUE ); + Store( *aStrm.GetOutStream() ); + } + + for( USHORT i = 0; i < nMaxRules; ++i ) + delete pNumRules[i]; +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ +void SwBaseNumRules::Init() +{ + for(USHORT i = 0; i < nMaxRules; ++i ) + pNumRules[i] = 0; + + String sNm( sFileName ); + SvtPathOptions aOpt; + if( aOpt.SearchFile( sNm, SvtPathOptions::PATH_USERCONFIG )) + { + SfxMedium aStrm( sNm, STREAM_STD_READ, TRUE ); + Load( *aStrm.GetInStream() ); + } +} + +/*-----------------26.06.97 08.30------------------- + +--------------------------------------------------*/ + +void SwBaseNumRules::ApplyNumRules(const SwNumRulesWithName &rCopy, USHORT nIdx) +{ + ASSERT(nIdx < nMaxRules, Array der NumRules ueberindiziert.); + if( !pNumRules[nIdx] ) + pNumRules[nIdx] = new SwNumRulesWithName( rCopy ); + else + *pNumRules[nIdx] = rCopy; +} + +// PROTECTED METHODES ---------------------------------------------------- +/*------------------------------------------------------------------------ + Beschreibung: Speichern +------------------------------------------------------------------------*/ + +BOOL /**/ SwBaseNumRules::Store(SvStream &rStream) +{ + rStream << ACT_NUM_VERSION; + // Schreiben, welche Positionen durch eine Regel belegt sind + // Anschliessend Schreiben der einzelnen Rules + for(USHORT i = 0; i < nMaxRules; ++i) + { + if(pNumRules[i]) + { + rStream << (unsigned char) TRUE; + pNumRules[i]->Store( rStream ); + } + else + rStream << (unsigned char) FALSE; + } + return TRUE; +} + + + +/*------------------------------------------------------------------------ + Beschreibung: Speichern / Laden +------------------------------------------------------------------------*/ + + +int SwBaseNumRules::Load(SvStream &rStream) +{ + int rc = 0; + + rStream >> nVersion; + + // wegen eines kleinen aber schweren Fehlers schreibt die PreFinal die + // gleiche VERSION_40A wie das SP2 #55402# + if(VERSION_40A == nVersion) + { + DBG_ERROR("Version 364 ist nicht eindeutig #55402#"); + } + else if( VERSION_30B == nVersion || VERSION_31B == nVersion || + ACT_NUM_VERSION >= nVersion ) + { + unsigned char bRule = FALSE; + for(USHORT i = 0; i < nMaxRules; ++i) + { + rStream >> bRule; + if(bRule) + pNumRules[i] = new SwNumRulesWithName( rStream, nVersion ); + } + } + else + { + rc = 1; + } + + return rc; +} + +/*-----------------26.06.97 08.34------------------- + +--------------------------------------------------*/ + +/*------------------------------------------------------------------------*/ + + +SwChapterNumRules::SwChapterNumRules() : + SwBaseNumRules(C2S(CHAPTER_FILENAME)) +{ +} + +/*------------------------------------------------------------------------*/ + + SwChapterNumRules::~SwChapterNumRules() +{ +} + +/*-----------------26.06.97 08.23------------------- + +--------------------------------------------------*/ +void SwChapterNumRules::ApplyNumRules(const SwNumRulesWithName &rCopy, USHORT nIdx) +{ + bModified = TRUE; + SwBaseNumRules::ApplyNumRules(rCopy, nIdx); +} + +/*------------------------------------------------------------------------*/ + +SwNumRulesWithName::SwNumRulesWithName( const SwNumRule &rCopy, + const String &rName ) + : aName(rName) +{ + for( USHORT n = 0; n < MAXLEVEL; ++n ) + { + const SwNumFmt* pFmt = rCopy.GetNumFmt( n ); + if( pFmt ) + aFmts[ n ] = new _SwNumFmtGlobal( *pFmt ); + else + aFmts[ n ] = 0; + } +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ +SwNumRulesWithName::SwNumRulesWithName( const SwNumRulesWithName& rCopy ) +{ + memset( aFmts, 0, sizeof( aFmts )); + *this = rCopy; +} + + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ +SwNumRulesWithName::~SwNumRulesWithName() +{ + for( int n = 0; n < MAXLEVEL; ++n ) + delete aFmts[ n ]; +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ +const SwNumRulesWithName& SwNumRulesWithName::operator=(const SwNumRulesWithName &rCopy) +{ + if( this != &rCopy ) + { + aName = rCopy.aName; + for( int n = 0; n < MAXLEVEL; ++n ) + { + delete aFmts[ n ]; + + _SwNumFmtGlobal* pFmt = rCopy.aFmts[ n ]; + if( pFmt ) + aFmts[ n ] = new _SwNumFmtGlobal( *pFmt ); + else + aFmts[ n ] = 0; + } + } + return *this; +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ +SwNumRulesWithName::SwNumRulesWithName( SvStream &rStream, USHORT nVersion ) +{ + CharSet eEncoding = gsl_getSystemTextEncoding(); + rStream.ReadByteString(aName, eEncoding); + + char c; + for(USHORT n = 0; n < MAXLEVEL; ++n ) + { + if( VERSION_30B == nVersion ) + c = 1; + // wegen eines kleinen aber schweren Fehlers schreibt die PreFinal die + // gleiche VERSION_40A wie das SP2 #55402# + else if(nVersion < VERSION_40A && n > 5) +// else if(nVersion < VERSION_50A && n > 5) + c = 0; + else + rStream >> c; + + if( c ) + aFmts[ n ] = new _SwNumFmtGlobal( rStream, nVersion ); + else + aFmts[ n ] = 0; + } +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +void SwNumRulesWithName::MakeNumRule( SwWrtShell& rSh, SwNumRule& rChg ) const +{ + // --> OD 2008-02-11 #newlistlevelattrs# + // --> OD 2008-06-06 #i89178# + rChg = SwNumRule( aName, numfunc::GetDefaultPositionAndSpaceMode() ); + // <-- + rChg.SetAutoRule( FALSE ); + _SwNumFmtGlobal* pFmt; + for( USHORT n = 0; n < MAXLEVEL; ++n ) + if( 0 != ( pFmt = aFmts[ n ] ) ) + { + SwNumFmt aNew; + pFmt->ChgNumFmt( rSh, aNew ); + rChg.Set( n, aNew ); + } +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ +void SwNumRulesWithName::Store( SvStream &rStream ) +{ + CharSet eEncoding = gsl_getSystemTextEncoding(); + rStream.WriteByteString(aName, eEncoding); + + for( USHORT n = 0; n < MAXLEVEL; ++n ) + { + _SwNumFmtGlobal* pFmt = aFmts[ n ]; + if( pFmt ) + { + rStream << (char)1; + pFmt->Store( rStream ); + } + else + rStream << (char)0; + } +} +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + + +SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( const SwNumFmt& rFmt ) + : aFmt( rFmt ), nCharPoolId( USHRT_MAX ) +{ + // relative Abstaende ????? + + SwCharFmt* pFmt = rFmt.GetCharFmt(); + if( pFmt ) + { + sCharFmtName = pFmt->GetName(); + nCharPoolId = pFmt->GetPoolFmtId(); + if( pFmt->GetAttrSet().Count() ) + { + SfxItemIter aIter( pFmt->GetAttrSet() ); + const SfxPoolItem *pCurr = aIter.GetCurItem(); + while( TRUE ) + { + aItems.Insert( pCurr->Clone(), aItems.Count() ); + if( aIter.IsAtEnd() ) + break; + pCurr = aIter.NextItem(); + } + } + + aFmt.SetCharFmt( 0 ); + } +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( const _SwNumFmtGlobal& rFmt ) + : + aFmt( rFmt.aFmt ), + sCharFmtName( rFmt.sCharFmtName ), + nCharPoolId( rFmt.nCharPoolId ) +{ + for( USHORT n = rFmt.aItems.Count(); n; ) + aItems.Insert( rFmt.aItems[ --n ]->Clone(), aItems.Count() ); +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream, + USHORT nVersion ) + : nCharPoolId( USHRT_MAX ) +{ + CharSet eEncoding = gsl_getSystemTextEncoding(); + { + USHORT nUS; + sal_Char cChar; + short nShort; + BOOL bFlag; + String sStr; + + rStream >> nUS; aFmt.SetNumberingType((sal_Int16)nUS ); + if( VERSION_53A > nVersion ) + { + rStream >> cChar; aFmt.SetBulletChar( cChar ); + } + else + { + rStream >> nUS; aFmt.SetBulletChar( nUS ); + } + + rStream >> bFlag; aFmt.SetIncludeUpperLevels( bFlag ); + + if( VERSION_30B == nVersion ) + { + long nL; + rStream >> cChar; aFmt.SetStart( (USHORT)cChar ); + + rStream.ReadByteString(sStr, eEncoding); + aFmt.SetPrefix( sStr ); + rStream.ReadByteString(sStr, eEncoding); + aFmt.SetSuffix( sStr ); + rStream >> nUS; aFmt.SetNumAdjust( SvxAdjust( nUS ) ); + rStream >> nL; aFmt.SetLSpace( lNumIndent ); + rStream >> nL; aFmt.SetFirstLineOffset( (short)nL ); + } + else // alter StartWert war ein Byte + { + rStream >> nUS; aFmt.SetStart( nUS ); + rStream.ReadByteString(sStr, eEncoding); + aFmt.SetPrefix( sStr ); + rStream.ReadByteString(sStr, eEncoding); + aFmt.SetSuffix( sStr ); + rStream >> nUS; aFmt.SetNumAdjust( SvxAdjust( nUS ) ); + rStream >> nUS; aFmt.SetAbsLSpace( nUS ); + rStream >> nShort; aFmt.SetFirstLineOffset( nShort ); + rStream >> nUS; aFmt.SetCharTextDistance( nUS ); + rStream >> nShort; aFmt.SetLSpace( nShort ); + rStream >> bFlag; + } + + USHORT nFamily; + USHORT nCharSet; + short nWidth; + short nHeight; + USHORT nPitch; + String aName; + + rStream.ReadByteString(aName, eEncoding); + rStream >> nFamily >> nCharSet >> nWidth >> nHeight >> nPitch; + + if( aName.Len() ) + { + Font aFont( nFamily, Size( nWidth, nHeight ) ); + aFont.SetName( aName ); + aFont.SetCharSet( (CharSet)nCharSet ); + aFont.SetPitch( (FontPitch)nPitch ); + + aFmt.SetBulletFont( &aFont ); + } + else + nCharSet = RTL_TEXTENCODING_SYMBOL; + + if( VERSION_53A > nVersion ) + aFmt.SetBulletChar( ByteString::ConvertToUnicode( + sal_Char(aFmt.GetBulletChar()), nCharSet )); + } + + if( VERSION_30B != nVersion ) + { + USHORT nItemCount; + rStream >> nCharPoolId; + rStream.ReadByteString(sCharFmtName, eEncoding); + rStream >> nItemCount; + + while( nItemCount-- ) + { + USHORT nWhich, nVers; + rStream >> nWhich >> nVers; + aItems.Insert( GetDfltAttr( nWhich )->Create( rStream, nVers ), + aItems.Count() ); + } + } + + if( VERSION_40A == nVersion && SVX_NUM_BITMAP == aFmt.GetNumberingType() ) + { + BYTE cF; + Size aSz; + + rStream >> aSz.Width() >> aSz.Height(); + + rStream >> cF; + if( cF ) + { + SvxBrushItem* pBrush = 0; + SwFmtVertOrient* pVOrient = 0; + USHORT nVer; + + if( cF & 1 ) + { + rStream >> nVer; + pBrush = (SvxBrushItem*)GetDfltAttr( RES_BACKGROUND ) + ->Create( rStream, nVer ); + } + + if( cF & 2 ) + { + rStream >> nVer; + pVOrient = (SwFmtVertOrient*)GetDfltAttr( RES_VERT_ORIENT ) + ->Create( rStream, nVer ); + } + sal_Int16 eOrient = text::VertOrientation::NONE; + if(pVOrient) + eOrient = (sal_Int16)pVOrient->GetVertOrient(); + aFmt.SetGraphicBrush( pBrush, &aSz, pVOrient ? &eOrient : 0 ); + } + } +} + + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +SwNumRulesWithName::_SwNumFmtGlobal::~_SwNumFmtGlobal() +{ +} +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + + +void SwNumRulesWithName::_SwNumFmtGlobal::Store( SvStream& rStream ) +{ + CharSet eEncoding = gsl_getSystemTextEncoding(); + { + String aName; + USHORT nFamily = FAMILY_DONTKNOW, nCharSet = 0, nPitch = 0; + short nWidth = 0, nHeight = 0; + + const Font* pFnt = aFmt.GetBulletFont(); + if( pFnt ) + { + aName = pFnt->GetName(); + nFamily = (USHORT)pFnt->GetFamily(); + nCharSet = (USHORT)pFnt->GetCharSet(); + nWidth = (short)pFnt->GetSize().Width(); + nHeight = (short)pFnt->GetSize().Height(); + nPitch = (USHORT)pFnt->GetPitch(); + } + + rStream << USHORT(aFmt.GetNumberingType()) + << aFmt.GetBulletChar() + << (aFmt.GetIncludeUpperLevels() > 0) + << aFmt.GetStart(); + rStream.WriteByteString( aFmt.GetPrefix(), eEncoding ); + rStream.WriteByteString( aFmt.GetSuffix(), eEncoding ); + rStream << USHORT( aFmt.GetNumAdjust() ) + << aFmt.GetAbsLSpace() + << aFmt.GetFirstLineOffset() + << aFmt.GetCharTextDistance() + << aFmt.GetLSpace() + << FALSE;//aFmt.IsRelLSpace(); + rStream.WriteByteString( aName, eEncoding ); + rStream << nFamily + << nCharSet + << nWidth + << nHeight + << nPitch; + } + rStream << nCharPoolId; + rStream.WriteByteString( sCharFmtName, eEncoding ); + rStream << aItems.Count(); + + for( USHORT n = aItems.Count(); n; ) + { + SfxPoolItem* pItem = aItems[ --n ]; + USHORT nIVers = pItem->GetVersion( SOFFICE_FILEFORMAT_50 ); + ASSERT( nIVers != USHRT_MAX, + "Was'n das: Item-Version USHRT_MAX in der aktuellen Version" ); + rStream << pItem->Which() + << nIVers; + pItem->Store( rStream, nIVers ); + } + + // Erweiterungen fuer Version 40A + + if( SVX_NUM_BITMAP == aFmt.GetNumberingType() ) + { + rStream << (INT32)aFmt.GetGraphicSize().Width() + << (INT32)aFmt.GetGraphicSize().Height(); + BYTE cFlg = ( 0 != aFmt.GetBrush() ? 1 : 0 ) + + ( 0 != aFmt.GetGraphicOrientation() ? 2 : 0 ); + rStream << cFlg; + + if( aFmt.GetBrush() ) + { + USHORT nVersion = aFmt.GetBrush()->GetVersion( SOFFICE_FILEFORMAT_50 ); + rStream << nVersion; + aFmt.GetBrush()->Store( rStream, nVersion ); + } + if( aFmt.GetGraphicOrientation() ) + { + USHORT nVersion = aFmt.GetGraphicOrientation()->GetVersion( SOFFICE_FILEFORMAT_50 ); + rStream << nVersion; + aFmt.GetGraphicOrientation()->Store( rStream, nVersion ); + } + } +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + +void SwNumRulesWithName::_SwNumFmtGlobal::ChgNumFmt( SwWrtShell& rSh, + SwNumFmt& rNew ) const +{ + SwCharFmt* pFmt = 0; + if( sCharFmtName.Len() ) + { + // suche erstmal ueber den Namen + USHORT nArrLen = rSh.GetCharFmtCount(); + for( USHORT i = 1; i < nArrLen; ++i ) + { + pFmt = &rSh.GetCharFmt( i ); + if( COMPARE_EQUAL == pFmt->GetName().CompareTo( sCharFmtName )) + // ist vorhanden, also belasse die Attribute wie sie sind! + break; + pFmt = 0; + } + + if( !pFmt ) + { + if( IsPoolUserFmt( nCharPoolId ) ) + { + pFmt = rSh.MakeCharFmt( sCharFmtName ); + pFmt->SetAuto( FALSE ); + } + else + pFmt = rSh.GetCharFmtFromPool( nCharPoolId ); + + if( !pFmt->GetDepends() ) // Attribute setzen + for( USHORT n = aItems.Count(); n; ) + pFmt->SetFmtAttr( *aItems[ --n ] ); + } + } + ((SwNumFmt&)aFmt).SetCharFmt( pFmt ); + rNew = aFmt; + if( pFmt ) + ((SwNumFmt&)aFmt).SetCharFmt( 0 ); +} + diff --git a/sw/source/ui/config/usrpref.cxx b/sw/source/ui/config/usrpref.cxx new file mode 100644 index 000000000000..85d3886fc79f --- /dev/null +++ b/sw/source/ui/config/usrpref.cxx @@ -0,0 +1,691 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#include <tools/stream.hxx> +#include <unotools/syslocale.hxx> + +#include "swtypes.hxx" +#include "hintids.hxx" +#include "uitool.hxx" +#include "usrpref.hxx" +#include "crstate.hxx" +#include <linguistic/lngprops.hxx> +#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> + +#include <unomid.h> + +using namespace utl; +using namespace rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + + +void SwMasterUsrPref::SetUsrPref(const SwViewOption &rCopy) +{ + *((SwViewOption*)this) = rCopy; +} + +SwMasterUsrPref::SwMasterUsrPref(BOOL bWeb) : + eFldUpdateFlags(AUTOUPD_OFF), + nLinkUpdateMode(0), + bIsHScrollMetricSet(sal_False), + 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) +{ + MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum(); + eUserMetric = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH; + eHScrollMetric = eUserMetric; + eVScrollMetric = eUserMetric; + + aContentConfig.Load(); + aLayoutConfig.Load(); + aGridConfig.Load(); + aCursorConfig.Load(); + 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[] = + { + "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++) + { + pNames[i] = OUString::createFromAscii(aPropNames[i]); + } + return aNames; +} +/*-- 28.09.00 09:55:33--------------------------------------------------- + + -----------------------------------------------------------------------*/ +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--------------------------------------------------- + + -----------------------------------------------------------------------*/ +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(); + + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); + + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + sal_Bool bVal = FALSE; + switch(nProp) + { + 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" + } + if(nProp != 16) + pValues[nProp].setValue(&bVal, ::getBooleanCppuType()); + } + 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"); + if(aValues.getLength() == aNames.getLength()) + { + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + if(pValues[nProp].hasValue()) + { + sal_Bool bSet = nProp != 16 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False; + switch(nProp) + { + 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" + } + } + } + } +} +/*-- 28.09.00 09:55:34--------------------------------------------------- + + -----------------------------------------------------------------------*/ +Sequence<OUString> SwLayoutViewConfig::GetPropertyNames() +{ + static const char* aPropNames[] = + { + "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]); + } + return aNames; +} +/*-- 28.09.00 09:55:34--------------------------------------------------- + + -----------------------------------------------------------------------*/ +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) +{ +} +/*-- 28.09.00 09:55:35--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwLayoutViewConfig::~SwLayoutViewConfig() +{ +} +/*-- 28.09.00 09:55:36--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwLayoutViewConfig::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.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--------------------------------------------------- + + -----------------------------------------------------------------------*/ +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; + 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", + case 18: rParent.SetDefaultPageMode(bSet,TRUE); break;// "Other/IsSquaredPageMode", + } + } + } + } +} + +void SwLayoutViewConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + +/* -----------------------------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), + 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"); + 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; + 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" + } + } + } + rParent.SetSnapSize(aSnap); + } +} + +void SwGridConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + +/* -----------------------------19.01.01 13:07-------------------------------- + + ---------------------------------------------------------------------------*/ +Sequence<OUString> SwCursorConfig::GetPropertyNames() +{ + static const char* aPropNames[] = + { + "DirectCursor/UseDirectCursor", // 0 + "DirectCursor/Insert", // 1 + "Option/ProtectedArea" // 2 + }; + const int nCount = 3; + 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), + 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", + case 1: pValues[nProp] <<= (sal_Int32)rParent.GetShdwCrsrFillMode(); break;// "DirectCursor/Insert", + case 2: bSet = rParent.IsCursorInProtectedArea(); break;// "Option/ProtectedArea" + } + if(nProp != 1 ) + 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"); + if(aValues.getLength() == aNames.getLength()) + { + + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + if(pValues[nProp].hasValue()) + { + sal_Bool bSet = sal_False; + sal_Int32 nSet = 0; + if(nProp != 1 ) + 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" + } + } + } + + } +} + +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), + 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); +} + +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"); + 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); + break;// "Color", + } + } + } + } +} + + diff --git a/sw/source/ui/config/viewopt.cxx b/sw/source/ui/config/viewopt.cxx new file mode 100644 index 000000000000..13cec2b93bb5 --- /dev/null +++ b/sw/source/ui/config/viewopt.cxx @@ -0,0 +1,643 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#include <svx/htmlmode.hxx> +#include <svtools/htmlcfg.hxx> + +#ifndef _SVX_SVXIDS_HRC //autogen +#include <svx/svxids.hrc> +#endif +#include <editeng/svxenum.hxx> +#include <editeng/svxacorr.hxx> +#include <unotools/localedatawrapper.hxx> +#ifndef _REGION_HXX //autogen +#include <vcl/region.hxx> +#endif +#ifndef _OUTDEV_HXX //autogen +#include <vcl/outdev.hxx> +#endif +#include <vcl/window.hxx> +#include <swmodule.hxx> +#include <swtypes.hxx> +#include <viewopt.hxx> +#ifndef _WDOCSH_HXX +#include <wdocsh.hxx> +#endif +#include <swrect.hxx> +#include <crstate.hxx> +#include <svtools/colorcfg.hxx> +#include <svtools/accessibilityoptions.hxx> +#include <unotools/syslocale.hxx> + +#include <editeng/acorrcfg.hxx> + +#ifdef DBG_UTIL +BOOL SwViewOption::bTest9 = FALSE; //DrawingLayerNotLoading +#endif +Color SwViewOption::aDocBoundColor(COL_LIGHTGRAY); +Color SwViewOption::aObjectBoundColor(COL_LIGHTGRAY); +Color SwViewOption::aDocColor(COL_LIGHTGRAY); +Color SwViewOption::aAppBackgroundColor(COL_LIGHTGRAY); +Color SwViewOption::aTableBoundColor(COL_LIGHTGRAY); +Color SwViewOption::aIndexShadingsColor(COL_LIGHTGRAY); +Color SwViewOption::aLinksColor(COL_BLUE); +Color SwViewOption::aVisitedLinksColor(COL_RED); +Color SwViewOption::aDirectCursorColor(COL_BLUE); +Color SwViewOption::aTextGridColor(COL_LIGHTGRAY); +Color SwViewOption::aSpellColor(COL_LIGHTRED); +Color SwViewOption::aSmarttagColor(COL_LIGHTMAGENTA); +Color SwViewOption::aFontColor(COL_BLACK); +Color SwViewOption::aFieldShadingsColor(COL_LIGHTGRAY); +Color SwViewOption::aSectionBoundColor(COL_LIGHTGRAY); +Color SwViewOption::aPageBreakColor(COL_BLUE); +Color SwViewOption::aScriptIndicatorColor(COL_GREEN); + +sal_Int32 SwViewOption::nAppearanceFlags = VIEWOPT_DOC_BOUNDARIES|VIEWOPT_OBJECT_BOUNDARIES; +USHORT SwViewOption::nPixelTwips = 0; //ein Pixel auf dem Bildschirm + + +#define LINEBREAK_SIZE 12, 8 +#define TAB_SIZE 12, 6 + +#define MIN_BLANKWIDTH 40 +#define MIN_BLANKHEIGHT 40 +#define MIN_TABWIDTH 120 +#define MIN_TABHEIGHT 200 + +static const char __FAR_DATA aPostItStr[] = " "; + +/************************************************************************* + * SwViewOption::IsEqualFlags() + *************************************************************************/ + +BOOL SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const +{ + return nCoreOptions == rOpt.nCoreOptions + && nCore2Options == rOpt.nCore2Options + && aSnapSize == rOpt.aSnapSize + && mnViewLayoutColumns == rOpt.mnViewLayoutColumns + && nDivisionX == rOpt.GetDivisionX() + && nDivisionY == rOpt.GetDivisionY() + && nPagePrevRow == rOpt.GetPagePrevRow() + && nPagePrevCol == rOpt.GetPagePrevCol() + && aRetoucheColor == rOpt.GetRetoucheColor() + && bFormView == rOpt.IsFormView() + && mbViewLayoutBookMode == rOpt.mbViewLayoutBookMode + && bShowPlaceHolderFields == rOpt.bShowPlaceHolderFields + && bIdle == rOpt.bIdle +#ifdef DBG_UTIL + // korrespondieren zu den Angaben in ui/config/cfgvw.src + && bTest1 == rOpt.IsTest1() + && bTest2 == rOpt.IsTest2() + && bTest3 == rOpt.IsTest3() + && bTest4 == rOpt.IsTest4() + && bTest5 == rOpt.IsTest5() + && bTest6 == rOpt.IsTest6() + && bTest7 == rOpt.IsTest7() + && bTest8 == rOpt.IsTest8() + && bTest10 == rOpt.IsTest10() +#endif + ; +} + +/************************************************************************* + * SwViewOption::DrawRect() + *************************************************************************/ + +void SwViewOption::DrawRect( OutputDevice *pOut, + const SwRect &rRect, long nCol ) const +{ + if ( pOut->GetOutDevType() != OUTDEV_PRINTER ) + { + const Color aCol( nCol ); + const Color aOldColor( pOut->GetFillColor() ); + pOut->SetFillColor( aCol ); + pOut->DrawRect( rRect.SVRect() ); + pOut->SetFillColor( aOldColor ); + } + else + DrawRectPrinter( pOut, rRect ); +} + +/************************************************************************* + * SwViewOption::DrawRectPrinter() + *************************************************************************/ + +void SwViewOption::DrawRectPrinter( OutputDevice *pOut, + const SwRect &rRect ) const +{ + Color aOldColor(pOut->GetLineColor()); + Color aOldFillColor( pOut->GetFillColor() ); + pOut->SetLineColor( Color(COL_BLACK) ); + pOut->SetFillColor( Color(COL_TRANSPARENT )); + pOut->DrawRect( rRect.SVRect() ); + pOut->SetFillColor( aOldFillColor ); + pOut->SetLineColor( aOldColor ); +} + +/************************************************************************* + * SwViewOption::GetPostItsWidth() + *************************************************************************/ + +USHORT SwViewOption::GetPostItsWidth( const OutputDevice *pOut ) const +{ + ASSERT( pOut, "no Outdev" ); + return USHORT(pOut->GetTextWidth( String::CreateFromAscii(aPostItStr ))); +} + +/************************************************************************* + * SwViewOption::PaintPostIts() + *************************************************************************/ + +void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, sal_Bool bIsScript ) const +{ + if( pOut && bIsScript ) + { + Color aOldLineColor( pOut->GetLineColor() ); + pOut->SetLineColor( Color(COL_GRAY ) ); + // Wir ziehen ueberall zwei Pixel ab, damit es schick aussieht + USHORT nPix = GetPixelTwips() * 2; + if( rRect.Width() <= 2 * nPix || rRect.Height() <= 2 * nPix ) + nPix = 0; + const Point aTopLeft( rRect.Left() + nPix, rRect.Top() + nPix ); + const Point aBotRight( rRect.Right() - nPix, rRect.Bottom() - nPix ); + const SwRect aRect( aTopLeft, aBotRight ); + DrawRect( pOut, aRect, aScriptIndicatorColor.GetColor() ); + pOut->SetLineColor( aOldLineColor ); + } +} + + +/************************************************************************* +|* +|* ViewOption::ViewOption() +|* +|* Letzte Aenderung MA 04. Aug. 93 +|* +|*************************************************************************/ + +SwViewOption::SwViewOption() : + aRetoucheColor( COL_TRANSPARENT ), + mnViewLayoutColumns( 0 ), + nPagePrevRow( 1 ), + nPagePrevCol( 2 ), + nShdwCrsrFillMode( FILL_TAB ), + bReadonly(FALSE), + bStarOneSetting(FALSE), + bIsPagePreview(FALSE), + bSelectionInReadonly(FALSE), + // --> FME 2004-06-29 #114856# Formular view + bFormView(FALSE), + // <-- + bBookview(FALSE), + mbViewLayoutBookMode(FALSE), + bShowPlaceHolderFields( sal_True ), + + nZoom( 100 ), + eZoom( SVX_ZOOM_PERCENT ), + nTblDest(TBL_DEST_CELL) +{ + // Initialisierung ist jetzt etwas einfacher + // alle Bits auf 0 + nCoreOptions = VIEWOPT_1_HARDBLANK | VIEWOPT_1_SOFTHYPH | + VIEWOPT_1_REF | + VIEWOPT_1_GRAPHIC | + VIEWOPT_1_TABLE | VIEWOPT_1_DRAW | VIEWOPT_1_CONTROL | + VIEWOPT_1_PAGEBACK | + VIEWOPT_1_SOLIDMARKHDL | VIEWOPT_1_POSTITS; + nCore2Options = VIEWOPT_CORE2_BLACKFONT | VIEWOPT_CORE2_HIDDENPARA; + nUIOptions = VIEWOPT_2_MODIFIED | VIEWOPT_2_GRFKEEPZOOM |VIEWOPT_2_ANY_RULER; + + if(MEASURE_METRIC != SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()) + aSnapSize.Width() = aSnapSize.Height() = 720; // 1/2" + else + aSnapSize.Width() = aSnapSize.Height() = 567; // 1 cm + nDivisionX = nDivisionY = 1; + + bSelectionInReadonly = SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly(); + + bIdle = true; + +#ifdef DBG_UTIL + // korrespondieren zu den Angaben in ui/config/cfgvw.src + bTest1 = bTest2 = bTest3 = bTest4 = + bTest5 = bTest6 = bTest7 = bTest8 = bTest10 = FALSE; +#endif +} + +SwViewOption::SwViewOption(const SwViewOption& rVOpt) +{ + bReadonly = FALSE; + bSelectionInReadonly = FALSE; + // --> FME 2004-06-29 #114856# Formular view + bFormView = rVOpt.bFormView; + // <-- + nZoom = rVOpt.nZoom ; + aSnapSize = rVOpt.aSnapSize ; + mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ; + nDivisionX = rVOpt.nDivisionX ; + nDivisionY = rVOpt.nDivisionY ; + nPagePrevRow = rVOpt.nPagePrevRow; + nPagePrevCol = rVOpt.nPagePrevCol; + bIsPagePreview = rVOpt.bIsPagePreview; + eZoom = rVOpt.eZoom ; + nTblDest = rVOpt.nTblDest ; + nUIOptions = rVOpt.nUIOptions ; + nCoreOptions = rVOpt.nCoreOptions ; + nCore2Options = rVOpt.nCore2Options ; + aRetoucheColor = rVOpt.GetRetoucheColor(); + sSymbolFont = rVOpt.sSymbolFont; + nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode; + bStarOneSetting = rVOpt.bStarOneSetting; + bBookview = rVOpt.bBookview; + mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode; + bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields; + bIdle = rVOpt.bIdle; + +#ifdef DBG_UTIL + bTest1 = rVOpt.bTest1 ; + bTest2 = rVOpt.bTest2 ; + bTest3 = rVOpt.bTest3 ; + bTest4 = rVOpt.bTest4 ; + bTest5 = rVOpt.bTest5 ; + bTest6 = rVOpt.bTest6 ; + bTest7 = rVOpt.bTest7 ; + bTest8 = rVOpt.bTest8 ; + bTest10 = rVOpt.bTest10 ; +#endif +} + + +SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt ) +{ + // --> DVO FME 2004-06-29 #114856# Formular view + bFormView = rVOpt.bFormView ; + // <-- + nZoom = rVOpt.nZoom ; + aSnapSize = rVOpt.aSnapSize ; + mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ; + nDivisionX = rVOpt.nDivisionX ; + nDivisionY = rVOpt.nDivisionY ; + nPagePrevRow = rVOpt.nPagePrevRow; + nPagePrevCol = rVOpt.nPagePrevCol; + bIsPagePreview = rVOpt.bIsPagePreview; + eZoom = rVOpt.eZoom ; + nTblDest = rVOpt.nTblDest ; + nUIOptions = rVOpt.nUIOptions ; + nCoreOptions = rVOpt.nCoreOptions; + nCore2Options = rVOpt.nCore2Options; + aRetoucheColor = rVOpt.GetRetoucheColor(); + sSymbolFont = rVOpt.sSymbolFont; + nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode; + bStarOneSetting = rVOpt.bStarOneSetting; + bBookview = rVOpt.bBookview; + mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode; + bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields; + bIdle = rVOpt.bIdle; + +#ifdef DBG_UTIL + bTest1 = rVOpt.bTest1 ; + bTest2 = rVOpt.bTest2 ; + bTest3 = rVOpt.bTest3 ; + bTest4 = rVOpt.bTest4 ; + bTest5 = rVOpt.bTest5 ; + bTest6 = rVOpt.bTest6 ; + bTest7 = rVOpt.bTest7 ; + bTest8 = rVOpt.bTest8 ; + bTest10 = rVOpt.bTest10 ; +#endif + return *this; +} + + +SwViewOption::~SwViewOption() +{ +} + +/************************************************************************* +|* +|* ViewOption::Init() +|* +|* Letzte Aenderung MA 04. Aug. 93 +|* +|*************************************************************************/ + +void SwViewOption::Init( Window *pWin ) +{ + if( !nPixelTwips && pWin ) + { + nPixelTwips = (USHORT)pWin->PixelToLogic( Size(1,1) ).Height(); + } +} + +BOOL SwViewOption::IsAutoCompleteWords() const +{ + const SvxSwAutoFmtFlags& rFlags = SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags(); + return /*rFlags.bAutoCompleteWords &&*/ rFlags.bAutoCmpltCollectWords; +} + +/*************************************************************************/ +/* */ +/*************************************************************************/ + +AuthorCharAttr::AuthorCharAttr() : + nItemId (SID_ATTR_CHAR_UNDERLINE), + nAttr (UNDERLINE_SINGLE), + nColor (COL_TRANSPARENT) +{ +} + +/*-----------------07.01.97 13.50------------------- + +--------------------------------------------------*/ + +USHORT GetHtmlMode(const SwDocShell* pShell) +{ + USHORT nRet = 0; + if(!pShell || PTR_CAST(SwWebDocShell, pShell)) + { + nRet = HTMLMODE_ON; + SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get(); + switch ( pHtmlOpt->GetExportMode() ) + { + case HTML_CFG_MSIE_40: + nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SMALL_CAPS| + HTMLMODE_SOME_STYLES| + HTMLMODE_FULL_STYLES|HTMLMODE_GRAPH_POS| + HTMLMODE_FULL_ABS_POS|HTMLMODE_SOME_ABS_POS; + break; + case HTML_CFG_NS40: + nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SOME_STYLES| + HTMLMODE_FRM_COLUMNS|HTMLMODE_BLINK|HTMLMODE_GRAPH_POS| + HTMLMODE_SOME_ABS_POS; + break; + case HTML_CFG_WRITER: + nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SMALL_CAPS| + HTMLMODE_SOME_STYLES| + HTMLMODE_FRM_COLUMNS|HTMLMODE_FULL_STYLES| + HTMLMODE_BLINK|HTMLMODE_DROPCAPS|HTMLMODE_GRAPH_POS| + HTMLMODE_FULL_ABS_POS|HTMLMODE_SOME_ABS_POS; + break; + case HTML_CFG_HTML32: + break; + } + } + return nRet; +} +/* -----------------------------24.04.2002 10:20------------------------------ + + ---------------------------------------------------------------------------*/ +Color& SwViewOption::GetDocColor() +{ + return aDocColor; +} +/* -----------------------------23.04.2002 17:18------------------------------ + + ---------------------------------------------------------------------------*/ +Color& SwViewOption::GetDocBoundariesColor() +{ + return aDocBoundColor; +} +/* -----------------------------23.04.2002 17:53------------------------------ + + ---------------------------------------------------------------------------*/ +Color& SwViewOption::GetObjectBoundariesColor() +{ + return aObjectBoundColor; +} +/* -----------------------------24.04.2002 10:41------------------------------ + + ---------------------------------------------------------------------------*/ +Color& SwViewOption::GetAppBackgroundColor() +{ + return aAppBackgroundColor; +} +/*-- 24.04.2002 10:50:11--------------------------------------------------- + + -----------------------------------------------------------------------*/ +Color& SwViewOption::GetTableBoundariesColor() +{ + return aTableBoundColor; +} +/*-- 24.04.2002 10:50:12--------------------------------------------------- + + -----------------------------------------------------------------------*/ +Color& SwViewOption::GetIndexShadingsColor() +{ + return aIndexShadingsColor; +} +/*-- 24.04.2002 10:50:12--------------------------------------------------- + + -----------------------------------------------------------------------*/ +Color& SwViewOption::GetLinksColor() +{ + return aLinksColor; +} +/*-- 24.04.2002 10:50:13--------------------------------------------------- + + -----------------------------------------------------------------------*/ +Color& SwViewOption::GetVisitedLinksColor() +{ + return aVisitedLinksColor; +} +/*-- 24.04.2002 10:50:13--------------------------------------------------- + + -----------------------------------------------------------------------*/ +Color& SwViewOption::GetDirectCursorColor() +{ + return aDirectCursorColor; +} +/*-- 24.04.2002 10:50:14--------------------------------------------------- + + -----------------------------------------------------------------------*/ +Color& SwViewOption::GetTextGridColor() +{ + return aTextGridColor; +} +/*-- 24.04.2002 10:50:14--------------------------------------------------- + + -----------------------------------------------------------------------*/ +Color& SwViewOption::GetSpellColor() +{ + return aSpellColor; +} +/*-- 24.04.2007 10:50:14--------------------------------------------------- + + -----------------------------------------------------------------------*/ +Color& SwViewOption::GetSmarttagColor() +{ + return aSmarttagColor; +} +/*-- 06.12.2002 10:50:11--------------------------------------------------- + + -----------------------------------------------------------------------*/ +Color& SwViewOption::GetFontColor() +{ + return aFontColor; +} +/*-- 24.04.2002 10:50:15--------------------------------------------------- + + -----------------------------------------------------------------------*/ +Color& SwViewOption::GetFieldShadingsColor() +{ + return aFieldShadingsColor; +} +/*-- 24.04.2002 10:50:15--------------------------------------------------- + + -----------------------------------------------------------------------*/ +Color& SwViewOption::GetSectionBoundColor() +{ + return aSectionBoundColor; +} +/* -----------------------------2002/07/31 14:00------------------------------ + + ---------------------------------------------------------------------------*/ +Color& SwViewOption::GetPageBreakColor() +{ + return aPageBreakColor; +} + +/* -----------------------------23.04.2002 17:41------------------------------ + + ---------------------------------------------------------------------------*/ +void SwViewOption::ApplyColorConfigValues(const svtools::ColorConfig& rConfig ) +{ + aDocColor.SetColor(rConfig.GetColorValue(svtools::DOCCOLOR).nColor); + + svtools::ColorConfigValue aValue = rConfig.GetColorValue(svtools::DOCBOUNDARIES); + aDocBoundColor.SetColor(aValue.nColor); + nAppearanceFlags = 0; + if(aValue.bIsVisible) + nAppearanceFlags |= VIEWOPT_DOC_BOUNDARIES; + + aAppBackgroundColor.SetColor(rConfig.GetColorValue(svtools::APPBACKGROUND).nColor); + + aValue = rConfig.GetColorValue(svtools::OBJECTBOUNDARIES); + aObjectBoundColor.SetColor(aValue.nColor); + if(aValue.bIsVisible) + nAppearanceFlags |= VIEWOPT_OBJECT_BOUNDARIES; + + aValue = rConfig.GetColorValue(svtools::TABLEBOUNDARIES); + aTableBoundColor.SetColor(aValue.nColor); + if(aValue.bIsVisible) + nAppearanceFlags |= VIEWOPT_TABLE_BOUNDARIES; + + aValue = rConfig.GetColorValue(svtools::WRITERIDXSHADINGS); + aIndexShadingsColor.SetColor(aValue.nColor); + if(aValue.bIsVisible) + nAppearanceFlags |= VIEWOPT_INDEX_SHADINGS; + + aValue = rConfig.GetColorValue(svtools::LINKS); + aLinksColor.SetColor(aValue.nColor); + if(aValue.bIsVisible) + nAppearanceFlags |= VIEWOPT_LINKS; + + aValue = rConfig.GetColorValue(svtools::LINKSVISITED); + aVisitedLinksColor.SetColor(aValue.nColor); + if(aValue.bIsVisible) + nAppearanceFlags |= VIEWOPT_VISITED_LINKS; + + aDirectCursorColor.SetColor(rConfig.GetColorValue(svtools::WRITERDIRECTCURSOR).nColor); + + aTextGridColor.SetColor(rConfig.GetColorValue(svtools::WRITERTEXTGRID).nColor); + + aSpellColor.SetColor(rConfig.GetColorValue(svtools::SPELL).nColor); + + aSmarttagColor.SetColor(rConfig.GetColorValue(svtools::SMARTTAGS).nColor); + + aFontColor.SetColor(rConfig.GetColorValue(svtools::FONTCOLOR).nColor); + + aValue = rConfig.GetColorValue(svtools::WRITERFIELDSHADINGS); + aFieldShadingsColor.SetColor(aValue.nColor); + if(aValue.bIsVisible) + nAppearanceFlags |= VIEWOPT_FIELD_SHADINGS; + + aValue = rConfig.GetColorValue(svtools::WRITERSECTIONBOUNDARIES); + aSectionBoundColor.SetColor(aValue.nColor); + if(aValue.bIsVisible) + nAppearanceFlags |= VIEWOPT_SECTION_BOUNDARIES; + + aValue = rConfig.GetColorValue(svtools::WRITERPAGEBREAKS); + aPageBreakColor.SetColor(aValue.nColor); + + aScriptIndicatorColor.SetColor(rConfig.GetColorValue(svtools::WRITERSCRIPTINDICATOR).nColor); +} +/* -----------------------------23.04.2002 17:48------------------------------ + + ---------------------------------------------------------------------------*/ +void SwViewOption::SetAppearanceFlag(sal_Int32 nFlag, BOOL bSet, BOOL bSaveInConfig ) +{ + if(bSet) + nAppearanceFlags |= nFlag; + else + nAppearanceFlags &= ~nFlag; + if(bSaveInConfig) + { + //create an editable svtools::ColorConfig and store the change + svtools::EditableColorConfig aEditableConfig; + struct FlagToConfig_Impl + { + sal_Int32 nFlag; + svtools::ColorConfigEntry eEntry; + }; + static const FlagToConfig_Impl aFlags[] = + { + { VIEWOPT_DOC_BOUNDARIES , svtools::DOCBOUNDARIES }, + { VIEWOPT_OBJECT_BOUNDARIES , svtools::OBJECTBOUNDARIES }, + { VIEWOPT_TABLE_BOUNDARIES , svtools::TABLEBOUNDARIES }, + { VIEWOPT_INDEX_SHADINGS , svtools::WRITERIDXSHADINGS }, + { VIEWOPT_LINKS , svtools::LINKS }, + { VIEWOPT_VISITED_LINKS , svtools::LINKSVISITED }, + { VIEWOPT_FIELD_SHADINGS , svtools::WRITERFIELDSHADINGS }, + { VIEWOPT_SECTION_BOUNDARIES , svtools::WRITERSECTIONBOUNDARIES }, + { 0 , svtools::ColorConfigEntryCount } + }; + sal_uInt16 nPos = 0; + while(aFlags[nPos].nFlag) + { + if(0 != (nFlag&aFlags[nPos].nFlag)) + { + svtools::ColorConfigValue aValue = aEditableConfig.GetColorValue(aFlags[nPos].eEntry); + aValue.bIsVisible = bSet; + aEditableConfig.SetColorValue(aFlags[nPos].eEntry, aValue); + } + nPos++; + } + } +} +/* -----------------------------24.04.2002 10:42------------------------------ + + ---------------------------------------------------------------------------*/ +BOOL SwViewOption::IsAppearanceFlag(sal_Int32 nFlag) +{ + return 0 != (nAppearanceFlags & nFlag); +} + |