diff options
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/crsr/bookmrk.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 19 | ||||
-rw-r--r-- | sw/source/core/doc/docnew.cxx | 32 | ||||
-rw-r--r-- | sw/source/core/doc/notxtfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/edit/edfld.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/graphic/ndgrf.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/inc/swfont.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/text/EnhancedPDFExportHelper.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/txtnode/fntcap.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/txtnode/swfont.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/txtnode/txtedt.cxx | 2 |
14 files changed, 72 insertions, 28 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 30039539de96..3c039f917d4a 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -84,7 +84,8 @@ namespace rStart.nNode.GetNode().GetTxtNode(); SwTxtNode const*const pEndTxtNode = rEnd.nNode.GetNode().GetTxtNode(); const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex()); - xub_StrLen nEndPos = rEnd == rStart ? rEnd.nContent.GetIndex() : rEnd.nContent.GetIndex() - 1; + xub_StrLen nEndPos = ( rEnd == rStart || rEnd.nContent.GetIndex() == 0 ) ? + rEnd.nContent.GetIndex() : rEnd.nContent.GetIndex() - 1; const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar( nEndPos ); SwPaM aStartPaM(rStart); SwPaM aEndPaM(rEnd); diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 9d26aaac80c9..1965c962de06 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1665,8 +1665,7 @@ sal_Bool SwCursor::LeftRight( sal_Bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, { // Set cursor to start/end of covered cell: SwTableBox* pTableBox = pOldTabBoxSttNode->GetTblBox(); - const long nRowSpan = pTableBox->getRowSpan(); - if ( nRowSpan > 1 ) + if ( pTableBox && pTableBox->getRowSpan() > 1 ) { pTableBox = & pTableBox->FindEndOfRowSpan( pOldTabSttNode->GetTable(), (sal_uInt16)(pTableBox->getRowSpan() + mnRowSpanOffset ) ); SwNodeIndex& rPtIdx = GetPoint()->nNode; @@ -1953,7 +1952,7 @@ sal_Bool SwCursor::GoPrevNextCell( sal_Bool bNext, sal_uInt16 nCnt ) // proceeding: if ( mnRowSpanOffset ) { - if ( pTableBox->getRowSpan() > 1 ) + if ( pTableBox && pTableBox->getRowSpan() > 1 ) { pTableBox = & pTableBox->FindEndOfRowSpan( pTblNd->GetTable(), (sal_uInt16)(pTableBox->getRowSpan() + mnRowSpanOffset) ); SwNodeIndex aNewIdx( *pTableBox->GetSttNd() ); @@ -1976,7 +1975,7 @@ sal_Bool SwCursor::GoPrevNextCell( sal_Bool bNext, sal_uInt16 nCnt ) pTableBoxStartNode = rPtIdx.GetNode().FindTableBoxStartNode(); pTableBox = pTableBoxStartNode->GetTblBox(); - if ( pTableBox->getRowSpan() < 1 ) + if ( pTableBox && pTableBox->getRowSpan() < 1 ) { mnRowSpanOffset = pTableBox->getRowSpan(); // move cursor to non-covered cell: diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 7c4e1984b819..e9ea7e9f30b0 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -201,6 +201,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const case TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: return mbTabAtLeftIndentForParagraphsInList; case INVERT_BORDER_SPACING: return mbInvertBorderSpacing; case COLLAPSE_EMPTY_CELL_PARA: return mbCollapseEmptyCellPara; + case SMALL_CAPS_PERCENTAGE_66: return mbSmallCapsPercentage66; case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the ViewShell has to be asked! case HTML_MODE: return mbHTMLMode; @@ -331,6 +332,10 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) case COLLAPSE_EMPTY_CELL_PARA: mbCollapseEmptyCellPara = value; break; + + case SMALL_CAPS_PERCENTAGE_66: + mbSmallCapsPercentage66 = value; + break; // COMPATIBILITY FLAGS END case BROWSE_MODE: //can be used temporary (load/save) when no ViewShell is avaiable diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 85a90d2565e3..74263efe9399 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -716,7 +716,24 @@ namespace sw { namespace mark DdeBookmark* const pDdeBookmark = dynamic_cast<DdeBookmark*>(ppMark->get()); if(pDdeBookmark) pDdeBookmark->DeregisterFromDoc(m_pDoc); - m_vMarks.erase(m_vMarks.begin() + (ppMark - m_vMarks.begin())); // clumsy const-cast + //Effective STL Item 27, get a non-const iterator aI at the same + //position as const iterator ppMark was + iterator_t aI = m_vMarks.begin(); + std::advance(aI, std::distance<const_iterator_t>(aI, ppMark)); + + //fdo#37974 + //a) a mark destructor may callback into this method. + //b) vector::erase first calls the destructor of the object, then + //removes it from the vector. + //So if the only reference to the object is the one + //in the vector then we may reenter this method when the mark + //is destructed but before it is removed, i.e. findMark still + //finds the object whose destructor is being run. Take a temp + //extra reference on the shared_ptr, remove the entry from the + //vector, and on xHoldPastErase release findMark won't find + //it anymore. + pMark_t xHoldPastErase = *aI; + m_vMarks.erase(aI); } void MarkManager::deleteMark(const IMark* const pMark) diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 5c18528525f7..85f3b33ae9c9 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -356,6 +356,7 @@ SwDoc::SwDoc() mbTabAtLeftIndentForParagraphsInList = false; // hidden #i89181# mbInvertBorderSpacing = false; // hidden mbCollapseEmptyCellPara = true; // hidden + mbSmallCapsPercentage66 = false; // hidden // // COMPATIBILITY FLAGS END @@ -1047,6 +1048,7 @@ void SwDoc::InitTOXTypes() SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const { SwDoc* pRet = new SwDoc; + //copy settings sal_uInt16 aRangeOfDefaults[] = { RES_FRMATR_BEGIN, RES_FRMATR_END-1, @@ -1057,22 +1059,24 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const 0 }; - SfxItemSet aNewDefaults( pRet->GetAttrPool(), aRangeOfDefaults ); - - sal_uInt16 nWhich; - sal_uInt16 nRange = 0; - while( aRangeOfDefaults[nRange] != 0) { - for( nWhich = aRangeOfDefaults[nRange]; nWhich < aRangeOfDefaults[nRange + 1]; ++nWhich ) + SfxItemSet aNewDefaults( pRet->GetAttrPool(), aRangeOfDefaults ); + + sal_uInt16 nWhich; + sal_uInt16 nRange = 0; + while( aRangeOfDefaults[nRange] != 0) { - const SfxPoolItem& rSourceAttr = mpAttrPool->GetDefaultItem( nWhich ); - if( rSourceAttr != pRet->mpAttrPool->GetDefaultItem( nWhich ) ) - aNewDefaults.Put( rSourceAttr ); + for( nWhich = aRangeOfDefaults[nRange]; nWhich < aRangeOfDefaults[nRange + 1]; ++nWhich ) + { + const SfxPoolItem& rSourceAttr = mpAttrPool->GetDefaultItem( nWhich ); + if( rSourceAttr != pRet->mpAttrPool->GetDefaultItem( nWhich ) ) + aNewDefaults.Put( rSourceAttr ); + } + nRange += 2; } - nRange += 2; + if( aNewDefaults.Count() ) + pRet->SetDefault( aNewDefaults ); } - if( aNewDefaults.Count() ) - pRet->SetDefault( aNewDefaults ); pRet->n32DummyCompatabilityOptions1 = n32DummyCompatabilityOptions1; pRet->n32DummyCompatabilityOptions2 = n32DummyCompatabilityOptions2; @@ -1116,12 +1120,16 @@ SfxObjectShell* SwDoc::CreateCopy(bool bCallInitNew ) const pRetShell->DoInitNew(); } + pRet->acquire(); + //copy content pRet->Paste( *this ); // remove the temporary shell if it is there as it was done before pRet->SetTmpDocShell( (SfxObjectShell*)NULL ); + pRet->release(); + return pRetShell; } diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 2e22977aa835..fb8355880843 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -818,7 +818,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons if( pGrfNd ) { - // Fix for bug #33781 + // Fix for bug fdo#33781 if (pShell->Imp()->GetDrawView()->IsAntiAliasing()) { pOut->SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW ); diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index 58005a97832b..9897e0a5f23d 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -204,7 +204,7 @@ void SwEditShell::FieldToText( SwFieldType* pType ) SwFieldHint aHint( pPaM ); SwClientIter aIter( *pType ); - for ( SwClient* pClient = aIter.GoStart(); pClient; aIter++ ) + for ( SwClient* pClient = aIter.GoStart(); pClient; pClient = aIter++ ) { pPaM->DeleteMark(); pClient->SwClientNotifyCall( *pType, aHint ); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 6c64e6bd5908..129488a2468d 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -2566,8 +2566,9 @@ sal_Bool SwFEShell::IsAlignPossible() const { SdrObject *pO = Imp()->GetDrawView()->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); SwDrawContact *pC = (SwDrawContact*)GetUserCall(pO); + OSL_ENSURE( pC, "No SwDrawContact!"); //only as character bound drawings can be aligned - bRet = (pC->GetFmt()->GetAnchor().GetAnchorId() == FLY_AS_CHAR); + bRet = pC ? (pC->GetFmt()->GetAnchor().GetAnchorId() == FLY_AS_CHAR) : sal_False; } if ( bRet ) return Imp()->GetDrawView()->IsAlignPossible(); diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index b1d1c75b54a7..20ae24e68a0e 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -806,8 +806,7 @@ SvStream* SwGrfNode::_GetStreamForEmbedGrf( { xub_StrLen nExtPos = _aStrmName.Search( '.' ); String aExtStr = _aStrmName.Copy( nExtPos ); - Graphic aGraphic( GetGrfObj().GetGraphic() ); - if ( aGraphic.GetType() != GRAPHIC_NONE ) + if ( GetGrfObj().GetType() != GRAPHIC_NONE ) { _aStrmName = String( GetGrfObj().GetUniqueID(), RTL_TEXTENCODING_ASCII_US ); _aStrmName += aExtStr; diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx index f0cf7bab6a32..d99e368d861f 100644 --- a/sw/source/core/inc/swfont.hxx +++ b/sw/source/core/inc/swfont.hxx @@ -58,8 +58,9 @@ class SwSubFont : public SvxFont sal_uInt16 nOrgHeight; // Hoehe inkl. Escapement/Proportion sal_uInt16 nOrgAscent; // Ascent inkl. Escapement/Proportion sal_uInt16 nPropWidth; // proportional width + bool smallCapsPercentage66; inline SwSubFont() : aSize(0,0) - { pMagic = NULL; nFntIndex = nOrgHeight = nOrgAscent = 0; nPropWidth =100; } + { pMagic = NULL; nFntIndex = nOrgHeight = nOrgAscent = 0; nPropWidth =100; smallCapsPercentage66 = false; } sal_uInt16 CalcEscAscent( const sal_uInt16 nOldAscent ) const; sal_uInt16 CalcEscHeight( const sal_uInt16 nOldHeight, diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 623272cd4919..ae8cc207b77a 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -381,7 +381,8 @@ bool SwTaggedPDFHelper::CheckReopenTag() { FrmTagIdMap& rFrmTagIdMap = SwEnhancedPDFExportHelper::GetFrmTagIdMap(); const FrmTagIdMap::const_iterator aIter = rFrmTagIdMap.find( pKey ); - nReopenTag = (*aIter).second; + if ( aIter != rFrmTagIdMap.end() ) + nReopenTag = (*aIter).second; } } } diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx index 5696984a7dce..98337825271b 100644 --- a/sw/source/core/txtnode/fntcap.cxx +++ b/sw/source/core/txtnode/fntcap.cxx @@ -622,8 +622,13 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) else pBigFont = pLastFont; - // Hier entsteht der Kleinbuchstabenfont: - aFont.SetProportion( (aFont.GetPropr() * SMALL_CAPS_PERCENTAGE ) / 100L ); + // Older LO versions had 66 as the small caps percentage size, later changed to 80, + // therefore a backwards compatibility option is kept (otherwise layout is changed). + // NOTE: There are more uses of SMALL_CAPS_PERCENTAGE in editeng, but it seems they + // do not matter for Writer (and if they did it'd be pretty ugly to propagate + // the option there). + int smallCapsPercentage = smallCapsPercentage66 ? 66 : SMALL_CAPS_PERCENTAGE; + aFont.SetProportion( (aFont.GetPropr() * smallCapsPercentage ) / 100L ); pMagic2 = NULL; nIndex2 = 0; SwFntAccess *pSmallFontAccess = new SwFntAccess( pMagic2, nIndex2, &aFont, diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index cfa8036ecdce..35216ec19983 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -560,6 +560,12 @@ SwFont::SwFont( const SwAttrSet* pAttrSet, SetVertical( pAttrSet->GetCharRotate().GetValue() ); else SetVertical( 0 ); + if( pIDocumentSettingAccess && pIDocumentSettingAccess->get( IDocumentSettingAccess::SMALL_CAPS_PERCENTAGE_66 )) + { + aSub[ SW_LATIN ].smallCapsPercentage66 = true; + aSub[ SW_CJK ].smallCapsPercentage66 = true; + aSub[ SW_CTL ].smallCapsPercentage66 = true; + } } SwSubFont& SwSubFont::operator=( const SwSubFont &rFont ) @@ -571,6 +577,7 @@ SwSubFont& SwSubFont::operator=( const SwSubFont &rFont ) nOrgAscent = rFont.nOrgAscent; nPropWidth = rFont.nPropWidth; aSize = rFont.aSize; + smallCapsPercentage66 = rFont.smallCapsPercentage66; return *this; } diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 917ae6c83068..22f7a2c0d548 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1814,7 +1814,7 @@ void SwTxtNode::CountWords( SwDocStat& rStat, } // make a copy of the text - String& rTextCopy = const_cast<String&>(m_Text); + String rTextCopy = m_Text.Copy( ); // mask out the redlined and hidden text with ' ' const xub_Unicode cChar(' '); |