[Libreoffice-commits] core.git: 5 commits - svtools/source sw/inc sw/source vcl/source
Caolán McNamara
caolanm at redhat.com
Wed Feb 19 14:06:47 CET 2014
svtools/source/brwbox/datwin.cxx | 3 +
svtools/source/contnr/templwin.cxx | 3 -
svtools/source/svhtml/parhtml.cxx | 1
sw/inc/IDocumentContentOperations.hxx | 2
sw/inc/doc.hxx | 5 +
sw/source/core/doc/doclay.cxx | 94 ++++++++++++++++++----------------
sw/source/core/frmedt/fecopy.cxx | 7 +-
sw/source/core/frmedt/fefly1.cxx | 2
sw/source/core/unocore/unodraw.cxx | 2
sw/source/filter/html/htmldraw.cxx | 2
sw/source/filter/ww8/ww8graf.cxx | 4 -
sw/source/filter/ww8/ww8graf2.cxx | 2
sw/source/filter/ww8/ww8par4.cxx | 2
vcl/source/filter/wmf/winmtf.hxx | 13 ++--
14 files changed, 79 insertions(+), 63 deletions(-)
New commits:
commit 14a502e4988574e4c56d2653d2170e1b14576d4d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Feb 19 12:54:17 2014 +0000
coverity#738857 Uninitialized scalar field
Change-Id: Ic82e559e9b7ca31fa6d9b5ff1d1fc5ae3fac9b88
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index 5c6c288..5d81568 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -197,7 +197,10 @@ BrowserDataWin::BrowserDataWin( BrowseBox* pParent )
,bNoScrollBack( false )
,bNoHScroll( false )
,bNoVScroll( false )
+ ,bAutoHScroll(false)
+ ,bAutoVScroll(false)
,bUpdateMode( true )
+ ,bAutoSizeLastCol(false)
,bResizeOnPaint( false )
,bUpdateOnUnlock( false )
,bInUpdateScrollbars( false )
commit b0e1a3f962adbf4e0f127b3102b88e04f2f3d9de
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Feb 19 12:42:17 2014 +0000
coverity#738860 Uninitialized scalar field
Change-Id: I968c9f10d426b90e6883e7a0ff1387187d97dcd2
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx
index 41e2f51..8674c24 100644
--- a/svtools/source/contnr/templwin.cxx
+++ b/svtools/source/contnr/templwin.cxx
@@ -586,7 +586,8 @@ OUString SvtDocInfoTable_Impl::GetString( long nId ) const
// class SvtFrameWindow_Impl ---------------------------------------------
SvtFrameWindow_Impl::SvtFrameWindow_Impl( Window* pParent )
- : Window( pParent )
+ : Window(pParent)
+ , bDocInfo(false)
{
// create windows and frame
pEditWin = new ODocumentInfoPreview( this ,WB_LEFT | WB_VSCROLL | WB_READONLY | WB_BORDER | WB_3DLOOK);
commit 2b2a3ed37358cab49933a218c8a8544be03fba22
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Feb 19 12:41:22 2014 +0000
coverity#738862 Uninitialized scalar field
Change-Id: Ib970ef372e7754db890b5a4cd9c9b422a129ba02
diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx
index e094c54..c200907 100644
--- a/vcl/source/filter/wmf/winmtf.hxx
+++ b/vcl/source/filter/wmf/winmtf.hxx
@@ -337,18 +337,18 @@ typedef enum {
struct WinMtfFillStyle
{
Color aFillColor;
- sal_Bool bTransparent;
+ bool bTransparent;
WinMtfFillStyleType aType;
Bitmap aBmp;
WinMtfFillStyle()
: aFillColor(Color(COL_BLACK))
- , bTransparent(sal_False)
+ , bTransparent(false)
, aType(FillStyleSolid)
{
}
- WinMtfFillStyle( const Color& rColor, sal_Bool bTrans = sal_False )
+ WinMtfFillStyle(const Color& rColor, bool bTrans = false)
: aFillColor(rColor)
, bTransparent(bTrans)
, aType(FillStyleSolid)
@@ -356,19 +356,20 @@ struct WinMtfFillStyle
}
WinMtfFillStyle(Bitmap& rBmp)
- : aType(FillStylePattern)
+ : bTransparent(false)
+ , aType(FillStylePattern)
, aBmp(rBmp)
{
}
- sal_Bool operator==( const WinMtfFillStyle& rStyle )
+ bool operator==( const WinMtfFillStyle& rStyle )
{
return ( ( aFillColor == rStyle.aFillColor )
&& ( bTransparent == rStyle.bTransparent )
&& ( aType == rStyle.aType )
);
}
- sal_Bool operator==( WinMtfFillStyle* pStyle )
+ bool operator==( WinMtfFillStyle* pStyle )
{
return ( ( aFillColor == pStyle->aFillColor )
&& ( bTransparent == pStyle->bTransparent )
commit 85f48b1b47903b41ebaa4b432e756833a5e92e45
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Feb 19 12:38:35 2014 +0000
coverity#738865 Uninitialized scalar field
Change-Id: Ie6473e4a8c4b311b6862019046fb4ae9cf05e1fb
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 942e881..6517e5c 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -296,6 +296,7 @@ HTMLParser::HTMLParser( SvStream& rIn, bool bReadNewDoc ) :
bPre_IgnoreNewPara(false),
bReadNextChar(false),
bReadComment(false),
+ nPre_LinePos(0),
mnPendingOffToken(0)
{
//#i76649, default to UTF-8 for HTML unless we know differently
commit 58e7439c396ba8d449e32db9afd8f3f71acc071b
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Tue Feb 18 11:47:13 2014 +0000
Resolves: #i124188# assure correct insertion of text attribute...
for as-character anchored drawing objects
Thx to Andre for his deep analysis.
(cherry picked from commit 28c0c081d07e5a49ccd238e7f4e882347ab3690c)
Conflicts:
sw/source/core/doc/doclay.cxx
sw/source/core/frmedt/fecopy.cxx
sw/source/filter/rtf/swparrtf.cxx
Change-Id: I73c4d3d6e3cd8e7079fe88b6baa5eaea52a89dd9
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx
index 7fd45f7..5768460 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -125,7 +125,7 @@ public:
/** Insert a DrawObject. The object must be already registered
in DrawModel.
*/
- virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*) = 0;
+ virtual SwDrawFrmFmt* InsertDrawObj( const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet ) = 0;
/** Insert OLE-objects.
*/
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index e0eec09..995f2ea 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -877,7 +877,10 @@ public:
const SfxItemSet* pFlyAttrSet, const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
virtual SwFlyFrmFmt* Insert(const SwPaM& rRg, const GraphicObject& rGrfObj, const SfxItemSet* pFlyAttrSet,
const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
- virtual SwDrawFrmFmt* Insert(const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet* pFlyAttrSet, SwFrmFmt*);
+ virtual SwDrawFrmFmt* InsertDrawObj(
+ const SwPaM &rRg,
+ SdrObject& rDrawObj,
+ const SfxItemSet& rFlyAttrSet );
virtual SwFlyFrmFmt* Insert(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet,
const SfxItemSet* pGrfAttrSet, SwFrmFmt*);
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index f5e793b..f7e1bf9 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -854,57 +854,52 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
return pFmt;
}
-/// Insert a DrawObject.
-/// The Object has to be already registered in the DrawModel.
-SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg,
- SdrObject& rDrawObj,
- const SfxItemSet* pFlyAttrSet,
- SwFrmFmt* pDefFmt )
+
+// Insert drawing object, which has to be already inserted in the DrawModel
+SwDrawFrmFmt* SwDoc::InsertDrawObj(
+ const SwPaM &rRg,
+ SdrObject& rDrawObj,
+ const SfxItemSet& rFlyAttrSet )
{
- SwDrawFrmFmt *pFmt = MakeDrawFrmFmt( OUString(),
- pDefFmt ? pDefFmt : GetDfltFrmFmt() );
+ SwDrawFrmFmt* pFmt = MakeDrawFrmFmt( OUString(), GetDfltFrmFmt() );
const SwFmtAnchor* pAnchor = 0;
- if( pFlyAttrSet )
- {
- pFlyAttrSet->GetItemState( RES_ANCHOR, sal_False,
- (const SfxPoolItem**)&pAnchor );
- pFmt->SetFmtAttr( *pFlyAttrSet );
- }
-
- RndStdIds eAnchorId = pAnchor ? pAnchor->GetAnchorId()
- : pFmt->GetAnchor().GetAnchorId();
+ rFlyAttrSet.GetItemState( RES_ANCHOR, sal_False, (const SfxPoolItem**) &pAnchor );
+ pFmt->SetFmtAttr( rFlyAttrSet );
// Didn't set the Anchor yet?
// DrawObjecte must never end up in the Header/Footer!
+ RndStdIds eAnchorId = pAnchor != NULL ? pAnchor->GetAnchorId() : pFmt->GetAnchor().GetAnchorId();
const bool bIsAtCntnt = (FLY_AT_PAGE != eAnchorId);
const SwNodeIndex* pChkIdx = 0;
- if( !pAnchor )
+ if ( pAnchor == NULL )
{
pChkIdx = &rRg.GetPoint()->nNode;
}
- else if( bIsAtCntnt )
+ else if ( bIsAtCntnt )
{
- pChkIdx = pAnchor->GetCntntAnchor()
- ? &pAnchor->GetCntntAnchor()->nNode
- : &rRg.GetPoint()->nNode;
+ pChkIdx =
+ pAnchor->GetCntntAnchor() ? &pAnchor->GetCntntAnchor()->nNode : &rRg.GetPoint()->nNode;
}
- // Allow drawing objects in header/footer, but control objects aren't
- // allowed in header/footer.
- if( pChkIdx &&
- ::CheckControlLayer( &rDrawObj ) &&
- IsInHeaderFooter( *pChkIdx ) )
+ // allow drawing objects in header/footer, but control objects aren't allowed in header/footer.
+ if( pChkIdx != NULL
+ && ::CheckControlLayer( &rDrawObj )
+ && IsInHeaderFooter( *pChkIdx ) )
{
- pFmt->SetFmtAttr( SwFmtAnchor( eAnchorId = FLY_AT_PAGE ) );
+ // apply at-page anchor format
+ eAnchorId = FLY_AT_PAGE;
+ pFmt->SetFmtAttr( SwFmtAnchor( eAnchorId ) );
}
- else if( !pAnchor || (bIsAtCntnt && !pAnchor->GetCntntAnchor() ))
+ else if( pAnchor == NULL
+ || ( bIsAtCntnt
+ && pAnchor->GetCntntAnchor() == NULL ) )
{
- // then set it, we need this in the Undo
- SwFmtAnchor aAnch( pAnchor ? *pAnchor : pFmt->GetAnchor() );
+ // apply anchor format
+ SwFmtAnchor aAnch( pAnchor != NULL ? *pAnchor : pFmt->GetAnchor() );
eAnchorId = aAnch.GetAnchorId();
- if( FLY_AT_FLY == eAnchorId )
+ if ( eAnchorId == FLY_AT_FLY )
{
SwPosition aPos( *rRg.GetNode()->FindFlyStartNode() );
aAnch.SetAnchor( &aPos );
@@ -912,25 +907,37 @@ SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg,
else
{
aAnch.SetAnchor( rRg.GetPoint() );
- if ( FLY_AT_PAGE == eAnchorId )
+ if ( eAnchorId == FLY_AT_PAGE )
{
- eAnchorId = rDrawObj.ISA( SdrUnoObj )
- ? FLY_AS_CHAR : FLY_AT_PARA;
+ eAnchorId = rDrawObj.ISA( SdrUnoObj ) ? FLY_AS_CHAR : FLY_AT_PARA;
aAnch.SetType( eAnchorId );
}
}
pFmt->SetFmtAttr( aAnch );
}
- // For Draws anchored as character we set the attribute in the paragraph
- if ( FLY_AS_CHAR == eAnchorId )
+ // insert text attribute for as-character anchored drawing object
+ if ( eAnchorId == FLY_AS_CHAR )
{
- const sal_Int32 nStt = rRg.GetPoint()->nContent.GetIndex();
- SwFmtFlyCnt aFmt( pFmt );
- // may fail if there's no space left
- if (!rRg.GetPoint()->nNode.GetNode().GetTxtNode()->InsertItem(aFmt, nStt, nStt))
- { // pFmt is dead now
- return 0;
+ bool bAnchorAtPageAsFallback = true;
+ const SwFmtAnchor& rDrawObjAnchorFmt = pFmt->GetAnchor();
+ if ( rDrawObjAnchorFmt.GetCntntAnchor() != NULL )
+ {
+ SwTxtNode* pAnchorTxtNode =
+ rDrawObjAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetTxtNode();
+ if ( pAnchorTxtNode != NULL )
+ {
+ const sal_Int32 nStt = rDrawObjAnchorFmt.GetCntntAnchor()->nContent.GetIndex();
+ SwFmtFlyCnt aFmt( pFmt );
+ pAnchorTxtNode->InsertItem( aFmt, nStt, nStt );
+ bAnchorAtPageAsFallback = false;
+ }
+ }
+
+ if ( bAnchorAtPageAsFallback )
+ {
+ OSL_ENSURE( false, "SwDoc::InsertDrawObj(..) - missing content anchor for as-character anchored drawing object --> anchor at-page" );
+ pFmt->SetFmtAttr( SwFmtAnchor( FLY_AT_PAGE ) );
}
}
@@ -939,6 +946,7 @@ SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg,
// Create Frames if necessary
if( GetCurrentViewShell() )
{
+ // create layout representation
pFmt->MakeFrms();
// #i42319# - follow-up of #i35635#
// move object to visible layer
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 9868750..d6a0523 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -196,7 +196,7 @@ sal_Bool SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpTxt )
pClpDoc->CloneSdrObj( *pObj, false, true );
SwPaM aTemp(aPos);
- pClpDoc->Insert(aTemp, *pNew, &aSet, NULL);
+ pClpDoc->InsertDrawObj(aTemp, *pNew, aSet );
}
else
{
@@ -380,8 +380,7 @@ sal_Bool SwFEShell::CopyDrawSel( SwFEShell* pDestShell, const Point& rSttPt,
aSet.Put( aAnchor );
SdrObject* pNew = pDestDoc->CloneSdrObj( *pObj, bIsMove &&
GetDoc() == pDestDoc, true );
- pFmt = pDestDoc->Insert( *pDestShell->GetCrsr(),
- *pNew, &aSet, NULL );
+ pFmt = pDestDoc->InsertDrawObj( *pDestShell->GetCrsr(), *pNew, aSet );
}
else
pFmt = pDestDoc->CopyLayoutFmt( *pFmt, aAnchor, true, true );
@@ -1440,7 +1439,7 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt )
DelSelectedObj();
- pFmt = GetDoc()->Insert( *GetCrsr(), *pNewObj, &aFrmSet, NULL );
+ pFmt = GetDoc()->InsertDrawObj( *GetCrsr(), *pNewObj, aFrmSet );
}
else
{
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 239d523..331e6d1 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -921,7 +921,7 @@ void SwFEShell::InsertDrawObj( SdrObject& rDrawObj,
::lcl_FindAnchorPos( *this, *GetDoc(), rInsertPosition, *pFrm, rFlyAttrSet );
}
// insert drawing object into the document creating a new <SwDrawFrmFmt> instance
- SwDrawFrmFmt* pFmt = GetDoc()->Insert( aPam, rDrawObj, &rFlyAttrSet, 0 );
+ SwDrawFrmFmt* pFmt = GetDoc()->InsertDrawObj( aPam, rDrawObj, rFlyAttrSet );
// move object to visible layer
SwContact* pContact = static_cast<SwContact*>(rDrawObj.GetUserCall());
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 5fcb684..51c947d 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -727,7 +727,7 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
if ( !pTemp )
pTemp = pPam;
UnoActionContext aAction(pDoc);
- pDoc->Insert( *pTemp, *pObj, &aSet, NULL );
+ pDoc->InsertDrawObj( *pTemp, *pObj, aSet );
SwFrmFmt* pFmt = ::FindFrmFmt( pObj );
if(pFmt)
pFmt->Add(pShape);
diff --git a/sw/source/filter/html/htmldraw.cxx b/sw/source/filter/html/htmldraw.cxx
index edb840d..95448f2 100644
--- a/sw/source/filter/html/htmldraw.cxx
+++ b/sw/source/filter/html/htmldraw.cxx
@@ -208,7 +208,7 @@ void SwHTMLParser::InsertDrawObject( SdrObject* pNewDrawObj,
}
aFrmSet.Put( aAnchor );
- pDoc->Insert( *pPam, *pNewDrawObj, &aFrmSet, NULL );
+ pDoc->InsertDrawObj( *pPam, *pNewDrawObj, aFrmSet );
}
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 2788732..36dc6da 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1410,7 +1410,7 @@ void SwWW8ImplReader::ReadGrafLayer1( WW8PLCFspecial* pPF, long nGrafAnchorCp )
if (SdrObject *pObject = ReadGrafPrimitive( nLeft, &aDo, aSet ))
{
pWWZOrder->InsertDrawingObject(pObject, SVBT16ToShort(aDo.dhgt));
- SwFrmFmt *pFrm = rDoc.Insert( *pPaM, *pObject, &aSet, NULL);
+ SwFrmFmt *pFrm = rDoc.InsertDrawObj( *pPaM, *pObject, aSet );
pObject->SetMergedItemSet(aSet);
pAnchorStck->AddAnchor(*pPaM->GetPoint(), pFrm);
}
@@ -2669,7 +2669,7 @@ SwFrmFmt* SwWW8ImplReader::Read_GrafLayer( long nGrafAnchorCp )
pWWZOrder->InsertTextLayerObject(pObject);
}
- pRetFrmFmt = rDoc.Insert(*pPaM, *pObject, &aFlySet, NULL);
+ pRetFrmFmt = rDoc.InsertDrawObj(*pPaM, *pObject, aFlySet );
OSL_ENSURE(pRetFrmFmt->GetAnchor().GetAnchorId() ==
eAnchor, "Not the anchor type requested!");
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index f5928c6..dbdfd79 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -662,7 +662,7 @@ SwFrmFmt* SwWW8ImplReader::ImportGraf(SdrTextObj* pTextObj,
}
}
else
- pRet = rDoc.Insert(*pPaM, *pObject, &aAttrSet, NULL);
+ pRet = rDoc.InsertDrawObj(*pPaM, *pObject, aAttrSet );
}
}
diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx
index 0611e8a..a71732c 100644
--- a/sw/source/filter/ww8/ww8par4.cxx
+++ b/sw/source/filter/ww8/ww8par4.cxx
@@ -295,7 +295,7 @@ SwFrmFmt* SwWW8ImplReader::ImportOle(const Graphic* pGrf,
SdrObject::Free( pRet ); // das brauchen wir nicht mehr
}
else
- pFmt = rDoc.Insert(*pPaM, *pRet, pFlySet, NULL);
+ pFmt = rDoc.InsertDrawObj(*pPaM, *pRet, *pFlySet );
}
else if (
GRAPHIC_GDIMETAFILE == aGraph.GetType() ||
More information about the Libreoffice-commits
mailing list