[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 7 commits - bridges/source sot/source svgio/source sw/inc sw/source tools/source vcl/source
Herbert Dürr
hdu at apache.org
Fri Mar 28 05:08:43 PDT 2014
bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx | 3
sot/source/sdstor/stgdir.cxx | 28 +++++-
sot/source/sdstor/stgdir.hxx | 6 +
svgio/source/svgreader/svgclippathnode.cxx | 78 +++++++++++++++---
sw/inc/tox.hxx | 20 ++--
sw/source/core/tox/tox.cxx | 73 +++++-----------
sw/source/filter/ww8/ww8par5.cxx | 28 +-----
sw/source/filter/ww8/ww8par6.cxx | 41 +++++----
sw/source/filter/ww8/ww8struc.hxx | 13 ++-
tools/source/generic/poly.cxx | 13 +++
vcl/source/gdi/dibtools.cxx | 24 +++++
11 files changed, 211 insertions(+), 116 deletions(-)
New commits:
commit 559b5f3876d1aed318a4b7d954150105501532ac
Author: Herbert Dürr <hdu at apache.org>
Date: Fri Mar 28 11:27:00 2014 +0000
#i124421# use OSL_ debug helpers instead of tools DBG_ stuff
diff --git a/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx b/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx
index baef65f..71126ff 100644
--- a/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/s5abi_macosx_x86-64/except.cxx
@@ -39,7 +39,6 @@
#include <rtl/ustrbuf.hxx>
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
-#include <tools/debug.hxx>
#include <com/sun/star/uno/genfunc.hxx>
#include "com/sun/star/uno/RuntimeException.hpp"
@@ -178,7 +177,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) SAL_THR
#if OSL_DEBUG_LEVEL >= 1
fprintf( stderr,"generated rtti for %s\n", rttiName );
const OString aCUnoName = OUStringToOString( unoName, RTL_TEXTENCODING_UTF8);
- DBG_WARNING1( "TypeInfo for \"%s\" not found and cannot be generated.\n", aCUnoName.getStr());
+ OSL_TRACE( "TypeInfo for \"%s\" not found and cannot be generated.\n", aCUnoName.getStr());
#endif
#if 0 // TODO: enable it again when the generated class_type_infos always work.
// Forcing the toolchain to create authentic typeinfos is much better though
commit 174563afe231755e76cf5ea6a10292853814b6e9
Author: Jürgen Schmidt <jsc at apache.org>
Date: Fri Mar 28 11:25:38 2014 +0000
#124461# merge from aoo410 branch, add checks for nested depth and entry indices
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index d0cf28e..e08281c 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -827,7 +827,7 @@ StgDirStrm::StgDirStrm( StgIo& r )
// temporarily use this instance as owner, so
// the TOC pages can be removed.
pEntry = (StgDirEntry*) this; // just for a bit pattern
- SetupEntry( 0, pRoot );
+ SetupEntry(0, pRoot, nSize/STGENTRY_SIZE, 0);
rIo.Revert( pEntry );
pEntry = NULL;
}
@@ -840,8 +840,26 @@ StgDirStrm::~StgDirStrm()
// Recursively parse the directory tree during reading the TOC stream
-void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
+void StgDirStrm::SetupEntry (
+ const sal_Int32 n,
+ StgDirEntry* pUpper,
+ const sal_Int32 nEntryCount,
+ const sal_Int32 nDepth)
{
+ if (nDepth >= nEntryCount)
+ {
+ // Tree grew higher than there are different nodes. Looks like
+ // something is wrong with the file. Return now to avoid
+ // infinite recursion.
+ return;
+ }
+ else if (n>=nEntryCount || (n<0 && n!=STG_FREE))
+ {
+ // n has an invalid value. Don't access the corresponding
+ // stream content.
+ return;
+ }
+
void* p = ( n == STG_FREE ) ? NULL : GetEntry( n );
if( p )
{
@@ -889,9 +907,9 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
delete pCur; pCur = NULL;
return;
}
- SetupEntry( nLeft, pUpper );
- SetupEntry( nRight, pUpper );
- SetupEntry( nLeaf, pCur );
+ SetupEntry( nLeft, pUpper, nEntryCount, nDepth+1);
+ SetupEntry( nRight, pUpper, nEntryCount, nDepth+1);
+ SetupEntry( nLeaf, pCur, nEntryCount, nDepth+1);
}
}
}
diff --git a/sot/source/sdstor/stgdir.hxx b/sot/source/sdstor/stgdir.hxx
index daf2f4b..11f0310 100644
--- a/sot/source/sdstor/stgdir.hxx
+++ b/sot/source/sdstor/stgdir.hxx
@@ -100,7 +100,11 @@ class StgDirStrm : public StgDataStrm
friend class StgIterator;
StgDirEntry* pRoot; // root of dir tree
short nEntries; // entries per page
- void SetupEntry( sal_Int32, StgDirEntry* );
+ void SetupEntry(
+ const sal_Int32 n,
+ StgDirEntry* pUpper,
+ const sal_Int32 nEntryCount,
+ const sal_Int32 nDepth);
public:
StgDirStrm( StgIo& );
~StgDirStrm();
commit 52c89c2aff23dbb875c9a86021145b30af463908
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Fri Mar 28 11:13:57 2014 +0000
124451: WW8 import: apply correct index entry template patterns which are used for e.g. TOC
diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 8955935..6ca8d3b 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -382,10 +382,8 @@ public:
void SetPattern(sal_uInt16 nLevel, const String& rStr);
const SwFormTokens& GetPattern(sal_uInt16 nLevel) const;
- // fill tab stop positions from template to pattern
- // #i21237#
- void AdjustTabStops(SwDoc& rDoc,
- sal_Bool bInsertNewTabStops = sal_False);
+ // fill tab stop positions from template to pattern- #i21237#
+ void AdjustTabStops( SwDoc& rDoc );
inline TOXTypes GetTOXType() const;
inline sal_uInt16 GetFormMax() const;
@@ -601,9 +599,14 @@ public:
const String& GetSortAlgorithm()const {return sSortAlgorithm;}
void SetSortAlgorithm(const String& rSet) {sSortAlgorithm = rSet;}
+
// #i21237#
- void AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop);
- SwTOXBase& operator=(const SwTOXBase& rSource);
+ inline void AdjustTabStops( SwDoc & rDoc )
+ {
+ aForm.AdjustTabStops( rDoc );
+ }
+
+ SwTOXBase& operator=(const SwTOXBase& rSource);
void RegisterToTOXType( SwTOXType& rMark );
};
@@ -754,11 +757,6 @@ inline const String& SwTOXBase::GetTypeName() const
inline const SwForm& SwTOXBase::GetTOXForm() const
{ return aForm; }
-inline void SwTOXBase::AdjustTabStops(SwDoc & rDoc, sal_Bool bDefaultRightTabStop)
-{
- aForm.AdjustTabStops(rDoc, bDefaultRightTabStop);
-}
-
inline void SwTOXBase::SetCreate(sal_uInt16 nCreate)
{ nCreateType = nCreate; }
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index c9e0820..05d42c3 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -428,78 +428,53 @@ bool operator == (const SwFormToken & rToken, FormTokenType eType)
}
//-----------------------------------------------------------------------------
-void SwForm::AdjustTabStops(SwDoc& rDoc, sal_Bool bInsertNewTapStops) // #i21237#
+void SwForm::AdjustTabStops( SwDoc& rDoc ) // #i21237#
{
for(sal_uInt16 nLevel = 1; nLevel < GetFormMax(); nLevel++)
{
const String& sTemplateName = GetTemplate(nLevel);
SwTxtFmtColl* pColl = rDoc.FindTxtFmtCollByName( sTemplateName );
- if( !pColl )
+ if( pColl == NULL )
{
- sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName
- ( sTemplateName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ); // #i21237#
- if( USHRT_MAX != nId )
+ const sal_uInt16 nId =
+ SwStyleNameMapper::GetPoolIdFromUIName( sTemplateName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if ( USHRT_MAX != nId )
pColl = rDoc.GetTxtCollFromPool( nId );
}
- const SvxTabStopItem* pTabStops = 0;
- sal_uInt16 nTabCount = 0;
- if( pColl &&
- 0 != ( pTabStops = &pColl->GetTabStops(sal_False) ) &&
- 0 != ( nTabCount = pTabStops->Count() ) )
+ const SvxTabStopItem* pTabStops = pColl != NULL ? &pColl->GetTabStops(sal_False) : 0;
+ const sal_uInt16 nTabCount = pTabStops != NULL ? pTabStops->Count() : 0;
+ if( pTabStops != NULL
+ && nTabCount != 0 )
{
- // #i21237#
SwFormTokens aCurrentPattern = GetPattern(nLevel);
SwFormTokens::iterator aIt = aCurrentPattern.begin();
- sal_Bool bChanged = sal_False;
-
+ bool bChanged = false;
for(sal_uInt16 nTab = 0; nTab < nTabCount; ++nTab)
{
const SvxTabStop& rTab = (*pTabStops)[nTab];
- // --> FME 2004-12-16 #i29178#
- // For Word import, we do not want to replace exising tokens,
- // we insert new tabstop tokens without a tabstop character:
- if ( bInsertNewTapStops )
+ aIt = find_if( aIt, aCurrentPattern.end(), SwFormTokenEqualToFormTokenType(TOKEN_TAB_STOP) );
+ if ( aIt != aCurrentPattern.end() )
{
- if ( SVX_TAB_ADJUST_DEFAULT != rTab.GetAdjustment() )
- {
- bChanged = sal_True;
- SwFormToken aToken(TOKEN_TAB_STOP);
- aToken.bWithTab = sal_False;
- aToken.nTabStopPosition = rTab.GetTabPos();
- aToken.eTabAlign = rTab.GetAdjustment();
- aToken.cTabFillChar = rTab.GetFill();
- aCurrentPattern.push_back(aToken);
- }
+ bChanged = true;
+ aIt->nTabStopPosition = rTab.GetTabPos();
+ aIt->eTabAlign =
+ ( nTab == nTabCount - 1
+ && rTab.GetAdjustment() == SVX_TAB_ADJUST_RIGHT )
+ ? SVX_TAB_ADJUST_END
+ : rTab.GetAdjustment();
+ aIt->cTabFillChar = rTab.GetFill();
+ ++aIt;
}
- // <--
else
- {
- aIt = find_if(aIt, aCurrentPattern.end(),
- SwFormTokenEqualToFormTokenType
- (TOKEN_TAB_STOP));
- if ( aIt != aCurrentPattern.end() )
- {
- bChanged = sal_True;
- aIt->nTabStopPosition = rTab.GetTabPos();
- aIt->eTabAlign = nTab == nTabCount - 1 &&
- SVX_TAB_ADJUST_RIGHT == rTab.GetAdjustment() ?
- SVX_TAB_ADJUST_END :
- rTab.GetAdjustment();
- aIt->cTabFillChar = rTab.GetFill();
- ++aIt;
- }
- else
- break; // no more tokens to replace
- }
+ break; // no more tokens to replace
}
- // <--
- if(bChanged)
- SetPattern(nLevel, aCurrentPattern); // #i21237#
+ if ( bChanged )
+ SetPattern( nLevel, aCurrentPattern );
}
}
}
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index cad23eb..9316895 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -3446,16 +3446,11 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
for(sal_uInt16 nLevel = 1; nLevel <= nEnd; ++nLevel)
{
SwFormTokens aPattern = aOldForm.GetPattern(nLevel);
-
- SwFormTokens::iterator new_end=remove_if(aPattern.begin(), aPattern.end(),
- SwFormTokenEqualToFormTokenType(TOKEN_ENTRY_NO));
-
- aPattern.erase (new_end, aPattern.end() ); // #124710#: table index imported with wrong page number format
-
- aForm.SetPattern(nLevel, aPattern);
-
- aForm.SetTemplate( nLevel,
- aOldForm.GetTemplate(nLevel));
+ SwFormTokens::iterator new_end =
+ remove_if(aPattern.begin(), aPattern.end(), SwFormTokenEqualToFormTokenType(TOKEN_ENTRY_NO));
+ aPattern.erase(new_end, aPattern.end() ); // #124710#: table index imported with wrong page number format
+ aForm.SetPattern( nLevel, aPattern );
+ aForm.SetTemplate( nLevel, aOldForm.GetTemplate(nLevel) );
}
// <- #i21237#
@@ -3475,17 +3470,10 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, String& rStr )
break;
} // ToxBase fertig
- // no Update of TOC anymore as its actual content is imported and kept.
- //rDoc.SetUpdateTOX(true);
-
- // #i21237#
- // propagate tab stops from paragraph styles used in TOX to
- // patterns of the TOX
- pBase->AdjustTabStops(rDoc, sal_True);
-
- //#i10028# inserting a toc implicltly acts like a parabreak
- //in word and writer
+ // #i21237# - propagate tab stops from paragraph styles used in TOX to patterns of the TOX
+ pBase->AdjustTabStops( rDoc );
+ //#i10028# inserting a toc implicltly acts like a parabreak in word and writer
if ( pPaM->End() &&
pPaM->End()->nNode.GetNode().GetTxtNode() &&
pPaM->End()->nNode.GetNode().GetTxtNode()->Len() != 0 )
commit 9ceda6fa56d31af717cc2c0c7572cf53cdc47af1
Author: Jürgen Schmidt <jsc at apache.org>
Date: Fri Mar 28 10:56:13 2014 +0000
#124467# merge from aoo410 branch, add check for image data offset against stream length, some further checks
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 2e7d698..3aa5df4 100755
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -390,7 +390,11 @@ void ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& rHeader, BitmapWriteAccess&
bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& rAcc, BitmapWriteAccess* pAccAlpha, bool bTopDown, bool& rAlphaUsed)
{
- const sal_uLong nAlignedWidth = AlignedWidth4Bytes(rHeader.nWidth * rHeader.nBitCount);
+ const sal_Int64 nBitsPerLine (static_cast<sal_Int64>(rHeader.nWidth) * static_cast<sal_Int64>(rHeader.nBitCount));
+ if (nBitsPerLine > SAL_MAX_UINT32)
+ return false;
+
+ const sal_uLong nAlignedWidth = AlignedWidth4Bytes(static_cast<sal_uLong>(nBitsPerLine));
sal_uInt32 nRMask(( rHeader.nBitCount == 16 ) ? 0x00007c00UL : 0x00ff0000UL);
sal_uInt32 nGMask(( rHeader.nBitCount == 16 ) ? 0x000003e0UL : 0x0000ff00UL);
sal_uInt32 nBMask(( rHeader.nBitCount == 16 ) ? 0x0000001fUL : 0x000000ffUL);
@@ -616,6 +620,13 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon
if(ImplReadDIBInfoHeader(rIStm, aHeader, bTopDown) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount)
{
+ if (aHeader.nSize > nOffset)
+ {
+ // Header size claims to extend into the image data.
+ // Looks like an error.
+ return false;
+ }
+
const sal_uInt16 nBitCount(discretizeBitcount(aHeader.nBitCount));
const Size aSizePixel(aHeader.nWidth, aHeader.nHeight);
BitmapPalette aDummyPal;
@@ -768,6 +779,9 @@ bool ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset )
sal_uInt16 nTmp16 = 0;
bool bRet = false;
+ const sal_Int64 nStreamLength (rIStm.Seek(STREAM_SEEK_TO_END));
+ rIStm.Seek(STREAM_SEEK_TO_BEGIN);
+
rIStm >> nTmp16;
if ( ( 0x4D42 == nTmp16 ) || ( 0x4142 == nTmp16 ) )
@@ -788,6 +802,14 @@ bool ImplReadDIBFileHeader( SvStream& rIStm, sal_uLong& rOffset )
rOffset = nTmp32 - 14UL; // adapt offset by sizeof(BITMAPFILEHEADER)
bRet = ( rIStm.GetError() == 0UL );
}
+
+ if (rOffset >= nStreamLength)
+ {
+ // Offset claims that image starts past the end of the
+ // stream. Unlikely.
+ rIStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ bRet = false;
+ }
}
else
rIStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
commit 804e547d70552fd64e1344d538427f8898824b43
Author: Jürgen Schmidt <jsc at apache.org>
Date: Fri Mar 28 10:52:29 2014 +0000
#124453# merge from aoo410 branch, check if the resulting polygon has already exceeded the number of points (2^16) that can be handled by a tools polygon
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 7f2772e..4bf0064 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1076,6 +1076,19 @@ void Polygon::AdaptiveSubdivide( Polygon& rResult, const double d ) const
}
*aPointIter++ = mpImplPolygon->mpPointAry[ i++ ];
+
+ if (aPoints.size() >= SAL_MAX_UINT16)
+ {
+ OSL_ENSURE(aPoints.size() < SAL_MAX_UINT16,
+ "Polygon::AdapativeSubdivision created polygon too many points;"
+ " using original polygon instead");
+
+ // The resulting polygon can not hold all the points
+ // that we have created so far. Stop the subdivision
+ // and return a copy of the unmodified polygon.
+ rResult = *this;
+ return;
+ }
}
// fill result polygon
commit 32d9f959cf3f133b9257c066a979848a967f7081
Author: Jürgen Schmidt <jsc at apache.org>
Date: Fri Mar 28 10:45:27 2014 +0000
#124468# merge from aoo410 branch, add checks for the read numbers of column for a section
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 2329ea9..50073fb 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -921,7 +921,14 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
// sprmSFBiDi
aNewSection.maSep.fBiDi = eVer >= ww::eWW8 ? ReadBSprm(pSep, 0x3228, 0) : 0;
+ // Reading section property sprmSCcolumns - one less than the number of columns in the section.
+ // It must be less than MAX_NO_OF_SEP_COLUMNS according the WW8 specification.
aNewSection.maSep.ccolM1 = ReadSprm(pSep, pIds[3], 0 );
+ if ( aNewSection.maSep.ccolM1 >= MAX_NO_OF_SEP_COLUMNS )
+ {
+ // fallback to one column
+ aNewSection.maSep.ccolM1 = 0;
+ }
//sprmSDxaColumns - Default-Abstand 1.25 cm
aNewSection.maSep.dxaColumns = ReadUSprm( pSep, pIds[4], 708 );
@@ -932,34 +939,36 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
if (eVer >= ww::eWW6)
{
// sprmSFEvenlySpaced
- aNewSection.maSep.fEvenlySpaced =
- ReadBSprm(pSep, (eVer <= ww::eWW7 ? 138 : 0x3005), 1) ? true : false;
+ aNewSection.maSep.fEvenlySpaced = ReadBSprm( pSep, ( eVer <= ww::eWW7 ? 138 : 0x3005 ), 1 ) ? true : false;
- if (aNewSection.maSep.ccolM1 > 0 && !aNewSection.maSep.fEvenlySpaced)
+ if ( aNewSection.maSep.ccolM1 > 0 && !aNewSection.maSep.fEvenlySpaced )
{
- aNewSection.maSep.rgdxaColumnWidthSpacing[0] = 0;
- int nCols = aNewSection.maSep.ccolM1 + 1;
- int nIdx = 0;
- for (int i = 0; i < nCols; ++i)
+ int nColumnDataIdx = 0;
+ aNewSection.maSep.rgdxaColumnWidthSpacing[nColumnDataIdx] = 0;
+
+ const sal_uInt16 nColumnWidthSprmId = ( eVer <= ww::eWW7 ? 136 : 0xF203 );
+ const sal_uInt16 nColumnSpacingSprmId = ( eVer <= ww::eWW7 ? 137 : 0xF204 );
+ const sal_uInt8 nColumnCount = static_cast< sal_uInt8 >(aNewSection.maSep.ccolM1 + 1);
+ for ( sal_uInt8 nColumn = 0; nColumn < nColumnCount; ++nColumn )
{
//sprmSDxaColWidth
- const sal_uInt8* pSW = pSep->HasSprm( (eVer <= ww::eWW7 ? 136 : 0xF203), sal_uInt8( i ) );
+ const sal_uInt8* pSW = pSep->HasSprm( nColumnWidthSprmId, nColumn );
- ASSERT( pSW, "+Sprm 136 (bzw. 0xF203) (ColWidth) fehlt" );
- sal_uInt16 nWidth = pSW ? SVBT16ToShort(pSW + 1) : 1440;
+ ASSERT( pSW != NULL, "+Sprm 136 (bzw. 0xF203) (ColWidth) fehlt" );
+ sal_uInt16 nWidth = pSW != NULL ? SVBT16ToShort( pSW + 1 ) : 1440;
- aNewSection.maSep.rgdxaColumnWidthSpacing[++nIdx] = nWidth;
+ aNewSection.maSep.rgdxaColumnWidthSpacing[++nColumnDataIdx] = nWidth;
- if (i < nCols-1)
+ if ( nColumn < nColumnCount - 1 )
{
//sprmSDxaColSpacing
- const sal_uInt8* pSD = pSep->HasSprm( (eVer <= ww::eWW7 ? 137 : 0xF204), sal_uInt8( i ) );
+ const sal_uInt8* pSD = pSep->HasSprm( nColumnSpacingSprmId, nColumn );
ASSERT( pSD, "+Sprm 137 (bzw. 0xF204) (Colspacing) fehlt" );
- if( pSD )
+ if ( pSD )
{
- nWidth = SVBT16ToShort(pSD + 1);
- aNewSection.maSep.rgdxaColumnWidthSpacing[++nIdx] = nWidth;
+ nWidth = SVBT16ToShort( pSD + 1 );
+ aNewSection.maSep.rgdxaColumnWidthSpacing[++nColumnDataIdx] = nWidth;
}
}
}
diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx
index 83f78f5..0f3b5a1 100644
--- a/sw/source/filter/ww8/ww8struc.hxx
+++ b/sw/source/filter/ww8/ww8struc.hxx
@@ -967,6 +967,9 @@ struct WW8_WKB
# pragma pack()
#endif
+// Maximum number of columns according the WW8 specification
+static const sal_uInt8 MAX_NO_OF_SEP_COLUMNS = 44;
+
struct SEPr
{
SEPr();
@@ -1026,7 +1029,7 @@ struct SEPr
sal_uInt32 dzaGutter;
sal_uInt32 dyaHdrTop;
sal_uInt32 dyaHdrBottom;
- sal_Int16 ccolM1;
+ sal_Int16 ccolM1; // have to be less than MAX_NO_OF_SEP_COLUMNS according the WW8 specification
sal_Int8 fEvenlySpaced;
sal_Int8 reserved3;
sal_uInt8 fBiDi;
@@ -1034,7 +1037,13 @@ struct SEPr
sal_uInt8 fRTLGutter;
sal_uInt8 fRTLAlignment;
sal_Int32 dxaColumns;
- sal_Int32 rgdxaColumnWidthSpacing[89];
+
+ // Fixed array - two entries for each SEP column to store width of column and spacing to next column.
+ // At odd index values [1,3,5,...] the column widths are stored.
+ // At even index values [2,4,6,...] the spacings to the next columns are stored.
+ // Value at index 0 is initialized with 0 and used for easier interation on the array
+ sal_Int32 rgdxaColumnWidthSpacing[MAX_NO_OF_SEP_COLUMNS*2 + 1];
+
sal_Int32 dxaColumnWidth;
sal_uInt8 dmOrientFirst;
sal_uInt8 fLayout;
commit 6dc64444a42997bb4e1ab38f52e4978719e0275a
Author: Armin Le Grand <alg at apache.org>
Date: Fri Mar 28 10:42:39 2014 +0000
i124313 At SVG import, try to optimize used CLipRegions
diff --git a/svgio/source/svgreader/svgclippathnode.cxx b/svgio/source/svgreader/svgclippathnode.cxx
index a242f67..4e795ff 100644
--- a/svgio/source/svgreader/svgclippathnode.cxx
+++ b/svgio/source/svgreader/svgclippathnode.cxx
@@ -29,6 +29,7 @@
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/processor2d/contourextractor2d.hxx>
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -179,16 +180,75 @@ namespace svgio
aContentRange.getMinimum()));
}
- // redefine target. Use MaskPrimitive2D with created clip
- // geometry. Using the automatically set mbIsClipPathContent at
- // SvgStyleAttributes the clip definition is without fill, stroke,
- // and strokeWidth and forced to black
- const drawinglayer::primitive2d::Primitive2DReference xEmbedTransparence(
- new drawinglayer::primitive2d::MaskPrimitive2D(
- aClipPolyPolygon,
- rContent));
+ // #124313# try to avoid creating an embedding to a MaskPrimitive2D if
+ // possible; MaskPrimitive2D processing is potentially expensive
+ bool bCreateEmbedding(true);
+ bool bAddContent(true);
- rContent = drawinglayer::primitive2d::Primitive2DSequence(&xEmbedTransparence, 1);
+ if(basegfx::tools::isRectangle(aClipPolyPolygon))
+ {
+ // ClipRegion is a rectangle, thus it is not expensive to tell
+ // if the content is completely inside or outside of it; get ranges
+ const basegfx::B2DRange aClipRange(aClipPolyPolygon.getB2DRange());
+ const basegfx::B2DRange aContentRange(
+ drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(
+ rContent,
+ aViewInformation2D));
+
+ if(aClipRange.isInside(aContentRange))
+ {
+ // completely contained, no need to clip at all, so no need for embedding
+ bCreateEmbedding = false;
+ }
+ else if(aClipRange.overlaps(aContentRange))
+ {
+ // overlap; embedding needed. ClipRegion can be minimized by using
+ // the intersection of the ClipRange and the ContentRange. Minimizing
+ // the ClipRegion potentially enhances further processing since
+ // usually clip operations are expensive.
+ basegfx::B2DRange aCommonRange(aContentRange);
+
+ aCommonRange.intersect(aClipRange);
+ aClipPolyPolygon = basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(aCommonRange));
+ }
+ else
+ {
+ // not inside and no overlap -> completely outside
+ // no need for embedding, no need for content at all
+ bCreateEmbedding = false;
+ bAddContent = false;
+ }
+ }
+ else
+ {
+ // ClipRegion is not a simple rectangle, it would be possible but expensive to
+ // tell if the content needs clipping or not. It is also dependent of
+ // the content's decomposition. To do this, a processor would be needed that
+ // is capable if processing the given sequence of primitives and decide
+ // if all is inside or all is outside. Such a ClipProcessor could be written,
+ // but for now just create the embedding
+ }
+
+ if(bCreateEmbedding)
+ {
+ // redefine target. Use MaskPrimitive2D with created clip
+ // geometry. Using the automatically set mbIsClipPathContent at
+ // SvgStyleAttributes the clip definition is without fill, stroke,
+ // and strokeWidth and forced to black
+ const drawinglayer::primitive2d::Primitive2DReference xEmbedTransparence(
+ new drawinglayer::primitive2d::MaskPrimitive2D(
+ aClipPolyPolygon,
+ rContent));
+
+ rContent = drawinglayer::primitive2d::Primitive2DSequence(&xEmbedTransparence, 1);
+ }
+ else
+ {
+ if(!bAddContent)
+ {
+ rContent.realloc(0);
+ }
+ }
}
else
{
More information about the Libreoffice-commits
mailing list