summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Riemer <ruderphilipp@gmail.com>2012-07-02 02:16:30 +0200
committerPhilipp Riemer <ruderphilipp@gmail.com>2012-07-02 02:16:30 +0200
commite3865adb873baa862bfc53339a6867f30f83643a (patch)
tree53453a467d34500f97f4304e8c9f0b1372c734a1
parent16c4e5506b10284611f2653f867fe09ce75b6a18 (diff)
Code cleanup and translation of German comments in "sw/source/core/bastyp/"
Change-Id: I9ba6f198fbc0f1a4655a57116f53719ea7d38fbd
-rw-r--r--sw/source/core/bastyp/SwSmartTagMgr.cxx2
-rw-r--r--sw/source/core/bastyp/bparr.cxx216
-rw-r--r--sw/source/core/bastyp/breakit.cxx43
-rw-r--r--sw/source/core/bastyp/calc.cxx1542
-rw-r--r--sw/source/core/bastyp/index.cxx60
-rw-r--r--sw/source/core/bastyp/init.cxx331
-rw-r--r--sw/source/core/bastyp/ring.cxx24
-rw-r--r--sw/source/core/bastyp/swcache.cxx104
-rw-r--r--sw/source/core/bastyp/swrect.cxx87
-rw-r--r--sw/source/core/bastyp/swregion.cxx120
-rw-r--r--sw/source/core/bastyp/swtypes.cxx18
-rw-r--r--sw/source/core/bastyp/tabcol.cxx16
12 files changed, 1153 insertions, 1410 deletions
diff --git a/sw/source/core/bastyp/SwSmartTagMgr.cxx b/sw/source/core/bastyp/SwSmartTagMgr.cxx
index fefddd008b93..389deace50e9 100644
--- a/sw/source/core/bastyp/SwSmartTagMgr.cxx
+++ b/sw/source/core/bastyp/SwSmartTagMgr.cxx
@@ -58,7 +58,6 @@ SwSmartTagMgr::~SwSmartTagMgr()
{
}
-// ::com::sun::star::util::XModifyListener
void SwSmartTagMgr::modified( const lang::EventObject& rEO ) throw( RuntimeException )
{
SolarMutexGuard aGuard;
@@ -69,7 +68,6 @@ void SwSmartTagMgr::modified( const lang::EventObject& rEO ) throw( RuntimeExcep
SmartTagMgr::modified( rEO );
}
-// ::com::sun::star::util::XChangesListener
void SwSmartTagMgr::changesOccurred( const util::ChangesEvent& rEvent ) throw( RuntimeException)
{
SolarMutexGuard aGuard;
diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx
index aa6c5ed04c82..1851cd6ae780 100644
--- a/sw/source/core/bastyp/bparr.cxx
+++ b/sw/source/core/bastyp/bparr.cxx
@@ -30,45 +30,37 @@
#include <limits.h>
#include "bparr.hxx"
-// die Blockverwaltung waechst/schrumpft immer um 20 Bloecke, das sind dann
-// immer ~ 20 * MAXENTRY == 20000 Eintraege
+/** Resize block management by this constant.
+ As a result there are approx. 20 * MAXENTRY == 20000 entries available */
const sal_uInt16 nBlockGrowSize = 20;
#if OSL_DEBUG_LEVEL > 2
-
#define CHECKIDX( p, n, i, c ) CheckIdx( p, n, i, c );
-
void CheckIdx( BlockInfo** ppInf, sal_uInt16 nBlock, sal_uLong nSize, sal_uInt16 nCur )
{
- assert(!nSize || nCur < nBlock); // BigPtrArray: CurIndex invalid
+ assert( !nSize || nCur < nBlock ); // BigPtrArray: CurIndex invalid
sal_uLong nIdx = 0;
for( sal_uInt16 nCnt = 0; nCnt < nBlock; ++nCnt, ++ppInf )
{
nIdx += (*ppInf)->nElem;
// Array with holes is not allowed
- assert(!nCnt || (*(ppInf-1))->nEnd + 1 == (*ppInf)->nStart);
+ assert( !nCnt || (*(ppInf-1))->nEnd + 1 == (*ppInf)->nStart );
}
assert(nIdx == nSize); // invalid count in nSize
}
-
#else
-
#define CHECKIDX( p, n, i, c )
-
#endif
-
BigPtrArray::BigPtrArray()
{
nBlock = nCur = 0;
nSize = 0;
- nMaxBlock = nBlockGrowSize; // == 20 * 1000 Eintraege
+ nMaxBlock = nBlockGrowSize;
ppInf = new BlockInfo* [ nMaxBlock ];
}
-
-
BigPtrArray::~BigPtrArray()
{
if( nBlock )
@@ -83,21 +75,24 @@ BigPtrArray::~BigPtrArray()
delete[] ppInf;
}
-// Auch der Move ist schlicht. Optimieren ist hier wg. der
-// Stueckelung des Feldes zwecklos!
-
+// Also moving is done simply here. Optimization is useless because of the
+// division of this field into multiple parts.
void BigPtrArray::Move( sal_uLong from, sal_uLong to )
{
sal_uInt16 cur = Index2Block( from );
BlockInfo* p = ppInf[ cur ];
ElementPtr pElem = p->pData[ from - p->nStart ];
- Insert( pElem, to ); // erst einfuegen, dann loeschen !!!!
+ Insert( pElem, to ); // insert first, then delete!
Remove( ( to < from ) ? ( from + 1 ) : from );
}
-// das Ende ist EXCLUSIV
-
+/** Apply function to every element.
+ @param nStart First element to start with
+ @param nEnd Last element (exclusive!)
+ @param fn Function
+ @param pArgs Additional arguments for <fn>
+*/
void BigPtrArray::ForEach( sal_uLong nStart, sal_uLong nEnd,
FnForEach fn, void* pArgs )
{
@@ -117,10 +112,10 @@ void BigPtrArray::ForEach( sal_uLong nStart, sal_uLong nEnd,
if( !(*fn)( *pElem++, pArgs ) || ++nStart >= nEnd )
break;
- // naechstes Element
+ // next element
if( !--nElem )
{
- // neuer Block
+ // new block
p = *++pp;
pElem = p->pData;
nElem = p->nElem;
@@ -129,11 +124,10 @@ void BigPtrArray::ForEach( sal_uLong nStart, sal_uLong nEnd,
}
}
-
ElementPtr BigPtrArray::operator[]( sal_uLong idx ) const
{
assert(idx < nSize); // operator[]: Index out of bounds
- // weil die Funktion eben doch nicht const ist:
+ // because this function is not <const>:
BigPtrArray* pThis = (BigPtrArray*) this;
sal_uInt16 cur = Index2Block( idx );
BlockInfo* p = ppInf[ cur ];
@@ -141,45 +135,33 @@ ElementPtr BigPtrArray::operator[]( sal_uLong idx ) const
return p->pData[ idx - p->nStart ];
}
-///////////////////////////////////////////////////////////////////////////
-
-// private Methoden
-
-// Suchen des Blocks einer bestimmten Position
-// Algorithmus:
-// 1. Test, ob der letzte Block der gesuchte Block ist
-// 2. Sonderfall: Index = 0?
-// 3. Test der Nachbarbloecke
-
-// 4. Binaere Suche
-
-
-
+/** Search a block at a given position */
sal_uInt16 BigPtrArray::Index2Block( sal_uLong pos ) const
{
- // zuletzt verwendeter Block?
+ // last used block?
BlockInfo* p = ppInf[ nCur ];
if( p->nStart <= pos && p->nEnd >= pos )
return nCur;
// Index = 0?
if( !pos )
return 0;
- // Folgeblock?
+
+ // following one?
if( nCur < ( nBlock - 1 ) )
{
p = ppInf[ nCur+1 ];
if( p->nStart <= pos && p->nEnd >= pos )
return nCur+1;
}
- // vorangehender Block?
+ // previous one?
else if( pos < p->nStart && nCur > 0 )
{
p = ppInf[ nCur-1 ];
if( p->nStart <= pos && p->nEnd >= pos )
return nCur-1;
}
- // Binaere Suche:
- // Diese fuehrt immer zum Erfolg
+
+ // binary search: always successful
sal_uInt16 lower = 0, upper = nBlock - 1;
sal_uInt16 cur = 0;
for(;;)
@@ -189,6 +171,7 @@ sal_uInt16 BigPtrArray::Index2Block( sal_uLong pos ) const
p = ppInf[ cur ];
if( p->nStart <= pos && p->nEnd >= pos )
return cur;
+
if( p->nStart > pos )
upper = cur;
else
@@ -196,11 +179,10 @@ sal_uInt16 BigPtrArray::Index2Block( sal_uLong pos ) const
}
}
+/** Update all index areas
-// Update aller Indexbereiche ab einer bestimmten Position
-
-// pos bezeichnet den letzten korrekten Block
-
+ @param pos last correct block (starting point)
+*/
void BigPtrArray::UpdIndex( sal_uInt16 pos )
{
BlockInfo** pp = ppInf + pos;
@@ -210,22 +192,22 @@ void BigPtrArray::UpdIndex( sal_uInt16 pos )
{
p = *++pp;
p->nStart = idx;
- idx += p->nElem;
- p->nEnd = idx - 1;
+ idx += p->nElem;
+ p->nEnd = idx - 1;
}
}
-// Einrichten eines neuen Blocks an einer bestimmten Position
-
-// Vorhandene Blocks werden nach hinten verschoben
-
+/** Create and insert new block
+ Existing blocks will be moved rearward.
+ @param pos Position at which the new block should be created.
+*/
BlockInfo* BigPtrArray::InsBlock( sal_uInt16 pos )
{
if( nBlock == nMaxBlock )
{
- // dann sollte wir mal das Array erweitern
+ // than extend the array first
BlockInfo** ppNew = new BlockInfo* [ nMaxBlock + nBlockGrowSize ];
memcpy( ppNew, ppInf, nMaxBlock * sizeof( BlockInfo* ));
delete[] ppInf;
@@ -233,8 +215,10 @@ BlockInfo* BigPtrArray::InsBlock( sal_uInt16 pos )
ppInf = ppNew;
}
if( pos != nBlock )
- memmove( ppInf + pos+1, ppInf + pos ,
- ( nBlock - pos ) * sizeof (BlockInfo*) );
+ {
+ memmove( ppInf + pos+1, ppInf + pos,
+ ( nBlock - pos ) * sizeof( BlockInfo* ));
+ }
++nBlock;
BlockInfo* p = new BlockInfo;
ppInf[ pos ] = p;
@@ -243,7 +227,8 @@ BlockInfo* BigPtrArray::InsBlock( sal_uInt16 pos )
p->nStart = p->nEnd = ppInf[ pos-1 ]->nEnd + 1;
else
p->nStart = p->nEnd = 0;
- p->nEnd--; // keine Elemente
+
+ p->nEnd--; // no elements
p->nElem = 0;
p->pData = new ElementPtr [ MAXENTRY ];
p->pBigArr = this;
@@ -255,7 +240,7 @@ void BigPtrArray::BlockDel( sal_uInt16 nDel )
nBlock = nBlock - nDel;
if( nMaxBlock - nBlock > nBlockGrowSize )
{
- // dann koennen wir wieder schrumpfen
+ // than shrink array
nDel = (( nBlock / nBlockGrowSize ) + 1 ) * nBlockGrowSize;
BlockInfo** ppNew = new BlockInfo* [ nDel ];
memcpy( ppNew, ppInf, nBlock * sizeof( BlockInfo* ));
@@ -265,7 +250,6 @@ void BigPtrArray::BlockDel( sal_uInt16 nDel )
}
}
-
void BigPtrArray::Insert( const ElementPtr& rElem, sal_uLong pos )
{
CHECKIDX( ppInf, nBlock, nSize, nCur );
@@ -273,26 +257,29 @@ void BigPtrArray::Insert( const ElementPtr& rElem, sal_uLong pos )
BlockInfo* p;
sal_uInt16 cur;
if( !nSize )
- // Sonderfall: erstes Element einfuegen
+ {
+ // special case: insert first element
p = InsBlock( cur = 0 );
+ }
else if( pos == nSize )
{
- // Sonderfall: Einfuegen am Ende
+ // special case: insert at end
cur = nBlock - 1;
p = ppInf[ cur ];
if( p->nElem == MAXENTRY )
- // Der letzte Block ist voll, neuen anlegen
+ // the last block is full, create a new one
p = InsBlock( ++cur );
}
else
{
- // Standardfall:
+ // standard case:
cur = Index2Block( pos );
p = ppInf[ cur ];
}
+
if( p->nElem == MAXENTRY )
{
- // passt der letzte Eintrag in den naechsten Block?
+ // does the last entry fit into the next block?
BlockInfo* q;
if( cur < ( nBlock - 1 ) && ppInf[ cur+1 ]->nElem < MAXENTRY )
{
@@ -310,19 +297,14 @@ void BigPtrArray::Insert( const ElementPtr& rElem, sal_uLong pos )
}
else
{
- // Wenn er auch nicht in den Folgeblock passt, muss ein
- // neuer Block eingefuegt werden
- // erst mal bei Bedarf komprimieren
-
- // wenn mehr als 50% "Luft" im Array ist, dann sollte man mal das
- // Compress aufrufen
+ // If it does not fit, then insert a new block. But if there is more
+ // than 50% space in the array then compress first.
if( /*nBlock == nMaxBlock &&*/
nBlock > ( nSize / ( MAXENTRY / 2 ) ) &&
cur >= Compress() )
{
- // es wurde vor der akt. Pos etwas verschoben und alle
- // Pointer koennen ungueltig sein. Also das Insert
- // nochmals aufsetzen
+ // Something was moved before the current position and all
+ // pointer might be invalid. Thus restart Insert.
Insert( rElem, pos );
return ;
}
@@ -330,7 +312,7 @@ void BigPtrArray::Insert( const ElementPtr& rElem, sal_uLong pos )
q = InsBlock( cur+1 );
}
- // Eintrag passt nicht mehr. Dann muss Platz gemacht werden
+ // entry does not fit anymore - clear space
ElementPtr pLast = p->pData[ MAXENTRY-1 ];
pLast->nOffset = 0;
pLast->pBlock = q;
@@ -342,7 +324,7 @@ void BigPtrArray::Insert( const ElementPtr& rElem, sal_uLong pos )
p->nEnd--;
p->nElem--;
}
- // Nun haben wir einen freien Block am Wickel: eintragen
+ // now we have free space - insert
pos -= p->nStart;
assert(pos < MAXENTRY);
if( pos != p->nElem )
@@ -353,7 +335,7 @@ void BigPtrArray::Insert( const ElementPtr& rElem, sal_uLong pos )
while( nCount-- )
++( *--pTo = *--pFrom )->nOffset;
}
- // Element eintragen und Indexe updaten
+ // insert element and update indices
((ElementPtr&)rElem)->nOffset = sal_uInt16(pos);
((ElementPtr&)rElem)->pBlock = p;
p->pData[ pos ] = rElem;
@@ -370,19 +352,20 @@ void BigPtrArray::Remove( sal_uLong pos, sal_uLong n )
{
CHECKIDX( ppInf, nBlock, nSize, nCur );
- sal_uInt16 nBlkdel = 0; // entfernte Bloecke
- sal_uInt16 cur = Index2Block( pos ); // aktuelle Blocknr
- sal_uInt16 nBlk1 = cur; // 1. behandelter Block
- sal_uInt16 nBlk1del = USHRT_MAX; // 1. entfernter Block
+ sal_uInt16 nBlkdel = 0; // deleted blocks
+ sal_uInt16 cur = Index2Block( pos ); // current block number
+ sal_uInt16 nBlk1 = cur; // 1st treated block
+ sal_uInt16 nBlk1del = USHRT_MAX; // 1st deleted block
BlockInfo* p = ppInf[ cur ];
pos -= p->nStart;
+
sal_uLong nElem = n;
while( nElem )
{
sal_uInt16 nel = p->nElem - sal_uInt16(pos);
if( sal_uLong(nel) > nElem )
nel = sal_uInt16(nElem);
- // Eventuell Elemente verschieben
+ // move elements if needed
if( ( pos + nel ) < sal_uLong(p->nElem) )
{
ElementPtr *pTo = p->pData + pos,
@@ -397,9 +380,9 @@ void BigPtrArray::Remove( sal_uLong pos, sal_uLong n )
}
p->nEnd -= nel;
p->nElem = p->nElem - nel;
+ // possibly delete block completely
if( !p->nElem )
{
- // eventuell Block ganz entfernen
delete[] p->pData;
nBlkdel++;
if( USHRT_MAX == nBlk1del )
@@ -411,10 +394,10 @@ void BigPtrArray::Remove( sal_uLong pos, sal_uLong n )
p = ppInf[ ++cur ];
pos = 0;
}
- // Am Ende die Tabelle updaten, falls Bloecke geloescht waren
+
+ // update table if blocks were removed
if( nBlkdel )
{
- // loeschen sollte man immer !!
for( sal_uInt16 i = nBlk1del; i < ( nBlk1del + nBlkdel ); i++ )
delete ppInf[ i ];
@@ -423,8 +406,7 @@ void BigPtrArray::Remove( sal_uLong pos, sal_uLong n )
memmove( ppInf + nBlk1del, ppInf + nBlk1del + nBlkdel,
( nBlock - nBlkdel - nBlk1del ) * sizeof( BlockInfo* ) );
- // JP 19.07.95: nicht den ersten behandelten, sondern den davor!!
- // UpdateIdx updatet nur alle Nachfolgende!!
+ // UpdateIdx updates the successor thus start before first elem
if( !nBlk1 )
{
p = ppInf[ 0 ];
@@ -432,9 +414,11 @@ void BigPtrArray::Remove( sal_uLong pos, sal_uLong n )
p->nEnd = p->nElem-1;
}
else
+ {
--nBlk1;
+ }
}
- BlockDel( nBlkdel ); // es wurden Bloecke geloescht
+ BlockDel( nBlkdel ); // blocks were deleted
}
nSize -= n;
@@ -442,19 +426,17 @@ void BigPtrArray::Remove( sal_uLong pos, sal_uLong n )
UpdIndex( nBlk1 );
nCur = nBlk1;
- // wenn mehr als 50% "Luft" im Array ist, dann sollte man mal das
- // Compress aufrufen
+ // call Compress() if there is more than 50% space in the array
if( nBlock > ( nSize / ( MAXENTRY / 2 ) ) )
Compress();
CHECKIDX( ppInf, nBlock, nSize, nCur );
}
-
void BigPtrArray::Replace( sal_uLong idx, const ElementPtr& rElem)
{
assert(idx < nSize); // Index out of bounds
- // weil die Funktion eben doch nicht const ist:
+ // because this function ist not <const>:
BigPtrArray* pThis = (BigPtrArray*) this;
sal_uInt16 cur = Index2Block( idx );
BlockInfo* p = ppInf[ cur ];
@@ -464,37 +446,32 @@ void BigPtrArray::Replace( sal_uLong idx, const ElementPtr& rElem)
p->pData[ idx - p->nStart ] = rElem;
}
-
-// Array komprimieren
-
+/** Compress the array */
sal_uInt16 BigPtrArray::Compress( short nMax )
{
CHECKIDX( ppInf, nBlock, nSize, nCur );
- // Es wird von vorne nach hinten ueber das InfoBlock Array iteriert.
- // Wenn zwischen durch Block gel�scht werden, dann mussen alle
- // nachfolgenden verschoben werden. Dazu werden die Pointer pp und qq
- // benutzt; wobei pp das "alte" Array, qq das "neue" Array ist.
+ // Iterate over InfoBlock array from beginning to end. If there is a deleted
+ // block in between so move all following ones accordingly. The pointer <pp>
+ // represents the "old" and <qq> the "new" array.
BlockInfo** pp = ppInf, **qq = pp;
BlockInfo* p;
- BlockInfo* pLast(0); // letzter nicht voller Block
- sal_uInt16 nLast = 0; // fehlende Elemente
- sal_uInt16 nBlkdel = 0; // Anzahl der geloeschte Bloecke
- sal_uInt16 nFirstChgPos = USHRT_MAX; // ab welcher Pos gab es die 1. Aenderung?
+ BlockInfo* pLast(0); // last empty block
+ sal_uInt16 nLast = 0; // missing elements
+ sal_uInt16 nBlkdel = 0; // number of deleted blocks
+ sal_uInt16 nFirstChgPos = USHRT_MAX; // at which position was the 1st change?
- // von Fuell-Prozenten auf uebrige Eintrage umrechnen
+ // convert fill percentage into number of remaining elements
nMax = MAXENTRY - (long) MAXENTRY * nMax / 100;
for( sal_uInt16 cur = 0; cur < nBlock; ++cur )
{
p = *pp++;
sal_uInt16 n = p->nElem;
- // Testen, ob der noch nicht volle Block so gelassen wird
- // dies ist der Fall, wenn der aktuelle Block gesplittet
- // werden muesste, der noch nicht volle Block aber bereits
- // ueber dem uebergebenen Break-Wert voll ist. In diesem
- // Fall wird von einer weiteren Fuellung (die ja wegen dem
- // zweifachen memmove() zeitaufwendig ist) abgesehen.
+ // Check if a not completely full block will be ignored. This happens if
+ // the current block would have to be split but the filling of the
+ // inspected block is already over its threshold value. In this case we
+ // do not fill more (it's expensive because of a double memmove() call)
if( nLast && ( n > nLast ) && ( nLast < nMax ) )
nLast = 0;
if( nLast )
@@ -502,28 +479,30 @@ sal_uInt16 BigPtrArray::Compress( short nMax )
if( USHRT_MAX == nFirstChgPos )
nFirstChgPos = cur;
- // ein nicht voller Block vorhanden: auffuellen
+ // Not full yet? Than fill up.
if( n > nLast )
n = nLast;
- // Elemente uebertragen, vom akt. in den letzten
+ // move elements from current to last block
ElementPtr* pElem = pLast->pData + pLast->nElem;
ElementPtr* pFrom = p->pData;
for( sal_uInt16 nCount = n, nOff = pLast->nElem;
nCount; --nCount, ++pElem )
+ {
*pElem = *pFrom++,
(*pElem)->pBlock = pLast,
(*pElem)->nOffset = nOff++;
+ }
- // korrigieren
+ // adjustment
pLast->nElem = pLast->nElem + n;
nLast = nLast - n;
p->nElem = p->nElem - n;
- // Ist der aktuelle Block dadurch leer geworden?
+ // Is the current block now empty as a result?
if( !p->nElem )
{
- // dann kann der entfernt werden
+ // than remove
delete[] p->pData;
delete p, p = 0;
++nBlkdel;
@@ -541,11 +520,11 @@ sal_uInt16 BigPtrArray::Compress( short nMax )
}
}
- if( p ) // die Blockinfo wurde nicht geloescht
+ if( p ) // BlockInfo was not deleted
{
- *qq++ = p; // dann setze sie an die richtige neue Position
+ *qq++ = p; // adjust to correct position
- // eventuell den letzten halbvollen Block festhalten
+ // keep the potentially existing last half-full block
if( !nLast && p->nElem < MAXENTRY )
{
pLast = p;
@@ -554,11 +533,11 @@ sal_uInt16 BigPtrArray::Compress( short nMax )
}
}
- // Bloecke geloescht wurden, ggfs. das BlockInfo Array verkuerzen
+ // if blocks were deleted shrink BlockInfo array if needed
if( nBlkdel )
BlockDel( nBlkdel );
- // Und neu durchindizieren
+ // and re-index
p = ppInf[ 0 ];
p->nEnd = p->nElem - 1;
UpdIndex( 0 );
@@ -571,5 +550,4 @@ sal_uInt16 BigPtrArray::Compress( short nMax )
return nFirstChgPos;
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx
index 21cb4a9ded5e..1e4d398c251c 100644
--- a/sw/source/core/bastyp/breakit.cxx
+++ b/sw/source/core/bastyp/breakit.cxx
@@ -26,7 +26,6 @@
*
************************************************************************/
-
#include "breakit.hxx"
#include <unicode/uchar.h>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -40,10 +39,9 @@
using namespace com::sun::star;
-SwBreakIt * pBreakIt = 0;
+SwBreakIt* pBreakIt = 0;
-void SwBreakIt::_Create(
- const uno::Reference< lang::XMultiServiceFactory > & rxMSF)
+void SwBreakIt::_Create( const uno::Reference<lang::XMultiServiceFactory> & rxMSF )
{
delete pBreakIt, pBreakIt = new SwBreakIt( rxMSF );
}
@@ -58,13 +56,12 @@ SwBreakIt * SwBreakIt::Get()
return pBreakIt;
}
-SwBreakIt::SwBreakIt(
- const uno::Reference< lang::XMultiServiceFactory > & rxMSF)
+SwBreakIt::SwBreakIt( const uno::Reference<lang::XMultiServiceFactory> & rxMSF )
: m_xMSF( rxMSF ),
m_pLocale( NULL ),
m_pForbidden( NULL ),
aLast( LANGUAGE_DONTKNOW ),
- aForbiddenLang( LANGUAGE_DONTKNOW)
+ aForbiddenLang( LANGUAGE_DONTKNOW )
{
OSL_ENSURE( m_xMSF.is(), "SwBreakIt: no MultiServiceFactory" );
}
@@ -78,7 +75,9 @@ SwBreakIt::~SwBreakIt()
void SwBreakIt::createBreakIterator() const
{
if ( m_xMSF.is() && !xBreak.is() )
- xBreak.set(m_xMSF->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator"))),uno::UNO_QUERY);
+ xBreak.set(m_xMSF->createInstance(::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator"))),
+ uno::UNO_QUERY);
}
void SwBreakIt::_GetLocale( const LanguageType aLang )
@@ -120,14 +119,19 @@ sal_uInt16 SwBreakIt::GetRealScriptOfText( const rtl::OUString& rTxt, sal_Int32
break;
}
}
- if( i18n::ScriptType::WEAK == nScript && nPos &&
- 0 < (nChgPos = xBreak->beginOfScript( rTxt, nPos, nScript )) )
+ if( i18n::ScriptType::WEAK == nScript &&
+ nPos &&
+ 0 < ( nChgPos = xBreak->beginOfScript( rTxt, nPos, nScript ) ) )
+ {
nScript = xBreak->getScriptType( rTxt, nChgPos-1 );
+ }
- if( i18n::ScriptType::WEAK == nScript && rTxt.getLength() >
- ( nChgPos = xBreak->endOfScript( rTxt, nPos, nScript ) ) &&
+ if( i18n::ScriptType::WEAK == nScript &&
+ rTxt.getLength() > ( nChgPos = xBreak->endOfScript( rTxt, nPos, nScript ) ) &&
0 <= nChgPos )
+ {
nScript = xBreak->getScriptType( rTxt, nChgPos );
+ }
}
if( i18n::ScriptType::WEAK == nScript )
nScript = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() );
@@ -137,12 +141,14 @@ sal_uInt16 SwBreakIt::GetRealScriptOfText( const rtl::OUString& rTxt, sal_Int32
sal_uInt16 SwBreakIt::GetAllScriptsOfText( const rtl::OUString& rTxt ) const
{
const sal_uInt16 coAllScripts = ( SCRIPTTYPE_LATIN |
- SCRIPTTYPE_ASIAN |
- SCRIPTTYPE_COMPLEX );
+ SCRIPTTYPE_ASIAN |
+ SCRIPTTYPE_COMPLEX );
createBreakIterator();
sal_uInt16 nRet = 0, nScript;
if( !xBreak.is() )
+ {
nRet = coAllScripts;
+ }
else if( !rTxt.isEmpty() )
{
for( sal_Int32 n = 0, nEnd = rTxt.getLength(); n < nEnd;
@@ -165,17 +171,20 @@ sal_uInt16 SwBreakIt::GetAllScriptsOfText( const rtl::OUString& rTxt ) const
return nRet;
}
-sal_Int32 SwBreakIt::getGraphemeCount(const rtl::OUString& rText, sal_Int32 nStart, sal_Int32 nEnd) const
+sal_Int32 SwBreakIt::getGraphemeCount(const rtl::OUString& rText,
+ sal_Int32 nStart, sal_Int32 nEnd) const
{
sal_Int32 nGraphemeCount = 0;
sal_Int32 nCurPos = nStart;
while (nCurPos < nEnd)
{
- //fdo#49208 cheat and assume that nothing can combine with a space
- //to form a single grapheme
+ // fdo#49208 cheat and assume that nothing can combine with a space
+ // to form a single grapheme
if (rText[nCurPos] == ' ')
+ {
++nCurPos;
+ }
else
{
sal_Int32 nCount2 = 1;
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 73baaf1ce835..6250178a07a3 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -61,7 +61,7 @@
using namespace ::com::sun::star;
-// tippt sich schneller
+// shortcut
#define RESOURCE ViewShell::GetShellRes()
const sal_Char sCalc_Add[] = "add";
@@ -79,8 +79,8 @@ const sal_Char sCalc_Eq[] = "eq";
const sal_Char sCalc_Neq[] = "neq";
const sal_Char sCalc_Leq[] = "leq";
const sal_Char sCalc_Geq[] = "geq";
-const sal_Char sCalc_L[] = "l";
-const sal_Char sCalc_G[] = "g";
+const sal_Char sCalc_L[] = "l";
+const sal_Char sCalc_G[] = "g";
const sal_Char sCalc_Sum[] = "sum";
const sal_Char sCalc_Mean[] = "mean";
const sal_Char sCalc_Min[] = "min";
@@ -91,12 +91,10 @@ const sal_Char sCalc_Tan[] = "tan";
const sal_Char sCalc_Asin[] = "asin";
const sal_Char sCalc_Acos[] = "acos";
const sal_Char sCalc_Atan[] = "atan";
-const sal_Char sCalc_Round[] = "round";
+const sal_Char sCalc_Round[]= "round";
const sal_Char sCalc_Date[] = "date";
-
-
-//!!!!! ACHTUNG - Sortierte Liste aller Operatoren !!!!!
+// ATTENTION: sorted list of all operators
struct _CalcOp
{
union{
@@ -107,35 +105,35 @@ struct _CalcOp
};
_CalcOp const aOpTable[] = {
-/* ACOS */ {{sCalc_Acos}, CALC_ACOS}, // Arcuscosinus
+/* ACOS */ {{sCalc_Acos}, CALC_ACOS}, // Arc cosine
/* ADD */ {{sCalc_Add}, CALC_PLUS}, // Addition
-/* AND */ {{sCalc_And}, CALC_AND}, // log. und
-/* ASIN */ {{sCalc_Asin}, CALC_ASIN}, // Arcussinus
-/* ATAN */ {{sCalc_Atan}, CALC_ATAN}, // Arcustangens
-/* COS */ {{sCalc_Cos}, CALC_COS}, // Cosinus
+/* AND */ {{sCalc_And}, CALC_AND}, // log. AND
+/* ASIN */ {{sCalc_Asin}, CALC_ASIN}, // Arc sine
+/* ATAN */ {{sCalc_Atan}, CALC_ATAN}, // Arc tangent
+/* COS */ {{sCalc_Cos}, CALC_COS}, // Cosine
/* DATE */ {{sCalc_Date}, CALC_DATE}, // Date
-/* DIV */ {{sCalc_Div}, CALC_DIV}, // Dividieren
-/* EQ */ {{sCalc_Eq}, CALC_EQ}, // gleich
-/* G */ {{sCalc_G}, CALC_GRE}, // groesser
-/* GEQ */ {{sCalc_Geq}, CALC_GEQ}, // groesser gleich
-/* L */ {{sCalc_L}, CALC_LES}, // kleiner
-/* LEQ */ {{sCalc_Leq}, CALC_LEQ}, // kleiner gleich
-/* MAX */ {{sCalc_Max}, CALC_MAX}, // Maximalwert
-/* MEAN */ {{sCalc_Mean}, CALC_MEAN}, // Mittelwert
-/* MIN */ {{sCalc_Min}, CALC_MIN}, // Minimalwert
-/* MUL */ {{sCalc_Mul}, CALC_MUL}, // Multiplizieren
-/* NEQ */ {{sCalc_Neq}, CALC_NEQ}, // nicht gleich
-/* NOT */ {{sCalc_Not}, CALC_NOT}, // log. nicht
-/* OR */ {{sCalc_Or}, CALC_OR}, // log. oder
-/* PHD */ {{sCalc_Phd}, CALC_PHD}, // Prozent
-/* POW */ {{sCalc_Pow}, CALC_POW}, // Potenzieren
-/* ROUND */ {{sCalc_Round}, CALC_ROUND}, // Runden
-/* SIN */ {{sCalc_Sin}, CALC_SIN}, // Sinus
-/* SQRT */ {{sCalc_Sqrt}, CALC_SQRT}, // Wurzel
-/* SUB */ {{sCalc_Sub}, CALC_MINUS}, // Subtraktion
-/* SUM */ {{sCalc_Sum}, CALC_SUM}, // Summe
-/* TAN */ {{sCalc_Tan}, CALC_TAN}, // Tangens
-/* XOR */ {{sCalc_Xor}, CALC_XOR} // log. xoder
+/* DIV */ {{sCalc_Div}, CALC_DIV}, // Division
+/* EQ */ {{sCalc_Eq}, CALC_EQ}, // Equality
+/* G */ {{sCalc_G}, CALC_GRE}, // Greater than
+/* GEQ */ {{sCalc_Geq}, CALC_GEQ}, // Greater or equal
+/* L */ {{sCalc_L}, CALC_LES}, // Less than
+/* LEQ */ {{sCalc_Leq}, CALC_LEQ}, // Less or equal
+/* MAX */ {{sCalc_Max}, CALC_MAX}, // Maximum value
+/* MEAN */ {{sCalc_Mean}, CALC_MEAN}, // Mean
+/* MIN */ {{sCalc_Min}, CALC_MIN}, // Minimum value
+/* MUL */ {{sCalc_Mul}, CALC_MUL}, // Multiplication
+/* NEQ */ {{sCalc_Neq}, CALC_NEQ}, // Not equal
+/* NOT */ {{sCalc_Not}, CALC_NOT}, // log. NOT
+/* OR */ {{sCalc_Or}, CALC_OR}, // log. OR
+/* PHD */ {{sCalc_Phd}, CALC_PHD}, // Percentage
+/* POW */ {{sCalc_Pow}, CALC_POW}, // Exponentiation
+/* ROUND */ {{sCalc_Round}, CALC_ROUND}, // Rounding
+/* SIN */ {{sCalc_Sin}, CALC_SIN}, // Sine
+/* SQRT */ {{sCalc_Sqrt}, CALC_SQRT}, // Square root
+/* SUB */ {{sCalc_Sub}, CALC_MINUS}, // Subtraction
+/* SUM */ {{sCalc_Sum}, CALC_SUM}, // Sum
+/* TAN */ {{sCalc_Tan}, CALC_TAN}, // Tangent
+/* XOR */ {{sCalc_Xor}, CALC_XOR} // log. XOR
};
double const nRoundVal[] = {
@@ -149,18 +147,17 @@ double const nKorrVal[] = {
9e-9, 9e-10, 9e-11, 9e-12, 9e-13, 9e-14
};
- // First character may be any alphabetic or underscore.
+// First character may be any alphabetic or underscore.
const sal_Int32 coStartFlags =
i18n::KParseTokens::ANY_LETTER_OR_NUMBER |
i18n::KParseTokens::ASC_UNDERSCORE |
i18n::KParseTokens::IGNORE_LEADING_WS;
- // Continuing characters may be any alphanumeric or underscore or dot.
+// Continuing characters may be any alphanumeric, underscore, or dot.
const sal_Int32 coContFlags =
( coStartFlags | i18n::KParseTokens::ASC_DOT )
& ~i18n::KParseTokens::IGNORE_LEADING_WS;
-
extern "C" {
static int SAL_CALL OperatorCompare( const void *pFirst, const void *pSecond)
{
@@ -169,23 +166,22 @@ static int SAL_CALL OperatorCompare( const void *pFirst, const void *pSecond)
{
if( CALC_NAME == ((_CalcOp*)pSecond)->eOp )
nRet = ((_CalcOp*)pFirst)->pUName->CompareTo(
- *((_CalcOp*)pSecond)->pUName );
+ *((_CalcOp*)pSecond)->pUName );
else
nRet = ((_CalcOp*)pFirst)->pUName->CompareToAscii(
- ((_CalcOp*)pSecond)->pName );
+ ((_CalcOp*)pSecond)->pName );
}
else
{
if( CALC_NAME == ((_CalcOp*)pSecond)->eOp )
nRet = -1 * ((_CalcOp*)pSecond)->pUName->CompareToAscii(
- ((_CalcOp*)pFirst)->pName );
+ ((_CalcOp*)pFirst)->pName );
else
nRet = strcmp( ((_CalcOp*)pFirst)->pName,
- ((_CalcOp*)pSecond)->pName );
+ ((_CalcOp*)pSecond)->pName );
}
return nRet;
}
-
}// extern "C"
_CalcOp* FindOperator( const String& rSrch )
@@ -194,38 +190,41 @@ _CalcOp* FindOperator( const String& rSrch )
aSrch.pUName = &rSrch;
aSrch.eOp = CALC_NAME;
- return (_CalcOp*)bsearch( (void*) &aSrch,
- (void*) aOpTable,
- sizeof( aOpTable ) / sizeof( _CalcOp ),
- sizeof( _CalcOp ),
- OperatorCompare );
+ return (_CalcOp*)bsearch( (void*) &aSrch,
+ (void*) aOpTable,
+ sizeof( aOpTable ) / sizeof( _CalcOp ),
+ sizeof( _CalcOp ),
+ OperatorCompare );
}
-
-//-----------------------------------------------------------------------------
-
-SwHash* Find( const String& rStr, SwHash** ppTable, sal_uInt16 nTblSize,
- sal_uInt16* pPos )
+SwHash* Find( const String& rStr, SwHash** ppTable,
+ sal_uInt16 nTblSize, sal_uInt16* pPos )
{
sal_uLong ii = 0;
for( xub_StrLen n = 0; n < rStr.Len(); ++n )
+ {
ii = ii << 1 ^ rStr.GetChar( n );
+ }
ii %= nTblSize;
if( pPos )
*pPos = (sal_uInt16)ii;
for( SwHash* pEntry = *(ppTable+ii); pEntry; pEntry = pEntry->pNext )
+ {
if( rStr == pEntry->aStr )
+ {
return pEntry;
+ }
+ }
return 0;
}
inline LanguageType GetDocAppScriptLang( SwDoc& rDoc )
{
return ((SvxLanguageItem&)rDoc.GetDefault(
- GetWhichOfScript( RES_CHRATR_LANGUAGE,
- GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ))
+ GetWhichOfScript( RES_CHRATR_LANGUAGE,
+ GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ))
)).GetLanguage();
}
@@ -236,23 +235,14 @@ double lcl_ConvertToDateValue( SwDoc& rDoc, sal_Int32 nDate )
if( pFormatter )
{
Date* pNull = pFormatter->GetNullDate();
- Date aDate( nDate >> 24, (nDate & 0x00FF0000) >> 16, nDate & 0x0000FFFF );
+ Date aDate( nDate >> 24, (nDate& 0x00FF0000) >> 16, nDate& 0x0000FFFF );
nRet = aDate - *pNull;
}
return nRet;
}
-//-----------------------------------------------------------------------------
-
-/******************************************************************************
-|*
-|* SwCalc::SwCalc( SwDoc* pD ) :
-|*
-|******************************************************************************/
-
SwCalc::SwCalc( SwDoc& rD )
- :
- aErrExpr( aEmptyStr, SwSbxValue(), 0 ),
+ : aErrExpr( aEmptyStr, SwSbxValue(), 0 ),
rDoc( rD ),
pLclData( m_aSysLocale.GetLocaleDataPtr() ),
pCharClass( &GetAppCharClass() ),
@@ -276,74 +266,73 @@ SwCalc::SwCalc( SwDoc& rD )
sCurrSym = comphelper::string::strip(pLclData->getCurrSymbol(), ' ');
sCurrSym = pCharClass->lowercase( sCurrSym );
-static sal_Char const
- sNType0[] = "false",
- sNType1[] = "true",
- sNType2[] = "pi",
- sNType3[] = "e",
- sNType4[] = "tables",
- sNType5[] = "graf",
- sNType6[] = "ole",
- sNType7[] = "page",
- sNType8[] = "para",
- sNType9[] = "word",
- sNType10[]= "char",
-
- sNType11[] = "user_firstname" ,
- sNType12[] = "user_lastname" ,
- sNType13[] = "user_initials" ,
- sNType14[] = "user_company" ,
- sNType15[] = "user_street" ,
- sNType16[] = "user_country" ,
- sNType17[] = "user_zipcode" ,
- sNType18[] = "user_city" ,
- sNType19[] = "user_title" ,
- sNType20[] = "user_position" ,
- sNType21[] = "user_tel_work" ,
- sNType22[] = "user_tel_home" ,
- sNType23[] = "user_fax" ,
- sNType24[] = "user_email" ,
- sNType25[] = "user_state" ,
- sNType26[] = "graph"
- ;
-
-static const sal_Char* const sNTypeTab[ 27 ] =
-{
- sNType0, sNType1, sNType2, sNType3, sNType4, sNType5,
- sNType6, sNType7, sNType8, sNType9, sNType10, sNType11,
- sNType12, sNType13, sNType14, sNType15, sNType16, sNType17,
- sNType18, sNType19, sNType20, sNType21, sNType22, sNType23,
- sNType24,
-
- // diese sind mit doppelten HashIds
- sNType25, sNType26
-};
-static sal_uInt16 const aHashValue[ 27 ] =
-{
- 34, 38, 43, 7, 18, 32, 22, 29, 30, 33, 3,
- 28, 24, 40, 9, 11, 26, 45, 4, 23, 36, 44, 19, 5, 1,
- // diese sind mit doppelten HashIds
- 11, 38
-};
-static sal_uInt16 const aAdrToken[ 12 ] =
-{
- USER_OPT_COMPANY, USER_OPT_STREET, USER_OPT_COUNTRY, USER_OPT_ZIP,
- USER_OPT_CITY, USER_OPT_TITLE, USER_OPT_POSITION, USER_OPT_TELEPHONEWORK,
- USER_OPT_TELEPHONEHOME, USER_OPT_FAX, USER_OPT_EMAIL, USER_OPT_STATE
-};
+ static sal_Char const
+ sNType0[] = "false",
+ sNType1[] = "true",
+ sNType2[] = "pi",
+ sNType3[] = "e",
+ sNType4[] = "tables",
+ sNType5[] = "graf",
+ sNType6[] = "ole",
+ sNType7[] = "page",
+ sNType8[] = "para",
+ sNType9[] = "word",
+ sNType10[]= "char",
+
+ sNType11[] = "user_firstname" ,
+ sNType12[] = "user_lastname" ,
+ sNType13[] = "user_initials" ,
+ sNType14[] = "user_company" ,
+ sNType15[] = "user_street" ,
+ sNType16[] = "user_country" ,
+ sNType17[] = "user_zipcode" ,
+ sNType18[] = "user_city" ,
+ sNType19[] = "user_title" ,
+ sNType20[] = "user_position" ,
+ sNType21[] = "user_tel_work" ,
+ sNType22[] = "user_tel_home" ,
+ sNType23[] = "user_fax" ,
+ sNType24[] = "user_email" ,
+ sNType25[] = "user_state" ,
+ sNType26[] = "graph"
+ ;
+ static const sal_Char* const sNTypeTab[ 27 ] =
+ {
+ sNType0, sNType1, sNType2, sNType3, sNType4, sNType5,
+ sNType6, sNType7, sNType8, sNType9, sNType10, sNType11,
+ sNType12, sNType13, sNType14, sNType15, sNType16, sNType17,
+ sNType18, sNType19, sNType20, sNType21, sNType22, sNType23,
+ sNType24,
+
+ // those have two HashIds
+ sNType25, sNType26
+ };
+ static sal_uInt16 const aHashValue[ 27 ] =
+ {
+ 34, 38, 43, 7, 18, 32, 22, 29, 30, 33, 3,
+ 28, 24, 40, 9, 11, 26, 45, 4, 23, 36, 44, 19, 5, 1,
+ // those have two HashIds
+ 11, 38
+ };
+ static sal_uInt16 const aAdrToken[ 12 ] =
+ {
+ USER_OPT_COMPANY, USER_OPT_STREET, USER_OPT_COUNTRY, USER_OPT_ZIP,
+ USER_OPT_CITY, USER_OPT_TITLE, USER_OPT_POSITION, USER_OPT_TELEPHONEWORK,
+ USER_OPT_TELEPHONEHOME, USER_OPT_FAX, USER_OPT_EMAIL, USER_OPT_STATE
+ };
-static sal_uInt16 SwDocStat::* const aDocStat1[ 3 ] =
-{
- &SwDocStat::nTbl, &SwDocStat::nGrf, &SwDocStat::nOLE
-};
-static sal_uLong SwDocStat::* const aDocStat2[ 4 ] =
-{
- &SwDocStat::nPage, &SwDocStat::nPara,
- &SwDocStat::nWord, &SwDocStat::nChar
-};
+ static sal_uInt16 SwDocStat::* const aDocStat1[ 3 ] =
+ {
+ &SwDocStat::nTbl, &SwDocStat::nGrf, &SwDocStat::nOLE
+ };
+ static sal_uLong SwDocStat::* const aDocStat2[ 4 ] =
+ {
+ &SwDocStat::nPage, &SwDocStat::nPara,
+ &SwDocStat::nWord, &SwDocStat::nChar
+ };
#if TBLSZ != 47
-#error Alle Hashwerte angepasst?
+#error Did you adjust all hash values?
#endif
const SwDocStat& rDocStat = rDoc.GetDocStat();
@@ -382,30 +371,19 @@ static sal_uLong SwDocStat::* const aDocStat2[ 4 ] =
sTmpStr.AssignAscii( sNTypeTab[ 25 ] );
VarTable[ aHashValue[ 25 ] ]->pNext = new SwCalcExp( sTmpStr, nVal, 0 );
-}
-
-/******************************************************************************
-|*
-|* SwCalc::~SwCalc()
-|*
-|******************************************************************************/
+} // SwCalc::SwCalc
SwCalc::~SwCalc()
{
for( sal_uInt16 n = 0; n < TBLSZ; ++n )
delete VarTable[n];
+
if( pLclData != m_aSysLocale.GetLocaleDataPtr() )
delete pLclData;
if( pCharClass != &GetAppCharClass() )
delete pCharClass;
}
-/******************************************************************************
-|*
-|* SwSbxValue SwCalc::Calculate( const String& rStr )
-|*
-|******************************************************************************/
-
SwSbxValue SwCalc::Calculate( const String& rStr )
{
eError = CALC_NOERR;
@@ -415,7 +393,7 @@ SwSbxValue SwCalc::Calculate( const String& rStr )
return nResult;
nListPor = 0;
- eCurrListOper = CALC_PLUS; // defaulten auf Summe
+ eCurrListOper = CALC_PLUS; // default: sum
sCommand = rStr;
nCommandPos = 0;
@@ -429,16 +407,16 @@ SwSbxValue SwCalc::Calculate( const String& rStr )
return nResult;
}
-/******************************************************************************
-|*
-|* String SwCalc::GetStrResult( SwSbxValue nValue, sal_Bool bRound = sal_True )
-|* Beschreibung Der Parameter bRound ist auf sal_True defaultet und darf
-|* nur beim errechnen von Tabellenzellen auf sal_False gesetzt
-|* werden, damit keine Rundungsfehler beim zusammenstellen
-|* der Formel entstehen.
-|*
-|******************************************************************************/
+//TODO: provide documentation
+/** ???
+ @param rVal ???
+ @param bRound In previous times <bRound> had a default value of <sal_True>.
+ There it should be only changed when calculating table cells,
+ so that no rounding errors would occur while composing a formula.
+ Now this parameter is ignored.
+ @return ???
+*/
String SwCalc::GetStrResult( const SwSbxValue& rVal, sal_Bool bRound )
{
if( !rVal.IsDouble() )
@@ -447,49 +425,37 @@ String SwCalc::GetStrResult( const SwSbxValue& rVal, sal_Bool bRound )
return GetStrResult( rVal.GetDouble(), bRound );
}
-
String SwCalc::GetStrResult( double nValue, sal_Bool )
{
if( nValue >= DBL_MAX )
switch( eError )
{
- case CALC_SYNTAX : return RESOURCE->aCalc_Syntax;
- case CALC_ZERODIV : return RESOURCE->aCalc_ZeroDiv;
- case CALC_BRACK : return RESOURCE->aCalc_Brack;
- case CALC_POWERR : return RESOURCE->aCalc_Pow;
- case CALC_VARNFND : return RESOURCE->aCalc_VarNFnd;
- case CALC_OVERFLOW : return RESOURCE->aCalc_Overflow;
- case CALC_WRONGTIME : return RESOURCE->aCalc_WrongTime;
- default : return RESOURCE->aCalc_Default;
+ case CALC_SYNTAX : return RESOURCE->aCalc_Syntax;
+ case CALC_ZERODIV : return RESOURCE->aCalc_ZeroDiv;
+ case CALC_BRACK : return RESOURCE->aCalc_Brack;
+ case CALC_POWERR : return RESOURCE->aCalc_Pow;
+ case CALC_VARNFND : return RESOURCE->aCalc_VarNFnd;
+ case CALC_OVERFLOW : return RESOURCE->aCalc_Overflow;
+ case CALC_WRONGTIME : return RESOURCE->aCalc_WrongTime;
+ default : return RESOURCE->aCalc_Default;
}
- sal_uInt16 nDec = 15; //pLclData->getNumDigits();
- String aRetStr( ::rtl::math::doubleToUString( nValue,
- rtl_math_StringFormat_Automatic,
- nDec,
- pLclData->getNumDecimalSep()[0],
- true ));
-
+ sal_uInt16 nDec = 15;
+ String aRetStr( ::rtl::math::doubleToUString(
+ nValue,
+ rtl_math_StringFormat_Automatic,
+ nDec,
+ pLclData->getNumDecimalSep()[0],
+ true ));
return aRetStr;
}
-/******************************************************************************
-|*
-|* SwCalcExp* SwCalc::VarLook( const String& )
-|*
-|******************************************************************************/
-
SwCalcExp* SwCalc::VarInsert( const String &rStr )
{
String aStr = pCharClass->lowercase( rStr );
return VarLook( aStr, 1 );
}
-/******************************************************************************
-|*
-|* SwCalcExp* SwCalc::VarLook( const String& , sal_uInt16 ins )
-|*
-|******************************************************************************/
SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins )
{
aErrExpr.nValue.SetVoidValue(false);
@@ -501,18 +467,20 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins )
if( !pFnd )
{
- // dann sehen wir mal im Doc nach:
+ // then check doc
SwHash** ppDocTbl = rDoc.GetUpdtFlds().GetFldTypeTable();
for( SwHash* pEntry = *(ppDocTbl+ii); pEntry; pEntry = pEntry->pNext )
+ {
if( aStr == pEntry->aStr )
{
- // dann hier zufuegen
+ // then insert here
pFnd = new SwCalcExp( aStr, SwSbxValue(),
((SwCalcFldType*)pEntry)->pFldType );
pFnd->pNext = *(VarTable+ii);
*(VarTable+ii) = pFnd;
break;
}
+ }
}
if( pFnd )
@@ -523,10 +491,12 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins )
{
SwUserFieldType* pUFld = (SwUserFieldType*)pFndExp->pFldType;
if( nsSwGetSetExpType::GSE_STRING & pUFld->GetType() )
+ {
pFndExp->nValue.PutString( pUFld->GetContent() );
+ }
else if( !pUFld->IsValid() )
{
- // Die aktuellen Werte sichern . . .
+ // Save the current values...
sal_uInt16 nOld_ListPor = nListPor;
SwSbxValue nOld_LastLeft = nLastLeft;
SwSbxValue nOld_NumberValue = nNumberValue;
@@ -536,7 +506,7 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins )
pFndExp->nValue.PutDouble( pUFld->GetValue( *this ) );
- // . . . und zurueck damit.
+ // ...and write them back.
nListPor = nOld_ListPor;
nLastLeft = nOld_LastLeft;
nNumberValue = nOld_NumberValue;
@@ -545,13 +515,13 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins )
eCurrListOper = eOld_CurrListOper;
}
else
+ {
pFndExp->nValue.PutDouble( pUFld->GetValue() );
+ }
}
return pFndExp;
}
- // Name(p)=Adress.PLZ oder Adress.DATENSATZNUMMER
- // DBSETNUMBERFLD = DatenSATZ-nummernfeld (NICHT "setze Datensatznummer!!!")
// At this point the "real" case variable has to be used
String sTmpName( rStr );
::ReplacePoint( sTmpName );
@@ -560,8 +530,6 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins )
{
SwNewDBMgr *pMgr = rDoc.GetNewDBMgr();
- // Name(p)=Adress.PLZ oder Adress.DATENSATZNUMMER
- // DBSETNUMBERFLD = DatenSATZ-nummernfeld (NICHT "setze Datensatznummer!!!")
String sDBName(GetDBName( sTmpName ));
String sSourceName(sDBName.GetToken(0, DB_DELIM));
String sTableName(sDBName.GetToken(0).GetToken(1, DB_DELIM));
@@ -569,14 +537,14 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins )
pMgr->OpenDataSource(sSourceName, sTableName, -1, false))
{
String sColumnName( GetColumnName( sTmpName ));
- OSL_ENSURE(sColumnName.Len(), "DB-Spaltenname fehlt!");
+ OSL_ENSURE(sColumnName.Len(), "Missing DB column name");
String sDBNum( SwFieldType::GetTypeStr(TYP_DBSETNUMBERFLD) );
sDBNum = pCharClass->lowercase(sDBNum);
- // Hier nochmal initialisieren, da das nicht mehr in docfld
- // fuer Felder != RES_DBFLD geschieht. Z.B. wenn ein Expressionfield
- // vor einem DB_Field in einem Dok vorkommt.
+ // Initialize again because this doesn't happen in docfld anymore for
+ // elements != RES_DBFLD. E.g. if there is an expression field before
+ // an DB_Field in a document.
VarChange( sDBNum, pMgr->GetSelectedRecordId(sSourceName, sTableName));
if( sDBNum.EqualsIgnoreCaseAscii(sColumnName) )
@@ -609,17 +577,16 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins )
//data source was not available - set return to "NoValue"
aErrExpr.nValue.SetVoidValue(true);
}
- // auf keinen fall eintragen!!
+ // NEVER save!
return &aErrExpr;
}
-
SwCalcExp* pNewExp = new SwCalcExp( aStr, SwSbxValue(), 0 );
pNewExp->pNext = VarTable[ ii ];
VarTable[ ii ] = pNewExp;
String sColumnName( GetColumnName( sTmpName ));
- OSL_ENSURE( sColumnName.Len(), "DB-Spaltenname fehlt!" );
+ OSL_ENSURE( sColumnName.Len(), "Missing DB column name" );
if( sColumnName.EqualsIgnoreCaseAscii(
SwFieldType::GetTypeStr( TYP_DBSETNUMBERFLD ) ))
{
@@ -630,20 +597,18 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins )
if( pMgr && sSourceName.Len() && sTableName.Len() &&
pMgr->OpenDataSource(sSourceName, sTableName, -1, false) &&
!pMgr->IsInMerge())
+ {
pNewExp->nValue.PutULong( pMgr->GetSelectedRecordId(sSourceName, sTableName));
+ }
else
+ {
pNewExp->nValue.SetVoidValue(true);
+ }
}
return pNewExp;
}
-/******************************************************************************
-|*
-|* sal_Bool SwCalc::VarChange( const String& rStr, const SwSbxValue nValue )
-|*
-|******************************************************************************/
-
void SwCalc::VarChange( const String& rStr, double nValue )
{
SwSbxValue aVal( nValue );
@@ -664,15 +629,11 @@ void SwCalc::VarChange( const String& rStr, const SwSbxValue& rValue )
VarTable[ nPos ] = pFnd;
}
else
+ {
pFnd->nValue = rValue;
+ }
}
-/******************************************************************************
-|*
-|* sal_Bool SwCalc::Push( const void* pPtr )
-|*
-|******************************************************************************/
-
sal_Bool SwCalc::Push( const VoidPtr pPtr )
{
if( USHRT_MAX != aRekurStk.GetPos( pPtr ) )
@@ -682,34 +643,21 @@ sal_Bool SwCalc::Push( const VoidPtr pPtr )
return sal_True;
}
-/******************************************************************************
-|*
-|* void SwCalc::Pop( const void* pPtr )
-|*
-|******************************************************************************/
-
void SwCalc::Pop( const VoidPtr )
{
- OSL_ENSURE( aRekurStk.Count(), "SwCalc: Pop auf ungueltigen Ptr" );
+ OSL_ENSURE( aRekurStk.Count(), "SwCalc: Pop on an invalid pointer" );
aRekurStk.Remove( aRekurStk.Count() - 1 );
}
-
-/******************************************************************************
-|*
-|* SwCalcOper SwCalc::GetToken()
-|*
-|******************************************************************************/
-
SwCalcOper SwCalc::GetToken()
{
#if OSL_DEBUG_LEVEL > 1
-//static for switch back to the "old" implementation of the
-//calculator, which don't use the I18N routines.
-static int nUseOld = 0;
-if( !nUseOld )
-{
+ // static for switch back to the "old" implementation of the calculator
+ // which doesn't use the I18N routines.
+ static int nUseOld = 0;
+ if( !nUseOld )
+ {
#endif
if( nCommandPos >= sCommand.Len() )
@@ -719,8 +667,8 @@ if( !nUseOld )
{
// Parse any token.
ParseResult aRes = pCharClass->parseAnyToken( sCommand, nCommandPos,
- coStartFlags, aEmptyStr,
- coContFlags, aEmptyStr );
+ coStartFlags, aEmptyStr,
+ coContFlags, aEmptyStr );
sal_Bool bSetError = sal_True;
xub_StrLen nRealStt = nCommandPos + (xub_StrLen)aRes.LeadingWhiteSpace;
@@ -732,38 +680,40 @@ if( !nUseOld )
}
else if( aRes.TokenType & KParseType::IDENTNAME )
{
- String aName( sCommand.Copy( nRealStt, static_cast<xub_StrLen>(aRes.EndPos) - nRealStt ));
- //#101436#: the variable may contain a database name it must not be converted to lower case
- // instead all further comparisons must be done case-insensitive
+ String aName( sCommand.Copy( nRealStt,
+ static_cast<xub_StrLen>(aRes.EndPos) - nRealStt ));
+ //#101436#: The variable may contain a database name. It must not be
+ // converted to lower case! Instead all further comparisons must be
+ // done case-insensitive
String sLowerCaseName = pCharClass->lowercase( aName );
- // Currency-Symbol abfangen
+ // catch currency symbol
if( sLowerCaseName == sCurrSym )
{
nCommandPos = (xub_StrLen)aRes.EndPos;
- return GetToken(); // also nochmal aufrufen
+ return GetToken(); // call again
}
- // Operations abfangen
+ // catch operators
_CalcOp* pFnd = ::FindOperator( sLowerCaseName );
if( pFnd )
{
switch( ( eCurrOper = ((_CalcOp*)pFnd)->eOp ) )
{
- case CALC_SUM:
- case CALC_MEAN:
- eCurrListOper = CALC_PLUS;
- break;
- case CALC_MIN:
- eCurrListOper = CALC_MIN_IN;
- break;
- case CALC_MAX:
- eCurrListOper = CALC_MAX_IN;
- break;
- case CALC_DATE:
- eCurrListOper = CALC_MONTH;
- break;
- default:
- break;
+ case CALC_SUM:
+ case CALC_MEAN:
+ eCurrListOper = CALC_PLUS;
+ break;
+ case CALC_MIN:
+ eCurrListOper = CALC_MIN_IN;
+ break;
+ case CALC_MAX:
+ eCurrListOper = CALC_MAX_IN;
+ break;
+ case CALC_DATE:
+ eCurrListOper = CALC_MONTH;
+ break;
+ default:
+ break;
}
nCommandPos = (xub_StrLen)aRes.EndPos;
return eCurrOper;
@@ -780,22 +730,25 @@ if( !nUseOld )
}
else if( aRes.TokenType & KParseType::ONE_SINGLE_CHAR )
{
- String aName( sCommand.Copy( nRealStt, static_cast<xub_StrLen>(aRes.EndPos) - nRealStt ));
+ String aName( sCommand.Copy( nRealStt,
+ static_cast<xub_StrLen>(aRes.EndPos) - nRealStt ));
if( 1 == aName.Len() )
{
bSetError = sal_False;
sal_Unicode ch = aName.GetChar( 0 );
switch( ch )
{
- case ';': if( CALC_MONTH == eCurrListOper ||
- CALC_DAY == eCurrListOper )
- {
- eCurrOper = eCurrListOper;
- break;
- }
+ case ';':
+ if( CALC_MONTH == eCurrListOper || CALC_DAY == eCurrListOper )
+ {
+ eCurrOper = eCurrListOper;
+ break;
+ }
+
case '\n':
- eCurrOper = CALC_PRINT;
- break;
+ eCurrOper = CALC_PRINT;
+ break;
+
case '%':
case '^':
case '*':
@@ -803,68 +756,71 @@ if( !nUseOld )
case '+':
case '-':
case '(':
- case ')': eCurrOper = SwCalcOper(ch);
- break;
+ case ')':
+ eCurrOper = SwCalcOper(ch);
+ break;
case '=':
case '!':
+ {
+ SwCalcOper eTmp2;
+ if( '=' == ch )
+ eCurrOper = SwCalcOper('='), eTmp2 = CALC_EQ;
+ else
+ eCurrOper = CALC_NOT, eTmp2 = CALC_NEQ;
+
+ if( aRes.EndPos < sCommand.Len() &&
+ '=' == sCommand.GetChar( (xub_StrLen)aRes.EndPos ) )
{
- SwCalcOper eTmp2;
- if( '=' == ch )
- eCurrOper = SwCalcOper('='), eTmp2 = CALC_EQ;
- else
- eCurrOper = CALC_NOT, eTmp2 = CALC_NEQ;
-
- if( aRes.EndPos < sCommand.Len() &&
- '=' == sCommand.GetChar( (xub_StrLen)aRes.EndPos ) )
- {
- eCurrOper = eTmp2;
- ++aRes.EndPos;
- }
+ eCurrOper = eTmp2;
+ ++aRes.EndPos;
}
- break;
+ }
+ break;
- case cListDelim :
- eCurrOper = eCurrListOper;
- break;
+ case cListDelim:
+ eCurrOper = eCurrListOper;
+ break;
case '[':
- if( aRes.EndPos < sCommand.Len() )
- {
- aVarName.Erase();
- xub_StrLen nFndPos = (xub_StrLen)aRes.EndPos,
- nSttPos = nFndPos;
+ if( aRes.EndPos < sCommand.Len() )
+ {
+ aVarName.Erase();
+ xub_StrLen nFndPos = (xub_StrLen)aRes.EndPos,
+ nSttPos = nFndPos;
- do{
- if( STRING_NOTFOUND != ( nFndPos =
- sCommand.Search( ']', nFndPos )) )
+ do {
+ if( STRING_NOTFOUND != ( nFndPos =
+ sCommand.Search( ']', nFndPos )) )
+ {
+ // ignore the ]
+ if( '\\' == sCommand.GetChar(nFndPos-1))
{
- // ignore the ]
- if( '\\' == sCommand.GetChar(nFndPos-1))
- {
- aVarName += sCommand.Copy( nSttPos,
+ aVarName += sCommand.Copy( nSttPos,
nFndPos - nSttPos - 1 );
- nSttPos = ++nFndPos;
- }
- else
- break;
+ nSttPos = ++nFndPos;
}
- } while( STRING_NOTFOUND != nFndPos );
+ else
+ break;
+ }
+ } while( STRING_NOTFOUND != nFndPos );
- if( STRING_NOTFOUND != nFndPos )
- {
- if( nSttPos != nFndPos )
- aVarName += sCommand.Copy( nSttPos,
+ if( STRING_NOTFOUND != nFndPos )
+ {
+ if( nSttPos != nFndPos )
+ aVarName += sCommand.Copy( nSttPos,
nFndPos - nSttPos );
- aRes.EndPos = nFndPos + 1;
- eCurrOper = CALC_NAME;
- }
- else
- bSetError = sal_True;
+ aRes.EndPos = nFndPos + 1;
+ eCurrOper = CALC_NAME;
}
else
bSetError = sal_True;
- break;
+ }
+ else
+ {
+ bSetError = sal_True;
+ }
+ break;
default:
bSetError = sal_True;
@@ -874,7 +830,8 @@ if( !nUseOld )
}
else if( aRes.TokenType & KParseType::BOOLEAN )
{
- String aName( sCommand.Copy( nRealStt, static_cast<xub_StrLen>(aRes.EndPos) - nRealStt ));
+ String aName( sCommand.Copy( nRealStt,
+ static_cast<xub_StrLen>(aRes.EndPos) - nRealStt ));
if( aName.Len() )
{
sal_Unicode ch = aName.GetChar(0);
@@ -909,41 +866,44 @@ if( !nUseOld )
};
#if OSL_DEBUG_LEVEL > 1
-
#define NextCh( s, n ) (nCommandPos < sCommand.Len() ? sCommand.GetChar( nCommandPos++ ) : 0)
-}
-else
-{
- sal_Unicode ch;
- sal_Unicode cTSep = pLclData->getNumThousandSep()[0],
- cDSep = pLclData->getNumDecimalSep()[0];
+ }
+ else
+ {
+ sal_Unicode ch;
+ sal_Unicode cTSep = pLclData->getNumThousandSep()[0],
+ cDSep = pLclData->getNumDecimalSep()[0];
- do {
- if( 0 == ( ch = NextCh( sCommand, nCommandPos ) ) )
- return eCurrOper = CALC_ENDCALC;
- } while ( ch == '\t' || ch == ' ' || ch == cTSep );
+ do {
+ if( 0 == ( ch = NextCh( sCommand, nCommandPos ) ) )
+ return eCurrOper = CALC_ENDCALC;
+ } while ( ch == '\t' || ch == ' ' || ch == cTSep );
- if( ch == cDSep )
- ch = '.';
+ if( ch == cDSep )
+ ch = '.';
- switch( ch )
- {
- case ';': if( CALC_MONTH == eCurrListOper || CALC_DAY == eCurrListOper )
- {
- eCurrOper = eCurrListOper;
- break;
- } // else .. no break
+ switch( ch )
+ {
+ case ';':
+ if( CALC_MONTH == eCurrListOper || CALC_DAY == eCurrListOper )
+ {
+ eCurrOper = eCurrListOper;
+ break;
+ } // else .. no break
case '\n':
- {
- sal_Unicode c;
- while( nCommandPos < sCommand.Len() && ( ( c =
- sCommand.GetChar( nCommandPos ) ) == ' ' ||
- c == '\t' || c == '\x0a' || c == '\x0d' ))
- ++nCommandPos;
- eCurrOper = CALC_PRINT;
- }
- break;
+ {
+ sal_Unicode c;
+ while( nCommandPos < sCommand.Len() &&
+ ( ( c = sCommand.GetChar( nCommandPos ) ) == ' ' ||
+ c == '\t' || c == '\x0a' || c == '\x0d' ))
+ {
+ ++nCommandPos;
+ }
+ eCurrOper = CALC_PRINT;
+ }
+ break;
+
case '%':
case '^':
case '*':
@@ -951,166 +911,178 @@ else
case '+':
case '-':
case '(':
- case ')': eCurrOper = SwCalcOper(ch);
- break;
+ case ')':
+ eCurrOper = SwCalcOper(ch);
+ break;
- case '=': if( '=' == sCommand.GetChar( nCommandPos ) )
- {
- ++nCommandPos;
- eCurrOper = CALC_EQ;
- }
- else
- eCurrOper = SwCalcOper(ch);
- break;
+ case '=':
+ if( '=' == sCommand.GetChar( nCommandPos ) )
+ {
+ ++nCommandPos;
+ eCurrOper = CALC_EQ;
+ }
+ else
+ {
+ eCurrOper = SwCalcOper(ch);
+ }
+ break;
- case '!': if( '=' == sCommand.GetChar( nCommandPos ) )
- {
- ++nCommandPos;
- eCurrOper = CALC_NEQ;
- }
- else
- eCurrOper = CALC_NOT;
- break;
+ case '!':
+ if( '=' == sCommand.GetChar( nCommandPos ) )
+ {
+ ++nCommandPos;
+ eCurrOper = CALC_NEQ;
+ }
+ else
+ {
+ eCurrOper = CALC_NOT;
+ }
+ break;
case '>':
- case '<': eCurrOper = '>' == ch ? CALC_GRE : CALC_LES;
- if( '=' == (ch = sCommand.GetChar( nCommandPos ) ) )
- {
- ++nCommandPos;
- eCurrOper = CALC_GRE == eCurrOper ? CALC_GEQ : CALC_LEQ;
- }
- else if( ' ' != ch )
- {
- eError = CALC_SYNTAX;
- eCurrOper = CALC_PRINT;
- }
- break;
+ case '<':
+ eCurrOper = '>' == ch ? CALC_GRE : CALC_LES;
+ if( '=' == (ch = sCommand.GetChar( nCommandPos ) ) )
+ {
+ ++nCommandPos;
+ eCurrOper = CALC_GRE == eCurrOper ? CALC_GEQ : CALC_LEQ;
+ }
+ else if( ' ' != ch )
+ {
+ eError = CALC_SYNTAX;
+ eCurrOper = CALC_PRINT;
+ }
+ break;
case cListDelim :
- eCurrOper = eCurrListOper;
- break;
+ eCurrOper = eCurrListOper;
+ break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case ',':
- case '.': {
- double nVal;
- --nCommandPos; // auf das 1. Zeichen zurueck
- if( Str2Double( sCommand, nCommandPos, nVal, pLclData ))
- {
- nNumberValue.PutDouble( nVal );
- eCurrOper = CALC_NUMBER;
- }
- else
- {
- // fehlerhafte Zahl
- eError = CALC_SYNTAX;
- eCurrOper = CALC_PRINT;
- }
- }
- break;
+ case '.':
+ {
+ double nVal;
+ --nCommandPos; // back to the first char
+ if( Str2Double( sCommand, nCommandPos, nVal, pLclData ))
+ {
+ nNumberValue.PutDouble( nVal );
+ eCurrOper = CALC_NUMBER;
+ }
+ else
+ {
+ // erroneous number
+ eError = CALC_SYNTAX;
+ eCurrOper = CALC_PRINT;
+ }
+ }
+ break;
- case '[': {
- String aStr;
- sal_Bool bIgnore = sal_False;
- do {
- while( 0 != ( ch = NextCh( sCommand, nCommandPos ))
- && ch != ']' )
- {
- if( !bIgnore && '\\' == ch )
- bIgnore = sal_True;
- else if( bIgnore )
- bIgnore = sal_False;
- aStr += ch;
- }
+ case '[':
+ {
+ String aStr;
+ sal_Bool bIgnore = sal_False;
+ do {
+ while( 0 != ( ch = NextCh( sCommand, nCommandPos )) &&
+ ch != ']' )
+ {
+ if( !bIgnore && '\\' == ch )
+ bIgnore = sal_True;
+ else if( bIgnore )
+ bIgnore = sal_False;
+ aStr += ch;
+ }
- if( !bIgnore )
- break;
+ if( !bIgnore )
+ break;
- aStr.SetChar( aStr.Len() - 1, ch );
- } while( ch );
+ aStr.SetChar( aStr.Len() - 1, ch );
+ } while( ch );
- aVarName = aStr;
- eCurrOper = CALC_NAME;
- }
- break;
+ aVarName = aStr;
+ eCurrOper = CALC_NAME;
+ }
+ break;
- case '"': {
- xub_StrLen nStt = nCommandPos;
- while( 0 != ( ch = NextCh( sCommand, nCommandPos ) )
- && '"' != ch )
- ;
-
- xub_StrLen nLen = nCommandPos - nStt;
- if( '"' == ch )
- --nLen;
- nNumberValue.PutString( sCommand.Copy( nStt, nLen ));
- eCurrOper = CALC_NUMBER;
- }
- break;
+ case '"':
+ {
+ xub_StrLen nStt = nCommandPos;
+ while( 0 != ( ch = NextCh( sCommand, nCommandPos ) ) &&
+ '"' != ch )
+ {
+ ;
+ }
- default: if (ch && (pCharClass->isLetter( sCommand, nCommandPos - 1) || '_' == ch))
- {
- xub_StrLen nStt = nCommandPos-1;
- while( 0 != (ch = NextCh( sCommand, nCommandPos )) &&
- (pCharClass->isLetterNumeric(
- sCommand, nCommandPos - 1) ||
- ch == '_' || ch == '.' ) )
- ;
+ xub_StrLen nLen = nCommandPos - nStt;
+ if( '"' == ch )
+ --nLen;
+ nNumberValue.PutString( sCommand.Copy( nStt, nLen ));
+ eCurrOper = CALC_NUMBER;
+ }
+ break;
- if( ch )
- --nCommandPos;
+ default:
+ if (ch && (pCharClass->isLetter( sCommand, nCommandPos - 1) ||
+ '_' == ch))
+ {
+ xub_StrLen nStt = nCommandPos-1;
+ while( 0 != (ch = NextCh( sCommand, nCommandPos )) &&
+ (pCharClass->isLetterNumeric( sCommand, nCommandPos - 1) ||
+ ch == '_' || ch == '.' ) )
+ {
+ ;
+ }
- String aStr( sCommand.Copy( nStt, nCommandPos-nStt ));
- aStr = pCharClass->lowercase( aStr );
+ if( ch )
+ --nCommandPos;
+ String aStr( sCommand.Copy( nStt, nCommandPos-nStt ));
+ aStr = pCharClass->lowercase( aStr );
- // Currency-Symbol abfangen
- if( aStr == sCurrSym )
- return GetToken(); // also nochmal aufrufen
+ // catch currency symbol
+ if( aStr == sCurrSym )
+ return GetToken(); // call again
- // Operations abfangen
- _CalcOp* pFnd = ::FindOperator( aStr );
- if( pFnd )
- {
- switch( ( eCurrOper = ((_CalcOp*)pFnd)->eOp ) )
- {
- case CALC_SUM :
- case CALC_MEAN : eCurrListOper = CALC_PLUS;
- break;
- case CALC_MIN : eCurrListOper = CALC_MIN_IN;
- break;
- case CALC_MAX : eCurrListOper = CALC_MAX_IN;
- break;
- case CALC_DATE : eCurrListOper = CALC_MONTH;
- break;
- default :
- break;
- }
- return eCurrOper;
- }
- aVarName = aStr;
- eCurrOper = CALC_NAME;
- }
- else
+ // catch operators
+ _CalcOp* pFnd = ::FindOperator( aStr );
+ if( pFnd )
+ {
+ switch( ( eCurrOper = ((_CalcOp*)pFnd)->eOp ) )
{
- eError = CALC_SYNTAX;
- eCurrOper = CALC_PRINT;
+ case CALC_SUM :
+ case CALC_MEAN :
+ eCurrListOper = CALC_PLUS;
+ break;
+ case CALC_MIN :
+ eCurrListOper = CALC_MIN_IN;
+ break;
+ case CALC_MAX :
+ eCurrListOper = CALC_MAX_IN;
+ break;
+ case CALC_DATE :
+ eCurrListOper = CALC_MONTH;
+ break;
+ default :
+ break;
}
- break;
+ return eCurrOper;
+ }
+ aVarName = aStr;
+ eCurrOper = CALC_NAME;
+ }
+ else
+ {
+ eError = CALC_SYNTAX;
+ eCurrOper = CALC_PRINT;
+ }
+ break;
+ }
}
-
-}
#endif
return eCurrOper;
}
-/******************************************************************************
-|*
-|* SwSbxValue SwCalc::Term()
-|*
-|******************************************************************************/
-
SwSbxValue SwCalc::Term()
{
SwSbxValue left( Prim() );
@@ -1121,136 +1093,145 @@ SwSbxValue SwCalc::Term()
switch( eCurrOper )
{
- case CALC_AND: {
- GetToken();
- sal_Bool bB = Prim().GetBool();
- left.PutBool( left.GetBool() && bB );
- }
- break;
- case CALC_OR: {
- GetToken();
- sal_Bool bB = Prim().GetBool();
- left.PutBool( left.GetBool() || bB );
- }
- break;
- case CALC_XOR: {
- GetToken();
- sal_Bool bR = Prim().GetBool();
- sal_Bool bL = left.GetBool();
- left.PutBool( (bL && !bR) || (!bL && bR) );
- }
- break;
-
- case CALC_EQ: nSbxOper = SbxEQ; break;
- case CALC_NEQ: nSbxOper = SbxNE; break;
- case CALC_LEQ: nSbxOper = SbxLE; break;
- case CALC_GEQ: nSbxOper = SbxGE; break;
- case CALC_GRE: nSbxOper = SbxGT; break;
- case CALC_LES: nSbxOper = SbxLT; break;
+ case CALC_AND:
+ {
+ GetToken();
+ sal_Bool bB = Prim().GetBool();
+ left.PutBool( left.GetBool() && bB );
+ }
+ break;
+ case CALC_OR:
+ {
+ GetToken();
+ sal_Bool bB = Prim().GetBool();
+ left.PutBool( left.GetBool() || bB );
+ }
+ break;
+ case CALC_XOR:
+ {
+ GetToken();
+ sal_Bool bR = Prim().GetBool();
+ sal_Bool bL = left.GetBool();
+ left.PutBool( (bL && !bR) || (!bL && bR) );
+ }
+ break;
- case CALC_MUL: nSbxOper = SbxMUL; break;
- case CALC_DIV: nSbxOper = SbxDIV; break;
+ case CALC_EQ: nSbxOper = SbxEQ; break;
+ case CALC_NEQ: nSbxOper = SbxNE; break;
+ case CALC_LEQ: nSbxOper = SbxLE; break;
+ case CALC_GEQ: nSbxOper = SbxGE; break;
+ case CALC_GRE: nSbxOper = SbxGT; break;
+ case CALC_LES: nSbxOper = SbxLT; break;
- case CALC_MIN_IN:
- {
- GetToken();
- SwSbxValue e = Prim();
- left = left.GetDouble() < e.GetDouble()
- ? left : e;
- }
- break;
- case CALC_MAX_IN:
- {
- GetToken();
- SwSbxValue e = Prim();
- left = left.GetDouble() > e.GetDouble()
- ? left : e;
- }
- break;
- case CALC_MONTH:
- {
- GetToken();
- SwSbxValue e = Prim();
- sal_Int32 nYear = (sal_Int32) floor( left.GetDouble() );
- nYear = nYear & 0x0000FFFF;
- sal_Int32 nMonth = (sal_Int32) floor( e.GetDouble() );
- nMonth = ( nMonth & 0x000000FF ) << 16;
- left.PutLong( nMonth + nYear );
- eCurrOper = CALC_DAY;
- }
- break;
- case CALC_DAY:
- {
- GetToken();
- SwSbxValue e = Prim();
- sal_Int32 nYearMonth = (sal_Int32) floor( left.GetDouble() );
- nYearMonth = nYearMonth & 0x00FFFFFF;
- sal_Int32 nDay = (sal_Int32) floor( e.GetDouble() );
- nDay = ( nDay & 0x000000FF ) << 24;
- left = lcl_ConvertToDateValue( rDoc, nDay + nYearMonth );
- }
- break;
- case CALC_ROUND:
- {
- GetToken();
- SwSbxValue e = Prim();
+ case CALC_MUL: nSbxOper = SbxMUL; break;
+ case CALC_DIV: nSbxOper = SbxDIV; break;
- double fVal = 0;
- double fFac = 1;
- sal_Int32 nDec = (sal_Int32) floor( e.GetDouble() );
- if( nDec < -20 || nDec > 20 )
- {
- eError = CALC_OVERFLOW;
- left.Clear();
- return left;
- }
- fVal = left.GetDouble();
- sal_uInt16 i;
- if( nDec >= 0)
- for (i = 0; i < (sal_uInt16) nDec; ++i )
- fFac *= 10.0;
- else
- for (i = 0; i < (sal_uInt16) -nDec; ++i )
- fFac /= 10.0;
+ case CALC_MIN_IN:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
+ left = left.GetDouble() < e.GetDouble() ? left : e;
+ }
+ break;
+ case CALC_MAX_IN:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
+ left = left.GetDouble() > e.GetDouble() ? left : e;
+ }
+ break;
+ case CALC_MONTH:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
+ sal_Int32 nYear = (sal_Int32) floor( left.GetDouble() );
+ nYear = nYear & 0x0000FFFF;
+ sal_Int32 nMonth = (sal_Int32) floor( e.GetDouble() );
+ nMonth = ( nMonth & 0x000000FF ) << 16;
+ left.PutLong( nMonth + nYear );
+ eCurrOper = CALC_DAY;
+ }
+ break;
+ case CALC_DAY:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
+ sal_Int32 nYearMonth = (sal_Int32) floor( left.GetDouble() );
+ nYearMonth = nYearMonth & 0x00FFFFFF;
+ sal_Int32 nDay = (sal_Int32) floor( e.GetDouble() );
+ nDay = ( nDay & 0x000000FF ) << 24;
+ left = lcl_ConvertToDateValue( rDoc, nDay + nYearMonth );
+ }
+ break;
+ case CALC_ROUND:
+ {
+ GetToken();
+ SwSbxValue e = Prim();
- fVal *= fFac;
+ double fVal = 0;
+ double fFac = 1;
+ sal_Int32 nDec = (sal_Int32) floor( e.GetDouble() );
+ if( nDec < -20 || nDec > 20 )
+ {
+ eError = CALC_OVERFLOW;
+ left.Clear();
+ return left;
+ }
+ fVal = left.GetDouble();
+ sal_uInt16 i;
+ if( nDec >= 0)
+ {
+ for (i = 0; i < (sal_uInt16) nDec; ++i )
+ fFac *= 10.0;
+ }
+ else
+ {
+ for (i = 0; i < (sal_uInt16) -nDec; ++i )
+ fFac /= 10.0;
+ }
- sal_Bool bSign;
- if (fVal < 0.0)
- {
- fVal *= -1.0;
- bSign = sal_True;
- }
- else
- bSign = sal_False;
+ fVal *= fFac;
+ sal_Bool bSign;
+ if (fVal < 0.0)
+ {
+ fVal *= -1.0;
+ bSign = sal_True;
+ }
+ else
+ {
+ bSign = sal_False;
+ }
- // runden
- double fNum = fVal; // find the exponent
- int nExp = 0;
- if( fNum > 0 )
- {
- while( fNum < 1.0 ) fNum *= 10.0, --nExp;
- while( fNum >= 10.0 ) fNum /= 10.0, ++nExp;
- }
- nExp = 15 - nExp;
- if( nExp > 15 )
- nExp = 15;
- else if( nExp <= 1 )
- nExp = 0;
- fVal = floor( fVal+ 0.5 + nRoundVal[ nExp ] );
+ // rounding
+ double fNum = fVal; // find the exponent
+ int nExp = 0;
+ if( fNum > 0 )
+ {
+ while( fNum < 1.0 )
+ fNum *= 10.0, --nExp;
+ while( fNum >= 10.0 )
+ fNum /= 10.0, ++nExp;
+ }
+ nExp = 15 - nExp;
+ if( nExp > 15 )
+ nExp = 15;
+ else if( nExp <= 1 )
+ nExp = 0;
+ fVal = floor( fVal+ 0.5 + nRoundVal[ nExp ] );
- if (bSign)
- fVal *= -1.0;
+ if (bSign)
+ fVal *= -1.0;
- fVal /= fFac;
+ fVal /= fFac;
- left.PutDouble( fVal );
- }
- break;
+ left.PutDouble( fVal );
+ }
+ break;
//#77448# (=2*3^2 != 18)
- default: return left;
+ default:
+ return left;
}
if( USHRT_MAX != nSbxOper )
@@ -1260,7 +1241,9 @@ SwSbxValue SwCalc::Term()
GetToken();
if( SbxEQ <= eSbxOper && eSbxOper <= SbxGE )
+ {
left.PutBool( left.Compare( eSbxOper, Prim() ));
+ }
else
{
SwSbxValue aRight( Prim() );
@@ -1276,12 +1259,6 @@ SwSbxValue SwCalc::Term()
}
}
-/******************************************************************************
-|*
-|* SwSbxValue SwCalc::Prim()
-|*
-|******************************************************************************/
-
extern "C" typedef double (*pfCalc)( double );
SwSbxValue SwCalc::Prim()
@@ -1294,112 +1271,131 @@ SwSbxValue SwCalc::Prim()
switch( eCurrOper )
{
- case CALC_SIN: pFnc = &sin; break;
- case CALC_COS: pFnc = &cos; break;
- case CALC_TAN: pFnc = &tan; break;
- case CALC_ATAN: pFnc = &atan; break;
- case CALC_ASIN: pFnc = &asin; bChkTrig = sal_True; break;
- case CALC_ACOS: pFnc = &acos; bChkTrig = sal_True; break;
-
- case CALC_NOT: {
- GetToken();
- nErg = Prim();
- if( SbxSTRING == nErg.GetType() )
- nErg.PutBool( 0 == nErg.GetString().Len() );
- else if(SbxBOOL == nErg.GetType() )
- nErg.PutBool(!nErg.GetBool());
- // evaluate arguments manually so that the binary NOT below
- // does not get called.
- // We want a BOOLEAN NOT.
- else if (nErg.IsNumeric())
- nErg.PutLong( nErg.GetDouble() == 0.0 ? 1 : 0 );
- else
- {
- OSL_FAIL( "unexpected case. computing binary NOT" );
- //!! computes a binary NOT
- nErg.Compute( SbxNOT, nErg );
- }
- }
- break;
+ case CALC_SIN: pFnc = &sin; break;
+ case CALC_COS: pFnc = &cos; break;
+ case CALC_TAN: pFnc = &tan; break;
+ case CALC_ATAN: pFnc = &atan; break;
+ case CALC_ASIN: pFnc = &asin; bChkTrig = sal_True; break;
+ case CALC_ACOS: pFnc = &acos; bChkTrig = sal_True; break;
+
+ case CALC_NOT:
+ {
+ GetToken();
+ nErg = Prim();
+ if( SbxSTRING == nErg.GetType() )
+ {
+ nErg.PutBool( 0 == nErg.GetString().Len() );
+ }
+ else if(SbxBOOL == nErg.GetType() )
+ {
+ nErg.PutBool(!nErg.GetBool());
+ }
+ // Evaluate arguments manually so that the binary NOT below does not
+ // get called. We want a BOOLEAN NOT.
+ else if (nErg.IsNumeric())
+ {
+ nErg.PutLong( nErg.GetDouble() == 0.0 ? 1 : 0 );
+ }
+ else
+ {
+ OSL_FAIL( "unexpected case. computing binary NOT" );
+ //!! computes a binary NOT
+ nErg.Compute( SbxNOT, nErg );
+ }
+ }
+ break;
- case CALC_NUMBER: if( GetToken() == CALC_PHD )
- {
- double aTmp = nNumberValue.GetDouble();
- aTmp *= 0.01;
- nErg.PutDouble( aTmp );
- GetToken();
- }
- else if( eCurrOper == CALC_NAME )
- eError = CALC_SYNTAX;
- else
- {
- nErg = nNumberValue;
- bChkPow = sal_True;
- }
- break;
+ case CALC_NUMBER:
+ if( GetToken() == CALC_PHD )
+ {
+ double aTmp = nNumberValue.GetDouble();
+ aTmp *= 0.01;
+ nErg.PutDouble( aTmp );
+ GetToken();
+ }
+ else if( eCurrOper == CALC_NAME )
+ {
+ eError = CALC_SYNTAX;
+ }
+ else
+ {
+ nErg = nNumberValue;
+ bChkPow = sal_True;
+ }
+ break;
- case CALC_NAME: if( GetToken() == CALC_ASSIGN )
- {
- SwCalcExp* n = VarInsert( aVarName );
- GetToken();
- nErg = n->nValue = Expr();
- }
- else
- {
- nErg = VarLook( aVarName )->nValue;
- bChkPow = sal_True;
- }
- break;
+ case CALC_NAME:
+ if( GetToken() == CALC_ASSIGN )
+ {
+ SwCalcExp* n = VarInsert( aVarName );
+ GetToken();
+ nErg = n->nValue = Expr();
+ }
+ else
+ {
+ nErg = VarLook( aVarName )->nValue;
+ bChkPow = sal_True;
+ }
+ break;
- case CALC_MINUS: GetToken();
- nErg.PutDouble( -(Prim().GetDouble()) );
- break;
+ case CALC_MINUS:
+ GetToken();
+ nErg.PutDouble( -(Prim().GetDouble()) );
+ break;
- case CALC_LP: {
- GetToken();
- nErg = Expr();
- if( eCurrOper != CALC_RP )
- eError = CALC_BRACK;
- else
- {
- GetToken();
- bChkPow = sal_True; // in order for =(7)^2 to work
- }
- }
- break;
-
- case CALC_MEAN: {
- nListPor = 1;
- GetToken();
- nErg = Expr();
- double aTmp = nErg.GetDouble();
- aTmp /= nListPor;
- nErg.PutDouble( aTmp );
- }
- break;
+ case CALC_LP:
+ {
+ GetToken();
+ nErg = Expr();
+ if( eCurrOper != CALC_RP )
+ {
+ eError = CALC_BRACK;
+ }
+ else
+ {
+ GetToken();
+ bChkPow = sal_True; // in order for =(7)^2 to work
+ }
+ }
+ break;
- case CALC_SQRT: {
- GetToken();
- nErg = Prim();
- if( nErg.GetDouble() < 0 )
- eError = CALC_OVERFLOW;
- else
- nErg.PutDouble( sqrt( nErg.GetDouble() ));
- }
- break;
+ case CALC_MEAN:
+ {
+ nListPor = 1;
+ GetToken();
+ nErg = Expr();
+ double aTmp = nErg.GetDouble();
+ aTmp /= nListPor;
+ nErg.PutDouble( aTmp );
+ }
+ break;
+
+ case CALC_SQRT:
+ {
+ GetToken();
+ nErg = Prim();
+ if( nErg.GetDouble() < 0 )
+ eError = CALC_OVERFLOW;
+ else
+ nErg.PutDouble( sqrt( nErg.GetDouble() ));
+ }
+ break;
- case CALC_SUM:
- case CALC_DATE:
- case CALC_MIN:
- case CALC_MAX: GetToken();
- nErg = Expr();
- break;
+ case CALC_SUM:
+ case CALC_DATE:
+ case CALC_MIN:
+ case CALC_MAX:
+ GetToken();
+ nErg = Expr();
+ break;
- case CALC_ENDCALC: nErg.Clear();
- break;
+ case CALC_ENDCALC:
+ nErg.Clear();
+ break;
- default: eError = CALC_SYNTAX;
- break;
+ default:
+ eError = CALC_SYNTAX;
+ break;
}
if( pFnc )
@@ -1437,7 +1433,6 @@ SwSbxValue SwCalc::Prim()
else
{
nErg.PutDouble( dleft );
-// GetToken();
}
}
}
@@ -1445,42 +1440,35 @@ SwSbxValue SwCalc::Prim()
return nErg;
}
-/******************************************************************************
-|*
-|* SwSbxValue SwCalc::Expr()
-|*
-|******************************************************************************/
-
SwSbxValue SwCalc::Expr()
{
SwSbxValue left = Term(), right;
nLastLeft = left;
for(;;)
+ {
switch(eCurrOper)
{
- case CALC_PLUS: GetToken();
- // erzeuge zum addieren auf jedenfall einen
- // Double-Wert
- left.MakeDouble();
- ( right = Term() ).MakeDouble();
- left.Compute( SbxPLUS, right );
- nListPor++;
- break;
-
- case CALC_MINUS: GetToken();
- // erzeuge zum addieren auf jedenfall einen
- // Double-Wert
- left.MakeDouble();
- ( right = Term() ).MakeDouble();
- left.Compute( SbxMINUS, right );
- break;
-
- default: return left;
+ case CALC_PLUS:
+ GetToken();
+ left.MakeDouble();
+ ( right = Term() ).MakeDouble();
+ left.Compute( SbxPLUS, right );
+ nListPor++;
+ break;
+
+ case CALC_MINUS:
+ GetToken();
+ left.MakeDouble();
+ ( right = Term() ).MakeDouble();
+ left.Compute( SbxMINUS, right );
+ break;
+
+ default:
+ return left;
}
+ }
}
-//------------------------------------------------------------------------------
-
String SwCalc::GetColumnName(const String& rName)
{
xub_StrLen nPos = rName.Search(DB_DELIM);
@@ -1494,8 +1482,6 @@ String SwCalc::GetColumnName(const String& rName)
return rName;
}
-//------------------------------------------------------------------------------
-
String SwCalc::GetDBName(const String& rName)
{
xub_StrLen nPos = rName.Search(DB_DELIM);
@@ -1513,36 +1499,31 @@ String SwCalc::GetDBName(const String& rName)
return sRet;
}
-//------------------------------------------------------------------------------
-
namespace
{
-
-static bool
-lcl_Str2Double( const String& rCommand, xub_StrLen& rCommandPos, double& rVal,
- const LocaleDataWrapper* const pLclData )
-{
- OSL_ASSERT(pLclData);
- const xub_Unicode nCurrCmdPos = rCommandPos;
- rtl_math_ConversionStatus eStatus;
- const sal_Unicode* pEnd;
- rVal = rtl_math_uStringToDouble( rCommand.GetBuffer() + rCommandPos,
- rCommand.GetBuffer() + rCommand.Len(),
- pLclData->getNumDecimalSep()[0],
- pLclData->getNumThousandSep()[0],
- &eStatus, &pEnd );
- rCommandPos = static_cast<xub_StrLen>(pEnd - rCommand.GetBuffer());
-
- return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos;
-}
-
+ static bool lcl_Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
+ double& rVal,
+ const LocaleDataWrapper* const pLclData )
+ {
+ OSL_ASSERT(pLclData);
+ const xub_Unicode nCurrCmdPos = rCommandPos;
+ rtl_math_ConversionStatus eStatus;
+ const sal_Unicode* pEnd;
+ rVal = rtl_math_uStringToDouble( rCommand.GetBuffer() + rCommandPos,
+ rCommand.GetBuffer() + rCommand.Len(),
+ pLclData->getNumDecimalSep()[0],
+ pLclData->getNumThousandSep()[0],
+ &eStatus,
+ &pEnd );
+ rCommandPos = static_cast<xub_StrLen>(pEnd - rCommand.GetBuffer());
+
+ return rtl_math_ConversionStatus_Ok == eStatus &&
+ nCurrCmdPos != rCommandPos;
+ }
}
-/******************************************************************************
- * Methode : sal_Bool SwCalc::Str2Double( double& )
- ******************************************************************************/
bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
- double& rVal, const LocaleDataWrapper* const pLclData )
+ double& rVal, const LocaleDataWrapper* const pLclData )
{
const SvtSysLocale aSysLocale;
return lcl_Str2Double( rCommand, rCommandPos, rVal,
@@ -1550,7 +1531,7 @@ bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
}
bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
- double& rVal, SwDoc* const pDoc )
+ double& rVal, SwDoc* const pDoc )
{
const SvtSysLocale aSysLocale;
::std::auto_ptr<const LocaleDataWrapper> pLclD;
@@ -1572,10 +1553,7 @@ bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
return bRet;
}
-//------------------------------------------------------------------------------
-
-sal_Bool SwCalc::IsValidVarName( const String& rStr,
- String* pValidName )
+sal_Bool SwCalc::IsValidVarName( const String& rStr, String* pValidName )
{
sal_Bool bRet = sal_False;
using namespace ::com::sun::star::i18n;
@@ -1591,7 +1569,8 @@ sal_Bool SwCalc::IsValidVarName( const String& rStr,
if( pValidName )
{
xub_StrLen nRealStt = (xub_StrLen)aRes.LeadingWhiteSpace;
- *pValidName = rStr.Copy( nRealStt, static_cast<xub_StrLen>(aRes.EndPos) - nRealStt );
+ *pValidName = rStr.Copy( nRealStt,
+ static_cast<xub_StrLen>(aRes.EndPos) - nRealStt );
}
}
else if( pValidName )
@@ -1600,18 +1579,11 @@ sal_Bool SwCalc::IsValidVarName( const String& rStr,
return bRet;
}
-//------------------------------------------------------------------------------
-
-/******************************************************************************
-|*
-|* CTOR DTOR der SwHash classes
-|*
-******************************************************************************/
-
SwHash::SwHash( const String& rStr ) :
aStr( rStr ),
pNext( 0 )
-{}
+{
+}
SwHash::~SwHash()
{
@@ -1626,14 +1598,13 @@ void DeleteHashTable( SwHash **ppHashTable, sal_uInt16 nCount )
}
SwCalcExp::SwCalcExp( const String& rStr, const SwSbxValue& rVal,
- const SwFieldType* pType )
+ const SwFieldType* pType )
: SwHash( rStr ),
nValue( rVal ),
pFldType( pType )
{
}
-
SwSbxValue::~SwSbxValue()
{
}
@@ -1657,7 +1628,9 @@ double SwSbxValue::GetDouble() const
nRet = 0 != GetBool() ? 1.0 : 0.0;
}
else
+ {
nRet = SbxValue::GetDouble();
+ }
return nRet;
}
@@ -1670,35 +1643,34 @@ SwSbxValue& SwSbxValue::MakeDouble()
#ifdef STANDALONE_HASHCALC
-// dies ist der Beispielcode zu erzeugen der HashValues im CTOR:
+// this is example code how to create hash values in the CTOR:
#include <stdio.h>
-
void main()
{
-static sal_Char
- sNType0[] = "false", sNType1[] = "true", sNType2[] = "pi",
- sNType3[] = "e", sNType4[] = "tables", sNType5[] = "graf",
- sNType6[] = "ole", sNType7[] = "page", sNType8[] = "para",
- sNType9[] = "word", sNType10[]= "char",
- sNType11[] = "user_company" , sNType12[] = "user_firstname" ,
- sNType13[] = "user_lastname" , sNType14[] = "user_initials",
- sNType15[] = "user_street" , sNType16[] = "user_country" ,
- sNType17[] = "user_zipcode" , sNType18[] = "user_city" ,
- sNType19[] = "user_title" , sNType20[] = "user_position" ,
- sNType21[] = "user_tel_home", sNType22[] = "user_tel_work",
- sNType23[] = "user_fax" , sNType24[] = "user_email" ,
- sNType25[] = "user_state", sNType26[] = "graph"
- ;
-
-static const sal_Char* sNTypeTab[ 27 ] =
-{
- sNType0, sNType1, sNType2, sNType3, sNType4, sNType5,
- sNType6, sNType7, sNType8, sNType9, sNType10, sNType11,
- sNType12, sNType13, sNType14, sNType15, sNType16, sNType17,
- sNType18, sNType19, sNType20, sNType21, sNType22, sNType23,
- sNType24, sNType25, sNType26
-};
+ static sal_Char
+ sNType0[] = "false", sNType1[] = "true", sNType2[] = "pi",
+ sNType3[] = "e", sNType4[] = "tables", sNType5[] = "graf",
+ sNType6[] = "ole", sNType7[] = "page", sNType8[] = "para",
+ sNType9[] = "word", sNType10[]= "char",
+ sNType11[] = "user_company" , sNType12[] = "user_firstname" ,
+ sNType13[] = "user_lastname" , sNType14[] = "user_initials",
+ sNType15[] = "user_street" , sNType16[] = "user_country" ,
+ sNType17[] = "user_zipcode" , sNType18[] = "user_city" ,
+ sNType19[] = "user_title" , sNType20[] = "user_position" ,
+ sNType21[] = "user_tel_home", sNType22[] = "user_tel_work",
+ sNType23[] = "user_fax" , sNType24[] = "user_email" ,
+ sNType25[] = "user_state", sNType26[] = "graph"
+ ;
+
+ static const sal_Char* sNTypeTab[ 27 ] =
+ {
+ sNType0, sNType1, sNType2, sNType3, sNType4, sNType5,
+ sNType6, sNType7, sNType8, sNType9, sNType10, sNType11,
+ sNType12, sNType13, sNType14, sNType15, sNType16, sNType17,
+ sNType18, sNType19, sNType20, sNType21, sNType22, sNType23,
+ sNType24, sNType25, sNType26
+ };
const unsigned short nTblSize = 47;
int aArr[ nTblSize ] = { 0 };
@@ -1710,7 +1682,9 @@ static const sal_Char* sNTypeTab[ 27 ] =
const sal_Char* pp = sNTypeTab[ n ];
while( *pp )
+ {
ii = ii << 1 ^ *pp++;
+ }
ii %= nTblSize;
ch = aArr[ ii ] ? 'X' : ' ';
@@ -1721,6 +1695,4 @@ static const sal_Char* sNTypeTab[ 27 ] =
#endif
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx
index 37a6c608d17f..833cb162c9f9 100644
--- a/sw/source/core/bastyp/index.cxx
+++ b/sw/source/core/bastyp/index.cxx
@@ -26,17 +26,18 @@
*
************************************************************************/
-
#include <assert.h>
-#include <stdlib.h> // fuer qsort
+#include <stdlib.h>
#include <tools/solar.h>
#include <tools/string.hxx>
#include "index.hxx"
+TYPEINIT0(SwIndexReg);
-TYPEINIT0(SwIndexReg); // rtti
-
+// -------
+// SwIndex
+// -------
SwIndex::SwIndex(SwIndexReg *const pReg, xub_StrLen const nIdx)
: m_nIndex( nIdx )
@@ -187,9 +188,6 @@ void SwIndex::Remove()
}
}
-/*************************************************************************
-|* SwIndex & SwIndex::operator=( const SwIndex & aSwIndex )
-*************************************************************************/
SwIndex& SwIndex::operator=( const SwIndex& rIdx )
{
bool bEqual;
@@ -208,9 +206,6 @@ SwIndex& SwIndex::operator=( const SwIndex& rIdx )
return *this;
}
-/*************************************************************************
-|* SwIndex &SwIndex::Assign
-*************************************************************************/
SwIndex& SwIndex::Assign( SwIndexReg* pArr, xub_StrLen nIdx )
{
if (pArr != m_pIndexReg) // unregister!
@@ -221,11 +216,15 @@ SwIndex& SwIndex::Assign( SwIndexReg* pArr, xub_StrLen nIdx )
Init(nIdx);
}
else if (m_nIndex != nIdx)
+ {
ChgValue( *this, nIdx );
+ }
return *this;
}
-// SwIndexReg ///////////////////////////////////////////////////////
+// ----------
+// SwIndexReg
+// ----------
SwIndexReg::SwIndexReg()
: m_pFirst( 0 ), m_pLast( 0 )
@@ -281,9 +280,10 @@ void SwIndexReg::Update( SwIndex const & rIdx, const xub_StrLen nDiff,
#ifdef DBG_UTIL
-/*************************************************************************
-|* SwIndex::operator++()
-*************************************************************************/
+// -------
+// SwIndex
+// -------
+
xub_StrLen SwIndex::operator++(int)
{
OSL_ASSERT( m_nIndex < INVALID_INDEX );
@@ -301,9 +301,6 @@ xub_StrLen SwIndex::operator++()
return m_nIndex;
}
-/*************************************************************************
-|* SwIndex::operator--()
-*************************************************************************/
xub_StrLen SwIndex::operator--(int)
{
OSL_ASSERT( m_nIndex );
@@ -319,45 +316,30 @@ xub_StrLen SwIndex::operator--()
return ChgValue( *this, m_nIndex-1 ).m_nIndex;
}
-/*************************************************************************
-|* SwIndex::operator+=( xub_StrLen )
-*************************************************************************/
xub_StrLen SwIndex::operator+=( xub_StrLen const nVal )
{
OSL_ASSERT( m_nIndex < INVALID_INDEX - nVal );
return ChgValue( *this, m_nIndex + nVal ).m_nIndex;
}
-/*************************************************************************
-|* SwIndex::operator-=( xub_StrLen )
-*************************************************************************/
xub_StrLen SwIndex::operator-=( xub_StrLen const nVal )
{
OSL_ASSERT( m_nIndex >= nVal );
return ChgValue( *this, m_nIndex - nVal ).m_nIndex;
}
-/*************************************************************************
-|* SwIndex::operator+=( const SwIndex & )
-*************************************************************************/
xub_StrLen SwIndex::operator+=( const SwIndex & rIndex )
{
OSL_ASSERT( m_nIndex < INVALID_INDEX - rIndex.m_nIndex );
return ChgValue( *this, m_nIndex + rIndex.m_nIndex ).m_nIndex;
}
-/*************************************************************************
-|* SwIndex::operator-=( const SwIndex & )
-*************************************************************************/
xub_StrLen SwIndex::operator-=( const SwIndex & rIndex )
{
OSL_ASSERT( m_nIndex >= rIndex.m_nIndex );
return ChgValue( *this, m_nIndex - rIndex.m_nIndex ).m_nIndex;
}
-/*************************************************************************
-|* SwIndex::operator<( const SwIndex & )
-*************************************************************************/
bool SwIndex::operator< ( const SwIndex & rIndex ) const
{
// Attempt to compare indices into different arrays
@@ -365,9 +347,6 @@ bool SwIndex::operator< ( const SwIndex & rIndex ) const
return m_nIndex < rIndex.m_nIndex;
}
-/*************************************************************************
-|* SwIndex::operator<=( const SwIndex & )
-*************************************************************************/
bool SwIndex::operator<=( const SwIndex & rIndex ) const
{
// Attempt to compare indices into different arrays
@@ -375,9 +354,6 @@ bool SwIndex::operator<=( const SwIndex & rIndex ) const
return m_nIndex <= rIndex.m_nIndex;
}
-/*************************************************************************
-|* SwIndex::operator>( const SwIndex & )
-*************************************************************************/
bool SwIndex::operator> ( const SwIndex & rIndex ) const
{
// Attempt to compare indices into different arrays
@@ -385,9 +361,6 @@ bool SwIndex::operator> ( const SwIndex & rIndex ) const
return m_nIndex > rIndex.m_nIndex;
}
-/*************************************************************************
-|* SwIndex::operator>=( const SwIndex & )
-*************************************************************************/
bool SwIndex::operator>=( const SwIndex & rIndex ) const
{
// Attempt to compare indices into different arrays
@@ -395,9 +368,6 @@ bool SwIndex::operator>=( const SwIndex & rIndex ) const
return m_nIndex >= rIndex.m_nIndex;
}
-/*************************************************************************
-|* SwIndex & SwIndex::operator=( xub_StrLen )
-*************************************************************************/
SwIndex& SwIndex::operator= ( xub_StrLen const nVal )
{
if (m_nIndex != nVal)
@@ -406,7 +376,7 @@ SwIndex& SwIndex::operator= ( xub_StrLen const nVal )
return *this;
}
-#endif // ifdef DBG_UTIL
+#endif
void SwIndexReg::MoveTo( SwIndexReg& rArr )
{
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index e24a7f402f69..4213cbfe1320 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -141,17 +141,17 @@ using namespace ::com::sun::star;
extern void _FrmFinit();
extern void ClearFEShellTabCols();
-/*************************************************************************
-|* einige Bereiche fuer die Set in Collections / Nodes
-|*************************************************************************/
- // AttrSet-Range fuer die 2 Break-Attribute
+// some ranges for sets in collections/ nodes
+
+// AttrSet range for the 2 break attributes
sal_uInt16 aBreakSetRange[] = {
RES_PAGEDESC, RES_BREAK,
- 0 };
+ 0
+};
- // AttrSet-Range fuer die TxtFmtColl
- // list attributes ( RES_PARATR_LIST_BEGIN - RES_PARATR_LIST_END ) are not
- // included in the paragraph style's itemset.
+// AttrSet range for TxtFmtColl
+// list attributes ( RES_PARATR_LIST_BEGIN - RES_PARATR_LIST_END ) are not
+// included in the paragraph style's itemset.
sal_uInt16 aTxtFmtCollSetRange[] = {
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
@@ -160,7 +160,7 @@ sal_uInt16 aTxtFmtCollSetRange[] = {
0
};
- // AttrSet-Range fuer die GrfFmtColl
+// AttrSet range for GrfFmtColl
sal_uInt16 aGrfFmtCollSetRange[] = {
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_GRFATR_BEGIN, RES_GRFATR_END-1,
@@ -168,7 +168,7 @@ sal_uInt16 aGrfFmtCollSetRange[] = {
0
};
- // AttrSet-Range fuer die TextNode
+// AttrSet range for TextNode
sal_uInt16 aTxtNodeSetRange[] = {
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
@@ -178,7 +178,7 @@ sal_uInt16 aTxtNodeSetRange[] = {
0
};
- // AttrSet-Range fuer die NoTxtNode
+// AttrSet range for NoTxtNode
sal_uInt16 aNoTxtNodeSetRange[] = {
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_GRFATR_BEGIN, RES_GRFATR_END-1,
@@ -224,21 +224,21 @@ sal_uInt16 aTableBoxSetRange[] = {
0
};
-// AttrSet-Range fuer die SwFrmFmt
+// AttrSet range for SwFrmFmt
sal_uInt16 aFrmFmtSetRange[] = {
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
0
};
-// AttrSet-Range fuer die SwCharFmt
+// AttrSet range for SwCharFmt
sal_uInt16 aCharFmtSetRange[] = {
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
0
};
-// AttrSet-Range fuer die character autostyles
+// AttrSet range for character autostyles
sal_uInt16 aCharAutoFmtSetRange[] = {
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
@@ -246,17 +246,14 @@ sal_uInt16 aCharAutoFmtSetRange[] = {
0
};
-// AttrSet-Range fuer die SwPageDescFmt
+// AttrSet range for SwPageDescFmt
sal_uInt16 aPgFrmFmtSetRange[] = {
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
0
};
-/******************************************************************************
- * lege eine Tabelle fuer einen Zugriff auf die
- * Default-Format-Attribute an
- ******************************************************************************/
+// create table for accessing default format attributes
SwDfltAttrTab aAttrTab;
SfxItemInfo aSlotTab[] =
@@ -299,7 +296,7 @@ SfxItemInfo aSlotTab[] =
{ SID_ATTR_CHAR_RELIEF, SFX_ITEM_POOLABLE }, // RES_CHRATR_RELIEF
{ SID_ATTR_CHAR_HIDDEN, SFX_ITEM_POOLABLE }, // RES_CHRATR_HIDDEN
{ SID_ATTR_CHAR_OVERLINE, SFX_ITEM_POOLABLE }, // RES_CHRATR_OVERLINE
- { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_RSID
+ { 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_RSID
{ 0, SFX_ITEM_POOLABLE }, // RES_CHRATR_DUMMY1
{ 0, 0 }, // RES_TXTATR_REFMARK
@@ -330,7 +327,6 @@ SfxItemInfo aSlotTab[] =
{ SID_ATTR_PARA_HYPHENZONE, SFX_ITEM_POOLABLE }, // RES_PARATR_HYPHENZONE
{ FN_FORMAT_DROPCAPS, 0 }, // RES_PARATR_DROP
{ SID_ATTR_PARA_REGISTER, SFX_ITEM_POOLABLE }, // RES_PARATR_REGISTER
- // RES_PARATR_NUMRULE is now poolable
{ SID_ATTR_PARA_NUMRULE, SFX_ITEM_POOLABLE }, // RES_PARATR_NUMRULE
{ SID_ATTR_PARA_SCRIPTSPACE, SFX_ITEM_POOLABLE }, // RES_PARATR_SCRIPTSPACE
{ SID_ATTR_PARA_HANGPUNCTUATION, SFX_ITEM_POOLABLE },// RES_PARATR_HANGINGPUNCTUATION
@@ -340,8 +336,8 @@ SfxItemInfo aSlotTab[] =
{ SID_ATTR_PARA_SNAPTOGRID, SFX_ITEM_POOLABLE }, // RES_PARATR_SNAPTOGRID
{ SID_ATTR_BORDER_CONNECT, SFX_ITEM_POOLABLE }, // RES_PARATR_CONNECT_BORDER
- { SID_ATTR_PARA_OUTLINE_LEVEL, SFX_ITEM_POOLABLE }, // RES_PARATR_OUTLINELEVEL //#outline level,zhaojianwei
- { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_RSID
+ { SID_ATTR_PARA_OUTLINE_LEVEL, SFX_ITEM_POOLABLE }, // RES_PARATR_OUTLINELEVEL //#outline level
+ { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_RSID
{ 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_ID
{ 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_LEVEL
{ 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_ISRESTART
@@ -384,14 +380,14 @@ SfxItemInfo aSlotTab[] =
{ SID_ATTR_FRAMEDIRECTION, SFX_ITEM_POOLABLE }, // RES_FRAMEDIR
- { SID_ATTR_HDFT_DYNAMIC_SPACING, SFX_ITEM_POOLABLE }, // RES_HEADER_FOOTER_EAT_SPACING
- { FN_TABLE_ROW_SPLIT, SFX_ITEM_POOLABLE }, // RES_ROW_SPLIT
+ { SID_ATTR_HDFT_DYNAMIC_SPACING, SFX_ITEM_POOLABLE },// RES_HEADER_FOOTER_EAT_SPACING
+ { FN_TABLE_ROW_SPLIT, SFX_ITEM_POOLABLE }, // RES_ROW_SPLIT
// #i18732# - use slot-id define in svx
- { SID_SW_FOLLOW_TEXT_FLOW, SFX_ITEM_POOLABLE }, // RES_FOLLOW_TEXT_FLOW
- // collapsing borders #i29550#
- { SID_SW_COLLAPSING_BORDERS, SFX_ITEM_POOLABLE }, // RES_COLLAPSING_BORDERS
+ { SID_SW_FOLLOW_TEXT_FLOW, SFX_ITEM_POOLABLE }, // RES_FOLLOW_TEXT_FLOW
+ // #i29550#
+ { SID_SW_COLLAPSING_BORDERS, SFX_ITEM_POOLABLE }, // RES_COLLAPSING_BORDERS
// #i28701#
- { SID_SW_WRAP_INFLUENCE_ON_OBJPOS, SFX_ITEM_POOLABLE }, // RES_WRAP_INFLUENCE_ON_OBJPOS
+ { SID_SW_WRAP_INFLUENCE_ON_OBJPOS, SFX_ITEM_POOLABLE },// RES_WRAP_INFLUENCE_ON_OBJPOS
{ 0, 0 }, // RES_AUTO_STYLE
{ 0, SFX_ITEM_POOLABLE }, // RES_FRMATR_STYLE_NAME
{ 0, SFX_ITEM_POOLABLE }, // RES_FRMATR_CONDITIONAL_STYLE_NAME
@@ -430,8 +426,8 @@ sal_uInt16* SwAttrPool::pVersionMap4 = 0;
sal_uInt16* SwAttrPool::pVersionMap5 = 0;
sal_uInt16* SwAttrPool::pVersionMap6 = 0;
-const sal_Char* pMarkToTable = "table";
-const sal_Char* pMarkToFrame = "frame";
+const sal_Char* pMarkToTable = "table";
+const sal_Char* pMarkToFrame = "frame";
const sal_Char* pMarkToRegion = "region";
const sal_Char* pMarkToText = "text";
const sal_Char* pMarkToOutline = "outline";
@@ -445,23 +441,21 @@ SwAutoCompleteWord* SwDoc::pACmpltWords = 0;
SwCheckIt* pCheckIt = 0;
CharClass* pAppCharClass = 0;
-CollatorWrapper* pCollator = 0, *pCaseCollator = 0;
+CollatorWrapper* pCollator = 0,
+ *pCaseCollator = 0;
-/******************************************************************************
- * void _InitCore()
- ******************************************************************************/
salhelper::SingletonRef<SwCalendarWrapper>* s_getCalendarWrapper()
{
static salhelper::SingletonRef<SwCalendarWrapper> aCalendarWrapper;
return &aCalendarWrapper;
}
+
void _InitCore()
{
SfxPoolItem* pItem;
- // erstmal alle Attribut-Pointer auf 0 setzen
- memset( aAttrTab, 0, (POOLATTR_END - POOLATTR_BEGIN) *
- sizeof( SfxPoolItem* ) );
+ // first initialize all attribute pointers with 0
+ memset( aAttrTab, 0, (POOLATTR_END - POOLATTR_BEGIN) * sizeof( SfxPoolItem* ) );
aAttrTab[ RES_CHRATR_CASEMAP- POOLATTR_BEGIN ] = new SvxCaseMapItem( SVX_CASEMAP_NOT_MAPPED, RES_CHRATR_CASEMAP);
aAttrTab[ RES_CHRATR_CHARSETCOLOR- POOLATTR_BEGIN ] = new SvxCharSetColorItem(RES_CHRATR_CHARSETCOLOR);
@@ -503,144 +497,139 @@ void _InitCore()
aAttrTab[ RES_CHRATR_ROTATE - POOLATTR_BEGIN ] = new SvxCharRotateItem( 0, sal_False, RES_CHRATR_ROTATE );
aAttrTab[ RES_CHRATR_EMPHASIS_MARK - POOLATTR_BEGIN ] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, RES_CHRATR_EMPHASIS_MARK );
- aAttrTab[ RES_CHRATR_TWO_LINES - POOLATTR_BEGIN ] = new SvxTwoLinesItem( sal_False, 0, 0, RES_CHRATR_TWO_LINES );
- aAttrTab[ RES_CHRATR_SCALEW - POOLATTR_BEGIN ] = new SvxCharScaleWidthItem( 100, RES_CHRATR_SCALEW );
- aAttrTab[ RES_CHRATR_RELIEF - POOLATTR_BEGIN ] = new SvxCharReliefItem( RELIEF_NONE, RES_CHRATR_RELIEF );
- aAttrTab[ RES_CHRATR_HIDDEN - POOLATTR_BEGIN ] = new SvxCharHiddenItem( sal_False, RES_CHRATR_HIDDEN );
- aAttrTab[ RES_CHRATR_OVERLINE- POOLATTR_BEGIN ] = new SvxOverlineItem( UNDERLINE_NONE, RES_CHRATR_OVERLINE );
+ aAttrTab[ RES_CHRATR_TWO_LINES - POOLATTR_BEGIN ] = new SvxTwoLinesItem( sal_False, 0, 0, RES_CHRATR_TWO_LINES );
+ aAttrTab[ RES_CHRATR_SCALEW - POOLATTR_BEGIN ] = new SvxCharScaleWidthItem( 100, RES_CHRATR_SCALEW );
+ aAttrTab[ RES_CHRATR_RELIEF - POOLATTR_BEGIN ] = new SvxCharReliefItem( RELIEF_NONE, RES_CHRATR_RELIEF );
+ aAttrTab[ RES_CHRATR_HIDDEN - POOLATTR_BEGIN ] = new SvxCharHiddenItem( sal_False, RES_CHRATR_HIDDEN );
+ aAttrTab[ RES_CHRATR_OVERLINE- POOLATTR_BEGIN ] = new SvxOverlineItem( UNDERLINE_NONE, RES_CHRATR_OVERLINE );
// CharakterAttr - Dummies
- aAttrTab[ RES_CHRATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_CHRATR_DUMMY1 );
-
-// CharakterAttr - Dummies
-
- aAttrTab[ RES_TXTATR_AUTOFMT- POOLATTR_BEGIN ] = new SwFmtAutoFmt;
- aAttrTab[ RES_TXTATR_INETFMT - POOLATTR_BEGIN ] = new SwFmtINetFmt( aEmptyStr, aEmptyStr );
- aAttrTab[ RES_TXTATR_REFMARK - POOLATTR_BEGIN ] = new SwFmtRefMark( aEmptyStr );
- aAttrTab[ RES_TXTATR_TOXMARK - POOLATTR_BEGIN ] = new SwTOXMark;
- aAttrTab[ RES_TXTATR_CHARFMT- POOLATTR_BEGIN ] = new SwFmtCharFmt( 0 );
- aAttrTab[ RES_TXTATR_CJK_RUBY - POOLATTR_BEGIN ] = new SwFmtRuby( aEmptyStr );
+ aAttrTab[ RES_CHRATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_CHRATR_DUMMY1 );
+
+ aAttrTab[ RES_TXTATR_AUTOFMT- POOLATTR_BEGIN ] = new SwFmtAutoFmt;
+ aAttrTab[ RES_TXTATR_INETFMT - POOLATTR_BEGIN ] = new SwFmtINetFmt( aEmptyStr, aEmptyStr );
+ aAttrTab[ RES_TXTATR_REFMARK - POOLATTR_BEGIN ] = new SwFmtRefMark( aEmptyStr );
+ aAttrTab[ RES_TXTATR_TOXMARK - POOLATTR_BEGIN ] = new SwTOXMark;
+ aAttrTab[ RES_TXTATR_CHARFMT- POOLATTR_BEGIN ] = new SwFmtCharFmt( 0 );
+ aAttrTab[ RES_TXTATR_CJK_RUBY - POOLATTR_BEGIN ] = new SwFmtRuby( aEmptyStr );
aAttrTab[ RES_TXTATR_UNKNOWN_CONTAINER - POOLATTR_BEGIN ] = new SvXMLAttrContainerItem( RES_TXTATR_UNKNOWN_CONTAINER );
- aAttrTab[ RES_TXTATR_META - POOLATTR_BEGIN ] = SwFmtMeta::CreatePoolDefault(RES_TXTATR_META);
+ aAttrTab[ RES_TXTATR_META - POOLATTR_BEGIN ] = SwFmtMeta::CreatePoolDefault(RES_TXTATR_META);
aAttrTab[ RES_TXTATR_METAFIELD - POOLATTR_BEGIN ] = SwFmtMeta::CreatePoolDefault(RES_TXTATR_METAFIELD);
- aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFmtFld;
- aAttrTab[ RES_TXTATR_FLYCNT - POOLATTR_BEGIN ] = new SwFmtFlyCnt( 0 );
- aAttrTab[ RES_TXTATR_FTN - POOLATTR_BEGIN ] = new SwFmtFtn;
+ aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFmtFld;
+ aAttrTab[ RES_TXTATR_FLYCNT - POOLATTR_BEGIN ] = new SwFmtFlyCnt( 0 );
+ aAttrTab[ RES_TXTATR_FTN - POOLATTR_BEGIN ] = new SwFmtFtn;
// TextAttr - Dummies
- aAttrTab[ RES_TXTATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY4 );
- aAttrTab[ RES_TXTATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY3 );
- aAttrTab[ RES_TXTATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY1 );
- aAttrTab[ RES_TXTATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY2 );
- aAttrTab[ RES_TXTATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY5 );
-// TextAttr - Dummies
-
- aAttrTab[ RES_PARATR_LINESPACING- POOLATTR_BEGIN ] = new SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING );
- aAttrTab[ RES_PARATR_ADJUST- POOLATTR_BEGIN ] = new SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST );
- aAttrTab[ RES_PARATR_SPLIT- POOLATTR_BEGIN ] = new SvxFmtSplitItem( sal_True, RES_PARATR_SPLIT );
- aAttrTab[ RES_PARATR_WIDOWS- POOLATTR_BEGIN ] = new SvxWidowsItem( 0, RES_PARATR_WIDOWS );
- aAttrTab[ RES_PARATR_ORPHANS- POOLATTR_BEGIN ] = new SvxOrphansItem( 0, RES_PARATR_ORPHANS );
- aAttrTab[ RES_PARATR_TABSTOP- POOLATTR_BEGIN ] = new SvxTabStopItem( 1, SVX_TAB_DEFDIST, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
+ aAttrTab[ RES_TXTATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY1 );
+ aAttrTab[ RES_TXTATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY2 );
+ aAttrTab[ RES_TXTATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY3 );
+ aAttrTab[ RES_TXTATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY4 );
+ aAttrTab[ RES_TXTATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY5 );
+
+ aAttrTab[ RES_PARATR_LINESPACING- POOLATTR_BEGIN ] = new SvxLineSpacingItem( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING );
+ aAttrTab[ RES_PARATR_ADJUST- POOLATTR_BEGIN ] = new SvxAdjustItem( SVX_ADJUST_LEFT, RES_PARATR_ADJUST );
+ aAttrTab[ RES_PARATR_SPLIT- POOLATTR_BEGIN ] = new SvxFmtSplitItem( sal_True, RES_PARATR_SPLIT );
+ aAttrTab[ RES_PARATR_WIDOWS- POOLATTR_BEGIN ] = new SvxWidowsItem( 0, RES_PARATR_WIDOWS );
+ aAttrTab[ RES_PARATR_ORPHANS- POOLATTR_BEGIN ] = new SvxOrphansItem( 0, RES_PARATR_ORPHANS );
+ aAttrTab[ RES_PARATR_TABSTOP- POOLATTR_BEGIN ] = new SvxTabStopItem( 1, SVX_TAB_DEFDIST, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
pItem = new SvxHyphenZoneItem( sal_False, RES_PARATR_HYPHENZONE );
- ((SvxHyphenZoneItem*)pItem)->GetMaxHyphens() = 0; // Default z.Z. auf 0
- aAttrTab[ RES_PARATR_HYPHENZONE- POOLATTR_BEGIN ] = pItem;
-
- aAttrTab[ RES_PARATR_DROP- POOLATTR_BEGIN ] = new SwFmtDrop;
- aAttrTab[ RES_PARATR_REGISTER - POOLATTR_BEGIN ] = new SwRegisterItem( sal_False );
- aAttrTab[ RES_PARATR_NUMRULE - POOLATTR_BEGIN ] = new SwNumRuleItem( aEmptyStr );
-
- aAttrTab[ RES_PARATR_SCRIPTSPACE - POOLATTR_BEGIN ] = new SvxScriptSpaceItem( sal_True, RES_PARATR_SCRIPTSPACE );
- aAttrTab[ RES_PARATR_HANGINGPUNCTUATION - POOLATTR_BEGIN ] = new SvxHangingPunctuationItem( sal_True, RES_PARATR_HANGINGPUNCTUATION );
- aAttrTab[ RES_PARATR_FORBIDDEN_RULES - POOLATTR_BEGIN ] = new SvxForbiddenRuleItem( sal_True, RES_PARATR_FORBIDDEN_RULES );
- aAttrTab[ RES_PARATR_VERTALIGN - POOLATTR_BEGIN ] = new SvxParaVertAlignItem( 0, RES_PARATR_VERTALIGN );
- aAttrTab[ RES_PARATR_SNAPTOGRID - POOLATTR_BEGIN ] = new SvxParaGridItem( sal_True, RES_PARATR_SNAPTOGRID );
+ ((SvxHyphenZoneItem*)pItem)->GetMaxHyphens() = 0; // Default: 0
+ aAttrTab[ RES_PARATR_HYPHENZONE- POOLATTR_BEGIN ] = pItem;
+
+ aAttrTab[ RES_PARATR_DROP- POOLATTR_BEGIN ] = new SwFmtDrop;
+ aAttrTab[ RES_PARATR_REGISTER - POOLATTR_BEGIN ] = new SwRegisterItem( sal_False );
+ aAttrTab[ RES_PARATR_NUMRULE - POOLATTR_BEGIN ] = new SwNumRuleItem( aEmptyStr );
+
+ aAttrTab[ RES_PARATR_SCRIPTSPACE - POOLATTR_BEGIN ] = new SvxScriptSpaceItem( sal_True, RES_PARATR_SCRIPTSPACE );
+ aAttrTab[ RES_PARATR_HANGINGPUNCTUATION - POOLATTR_BEGIN ] = new SvxHangingPunctuationItem( sal_True, RES_PARATR_HANGINGPUNCTUATION );
+ aAttrTab[ RES_PARATR_FORBIDDEN_RULES - POOLATTR_BEGIN ] = new SvxForbiddenRuleItem( sal_True, RES_PARATR_FORBIDDEN_RULES );
+ aAttrTab[ RES_PARATR_VERTALIGN - POOLATTR_BEGIN ] = new SvxParaVertAlignItem( 0, RES_PARATR_VERTALIGN );
+ aAttrTab[ RES_PARATR_SNAPTOGRID - POOLATTR_BEGIN ] = new SvxParaGridItem( sal_True, RES_PARATR_SNAPTOGRID );
aAttrTab[ RES_PARATR_CONNECT_BORDER - POOLATTR_BEGIN ] = new SwParaConnectBorderItem;
- aAttrTab[ RES_PARATR_OUTLINELEVEL - POOLATTR_BEGIN ] = new SfxUInt16Item( RES_PARATR_OUTLINELEVEL, 0 );//#outline level,zhaojianwei
- aAttrTab[ RES_PARATR_RSID - POOLATTR_BEGIN ] = new SvxRsidItem( 0, RES_PARATR_RSID );
+ aAttrTab[ RES_PARATR_OUTLINELEVEL - POOLATTR_BEGIN ] = new SfxUInt16Item( RES_PARATR_OUTLINELEVEL, 0 );
+ aAttrTab[ RES_PARATR_RSID - POOLATTR_BEGIN ] = new SvxRsidItem( 0, RES_PARATR_RSID );
- aAttrTab[ RES_PARATR_LIST_ID - POOLATTR_BEGIN ] = new SfxStringItem( RES_PARATR_LIST_ID, aEmptyStr );
- aAttrTab[ RES_PARATR_LIST_LEVEL - POOLATTR_BEGIN ] = new SfxInt16Item( RES_PARATR_LIST_LEVEL, 0 );
+ aAttrTab[ RES_PARATR_LIST_ID - POOLATTR_BEGIN ] = new SfxStringItem( RES_PARATR_LIST_ID, aEmptyStr );
+ aAttrTab[ RES_PARATR_LIST_LEVEL - POOLATTR_BEGIN ] = new SfxInt16Item( RES_PARATR_LIST_LEVEL, 0 );
aAttrTab[ RES_PARATR_LIST_ISRESTART - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_LIST_ISRESTART, sal_False );
aAttrTab[ RES_PARATR_LIST_RESTARTVALUE - POOLATTR_BEGIN ] = new SfxInt16Item( RES_PARATR_LIST_RESTARTVALUE, 1 );
aAttrTab[ RES_PARATR_LIST_ISCOUNTED - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_LIST_ISCOUNTED, sal_True );
- aAttrTab[ RES_FILL_ORDER- POOLATTR_BEGIN ] = new SwFmtFillOrder;
- aAttrTab[ RES_FRM_SIZE- POOLATTR_BEGIN ] = new SwFmtFrmSize;
- aAttrTab[ RES_PAPER_BIN- POOLATTR_BEGIN ] = new SvxPaperBinItem( RES_PAPER_BIN );
- aAttrTab[ RES_LR_SPACE- POOLATTR_BEGIN ] = new SvxLRSpaceItem( RES_LR_SPACE );
- aAttrTab[ RES_UL_SPACE- POOLATTR_BEGIN ] = new SvxULSpaceItem( RES_UL_SPACE );
- aAttrTab[ RES_PAGEDESC- POOLATTR_BEGIN ] = new SwFmtPageDesc;
- aAttrTab[ RES_BREAK- POOLATTR_BEGIN ] = new SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK);
- aAttrTab[ RES_CNTNT- POOLATTR_BEGIN ] = new SwFmtCntnt;
- aAttrTab[ RES_HEADER- POOLATTR_BEGIN ] = new SwFmtHeader;
- aAttrTab[ RES_FOOTER- POOLATTR_BEGIN ] = new SwFmtFooter;
- aAttrTab[ RES_PRINT- POOLATTR_BEGIN ] = new SvxPrintItem( RES_PRINT );
- aAttrTab[ RES_OPAQUE- POOLATTR_BEGIN ] = new SvxOpaqueItem( RES_OPAQUE );
- aAttrTab[ RES_PROTECT- POOLATTR_BEGIN ] = new SvxProtectItem( RES_PROTECT );
- aAttrTab[ RES_SURROUND- POOLATTR_BEGIN ] = new SwFmtSurround;
- aAttrTab[ RES_VERT_ORIENT- POOLATTR_BEGIN ] = new SwFmtVertOrient;
- aAttrTab[ RES_HORI_ORIENT- POOLATTR_BEGIN ] = new SwFmtHoriOrient;
- aAttrTab[ RES_ANCHOR- POOLATTR_BEGIN ] = new SwFmtAnchor;
- aAttrTab[ RES_BACKGROUND- POOLATTR_BEGIN ] = new SvxBrushItem( RES_BACKGROUND );
- aAttrTab[ RES_BOX- POOLATTR_BEGIN ] = new SvxBoxItem( RES_BOX );
- aAttrTab[ RES_SHADOW- POOLATTR_BEGIN ] = new SvxShadowItem( RES_SHADOW );
- aAttrTab[ RES_FRMMACRO- POOLATTR_BEGIN ] = new SvxMacroItem( RES_FRMMACRO );
- aAttrTab[ RES_COL- POOLATTR_BEGIN ] = new SwFmtCol;
- aAttrTab[ RES_KEEP - POOLATTR_BEGIN ] = new SvxFmtKeepItem( sal_False, RES_KEEP );
- aAttrTab[ RES_URL - POOLATTR_BEGIN ] = new SwFmtURL();
- aAttrTab[ RES_EDIT_IN_READONLY - POOLATTR_BEGIN ] = new SwFmtEditInReadonly;
- aAttrTab[ RES_LAYOUT_SPLIT - POOLATTR_BEGIN ] = new SwFmtLayoutSplit;
- aAttrTab[ RES_CHAIN - POOLATTR_BEGIN ] = new SwFmtChain;
- aAttrTab[ RES_TEXTGRID - POOLATTR_BEGIN ] = new SwTextGridItem;
+ aAttrTab[ RES_FILL_ORDER- POOLATTR_BEGIN ] = new SwFmtFillOrder;
+ aAttrTab[ RES_FRM_SIZE- POOLATTR_BEGIN ] = new SwFmtFrmSize;
+ aAttrTab[ RES_PAPER_BIN- POOLATTR_BEGIN ] = new SvxPaperBinItem( RES_PAPER_BIN );
+ aAttrTab[ RES_LR_SPACE- POOLATTR_BEGIN ] = new SvxLRSpaceItem( RES_LR_SPACE );
+ aAttrTab[ RES_UL_SPACE- POOLATTR_BEGIN ] = new SvxULSpaceItem( RES_UL_SPACE );
+ aAttrTab[ RES_PAGEDESC- POOLATTR_BEGIN ] = new SwFmtPageDesc;
+ aAttrTab[ RES_BREAK- POOLATTR_BEGIN ] = new SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK);
+ aAttrTab[ RES_CNTNT- POOLATTR_BEGIN ] = new SwFmtCntnt;
+ aAttrTab[ RES_HEADER- POOLATTR_BEGIN ] = new SwFmtHeader;
+ aAttrTab[ RES_FOOTER- POOLATTR_BEGIN ] = new SwFmtFooter;
+ aAttrTab[ RES_PRINT- POOLATTR_BEGIN ] = new SvxPrintItem( RES_PRINT );
+ aAttrTab[ RES_OPAQUE- POOLATTR_BEGIN ] = new SvxOpaqueItem( RES_OPAQUE );
+ aAttrTab[ RES_PROTECT- POOLATTR_BEGIN ] = new SvxProtectItem( RES_PROTECT );
+ aAttrTab[ RES_SURROUND- POOLATTR_BEGIN ] = new SwFmtSurround;
+ aAttrTab[ RES_VERT_ORIENT- POOLATTR_BEGIN ] = new SwFmtVertOrient;
+ aAttrTab[ RES_HORI_ORIENT- POOLATTR_BEGIN ] = new SwFmtHoriOrient;
+ aAttrTab[ RES_ANCHOR- POOLATTR_BEGIN ] = new SwFmtAnchor;
+ aAttrTab[ RES_BACKGROUND- POOLATTR_BEGIN ] = new SvxBrushItem( RES_BACKGROUND );
+ aAttrTab[ RES_BOX- POOLATTR_BEGIN ] = new SvxBoxItem( RES_BOX );
+ aAttrTab[ RES_SHADOW- POOLATTR_BEGIN ] = new SvxShadowItem( RES_SHADOW );
+ aAttrTab[ RES_FRMMACRO- POOLATTR_BEGIN ] = new SvxMacroItem( RES_FRMMACRO );
+ aAttrTab[ RES_COL- POOLATTR_BEGIN ] = new SwFmtCol;
+ aAttrTab[ RES_KEEP - POOLATTR_BEGIN ] = new SvxFmtKeepItem( sal_False, RES_KEEP );
+ aAttrTab[ RES_URL - POOLATTR_BEGIN ] = new SwFmtURL();
+ aAttrTab[ RES_EDIT_IN_READONLY - POOLATTR_BEGIN ] = new SwFmtEditInReadonly;
+ aAttrTab[ RES_LAYOUT_SPLIT - POOLATTR_BEGIN ] = new SwFmtLayoutSplit;
+ aAttrTab[ RES_CHAIN - POOLATTR_BEGIN ] = new SwFmtChain;
+ aAttrTab[ RES_TEXTGRID - POOLATTR_BEGIN ] = new SwTextGridItem;
aAttrTab[ RES_HEADER_FOOTER_EAT_SPACING - POOLATTR_BEGIN ] = new SwHeaderAndFooterEatSpacingItem;
- aAttrTab[ RES_LINENUMBER - POOLATTR_BEGIN ] = new SwFmtLineNumber;
- aAttrTab[ RES_FTN_AT_TXTEND - POOLATTR_BEGIN ] = new SwFmtFtnAtTxtEnd;
- aAttrTab[ RES_END_AT_TXTEND - POOLATTR_BEGIN ] = new SwFmtEndAtTxtEnd;
- aAttrTab[ RES_COLUMNBALANCE - POOLATTR_BEGIN ] = new SwFmtNoBalancedColumns;
- aAttrTab[ RES_FRAMEDIR - POOLATTR_BEGIN ] = new SvxFrameDirectionItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
- aAttrTab[ RES_ROW_SPLIT - POOLATTR_BEGIN ] = new SwFmtRowSplit;
+ aAttrTab[ RES_LINENUMBER - POOLATTR_BEGIN ] = new SwFmtLineNumber;
+ aAttrTab[ RES_FTN_AT_TXTEND - POOLATTR_BEGIN ] = new SwFmtFtnAtTxtEnd;
+ aAttrTab[ RES_END_AT_TXTEND - POOLATTR_BEGIN ] = new SwFmtEndAtTxtEnd;
+ aAttrTab[ RES_COLUMNBALANCE - POOLATTR_BEGIN ] = new SwFmtNoBalancedColumns;
+ aAttrTab[ RES_FRAMEDIR - POOLATTR_BEGIN ] = new SvxFrameDirectionItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
+ aAttrTab[ RES_ROW_SPLIT - POOLATTR_BEGIN ] = new SwFmtRowSplit;
// #i18732#
- aAttrTab[ RES_FOLLOW_TEXT_FLOW - POOLATTR_BEGIN ] = new SwFmtFollowTextFlow( sal_True );
+ aAttrTab[ RES_FOLLOW_TEXT_FLOW - POOLATTR_BEGIN ] = new SwFmtFollowTextFlow( sal_True );
// collapsing borders #i29550#
- aAttrTab[ RES_COLLAPSING_BORDERS - POOLATTR_BEGIN ] = new SfxBoolItem( RES_COLLAPSING_BORDERS, sal_False );
+ aAttrTab[ RES_COLLAPSING_BORDERS - POOLATTR_BEGIN ] = new SfxBoolItem( RES_COLLAPSING_BORDERS, sal_False );
// #i28701#
// #i35017# - constant name has changed
aAttrTab[ RES_WRAP_INFLUENCE_ON_OBJPOS - POOLATTR_BEGIN ] =
new SwFmtWrapInfluenceOnObjPos( text::WrapInfluenceOnPosition::ONCE_CONCURRENT );
-// FrmAttr-Dummies
- aAttrTab[ RES_AUTO_STYLE - POOLATTR_BEGIN ] = new SwFmtAutoFmt( RES_AUTO_STYLE );
- aAttrTab[ RES_FRMATR_STYLE_NAME - POOLATTR_BEGIN ] = new SfxStringItem( RES_FRMATR_STYLE_NAME, aEmptyStr );
+
+ aAttrTab[ RES_AUTO_STYLE - POOLATTR_BEGIN ] = new SwFmtAutoFmt( RES_AUTO_STYLE );
+ aAttrTab[ RES_FRMATR_STYLE_NAME - POOLATTR_BEGIN ] = new SfxStringItem( RES_FRMATR_STYLE_NAME, aEmptyStr );
aAttrTab[ RES_FRMATR_CONDITIONAL_STYLE_NAME - POOLATTR_BEGIN ] = new SfxStringItem( RES_FRMATR_CONDITIONAL_STYLE_NAME, aEmptyStr );
-// FrmAttr-Dummies
-
- aAttrTab[ RES_GRFATR_MIRRORGRF- POOLATTR_BEGIN ] = new SwMirrorGrf;
- aAttrTab[ RES_GRFATR_CROPGRF- POOLATTR_BEGIN ] = new SwCropGrf;
- aAttrTab[ RES_GRFATR_ROTATION - POOLATTR_BEGIN ] = new SwRotationGrf;
- aAttrTab[ RES_GRFATR_LUMINANCE - POOLATTR_BEGIN ] = new SwLuminanceGrf;
- aAttrTab[ RES_GRFATR_CONTRAST - POOLATTR_BEGIN ] = new SwContrastGrf;
- aAttrTab[ RES_GRFATR_CHANNELR - POOLATTR_BEGIN ] = new SwChannelRGrf;
- aAttrTab[ RES_GRFATR_CHANNELG - POOLATTR_BEGIN ] = new SwChannelGGrf;
- aAttrTab[ RES_GRFATR_CHANNELB - POOLATTR_BEGIN ] = new SwChannelBGrf;
- aAttrTab[ RES_GRFATR_GAMMA - POOLATTR_BEGIN ] = new SwGammaGrf;
- aAttrTab[ RES_GRFATR_INVERT - POOLATTR_BEGIN ] = new SwInvertGrf;
- aAttrTab[ RES_GRFATR_TRANSPARENCY - POOLATTR_BEGIN ] = new SwTransparencyGrf;
- aAttrTab[ RES_GRFATR_DRAWMODE - POOLATTR_BEGIN ] = new SwDrawModeGrf;
+
+ aAttrTab[ RES_GRFATR_MIRRORGRF- POOLATTR_BEGIN ] = new SwMirrorGrf;
+ aAttrTab[ RES_GRFATR_CROPGRF- POOLATTR_BEGIN ] = new SwCropGrf;
+ aAttrTab[ RES_GRFATR_ROTATION - POOLATTR_BEGIN ] = new SwRotationGrf;
+ aAttrTab[ RES_GRFATR_LUMINANCE - POOLATTR_BEGIN ] = new SwLuminanceGrf;
+ aAttrTab[ RES_GRFATR_CONTRAST - POOLATTR_BEGIN ] = new SwContrastGrf;
+ aAttrTab[ RES_GRFATR_CHANNELR - POOLATTR_BEGIN ] = new SwChannelRGrf;
+ aAttrTab[ RES_GRFATR_CHANNELG - POOLATTR_BEGIN ] = new SwChannelGGrf;
+ aAttrTab[ RES_GRFATR_CHANNELB - POOLATTR_BEGIN ] = new SwChannelBGrf;
+ aAttrTab[ RES_GRFATR_GAMMA - POOLATTR_BEGIN ] = new SwGammaGrf;
+ aAttrTab[ RES_GRFATR_INVERT - POOLATTR_BEGIN ] = new SwInvertGrf;
+ aAttrTab[ RES_GRFATR_TRANSPARENCY - POOLATTR_BEGIN ] = new SwTransparencyGrf;
+ aAttrTab[ RES_GRFATR_DRAWMODE - POOLATTR_BEGIN ] = new SwDrawModeGrf;
// GraphicAttr - Dummies
- aAttrTab[ RES_GRFATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY1 );
- aAttrTab[ RES_GRFATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY2 );
- aAttrTab[ RES_GRFATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY3 );
- aAttrTab[ RES_GRFATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY4 );
- aAttrTab[ RES_GRFATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY5 );
-// GraphicAttr - Dummies
+ aAttrTab[ RES_GRFATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY1 );
+ aAttrTab[ RES_GRFATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY2 );
+ aAttrTab[ RES_GRFATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY3 );
+ aAttrTab[ RES_GRFATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY4 );
+ aAttrTab[ RES_GRFATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY5 );
- aAttrTab[ RES_BOXATR_FORMAT- POOLATTR_BEGIN ] = new SwTblBoxNumFormat;
- aAttrTab[ RES_BOXATR_FORMULA- POOLATTR_BEGIN ] = new SwTblBoxFormula( aEmptyStr );
- aAttrTab[ RES_BOXATR_VALUE- POOLATTR_BEGIN ] = new SwTblBoxValue;
+ aAttrTab[ RES_BOXATR_FORMAT- POOLATTR_BEGIN ] = new SwTblBoxNumFormat;
+ aAttrTab[ RES_BOXATR_FORMULA- POOLATTR_BEGIN ] = new SwTblBoxFormula( aEmptyStr );
+ aAttrTab[ RES_BOXATR_VALUE- POOLATTR_BEGIN ] = new SwTblBoxValue;
aAttrTab[ RES_UNKNOWNATR_CONTAINER- POOLATTR_BEGIN ] =
new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER );
@@ -650,12 +639,12 @@ void _InitCore()
*(SvxFontItem*)aAttrTab[ RES_CHRATR_CJK_FONT - POOLATTR_BEGIN ],
*(SvxFontItem*)aAttrTab[ RES_CHRATR_CTL_FONT - POOLATTR_BEGIN ] );
- // 1. Version - neue Attribute:
+ // 1. version - new attributes:
// - RES_CHRATR_BLINK
// - RES_CHRATR_NOHYPHEN
// - RES_CHRATR_NOLINEBREAK
// - RES_PARATR_REGISTER
- // + 2 Dummies fuer die einzelnen "Bereiche"
+ // + 2 dummies for the "ranges"
SwAttrPool::pVersionMap1 = new sal_uInt16[ 60 ];
sal_uInt16 i;
for( i = 1; i <= 17; i++ )
@@ -669,17 +658,17 @@ void _InitCore()
for ( i = 59; i <= 60; ++i )
SwAttrPool::pVersionMap1[ i-1 ] = i + 12;
- // 2. Version - neue Attribute:
- // 10 Dummies fuer den Frame "Bereich"
+ // 2. version - new attributes:
+ // 10 dummies for the frame "range"
SwAttrPool::pVersionMap2 = new sal_uInt16[ 75 ];
for( i = 1; i <= 70; i++ )
SwAttrPool::pVersionMap2[ i-1 ] = i;
for ( i = 71; i <= 75; ++i )
SwAttrPool::pVersionMap2[ i-1 ] = i + 10;
- // 3. Version - neue Attribute:
- // neue Attribute und Dummies fuer die CJK-Version
- // und neue Grafik-Attribute
+ // 3. version:
+ // new attributes and dummies for the CJK version and
+ // new graphics attributes
SwAttrPool::pVersionMap3 = new sal_uInt16[ 86 ];
for( i = 1; i <= 21; i++ )
SwAttrPool::pVersionMap3[ i-1 ] = i;
@@ -690,13 +679,15 @@ void _InitCore()
for ( i = 83; i <= 86; ++i )
SwAttrPool::pVersionMap3[ i-1 ] = i + 35;
- // 4. Version - neue Paragraph Attribute fuer die CJK-Version
+ // 4. version:
+ // new paragraph attributes for CJK version
SwAttrPool::pVersionMap4 = new sal_uInt16[ 121 ];
for( i = 1; i <= 65; i++ )
SwAttrPool::pVersionMap4[ i-1 ] = i;
for ( i = 66; i <= 121; ++i )
SwAttrPool::pVersionMap4[ i-1 ] = i + 9;
+ // 5. version
// #i18732# - setup new version map due to extension of
// the frame attributes (RES_FRMATR_*) for binary filters.
SwAttrPool::pVersionMap5 = new sal_uInt16[ 130 ];
@@ -705,16 +696,15 @@ void _InitCore()
for ( i = 110; i <= 130; ++i )
SwAttrPool::pVersionMap5[ i-1 ] = i + 6;
- // 6. Version - new character attribute for overlining plus 2 dummies
+ // 6. version:
+ // new character attribute for overlining plus 2 dummies
SwAttrPool::pVersionMap6 = new sal_uInt16[ 136 ];
for( i = 1; i <= 37; i++ )
SwAttrPool::pVersionMap6[ i-1 ] = i;
for ( i = 38; i <= 136; ++i )
SwAttrPool::pVersionMap6[ i-1 ] = i + 3;
- uno::Reference<
- lang::XMultiServiceFactory > xMSF =
- ::comphelper::getProcessServiceFactory();
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
SwBreakIt::_Create( xMSF );
pCheckIt = NULL;
@@ -732,12 +722,6 @@ void _InitCore()
rAFlags.nAutoCmpltWordLen );
}
-/******************************************************************************
- * void _FinitCore()
- ******************************************************************************/
-
-
-
void _FinitCore()
{
_FrmFinit();
@@ -749,7 +733,7 @@ void _FinitCore()
delete pCollator;
delete pCaseCollator;
- // das default TableAutoFormat zerstoeren
+ // destroy default TableAutoFormat
delete SwTableAutoFmt::pDfltBoxAutoFmt;
delete SwSelPaintRects::pMapMode;
@@ -803,7 +787,7 @@ void _FinitCore()
delete SwStyleNameMapper::pNumRuleProgMap;
- // loesche alle default-Attribute
+ // delete all default attributes
SfxPoolItem* pHt;
for( sal_uInt16 n = 0; n < POOLATTR_END - POOLATTR_BEGIN; n++ )
if( 0 != ( pHt = aAttrTab[n] ))
@@ -854,9 +838,7 @@ CollatorWrapper& GetAppCollator()
{
const lang::Locale& rLcl = pBreakIt->GetLocale(
(LanguageType)GetAppLanguage() );
- uno::Reference<
- lang::XMultiServiceFactory > xMSF =
- ::comphelper::getProcessServiceFactory();
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
pCollator = new CollatorWrapper( xMSF );
pCollator->loadDefaultCollator( rLcl, SW_COLLATOR_IGNORES );
@@ -869,9 +851,7 @@ CollatorWrapper& GetAppCaseCollator()
{
const lang::Locale& rLcl = pBreakIt->GetLocale(
(LanguageType)GetAppLanguage() );
- uno::Reference<
- lang::XMultiServiceFactory > xMSF =
- ::comphelper::getProcessServiceFactory();
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
pCaseCollator = new CollatorWrapper( xMSF );
pCaseCollator->loadDefaultCollator( rLcl, 0 );
@@ -888,8 +868,7 @@ namespace
public:
TransWrp()
{
- uno::Reference< lang::XMultiServiceFactory > xMSF =
- ::comphelper::getProcessServiceFactory();
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
xTransWrp.reset(new ::utl::TransliterationWrapper( xMSF,
i18n::TransliterationModules_IGNORE_CASE |
diff --git a/sw/source/core/bastyp/ring.cxx b/sw/source/core/bastyp/ring.cxx
index 407a4363e6e0..318ec165aa06 100644
--- a/sw/source/core/bastyp/ring.cxx
+++ b/sw/source/core/bastyp/ring.cxx
@@ -28,15 +28,12 @@
#include "ring.hxx"
-
-/*************************************************************************
-|* Ring::Ring()
-*************************************************************************/
-
Ring::Ring( Ring *pObj )
{
if( !pObj )
+ {
pNext = this, pPrev = this;
+ }
else
{
pNext = pObj;
@@ -46,27 +43,19 @@ Ring::Ring( Ring *pObj )
}
}
-/*************************************************************************
-|* Ring::~Ring()
-*************************************************************************/
-
Ring::~Ring()
{
pNext->pPrev = pPrev;
pPrev->pNext = pNext;
}
-/*************************************************************************
-|* Ring::MoveTo
-*************************************************************************/
-
void Ring::MoveTo(Ring *pDestRing)
{
- // loeschen aus dem alten
+ // delete from "old"
pNext->pPrev = pPrev;
pPrev->pNext = pNext;
- // im neuen einfuegen
+ // insert into "new"
if( pDestRing )
{
pNext = pDestRing;
@@ -75,13 +64,15 @@ void Ring::MoveTo(Ring *pDestRing)
pPrev->pNext = this;
}
else
+ {
pNext = pPrev = this;
+ }
}
void Ring::MoveRingTo(Ring *pDestRing)
{
- // den gesamten Ring in den DestRing einfuegen
+ // insert the whole ring into DestRing
Ring* pMyPrev = pPrev;
Ring* pDestPrev = pDestRing->pPrev;
@@ -103,5 +94,4 @@ sal_uInt32 Ring::numberOf() const
return nRet;
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
index c63afb52fad7..4aa3108fcb0d 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -26,7 +26,6 @@
*
************************************************************************/
-
#include <swcache.hxx>
#include <rtl/strbuf.hxx>
@@ -36,17 +35,13 @@
#define INCREMENT( nVar )
#endif
-/*************************************************************************
-|* SwCache::Check()
-|*************************************************************************/
-
#ifdef DBG_UTIL
void SwCache::Check()
{
if ( !pRealFirst )
return;
- //Konsistenspruefung.
+ // consistency check
SAL_WARN_IF( pLast->GetNext(), "sw", "Last but not last." );
SAL_WARN_IF( pRealFirst->GetPrev(), "sw", "First but not first." );
sal_uInt16 nCnt = 0;
@@ -55,7 +50,7 @@ void SwCache::Check()
SwCacheObj *pRekursive = pObj;
while ( pObj )
{
- //Das Objekt muss auch auf dem Rueckwaertsweg gefunden werden.
+ // the object must be found also when moving backwards
SwCacheObj *pTmp = pLast;
while ( pTmp && pTmp != pObj )
pTmp = pTmp->GetPrev();
@@ -83,10 +78,6 @@ void SwCache::Check()
#define CHECK
#endif
-/*************************************************************************
-|* SwCache::SwCache(), ~SwCache()
-|*************************************************************************/
-
SwCache::SwCache( const sal_uInt16 nInitSize
#ifdef DBG_UTIL
@@ -188,11 +179,6 @@ SwCache::~SwCache()
delete *it;
}
-/*************************************************************************
-|* SwCache::Flush()
-|*************************************************************************/
-
-
void SwCache::Flush( const sal_uInt8 )
{
INCREMENT( m_nFlushCnt );
@@ -234,30 +220,27 @@ void SwCache::Flush( const sal_uInt8 )
}
}
-/*************************************************************************
-|* SwCache::ToTop()
-|*************************************************************************/
-
-
void SwCache::ToTop( SwCacheObj *pObj )
{
INCREMENT( m_nToTop );
- //Objekt aus der LRU-Kette ausschneiden und am Anfang einfuegen.
- if ( pRealFirst == pObj ) //pFirst wurde vom Aufrufer geprueft!
- { CHECK;
+ // cut object out of chain and insert at beginning
+ if ( pRealFirst == pObj ) // pFirst was checked by caller
+ {
+ CHECK;
return;
}
if ( !pRealFirst )
- { //Der erste wird eingetragen.
+ {
+ // the first will be inserted
OSL_ENSURE( !pFirst && !pLast, "First not first." );
pRealFirst = pFirst = pLast = pObj;
CHECK;
return;
}
- //Ausschneiden.
+ // cut
if ( pObj == pLast )
{
OSL_ENSURE( pObj->GetPrev(), "Last but no Prev." );
@@ -272,7 +255,7 @@ void SwCache::ToTop( SwCacheObj *pObj )
pObj->GetPrev()->SetNext( pObj->GetNext() );
}
- //Am (virtuellen) Anfang einfuegen.
+ // paste at the (virtual) beginning
if ( pRealFirst == pFirst )
{
pRealFirst->SetPrev( pObj );
@@ -299,11 +282,6 @@ void SwCache::ToTop( SwCacheObj *pObj )
}
}
-/*************************************************************************
-|* SwCache::Get()
-|*************************************************************************/
-
-
SwCacheObj *SwCache::Get( const void *pOwner, const sal_uInt16 nIndex,
const sal_Bool bToTop )
{
@@ -326,8 +304,6 @@ SwCacheObj *SwCache::Get( const void *pOwner, const sal_uInt16 nIndex,
return pRet;
}
-
-
SwCacheObj *SwCache::Get( const void *pOwner, const sal_Bool bToTop )
{
SwCacheObj *pRet = pRealFirst;
@@ -350,15 +326,10 @@ SwCacheObj *SwCache::Get( const void *pOwner, const sal_Bool bToTop )
return pRet;
}
-/*************************************************************************
-|* SwCache::Delete()
-|*************************************************************************/
-
-
void SwCache::DeleteObj( SwCacheObj *pObj )
{
CHECK;
- OSL_ENSURE( !pObj->IsLocked(), "SwCache::Delete: Object ist Locked." );
+ OSL_ENSURE( !pObj->IsLocked(), "SwCache::Delete: object is locked." );
if ( pObj->IsLocked() )
return;
@@ -386,11 +357,9 @@ void SwCache::DeleteObj( SwCacheObj *pObj )
if ( m_aCacheObjects.size() > nCurMax &&
(nCurMax <= (m_aCacheObjects.size() - aFreePositions.size())) )
{
- //Falls moeglich wieder verkleinern, dazu muessen allerdings ausreichend
- //Freie Positionen bereitstehen.
- //Unangenehmer Nebeneffekt ist, das die Positionen verschoben werden
- //muessen, und die Eigentuemer der Objekte diese wahrscheinlich nicht
- //wiederfinden werden.
+ // Shrink if possible.To do so we need enough free positions.
+ // Unpleasent side effect: positions will be moved and the owner of
+ // these might not find them afterwards
for ( sal_uInt16 i = 0; i < m_aCacheObjects.size(); ++i )
{
SwCacheObj *pTmpObj = m_aCacheObjects[i];
@@ -399,7 +368,9 @@ void SwCache::DeleteObj( SwCacheObj *pObj )
--i;
}
else
+ {
pTmpObj->SetCachePos( i );
+ }
}
aFreePositions.clear();
}
@@ -414,28 +385,22 @@ void SwCache::Delete( const void *pOwner )
DeleteObj( pObj );
}
-
-/*************************************************************************
-|* SwCache::Insert()
-|*************************************************************************/
-
-
sal_Bool SwCache::Insert( SwCacheObj *pNew )
{
CHECK;
OSL_ENSURE( !pNew->GetPrev() && !pNew->GetNext(), "New but not new." );
- sal_uInt16 nPos;//Wird hinter den if's zum setzen am Obj benutzt.
+ sal_uInt16 nPos;
if ( m_aCacheObjects.size() < nCurMax )
{
- //Es ist noch Platz frei, also einfach einfuegen.
+ // there is still space; insert directly
INCREMENT( m_nAppend );
nPos = m_aCacheObjects.size();
m_aCacheObjects.push_back(pNew);
}
else if ( !aFreePositions.empty() )
{
- //Es exitieren Platzhalter, also den letzten benutzen.
+ // there are placeholders; use the last of those
INCREMENT( m_nInsertFree );
const sal_uInt16 nFreePos = aFreePositions.size() - 1;
nPos = aFreePositions[ nFreePos ];
@@ -445,7 +410,7 @@ sal_Bool SwCache::Insert( SwCacheObj *pNew )
else
{
INCREMENT( m_nReplace );
- //Der letzte des LRU fliegt raus.
+ // the last of the LRU has to go
SwCacheObj *pObj = pLast;
while ( pObj && pObj->IsLocked() )
@@ -474,8 +439,6 @@ sal_Bool SwCache::Insert( SwCacheObj *pNew )
}
pNew->SetCachePos( nPos );
- //Anstelle von ToTop, einfach als pFirst einfuegen.
-// ToTop( nPos );
if ( pFirst )
{
if ( pFirst->GetPrev() )
@@ -497,11 +460,6 @@ sal_Bool SwCache::Insert( SwCacheObj *pNew )
return sal_True;
}
-/*************************************************************************
-|* SwCache::SetLRUOfst()
-|*************************************************************************/
-
-
void SwCache::SetLRUOfst( const sal_uInt16 nOfst )
{
if ( !pRealFirst || ((m_aCacheObjects.size() - aFreePositions.size()) < nOfst) )
@@ -519,11 +477,6 @@ void SwCache::SetLRUOfst( const sal_uInt16 nOfst )
CHECK;
}
-/*************************************************************************
-|* SwCacheObj::SwCacheObj()
-|*************************************************************************/
-
-
SwCacheObj::SwCacheObj( const void *pOwn ) :
pNext( 0 ),
pPrev( 0 ),
@@ -533,16 +486,10 @@ SwCacheObj::SwCacheObj( const void *pOwn ) :
{
}
-
-
SwCacheObj::~SwCacheObj()
{
}
-/*************************************************************************
-|* SwCacheObj::SetLock(), Unlock()
-|*************************************************************************/
-
#ifdef DBG_UTIL
void SwCacheObj::Lock()
{
@@ -557,17 +504,12 @@ void SwCacheObj::Unlock()
}
#endif
-
SwCacheAccess::~SwCacheAccess()
{
if ( pObj )
pObj->Unlock();
}
-/*************************************************************************
-|* SwCacheAccess::Get()
-|*************************************************************************/
-
void SwCacheAccess::_Get()
{
OSL_ENSURE( !pObj, "SwCacheAcces Obj already available." );
@@ -579,13 +521,11 @@ void SwCacheAccess::_Get()
pObj = 0;
}
else
+ {
pObj->Lock();
+ }
}
-/*************************************************************************
-|* SwCacheAccess::IsAvailable()
-|*************************************************************************/
-
sal_Bool SwCacheAccess::IsAvailable() const
{
return pObj != 0;
diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx
index 8bc90da42690..4b8c4c48d3f7 100644
--- a/sw/source/core/bastyp/swrect.cxx
+++ b/sw/source/core/bastyp/swrect.cxx
@@ -34,13 +34,6 @@
#include "swrect.hxx"
#include <math.h>
-/*************************************************************************
-|*
-|* SwRect::SwRect()
-|*
-|*************************************************************************/
-
-
SwRect::SwRect( const Rectangle &rRect ) :
m_Point( rRect.Left(), rRect.Top() )
@@ -51,25 +44,12 @@ SwRect::SwRect( const Rectangle &rRect ) :
rRect.Bottom() - rRect.Top() + 1);
}
-/*************************************************************************
-|*
-|* SwRect::Center()
-|*
-|*************************************************************************/
Point SwRect::Center() const
{
return Point( Left() + Width() / 2,
Top() + Height() / 2 );
}
-/*************************************************************************
-|*
-|* SwRect::Union()
-|*
-|*************************************************************************/
-
-
-
SwRect& SwRect::Union( const SwRect& rRect )
{
if ( Top() > rRect.Top() )
@@ -84,21 +64,13 @@ SwRect& SwRect::Union( const SwRect& rRect )
Bottom( n );
return *this;
}
-/*************************************************************************
-|*
-|* SwRect::Intersection(), _Intersection()
-|*
-|*************************************************************************/
-
-
SwRect& SwRect::Intersection( const SwRect& rRect )
{
- //Hat das Teil ueberhaupt Gemeinsamkeiten mit mir?
+ // any similarity between me and given element?
if ( IsOver( rRect ) )
{
- //Bestimmung der kleineren rechten sowie unteren und
- // der groesseren linken sowie oberen Kante.
+ // get smaller right and lower, and greater left and upper edge
if ( Left() < rRect.Left() )
Left( rRect.Left() );
if ( Top() < rRect.Top() )
@@ -111,18 +83,15 @@ SwRect& SwRect::Intersection( const SwRect& rRect )
Bottom( n );
}
else
- //Def.: Bei einer leeren Intersection wird nur die SSize genullt.
+ // Def.: if intersection is empty, set only SSize to 0
SSize(0, 0);
return *this;
}
-
-
SwRect& SwRect::_Intersection( const SwRect& rRect )
{
- //Bestimmung der kleineren rechten sowie unteren und
- // der groesseren linken sowie oberen Kante.
+ // get smaller right and lower, and greater left and upper edge
if ( Left() < rRect.Left() )
Left( rRect.Left() );
if ( Top() < rRect.Top() )
@@ -136,13 +105,6 @@ SwRect& SwRect::_Intersection( const SwRect& rRect )
return *this;
}
-/*************************************************************************
-|*
-|* SwRect::IsInside()
-|*
-|*************************************************************************/
-
-
sal_Bool SwRect::IsInside( const SwRect& rRect ) const
{
@@ -156,18 +118,15 @@ sal_Bool SwRect::IsInside( const SwRect& rRect ) const
(Top() <= nrBottom) && (nrBottom <= nBottom);
}
-
-
sal_Bool SwRect::IsInside( const Point& rPoint ) const
{
- return (Left() <= rPoint.X())
- && (Top() <= rPoint.Y())
- && (Right() >= rPoint.X())
- && (Bottom()>= rPoint.Y());
+ return (Left() <= rPoint.X()) &&
+ (Top() <= rPoint.Y()) &&
+ (Right() >= rPoint.X()) &&
+ (Bottom()>= rPoint.Y());
}
-/* ---------------------------------------------------------------------------
- mouse moving of table borders
- ---------------------------------------------------------------------------*/
+
+// mouse moving of table borders
sal_Bool SwRect::IsNear( const Point& rPoint, long nTolerance ) const
{
return IsInside(rPoint) ||
@@ -177,13 +136,6 @@ sal_Bool SwRect::IsNear( const Point& rPoint, long nTolerance ) const
&& ((Bottom() + nTolerance)>= rPoint.Y()));
}
-/*************************************************************************
-|*
-|* SwRect::IsOver()
-|*
-|*************************************************************************/
-
-
sal_Bool SwRect::IsOver( const SwRect& rRect ) const
{
@@ -193,14 +145,6 @@ sal_Bool SwRect::IsOver( const SwRect& rRect ) const
&& (Bottom()>= rRect.Top()) ? sal_True : sal_False;
}
-/*************************************************************************
-|*
-|* SwRect::Justify()
-|*
-|*************************************************************************/
-
-
-
void SwRect::Justify()
{
if ( m_Size.getHeight() < 0 )
@@ -215,9 +159,7 @@ void SwRect::Justify()
}
}
-
// Similiar to the inline methods, but we need the function pointers
-
void SwRect::_Width( const long nNew ) { m_Size.setWidth(nNew); }
void SwRect::_Height( const long nNew ) { m_Size.setHeight(nNew); }
void SwRect::_Left( const long nLeft ){ m_Size.Width() += m_Point.getX() - nLeft; m_Point.setX(nLeft); }
@@ -240,17 +182,21 @@ void SwRect::SubTop( const long nSub ){ m_Size.Height() += nSub; m_Point.Y() -=
void SwRect::AddBottom( const long nAdd ){ m_Size.Height() += nAdd; }
void SwRect::SetPosX( const long nNew ){ m_Point.setX(nNew); }
void SwRect::SetPosY( const long nNew ){ m_Point.setY(nNew); }
+
const Size SwRect::_Size() const { return SSize(); }
const Size SwRect::SwappedSize() const { return Size( m_Size.getHeight(), m_Size.getWidth() ); }
+
const Point SwRect::TopLeft() const { return Pos(); }
const Point SwRect::TopRight() const { return Point( m_Point.getX() + m_Size.getWidth(), m_Point.getY() ); }
const Point SwRect::BottomLeft() const { return Point( m_Point.getX(), m_Point.getY() + m_Size.getHeight() ); }
const Point SwRect::BottomRight() const
{ return Point( m_Point.getX() + m_Size.getWidth(), m_Point.getY() + m_Size.getHeight() ); }
+
long SwRect::GetLeftDistance( long nLimit ) const { return m_Point.getX() - nLimit; }
long SwRect::GetBottomDistance( long nLim ) const { return nLim - m_Point.getY() - m_Size.getHeight();}
long SwRect::GetTopDistance( long nLimit ) const { return m_Point.getY() - nLimit; }
long SwRect::GetRightDistance( long nLim ) const { return nLim - m_Point.getX() - m_Size.getWidth(); }
+
sal_Bool SwRect::OverStepLeft( long nLimit ) const
{ return nLimit > m_Point.getX() && m_Point.getX() + m_Size.getWidth() > nLimit; }
sal_Bool SwRect::OverStepBottom( long nLimit ) const
@@ -259,6 +205,7 @@ sal_Bool SwRect::OverStepTop( long nLimit ) const
{ return nLimit > m_Point.getY() && m_Point.getY() + m_Size.getHeight() > nLimit; }
sal_Bool SwRect::OverStepRight( long nLimit ) const
{ return nLimit > m_Point.getX() && m_Point.getX() + m_Size.getWidth() > nLimit; }
+
void SwRect::SetLeftAndWidth( long nLeft, long nNew )
{
m_Point.setX(nLeft);
@@ -287,9 +234,6 @@ void SwRect::SetLowerLeftCorner( const Point& rNew )
{ m_Point = Point(rNew.nA, rNew.nB - m_Size.getHeight()); }
#ifdef DBG_UTIL
-/*************************************************************************
- * operator<<( ostream&, SwRect&)
- *************************************************************************/
SvStream &operator<<( SvStream &rStream, const SwRect &rRect )
{
rStream << '[' << static_cast<sal_Int32>(rRect.Top())
@@ -301,5 +245,4 @@ SvStream &operator<<( SvStream &rStream, const SwRect &rRect )
}
#endif
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/bastyp/swregion.cxx b/sw/source/core/bastyp/swregion.cxx
index 89b87e292a9c..dc4069ef7111 100644
--- a/sw/source/core/bastyp/swregion.cxx
+++ b/sw/source/core/bastyp/swregion.cxx
@@ -26,18 +26,12 @@
*
************************************************************************/
-
#include "swtypes.hxx"
#include "swrect.hxx"
#include "swregion.hxx"
-
SV_IMPL_VARARR( SwRects, SwRect );
-/*************************************************************************
-|* SwRegionRects::SwRegionRects()
-|*************************************************************************/
-
SwRegionRects::SwRegionRects( const SwRect &rStartRect, sal_uInt16 nInit ) :
SwRects( (sal_uInt8)nInit ),
aOrigin( rStartRect )
@@ -45,16 +39,10 @@ SwRegionRects::SwRegionRects( const SwRect &rStartRect, sal_uInt16 nInit ) :
Insert( aOrigin, 0 );
}
-/*************************************************************************
- * inline InsertRect()
- *
- * InsertRect() wird nur von operator-=() gerufen.
- * Wenn bDel == sal_True ist, dann wird das Rect an der Position nPos mit
- * rRect ueberschrieben, ansonsten wird rRect hinten angehaengt.
- *************************************************************************/
-
-inline void SwRegionRects::InsertRect( const SwRect &rRect, const sal_uInt16 nPos,
- sal_Bool &rDel )
+// If <rDel> is sal_True then this Rect will be overwritten by <rRect> at
+// position <nPos>. Otherwise <rRect> is attached at the end.
+inline void SwRegionRects::InsertRect( const SwRect &rRect,
+ const sal_uInt16 nPos, sal_Bool &rDel )
{
if( rDel )
{
@@ -63,21 +51,17 @@ inline void SwRegionRects::InsertRect( const SwRect &rRect, const sal_uInt16 nPo
rDel = sal_False;
}
else
+ {
Insert( rRect, Count() );
+ }
}
-/*************************************************************************
-|*
-|* SwRegionRects::operator-=()
-|*
-|* Beschreibung Alle Ueberschneidungen der Rechtecke, die sich
-|* gerade im Array befinden, mit dem uebergebenen Rechteck werden
-|* entfernt.
-|* Dazu muessen die vorhandenen Rechtecke entweder aufgeteilt oder
-|* geloescht werden.
-|*
-|*************************************************************************/
+/** Delete all overlaps of the Rects in array with the given <rRect>
+ To do so, all existing rectangles have to be either split or deleted.
+
+ @param rRect rectangle with the area that should be deleted
+*/
void SwRegionRects::operator-=( const SwRect &rRect )
{
sal_uInt16 nMax = Count();
@@ -89,14 +73,12 @@ void SwRegionRects::operator-=( const SwRect &rRect )
SwRect aInter( aTmp );
aInter._Intersection( rRect );
- // Das erste Rect, das wir inserten wollen, nimmt die
- // Stelle von i ein. So ersparen wir uns das Delete().
+ // The first Rect that should be inserted takes position of i.
+ // This avoids one Delete() call.
sal_Bool bDel = sal_True;
- //Jetzt aufteilen das Teil: Es sollen diejenigen Rechtecke
- //zurueckbleiben, die im alten aber nicht im neuen liegen.
- //Sprich alle Rechtecke die im alten aber nicht in der Intersection
- //liegen.
+ // now split; only those rectangles should be left over that are in
+ // the "old" but not in the "new" area; hence, not in intersection.
long nTmp;
if ( 0 < (nTmp = aInter.Top() - aTmp.Top()) )
{
@@ -127,37 +109,29 @@ void SwRegionRects::operator-=( const SwRect &rRect )
if( bDel )
{
Remove( i );
- --i; //Damit wir keinen uebergehen.
- --nMax; //Damit wir keinen zuviel verarbeiten.
+ --i; // so that we don't forget any
+ --nMax; // so that we don't check too much
}
}
}
-
}
-/*************************************************************************
- * SwRegionRects::Invert()
- *
- * Bezugspunkt ist aOrigin, das Original-SRectangle.
- * Aus Loechern werden Flaechen, aus Flaechen werden Loecher.
- * Ein Hinweis: Wenn keine Rects abgezogen wurden, so ist das enthaltene
- * Rechteck identisch mit aOrigin. Nach Invert() besteht die Region aus
- * einem Null-SRectangle.
- *************************************************************************/
+/** invert current rectangle
+
+ Change the shape, such that holes with be areas and areas are holes now.
+ Note: If no rects were removed, then the shape is identical to the original
+ shape. As a result, it will be a NULL-SRectangle after inverting.
+*/
void SwRegionRects::Invert()
{
- // Nicht besonders elegant und schnell, aber wirkungsvoll:
- // Wir legen eine weitere Region an und ziehen alle Flaechen ab,
- // die in uns noch uebrig geblieben sind. Danach werden alle
- // Werte uebertragen.
-
- // Um unuetze Speicheranforderungen zu vermeiden versuchen wir die
- // iniale Groesse moeglichst brauchbar anzulegen:
- // Anzahl der Rechtecke in der Region * 2 + 2
- // plus zwei um den Sonderfall eines einzelnen Loches (macht vier
- // Rechtecke im inversen Fall) abzudecken.
+ // not very elegant and fast, but efficient:
+ // Create a new region and remove all areas that are left over. Afterwards
+ // copy all values.
+ // To avoid unnecessary memory requirements, create a "useful" initial size:
+ // Number of rectangles in this area * 2 + 2 for the special case of a
+ // single hole (so four Rects in the inverse case).
SwRegionRects aInvRegion( aOrigin, Count()*2+2 );
const SwRect *pDat = GetData();
for( sal_uInt16 i = 0; i < Count(); ++pDat, ++i )
@@ -169,7 +143,7 @@ void SwRegionRects::Invert()
nDel = Count() - aInvRegion.Count();
nCpy = aInvRegion.Count();
}
- // alle vorhandenen ueberschreiben
+ // overwrite all existing
memcpy( pData, aInvRegion.GetData(), nCpy * sizeof( SwRect ));
if( nCpy < aInvRegion.Count() )
@@ -177,27 +151,21 @@ void SwRegionRects::Invert()
else if( nDel )
Remove( nCpy, nDel );
}
-/*************************************************************************
-|*
-|* SwRegionRects::Compress()
-|*
-|* Beschreibung Zusammenfassen von benachbarten Rechtecken.
-|*
-|*************************************************************************/
+
inline SwTwips CalcArea( const SwRect &rRect )
{
return rRect.Width() * rRect.Height();
}
-
+// combine all adjacent rectangles
void SwRegionRects::Compress( sal_Bool bFuzzy )
{
for ( int i = 0; i < Count(); ++i )
{
for ( int j = i+1; j < Count(); ++j )
{
- //Wenn zwei Rechtecke ineinanderliegen, so ist eins davon
- //uberfluessig.
+ // If one rectangle contains a second completely than the latter
+ // does not need to be stored and can be deleted
if ( (*(pData + i)).IsInside( *(pData + j) ) )
{
Remove( static_cast<sal_uInt16>(j), 1 );
@@ -212,17 +180,17 @@ void SwRegionRects::Compress( sal_Bool bFuzzy )
}
else
{
- //Wenn zwei Rechtecke dieselbe Flaeche haben wie deren
- //Union abzueglich deren Intersection, so ist eines
- //davon ueberfluessig.
- //Um moeglichst viel zusammenzufassen und in der Folge
- //moeglichst wenig einzelne Paints zu haben darf die Flaeche
- //der Union ruhig ein bischen groesser sein
- //( 9622 * 141.5 = 1361513 ~= ein virtel Zentimeter ueber die
- // Breite einer DINA4 Seite)
+ // If two rectangles have the same area of their union minus the
+ // intersection then one of them can be deleted.
+ // For combining as much as possible (and for having less single
+ // paints), the area of the union can be a little bit larger:
+ // ( 9622 * 141.5 = 1361513 ~= a quarter (1/4) centimeter wider
+ // than the width of a A4 page
const long nFuzzy = bFuzzy ? 1361513 : 0;
- SwRect aUnion( *(pData + i) );aUnion.Union( *(pData + j) );
- SwRect aInter( *(pData + i) );aInter.Intersection( *(pData + j));
+ SwRect aUnion( *(pData + i) );
+ aUnion.Union( *(pData + j) );
+ SwRect aInter( *(pData + i) );
+ aInter.Intersection( *(pData + j));
if ( (::CalcArea( *(pData + i) ) +
::CalcArea( *(pData + j) ) + nFuzzy) >=
(::CalcArea( aUnion ) - CalcArea( aInter )) )
diff --git a/sw/source/core/bastyp/swtypes.cxx b/sw/source/core/bastyp/swtypes.cxx
index 27f687d10912..90bf03370237 100644
--- a/sw/source/core/bastyp/swtypes.cxx
+++ b/sw/source/core/bastyp/swtypes.cxx
@@ -26,7 +26,6 @@
*
************************************************************************/
-
#include "swtypes.hxx"
#include "tools/string.hxx"
#include <vcl/svapp.hxx>
@@ -56,8 +55,8 @@
using namespace com::sun::star;
-String aEmptyStr; // Konstante Strings
-String aDotStr('.'); // Konstante Strings
+String aEmptyStr; // constant string
+String aDotStr('.'); // constant string
IMPL_FIXEDMEMPOOL_NEWDEL( SwAttrSet )
IMPL_FIXEDMEMPOOL_NEWDEL( SwStartNode )
@@ -88,11 +87,10 @@ IMPL_FIXEDMEMPOOL_NEWDEL( SwTableLineFmt )
IMPL_FIXEDMEMPOOL_NEWDEL( SwTableBoxFmt )
IMPL_FIXEDMEMPOOL_NEWDEL( _SwCursor_SavePos )
-
Size GetGraphicSizeTwip( const Graphic& rGraphic, OutputDevice* pOutDev )
{
const MapMode aMapTwip( MAP_TWIP );
- Size aSize( rGraphic.GetPrefSize() );
+ Size aSize( rGraphic.GetPrefSize() );
if( MAP_PIXEL == rGraphic.GetPrefMapMode().GetMapUnit() )
{
if( !pOutDev )
@@ -100,34 +98,32 @@ Size GetGraphicSizeTwip( const Graphic& rGraphic, OutputDevice* pOutDev )
aSize = pOutDev->PixelToLogic( aSize, aMapTwip );
}
else
+ {
aSize = OutputDevice::LogicToLogic( aSize,
- rGraphic.GetPrefMapMode(), aMapTwip );
+ rGraphic.GetPrefMapMode(),
+ aMapTwip );
+ }
return aSize;
}
-
uno::Reference< linguistic2::XSpellChecker1 > GetSpellChecker()
{
return LinguMgr::GetSpellChecker();
}
-
uno::Reference< linguistic2::XHyphenator > GetHyphenator()
{
return LinguMgr::GetHyphenator();
}
-
uno::Reference< linguistic2::XThesaurus > GetThesaurus()
{
return LinguMgr::GetThesaurus();
}
-
uno::Reference< beans::XPropertySet > GetLinguPropertySet()
{
return LinguMgr::GetLinguPropertySet();
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/bastyp/tabcol.cxx b/sw/source/core/bastyp/tabcol.cxx
index 8986ac13ad3c..2042de011b73 100644
--- a/sw/source/core/bastyp/tabcol.cxx
+++ b/sw/source/core/bastyp/tabcol.cxx
@@ -26,11 +26,10 @@
*
************************************************************************/
-
#include <osl/diagnose.h>
#include "tabcol.hxx"
-#include <limits.h> //for LONG_MAX
+#include <limits.h>
SwTabCols::SwTabCols( sal_uInt16 nSize ) :
nLeftMin( 0 ),
@@ -59,10 +58,10 @@ SwTabCols::SwTabCols( const SwTabCols& rCpy ) :
(void) aEntry1;
(void) aEntry2;
OSL_ENSURE( aEntry1.nPos == aEntry2.nPos &&
- aEntry1.nMin == aEntry2.nMin &&
- aEntry1.nMax == aEntry2.nMax &&
- aEntry1.bHidden == aEntry2.bHidden,
- "CopyContructor of SwTabColsEntries did not succeed!" );
+ aEntry1.nMin == aEntry2.nMin &&
+ aEntry1.nMax == aEntry2.nMax &&
+ aEntry1.bHidden == aEntry2.bHidden,
+ "CopyContructor of SwTabColsEntries did not succeed!" );
}
#endif
}
@@ -97,14 +96,15 @@ sal_Bool SwTabCols::operator==( const SwTabCols& rCmp ) const
{
SwTabColsEntry aEntry1 = aData[i];
SwTabColsEntry aEntry2 = rCmp.GetData()[i];
- if ( aEntry1.nPos != aEntry2.nPos || aEntry1.bHidden != aEntry2.bHidden )
+ if ( aEntry1.nPos != aEntry2.nPos || aEntry1.bHidden != aEntry2.bHidden )
return sal_False;
}
return sal_True;
}
-void SwTabCols::Insert( long nValue, long nMin, long nMax, sal_Bool bValue, sal_uInt16 nPos )
+void SwTabCols::Insert( long nValue, long nMin, long nMax,
+ sal_Bool bValue, sal_uInt16 nPos )
{
SwTabColsEntry aEntry;
aEntry.nPos = nValue;