summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-07-08 07:21:48 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-07-08 07:21:48 +0000
commit345d77aa3406c1630270e1459324ed5bf35fff11 (patch)
tree92a602414cb8c17c3eb09f49a4591d09fcf99376
parent0e5b16444dd89f0bb0b38c4161b841dd99770ec1 (diff)
INTEGRATION: CWS sw30bf06 (1.50.16); FILE MERGED
2008/06/19 14:36:49 od 1.50.16.5: corrections due to compiler warnings 2008/06/19 10:53:12 od 1.50.16.4: RESYNC: (1.50-1.51); FILE MERGED 2008/06/16 13:41:23 od 1.50.16.3: #i90078# refactoring and consideration of new list level attribute of methods changing the list level indent. 2008/06/09 07:21:39 od 1.50.16.2: #i89178# implementation of function <numfunc::GetDefaultPositionAndSpaceMode()> 2008/06/06 08:49:04 od 1.50.16.1: #i63395# new default bullet characters and new default bullet font
-rw-r--r--sw/source/core/doc/number.cxx267
1 files changed, 207 insertions, 60 deletions
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 9d4080cf8ec1..b050b944c98f 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: number.cxx,v $
- * $Revision: 1.51 $
+ * $Revision: 1.52 $
*
* This file is part of OpenOffice.org.
*
@@ -63,6 +63,9 @@
#include <list.hxx>
#include <algorithm>
// <--
+// --> OD 2008-06-06 #i89178#
+#include <svtools/saveopt.hxx>
+// <--
using namespace ::com::sun::star;
@@ -993,71 +996,151 @@ void SwNumRule::SetInvalidRule(BOOL bFlag)
bInvalidRuleFlag = bFlag;
}
+// --> OD 2008-06-16 #i90078#
// #i23725#, #i23726#
-void SwNumRule::Indent(short nAmount, int nLevel, int nReferenceLevel,
- BOOL bRelative, BOOL bFirstLine, BOOL bCheckGtZero)
-{
- int nStartLevel = 0;
- int nEndLevel = MAXLEVEL - 1;
- BOOL bGotInvalid = FALSE;
+//void SwNumRule::Indent(short nAmount, int nLevel, int nReferenceLevel,
+// BOOL bRelative, BOOL bFirstLine, BOOL bCheckGtZero)
+//{
+// int nStartLevel = 0;
+// int nEndLevel = MAXLEVEL - 1;
+// BOOL bGotInvalid = FALSE;
- if (nLevel >= 0)
- nStartLevel = nEndLevel = nLevel;
+// if (nLevel >= 0)
+// nStartLevel = nEndLevel = nLevel;
- int i;
- short nRealAmount = nAmount;
+// int i;
+// short nRealAmount = nAmount;
- if (! bRelative)
- {
- if (bFirstLine)
- {
- if (nReferenceLevel >= 0)
- nAmount = nAmount - Get(static_cast<USHORT>(nReferenceLevel)).GetFirstLineOffset();
- else
- nAmount = nAmount - Get(static_cast<USHORT>(nStartLevel)).GetFirstLineOffset();
- }
+// if (! bRelative)
+// {
+// if (bFirstLine)
+// {
+// if (nReferenceLevel >= 0)
+// nAmount = nAmount - Get(static_cast<USHORT>(nReferenceLevel)).GetFirstLineOffset();
+// else
+// nAmount = nAmount - Get(static_cast<USHORT>(nStartLevel)).GetFirstLineOffset();
+// }
- BOOL bFirst = TRUE;
+// BOOL bFirst = TRUE;
- if (nReferenceLevel >= 0)
- nRealAmount = nAmount - Get(static_cast<USHORT>(nReferenceLevel)).GetAbsLSpace();
- else
- for (i = nStartLevel; i < nEndLevel + 1; i++)
- {
- short nTmp = nAmount - Get(static_cast<USHORT>(i)).GetAbsLSpace();
+// if (nReferenceLevel >= 0)
+// nRealAmount = nAmount - Get(static_cast<USHORT>(nReferenceLevel)).GetAbsLSpace();
+// else
+// for (i = nStartLevel; i < nEndLevel + 1; i++)
+// {
+// short nTmp = nAmount - Get(static_cast<USHORT>(i)).GetAbsLSpace();
- if (bFirst || nTmp > nRealAmount)
- {
- nRealAmount = nTmp;
- bFirst = FALSE;
- }
- }
- }
+// if (bFirst || nTmp > nRealAmount)
+// {
+// nRealAmount = nTmp;
+// bFirst = FALSE;
+// }
+// }
+// }
+
+// if (nRealAmount < 0)
+// for (i = nStartLevel; i < nEndLevel + 1; i++)
+// if (Get(static_cast<USHORT>(i)).GetAbsLSpace() + nRealAmount < 0)
+// nRealAmount = -Get(static_cast<USHORT>(i)).GetAbsLSpace();
+
+// for (i = nStartLevel; i < nEndLevel + 1; i++)
+// {
+// short nNew = Get(static_cast<USHORT>(i)).GetAbsLSpace() + nRealAmount;
+
+// if (bCheckGtZero && nNew < 0)
+// nNew = 0;
+
+// SwNumFmt aTmpNumFmt(Get(static_cast<USHORT>(i)));
+// aTmpNumFmt.SetAbsLSpace(nNew);
+
+// Set(static_cast<USHORT>(i), aTmpNumFmt);
- if (nRealAmount < 0)
- for (i = nStartLevel; i < nEndLevel + 1; i++)
- if (Get(static_cast<USHORT>(i)).GetAbsLSpace() + nRealAmount < 0)
- nRealAmount = -Get(static_cast<USHORT>(i)).GetAbsLSpace();
+// bGotInvalid = TRUE;
+// }
- for (i = nStartLevel; i < nEndLevel + 1; i++)
+// if (bGotInvalid)
+// SetInvalidRule(bGotInvalid);
+//}
+
+// change indent of all list levels by given difference
+void SwNumRule::ChangeIndent( const short nDiff )
+{
+ for ( USHORT i = 0; i < MAXLEVEL; ++i )
{
- short nNew = Get(static_cast<USHORT>(i)).GetAbsLSpace() + nRealAmount;
+ SwNumFmt aTmpNumFmt( Get(i) );
+
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
+ aTmpNumFmt.GetPositionAndSpaceMode() );
+ if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ short nNewIndent = nDiff +
+ aTmpNumFmt.GetAbsLSpace();
+ if ( nNewIndent < 0 )
+ {
+ nNewIndent = 0;
+ }
+ aTmpNumFmt.SetAbsLSpace( nNewIndent );
+ }
+ else if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ long nNewIndent = nDiff +
+ aTmpNumFmt.GetIndentAt();
+ aTmpNumFmt.SetIndentAt( nNewIndent );
+ }
- if (bCheckGtZero && nNew < 0)
- nNew = 0;
+ Set( i, aTmpNumFmt );
+ }
- SwNumFmt aTmpNumFmt(Get(static_cast<USHORT>(i)));
- aTmpNumFmt.SetAbsLSpace(nNew);
+ SetInvalidRule( TRUE );
+}
- Set(static_cast<USHORT>(i), aTmpNumFmt);
+// set indent of certain list level to given value
+void SwNumRule::SetIndent( const short nNewIndent,
+ const USHORT nListLevel )
+{
+ SwNumFmt aTmpNumFmt( Get(nListLevel) );
- bGotInvalid = TRUE;
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
+ aTmpNumFmt.GetPositionAndSpaceMode() );
+ if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aTmpNumFmt.SetAbsLSpace( nNewIndent );
+ }
+ else if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aTmpNumFmt.SetIndentAt( nNewIndent );
}
- if (bGotInvalid)
- SetInvalidRule(bGotInvalid);
+ SetInvalidRule( TRUE );
}
+// set indent of first list level to given value and change other list level's
+// indents accordingly
+void SwNumRule::SetIndentOfFirstListLevelAndChangeOthers( const short nNewIndent )
+{
+ SwNumFmt aTmpNumFmt( Get(0) );
+
+ short nDiff( 0 );
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
+ aTmpNumFmt.GetPositionAndSpaceMode() );
+ if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ nDiff = nNewIndent
+ - aTmpNumFmt.GetFirstLineOffset()
+ - aTmpNumFmt.GetAbsLSpace();
+ }
+ else if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ nDiff = static_cast<short>(nNewIndent
+ - aTmpNumFmt.GetIndentAt());
+ }
+ if ( nDiff != 0 )
+ {
+ ChangeIndent( nDiff );
+ }
+}
+// <--
+
void SwNumRule::Validate()
{
// --> OD 2008-03-13 #refactorlists#
@@ -1141,6 +1224,12 @@ namespace numfunc
{
return msFontname;
}
+ // --> OD 2008-06-02 #i63395#
+ inline const bool IsFontnameUserDefined() const
+ {
+ return mbUserDefinedFontname;
+ }
+ // <--
inline const Font& GetFont() const
{
return *mpFont;
@@ -1201,6 +1290,9 @@ namespace numfunc
// default bullet list configuration data
String msFontname;
+ // --> OD 2008-06-02 #i63395#
+ bool mbUserDefinedFontname;
+ // <--
FontWeight meFontWeight;
FontItalic meFontItalic;
sal_Unicode mnLevelChars[MAXLEVEL];
@@ -1213,7 +1305,11 @@ namespace numfunc
SwDefBulletConfig::SwDefBulletConfig()
: ConfigItem( rtl::OUString::createFromAscii("Office.Writer/Numbering/DefaultBulletList") ),
- msFontname( String::CreateFromAscii("StarSymbol") ),
+ // --> OD 2008-06-02 #i63395#
+ // default bullet font is now OpenSymbol
+ msFontname( String::CreateFromAscii("OpenSymbol") ),
+ mbUserDefinedFontname( false ),
+ // <--
meFontWeight( WEIGHT_DONTKNOW ),
meFontItalic( ITALIC_NONE ),
mpFont( 0 )
@@ -1228,20 +1324,38 @@ namespace numfunc
void SwDefBulletConfig::SetToDefault()
{
- msFontname = String::CreateFromAscii("StarSymbol");
+ // --> OD 2008-06-02 #i63395#
+ // default bullet font name is now OpenSymbol
+// msFontname = String::CreateFromAscii("StarSymbol");
+ msFontname = String::CreateFromAscii("OpenSymbol");
+ mbUserDefinedFontname = false;
+ // <--
meFontWeight = WEIGHT_DONTKNOW;
meFontItalic = ITALIC_NONE;
- mnLevelChars[0] = 0x25cf;
- mnLevelChars[1] = 0x25cb;
- mnLevelChars[2] = 0x25a0;
- mnLevelChars[3] = 0x25cf;
- mnLevelChars[4] = 0x25cb;
- mnLevelChars[5] = 0x25a0;
- mnLevelChars[6] = 0x25cf;
- mnLevelChars[7] = 0x25cb;
- mnLevelChars[8] = 0x25a0;
- mnLevelChars[9] = 0x25cf;
+ // --> OD 2008-06-03 #i63395#
+ // new bullet characters
+// mnLevelChars[0] = 0x25cf;
+// mnLevelChars[1] = 0x25cb;
+// mnLevelChars[2] = 0x25a0;
+// mnLevelChars[3] = 0x25cf;
+// mnLevelChars[4] = 0x25cb;
+// mnLevelChars[5] = 0x25a0;
+// mnLevelChars[6] = 0x25cf;
+// mnLevelChars[7] = 0x25cb;
+// mnLevelChars[8] = 0x25a0;
+// mnLevelChars[9] = 0x25cf;
+ mnLevelChars[0] = 0x2022;
+ mnLevelChars[1] = 0x25e6;
+ mnLevelChars[2] = 0x25aa;
+ mnLevelChars[3] = 0x2022;
+ mnLevelChars[4] = 0x25e6;
+ mnLevelChars[5] = 0x25aa;
+ mnLevelChars[6] = 0x2022;
+ mnLevelChars[7] = 0x25e6;
+ mnLevelChars[8] = 0x25aa;
+ mnLevelChars[9] = 0x2022;
+ // <--
}
uno::Sequence<rtl::OUString> SwDefBulletConfig::GetPropNames() const
@@ -1286,6 +1400,9 @@ namespace numfunc
rtl::OUString aStr;
pValues[nProp] >>= aStr;
msFontname = aStr;
+ // --> OD 2008-06-02 #i63395#
+ mbUserDefinedFontname = true;
+ // <--
}
break;
case 1:
@@ -1343,6 +1460,13 @@ namespace numfunc
return SwDefBulletConfig::getInstance()->GetFontname();
}
+ // --> OD 2008-06-02 #i63395#
+ const bool IsDefBulletFontUserDefined()
+ {
+ return SwDefBulletConfig::getInstance()->IsFontnameUserDefined();
+ }
+ // <--
+
const Font& GetDefBulletFont()
{
return SwDefBulletConfig::getInstance()->GetFont();
@@ -1483,5 +1607,28 @@ namespace numfunc
{
return SwNumberingUIBehaviorConfig::getInstance()->ChangeIndentOnTabAtFirstPosOfFirstListItem();
}
+
+ // --> OD 2008-06-06 #i89178#
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
+ {
+ SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode;
+ SvtSaveOptions aSaveOptions;
+ switch ( aSaveOptions.GetODFDefaultVersion() )
+ {
+ case SvtSaveOptions::ODFVER_010:
+ case SvtSaveOptions::ODFVER_011:
+ {
+ ePosAndSpaceMode = SvxNumberFormat::LABEL_WIDTH_AND_POSITION;
+ }
+ break;
+ default: // ODFVER_UNKNOWN or ODFVER_012
+ {
+ ePosAndSpaceMode = SvxNumberFormat::LABEL_ALIGNMENT;
+ }
+ }
+
+ return ePosAndSpaceMode;
+ }
+ // <--
}
// <--