diff options
author | hg <hg@oosvn01.> | 2009-10-08 16:03:52 +0000 |
---|---|---|
committer | hg <hg@oosvn01.> | 2009-10-08 16:03:52 +0000 |
commit | e81c8c6ae95c3937a80acac2eca49abd48785277 (patch) | |
tree | 207d59f7eba163a8955d90093a89c75d59807f61 /sw/source | |
parent | ff0c53640ac0a74134b625791fb48b29d90f4fcb (diff) | |
parent | b60103486b997271ba94c9de92401a91d758e603 (diff) |
merge with m55
Diffstat (limited to 'sw/source')
66 files changed, 1026 insertions, 488 deletions
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 90680b7a1d22..89686a3673bc 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -623,7 +623,7 @@ int SwFindParaText::Find( SwPaM* pCrsr, SwMoveFn fnMove, p->MoveTo( (Ring*)pRegion ); } while( p != pPrev ); } - rSttCntIdx = nSttCnt; + pCrsr->Start()->nContent = nSttCnt; return FIND_NO_RING; } return bFnd ? FIND_FOUND : FIND_NOT_FOUND; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 0f471c3c82f3..572fbeb5cc7f 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -2367,11 +2367,13 @@ BOOL SwDoc::ConvertFieldsToText() sText.Erase(); //now remove the field and insert the string - SwPaM aPam(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart()); - aPam.SetMark(); - aPam.Move(); - DeleteAndJoin(aPam); - Insert( aPam, sText, true ); + SwPaM aPam1(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart()); + aPam1.Move(); + Insert( aPam1, sText, true );//insert first to keep the field's attributes + SwPaM aPam2(*pTxtFld->GetpTxtNode(), *pTxtFld->GetStart()); + aPam2.SetMark(); + aPam2.Move(); + DeleteAndJoin(aPam2);//remove the field } } ++aBegin; diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index fe513d51e4da..fb94d433d14f 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1196,7 +1196,7 @@ BOOL SwCompareLine::ChangesInLine( const SwCompareLine& rLine, SwPaM aCpyPam( rSrcNd, nStt ); aCpyPam.SetMark(); aCpyPam.GetPoint()->nContent = nSEnd; - aCpyPam.GetDoc()->Copy( aCpyPam, *aPam.GetPoint() ); + aCpyPam.GetDoc()->Copy( aCpyPam, *aPam.GetPoint(), false ); pDoc->DoUndo( bUndo ); } @@ -1367,7 +1367,7 @@ void SwCompareData::ShowDelete( const CompareData& rData, ULONG nStt, SwNodeIndex aInsPos( *pLineNd, nOffset ); SwNodeIndex aSavePos( aInsPos, -1 ); - ((SwCompareData&)rData).rDoc.CopyWithFlyInFly( aRg, aInsPos ); + ((SwCompareData&)rData).rDoc.CopyWithFlyInFly( aRg, 0, aInsPos ); rDoc.SetModified(); aSavePos++; @@ -1624,7 +1624,7 @@ USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn ) RedlineMode_t eOld = pDoc->GetRedlineMode(); pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - pSrcRedl->GetDoc()->Copy( *(SwPaM*)pSrcRedl, *pDestRedl->GetPoint() ); + pSrcRedl->GetDoc()->Copy( *(SwPaM*)pSrcRedl, *pDestRedl->GetPoint(), false ); pDoc->SetRedlineMode_intern( eOld ); pDoc->DoUndo( bUndo ); diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx index a7c042f51d88..f03ca5b5d352 100644 --- a/sw/source/core/doc/docdde.cxx +++ b/sw/source/core/doc/docdde.cxx @@ -62,7 +62,7 @@ using namespace ::com::sun::star; namespace { - static ::sw::mark::DdeBookmark* const lcl_FindDdeBookmark(const IDocumentMarkAccess& rMarkAccess, const String& rName) + static ::sw::mark::DdeBookmark* lcl_FindDdeBookmark(const IDocumentMarkAccess& rMarkAccess, const String& rName) { //Iterating over all bookmarks, checking DdeBookmarks const String sNameLc = GetAppCharClass().lower(rName); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index bb9f24db8fb0..9db1c98685f3 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -2139,7 +2139,7 @@ void SwDoc::_CopyPageDescHeaderFooter( BOOL bCpyHeader, aTmpIdx = *pSttNd->EndOfSectionNode(); rSrcNds._Copy( aRg, aTmpIdx ); aTmpIdx = *pSttNd; - rSrcFmt.GetDoc()->_CopyFlyInFly( aRg, aTmpIdx ); + rSrcFmt.GetDoc()->_CopyFlyInFly( aRg, 0, aTmpIdx ); pNewFmt->SetFmtAttr( SwFmtCntnt( pSttNd )); } else diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index a4bfb749174c..b340b1ce45fb 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -307,7 +307,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, pDoc->GetNodes().Delete( aIdx, 1 ); // alle Flys in dem Bereich - _CopyFlyInFly( aRg, aIdx ); + _CopyFlyInFly( aRg, 0, aIdx ); // und noch alle Bookmarks @@ -653,7 +653,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) pDoc->GetNodes().Delete( aIdx, 1 ); // alle Flys in dem Bereich - _CopyFlyInFly( aRg, aIdx ); + _CopyFlyInFly( aRg, 0, aIdx ); // und noch alle Bookmarks diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx index 4dac390ece46..2f3f58e76f3b 100644 --- a/sw/source/core/doc/docglos.cxx +++ b/sw/source/core/doc/docglos.cxx @@ -183,7 +183,7 @@ BOOL SwDoc::InsertGlossary( SwTextBlocks& rBlock, const String& rEntry, SwDontExpandItem aACD; aACD.SaveDontExpandItems( rInsPos ); - pGDoc->Copy( aCpyPam, rInsPos ); + pGDoc->Copy( aCpyPam, rInsPos, false ); aACD.RestoreDontExpandItems( rInsPos ); if( pShell ) diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 29258f9de72e..77df07dcb2d3 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -507,7 +507,7 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource, // sorge dafuer das auch Fly's in Fly's kopiert werden aIdx = *pSttNd->EndOfSectionNode(); - pSrcDoc->CopyWithFlyInFly( aRg, aIdx, sal_False, sal_True, sal_True ); + pSrcDoc->CopyWithFlyInFly( aRg, 0, aIdx, sal_False, sal_True, sal_True ); } else { @@ -885,7 +885,7 @@ if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht. do { if( pTmp->HasMark() && *pTmp->GetPoint() != *pTmp->GetMark() ) - Copy( *pTmp, aPos ); + Copy( *pTmp, aPos, false ); } while( &rPam != ( pTmp = (SwPaM*)pTmp->GetNext() ) ); mbCopyIsMove = bOldFlag; mbUndo = bOldUndo; diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index e810d55d97c9..67c64e27b9d0 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -32,6 +32,7 @@ #include "precompiled_sw.hxx" #define ROLBCK_HISTORY_ONLY // Der Kampf gegen die CLOOK's #include <doc.hxx> +#include <dcontact.hxx> #include <com/sun/star/document/PrinterIndependentLayout.hpp> #include <com/sun/star/document/UpdateDocMode.hpp> #include <com/sun/star/text/XTextDocument.hpp> @@ -48,6 +49,7 @@ #include <svtools/macitem.hxx> #include <svx/svxids.hrc> +#include <svx/svdogrp.hxx> #include <svx/linkmgr.hxx> #include <svx/forbiddencharacterstable.hxx> #include <svtools/zforlist.hxx> @@ -95,8 +97,8 @@ #include <istyleaccess.hxx> #include <swstylemanager.hxx> #include <IGrammarContact.hxx> +#include <tblsel.hxx> #include <MarkManager.hxx> - #include <unochart.hxx> #include <cmdid.h> // fuer den dflt - Printer in SetJob @@ -276,7 +278,6 @@ SwDoc::SwDoc() : mIdleBlockCount(0), nLockExpFld( 0 ), mbReadlineChecked(false), - mbWinEncryption(sal_False), // --> OD 2005-02-11 #i38810# mbLinksUpdated( sal_False ), mbClipBoard( false ), @@ -1057,3 +1058,369 @@ void SwDoc::InitTOXTypes() pTOXTypes->Insert( pNew, pTOXTypes->Count() ); } +/*-- 08.05.2009 10:07:57--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwDoc* SwDoc::CreateCopy() const +{ + SwDoc* pRet = new SwDoc; + //copy settings +/* + //aNodes( this ), + //aUndoNodes( this ), + mpAttrPool(new SwAttrPool(this)),*/ + USHORT __FAR_DATA aRangeOfDefaults[] = { + RES_FRMATR_BEGIN, RES_FRMATR_END-1, + RES_CHRATR_BEGIN, RES_CHRATR_END-1, + RES_PARATR_BEGIN, RES_PARATR_END-1, + // --> OD 2008-02-25 #refactorlists## + RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1, + // <-- + RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, + 0 + }; + + SfxItemSet aNewDefaults( pRet->GetAttrPool(), aRangeOfDefaults ); + + USHORT nWhich; + USHORT nRange = 0; + while( aRangeOfDefaults[nRange] != 0) + { + 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; + } + if( aNewDefaults.Count() ) + pRet->SetDefault( aNewDefaults ); + + /* + pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ), + pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ), + pColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, pDfltFrmFmt ) ), + pDfltCharFmt( new SwCharFmt( GetAttrPool(), sCharFmtStr, 0 ) ), + pDfltTxtFmtColl( new SwTxtFmtColl( GetAttrPool(), sTxtCollStr ) ), + pDfltGrfFmtColl( new SwGrfFmtColl( GetAttrPool(), sGrfCollStr ) ), + pFrmFmtTbl( new SwFrmFmts() ), + pCharFmtTbl( new SwCharFmts() ), + pSpzFrmFmtTbl( new SwSpzFrmFmts() ), + pSectionFmtTbl( new SwSectionFmts() ), + pTblFrmFmtTbl( new SwFrmFmts() ), + pTxtFmtCollTbl( new SwTxtFmtColls() ), + pGrfFmtCollTbl( new SwGrfFmtColls() ), + pBookmarkTbl( new SwBookmarks( 0, 16 ) ), + pTOXTypes( new SwTOXTypes() ), + pDefTOXBases( new SwDefTOXBase_Impl() ), + pLayout( 0 ), // Rootframe des spezifischen Layouts. + pDrawModel( 0 ), + pUndos( new SwUndos( 0, 20 ) ), + pUpdtFlds( new SwDocUpdtFld() ), + pFldTypes( new SwFldTypes() ), + pVirDev( 0 ), + pPrt( 0 ), + pPrtData( 0 ), + pGlossaryDoc( 0 ), + pOutlineRule( 0 ), + pFtnInfo( new SwFtnInfo ), + pEndNoteInfo( new SwEndNoteInfo ), + pLineNumberInfo( new SwLineNumberInfo ), + pFtnIdxs( new SwFtnIdxs ), + pDocStat( new SwDocStat ), + pDocShell( 0 ), + pDocShRef( 0 ), + pLinkMgr( new SvxLinkManager( 0 ) ), + pACEWord( 0 ), + pURLStateChgd( 0 ), + pNumberFormatter( 0 ), + pNumRuleTbl( new SwNumRuleTbl ), + // --> OD 2008-03-26 #refactorlists# + maLists(), + maListStyleLists(), + // <-- + pRedlineTbl( new SwRedlineTbl ), + pAutoFmtRedlnComment( 0 ), + pUnoCrsrTbl( new SwUnoCrsrTbl( 0, 16 ) ), + pPgPViewPrtData( 0 ), + pExtInputRing( 0 ), + pLayouter( 0 ), + // --> OD 2008-03-07 #refactorlists# + pStyleAccess( 0 ), + // <-- + pLayoutCache( 0 ), + pUnoCallBack(new SwUnoCallBack(0)), + mpGrammarContact( 0 ), + aChartDataProviderImplRef(), + pChartControllerHelper( 0 ), + // --> OD 2007-10-31 #i83479# + mpListItemsList( new tImplSortedNodeNumList() ), + // <-- + nUndoPos( 0 ), + nUndoSavePos( 0 ), + nUndoCnt( 0 ), + nUndoSttEnd( 0 ), + nAutoFmtRedlnCommentNo( 0 ), + nLinkUpdMode( GLOBALSETTING ), + eFldUpdMode( AUTOUPD_GLOBALSETTING ), + eRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)), + eChrCmprType( CHARCOMPRESS_NONE ), + mReferenceCount(0), + mIdleBlockCount(0), + nLockExpFld( 0 ), + mbReadlineChecked(false), + mbWinEncryption(sal_False), + // --> OD 2005-02-11 #i38810# + mbLinksUpdated( sal_False ), + mbClipBoard( false ), + mbColumnSelection( false ), + // i#78591# + mbProtectForm(false),*/ + pRet->n32DummyCompatabilityOptions1 = n32DummyCompatabilityOptions1; + pRet->n32DummyCompatabilityOptions2 = n32DummyCompatabilityOptions2; + /* + mbStartIdleTimer(sal_False) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::SwDoc" ); + + mbGlossDoc = + mbModified = + mbDtor = + mbUndo = + mbPageNums = + mbLoaded = + mbUpdateExpFld = + mbNewDoc = + mbCopyIsMove = + mbNoDrawUndoObj = + mbBrowseMode = + mbInReading = + mbInXMLImport = + mbUpdateTOX = + mbInLoadAsynchron = + mbHTMLMode = + mbInCallModified = + mbIsGlobalDoc = + mbGlblDocSaveLinks = + mbIsLabelDoc = + mbIsAutoFmtRedline = + mbOLEPrtNotifyPending = + mbAllOLENotify = + mbIsRedlineMove = + mbInsOnlyTxtGlssry = + mbContains_MSVBasic = + mbKernAsianPunctuation = +#ifndef PRODUCT + mbXMLExport = +#endif + // --> OD 2006-03-21 #b6375613# + mbApplyWorkaroundForB6375613 = + // <-- + false; + + mbGroupUndo = + mbNewFldLst = + mbVisibleLinks = + mbPurgeOLE = + true; + + // + // COMPATIBILITY FLAGS START + // + + // Note: Any non-hidden compatibility flag should obtain its default + // by asking SvtCompatibilityOptions, see below. + // + const SvtCompatibilityOptions aOptions; + */ + pRet->mbParaSpaceMax = mbParaSpaceMax ; + pRet->mbParaSpaceMaxAtPages = mbParaSpaceMaxAtPages ; + pRet->mbTabCompat = mbTabCompat ; + pRet->mbUseVirtualDevice = mbUseVirtualDevice ; + pRet->mbAddExternalLeading = mbAddExternalLeading ; + pRet->mbOldLineSpacing = mbOldLineSpacing ; + pRet->mbAddParaSpacingToTableCells = mbAddParaSpacingToTableCells ; + pRet->mbUseFormerObjectPos = mbUseFormerObjectPos ; + pRet->mbUseFormerTextWrapping = mbUseFormerTextWrapping ; + pRet->mbConsiderWrapOnObjPos = mbConsiderWrapOnObjPos ; + pRet->mbAddFlyOffsets = mbAddFlyOffsets ; + pRet->mbOldNumbering = mbOldNumbering ; + pRet->mbUseHiResolutionVirtualDevice = mbUseHiResolutionVirtualDevice ; + pRet->mbIgnoreFirstLineIndentInNumbering = mbIgnoreFirstLineIndentInNumbering ; + pRet->mbDoNotJustifyLinesWithManualBreak = mbDoNotJustifyLinesWithManualBreak ; + pRet->mbDoNotResetParaAttrsForNumFont = mbDoNotResetParaAttrsForNumFont ; + pRet->mbOutlineLevelYieldsOutlineRule = mbOutlineLevelYieldsOutlineRule ; + pRet->mbTableRowKeep = mbTableRowKeep ; + pRet->mbIgnoreTabsAndBlanksForLineCalculation = mbIgnoreTabsAndBlanksForLineCalculation ; + pRet->mbDoNotCaptureDrawObjsOnPage = mbDoNotCaptureDrawObjsOnPage ; + pRet->mbClipAsCharacterAnchoredWriterFlyFrames= mbClipAsCharacterAnchoredWriterFlyFrames; + pRet->mbUnixForceZeroExtLeading = mbUnixForceZeroExtLeading ; + pRet->mbOldPrinterMetrics = mbOldPrinterMetrics ; + pRet->mbTabRelativeToIndent = mbTabRelativeToIndent ; + pRet->mbTabAtLeftIndentForParagraphsInList = mbTabAtLeftIndentForParagraphsInList ; + + // + // COMPATIBILITY FLAGS END + // + /* + pMacroTable = new SvxMacroTableDtor; + + mpGrammarContact = ::createGrammarContact(); + + // Formate + pFrmFmtTbl->Insert(pDfltFrmFmt, 0 ); + pCharFmtTbl->Insert(pDfltCharFmt, 0 ); + + // FmtColls + // TXT + pTxtFmtCollTbl->Insert(pDfltTxtFmtColl, 0 ); + // GRF + pGrfFmtCollTbl->Insert(pDfltGrfFmtColl, 0 ); + + // PageDesc, EmptyPageFmt und ColumnFmt anlegen + if ( !aPageDescs.Count() ) + GetPageDescFromPool( RES_POOLPAGE_STANDARD ); + + //Leere Seite Einstellen. + pEmptyPageFmt->SetFmtAttr( SwFmtFrmSize( ATT_FIX_SIZE ) ); + //BodyFmt fuer Spalten Einstellen. + pColumnContFmt->SetFmtAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ) ); + + _InitFieldTypes(); + + // lege (fuer die Filter) eine Default-OutlineNumRule an + // --> OD 2008-02-11 #newlistlevelattrs# + pOutlineRule = new SwNumRule( String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ), + // --> OD 2008-06-06 #i89178# + numfunc::GetDefaultPositionAndSpaceMode(), + // <-- + OUTLINE_RULE ); + // <-- + // #115901# + AddNumRule(pOutlineRule); + // --> OD 2005-10-21 - counting of phantoms depends on <IsOldNumbering()> + pOutlineRule->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING) ); + // <-- + + new SwTxtNode( SwNodeIndex( aUndoNodes.GetEndOfContent() ), pDfltTxtFmtColl ); + new SwTxtNode( SwNodeIndex( aNodes.GetEndOfContent() ), + GetTxtCollFromPool( RES_POOLCOLL_STANDARD )); + + // den eigenen IdleTimer setzen + aIdleTimer.SetTimeout( 600 ); + aIdleTimer.SetTimeoutHdl( LINK(this, SwDoc, DoIdleJobs) ); + + aOLEModifiedTimer.SetTimeout( 1000 ); + aOLEModifiedTimer.SetTimeoutHdl( LINK( this, SwDoc, DoUpdateModifiedOLE )); + + // DBMgr anlegen + pNewDBMgr = new SwNewDBMgr; + + // create TOXTypes + ShellResource* pShellRes = ViewShell::GetShellRes(); + + SwTOXType * pNew = new SwTOXType(TOX_CONTENT, pShellRes->aTOXContentName ); + pTOXTypes->Insert( pNew, pTOXTypes->Count() ); + pNew = new SwTOXType(TOX_INDEX, pShellRes->aTOXIndexName ); + pTOXTypes->Insert( pNew, pTOXTypes->Count() ); + pNew = new SwTOXType(TOX_USER, pShellRes->aTOXUserName ); + pTOXTypes->Insert( pNew, pTOXTypes->Count() ); + pNew = new SwTOXType(TOX_ILLUSTRATIONS, pShellRes->aTOXIllustrationsName ); + pTOXTypes->Insert( pNew, pTOXTypes->Count() ); + pNew = new SwTOXType(TOX_OBJECTS, pShellRes->aTOXObjectsName ); + pTOXTypes->Insert( pNew, pTOXTypes->Count() ); + pNew = new SwTOXType(TOX_TABLES, pShellRes->aTOXTablesName ); + pTOXTypes->Insert( pNew, pTOXTypes->Count() ); + pNew = new SwTOXType(TOX_AUTHORITIES, pShellRes->aTOXAuthoritiesName ); + pTOXTypes->Insert( pNew, pTOXTypes->Count() ); + + { + SfxItemSet aIgnorableParagraphItems( GetAttrPool(), + RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1, + 0 ); + pStyleAccess = createStyleManager( &aIgnorableParagraphItems ); + } + + ResetModified(); + +*/ + //copy content + pRet->Paste( *this ); + return pRet; +} +/*-- 08.05.2009 10:52:40--------------------------------------------------- + copy document content - code from SwFEShell::Paste( SwDoc* , BOOL ) + -----------------------------------------------------------------------*/ +void SwDoc::Paste( const SwDoc& rSource ) +{ +// this has to be empty const USHORT nStartPageNumber = GetPhyPageNum(); + // until the end of the NodesArray + SwNodeIndex aSourceIdx( rSource.GetNodes().GetEndOfExtras(), 2 ); + SwPaM aCpyPam( aSourceIdx ); //DocStart + SwNodeIndex aTargetIdx( GetNodes().GetEndOfExtras(), 2 ); + SwPaM aInsertPam( aTargetIdx ); //replaces PCURCRSR from SwFEShell::Paste() + + + aCpyPam.SetMark(); + aCpyPam.Move( fnMoveForward, fnGoDoc ); + + this->StartUndo( UNDO_INSGLOSSARY, NULL ); + this->LockExpFlds(); + + { + SwPosition& rInsPos = *aInsertPam.GetPoint(); + //find out if the clipboard document starts with a table + bool bStartWithTable = 0 != aCpyPam.Start()->nNode.GetNode().FindTableNode(); + SwPosition aInsertPosition( rInsPos ); + + { + SwNodeIndex aIndexBefore(rInsPos.nNode); + + aIndexBefore--; + + rSource.Copy( aCpyPam, rInsPos, true ); + + { + aIndexBefore++; + SwPaM aPaM(SwPosition(aIndexBefore, 0), + SwPosition(rInsPos.nNode, 0)); + + MakeUniqueNumRules(aPaM); + } + } + + //TODO: Is this necessary here? SaveTblBoxCntnt( &rInsPos ); + if(/*bIncludingPageFrames && */bStartWithTable) + { + //remove the paragraph in front of the table + SwPaM aPara(aInsertPosition); + this->DelFullPara(aPara); + } + //additionally copy page bound frames + if( /*bIncludingPageFrames && */rSource.GetSpzFrmFmts()->Count() ) + { + for ( USHORT i = 0; i < rSource.GetSpzFrmFmts()->Count(); ++i ) + { + BOOL bInsWithFmt = TRUE; + const SwFrmFmt& rCpyFmt = *(*rSource.GetSpzFrmFmts())[i]; + if( bInsWithFmt ) + { + SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() ); + if( FLY_PAGE == aAnchor.GetAnchorId() ) + { + aAnchor.SetPageNum( aAnchor.GetPageNum() + /*nStartPageNumber - */1 ); + } + else + continue; + this->CopyLayoutFmt( rCpyFmt, aAnchor, true, true ); + } + } + } + } + + this->EndUndo( UNDO_INSGLOSSARY, NULL ); + + UnlockExpFlds(); + UpdateFlds(NULL, false); +} diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 81cc7dc72239..4720bcd6fef8 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -2277,7 +2277,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) } } - Copy( aPam, aInsPos ); + Copy( aPam, aInsPos, false ); if( bDelLastPara ) { // dann muss der letzte leere Node wieder entfernt werden diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 77268d3e318a..a1dc2e7c7e9d 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -3419,7 +3419,7 @@ void SwRedline::CopyToSection() SwNodeIndex aNdIdx( *pSttNd, 1 ); SwTxtNode* pTxtNd = aNdIdx.GetNode().GetTxtNode(); SwPosition aPos( aNdIdx, SwIndex( pTxtNd )); - pDoc->Copy( *this, aPos ); + pDoc->Copy( *this, aPos, false ); // JP 08.10.98: die Vorlage vom EndNode ggfs. mit uebernehmen // - ist im Doc::Copy nicht erwuenscht @@ -3444,13 +3444,13 @@ void SwRedline::CopyToSection() if( pCEndNd ) { SwPosition aPos( *pSttNd->EndOfSectionNode() ); - pDoc->Copy( *this, aPos ); + pDoc->Copy( *this, aPos, false ); } else { SwNodeIndex aInsPos( *pSttNd->EndOfSectionNode() ); SwNodeRange aRg( pStt->nNode, 0, pEnd->nNode, 1 ); - pDoc->CopyWithFlyInFly( aRg, aInsPos ); + pDoc->CopyWithFlyInFly( aRg, 0, aInsPos ); } } pCntntSect = new SwNodeIndex( *pSttNd ); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index e939b7ddec05..5b4831017fdf 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -799,6 +799,34 @@ void SwNoTxtFrm::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) } } +void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInArea, OutputDevice* pOut ) +{ + if(!pOut) + return; + Rectangle aPxRect = pOut->LogicToPixel( rInArea.SVRect() );
+ Rectangle aNewPxRect( aPxRect );
+ while( aNewPxRect.Left() < aPxRect.Left() )
+ {
+ rAlignedGrfArea.Left( rAlignedGrfArea.Left()+1 );
+ aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
+ }
+ while( aNewPxRect.Top() < aPxRect.Top() )
+ {
+ rAlignedGrfArea.Top( rAlignedGrfArea.Top()+1 );
+ aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
+ }
+ while( aNewPxRect.Bottom() > aPxRect.Bottom() )
+ {
+ rAlignedGrfArea.Bottom( rAlignedGrfArea.Bottom()-1 );
+ aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
+ }
+ while( aNewPxRect.Right() > aPxRect.Right() )
+ {
+ rAlignedGrfArea.Right( rAlignedGrfArea.Right()-1 );
+ aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
+ } +} + // Ausgabe der Grafik. Hier wird entweder eine QuickDraw-Bmp oder // eine Grafik vorausgesetzt. Ist nichts davon vorhanden, wird // eine Ersatzdarstellung ausgegeben. @@ -816,15 +844,30 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons const BOOL bPrn = pOut == rNoTNd.getIDocumentDeviceAccess()->getPrinter( false ) || pOut->GetConnectMetaFile(); + const bool bIsChart = pOLENd && ChartPrettyPainter::IsChart( pOLENd->GetOLEObj().GetObject() ); + /// OD 25.09.2002 #99739# - calculate aligned rectangle from parameter <rGrfArea>. /// Use aligned rectangle <aAlignedGrfArea> instead of <rGrfArea> in /// the following code. SwRect aAlignedGrfArea = rGrfArea; ::SwAlignRect( aAlignedGrfArea, pShell ); - /// OD 25.09.2002 #99739# - /// Because for drawing a graphic left-top-corner and size coordinations are - /// used, these coordinations have to be determined on pixel level. - ::SwAlignGrfRect( &aAlignedGrfArea, *pOut ); + + if( !bIsChart ) + { + /// OD 25.09.2002 #99739# + /// Because for drawing a graphic left-top-corner and size coordinations are + /// used, these coordinations have to be determined on pixel level. + ::SwAlignGrfRect( &aAlignedGrfArea, *pOut ); + } + else //if( bIsChart ) + {
+ //#i78025# charts own borders are not completely visible
+ //the above pixel correction is not correct - at least not for charts
+ //so a different pixel correction is choosen here
+ //this might be a good idea for all other OLE objects also,
+ //but as I cannot oversee the consequences I fix it only for charts for now
+ lcl_correctlyAlignRect( aAlignedGrfArea, rGrfArea, pOut );
+ } if( pGrfNd ) { @@ -946,9 +989,8 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons if( bForceSwap ) pGrfNd->SwapOut(); } - else if( pOLENd + else if( bIsChart //charts must be painted resolution dependent!! #i82893#, #i75867# - && ChartPrettyPainter::IsChart(pOLENd->GetOLEObj().GetObject()) && ChartPrettyPainter::ShouldPrettyPaintChartOnThisDevice( pOut ) && svt::EmbeddedObjectRef::TryRunningState( pOLENd->GetOLEObj().GetOleRef() ) && ChartPrettyPainter::DoPrettyPaintChart( uno::Reference< frame::XModel >( diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index 5df20bfa2a74..8e0469fe5d87 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -299,9 +299,12 @@ void SwServerObject::SetNoServer() if(eType == BOOKMARK_SERVER && CNTNT_TYPE.pBkmk) { ::sw::mark::DdeBookmark* const pDdeBookmark = dynamic_cast< ::sw::mark::DdeBookmark* >(CNTNT_TYPE.pBkmk); - if(pDdeBookmark) pDdeBookmark->SetRefObject(NULL); + if(pDdeBookmark) + { + CNTNT_TYPE.pBkmk = 0, eType = NONE_SERVER; + pDdeBookmark->SetRefObject(NULL); + } } - CNTNT_TYPE.pBkmk = 0, eType = NONE_SERVER; } void SwServerObject::SetDdeBookmark( ::sw::mark::IMark& rBookmark) diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index 741911c743b0..5eea4c33247c 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -567,7 +567,7 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, SwNodeIndex aSavePos( aInsIdx, -1 ); if( pRg.get() ) - pCpyDoc->CopyWithFlyInFly( *pRg, aInsIdx, FALSE ); + pCpyDoc->CopyWithFlyInFly( *pRg, 0, aInsIdx, FALSE ); else pDoc->GetNodes().MakeTxtNode( aInsIdx, (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() ); aSavePos++; diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 7712bd125720..2d6738fd915f 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -2103,7 +2103,7 @@ BOOL lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara ) *rpFndBox->GetBox()->GetSttNd()->EndOfSectionNode() ); SwNodeIndex aInsIdx( *pBox->GetSttNd(), 1 ); - pFromDoc->CopyWithFlyInFly( aCpyRg, aInsIdx, FALSE ); + pFromDoc->CopyWithFlyInFly( aCpyRg, 0, aInsIdx, FALSE ); // den initialen TextNode loeschen pCpyPara->pDoc->GetNodes().Delete( aInsIdx, 1 ); } diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 4022c0d82e1b..2534dc6da659 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -673,7 +673,7 @@ void lcl_DeleteRedlines( const SwNodeRange& rRg, SwNodeRange& rCpyRg ) // Kopieren eines Bereiches im oder in ein anderes Dokument ! -bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos ) const +bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos, bool bCopyAll ) const { const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End(); @@ -712,13 +712,13 @@ bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos ) const BOOL bRet = FALSE; if( pDoc != this ) - bRet = _Copy( rPam, rPos, TRUE, pRedlineRange ); // nur normales Kopieren + bRet = _Copy( rPam, rPos, TRUE, bCopyAll, pRedlineRange ); // nur normales Kopieren // Copy in sich selbst (ueber mehrere Nodes wird hier gesondert // behandelt; in einem TextNode wird normal behandelt) else if( ! ( *pStt <= rPos && rPos < *pEnd && ( pStt->nNode != pEnd->nNode || !pStt->nNode.GetNode().IsTxtNode() )) ) - bRet = _Copy( rPam, rPos, TRUE, pRedlineRange ); // nur normales Kopieren + bRet = _Copy( rPam, rPos, TRUE, bCopyAll, pRedlineRange ); // nur normales Kopieren else { @@ -742,7 +742,7 @@ bool SwDoc::Copy( SwPaM& rPam, SwPosition& rPos ) const SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection( SwNodeIndex( GetNodes().GetEndOfAutotext() )); aPam.GetPoint()->nNode = *pSttNd->EndOfSectionNode(); - pDoc->_Copy( rPam, *aPam.GetPoint(), FALSE ); // kopieren ohne Frames + pDoc->_Copy( rPam, *aPam.GetPoint(), FALSE, bCopyAll, 0 ); // kopieren ohne Frames aPam.GetPoint()->nNode = pDoc->GetNodes().GetEndOfAutotext(); aPam.SetMark(); @@ -817,7 +817,7 @@ BOOL lcl_MarksWholeNode(const SwPaM & rPam) } BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, - BOOL bMakeNewFrms, SwPaM* pCpyRange ) const + BOOL bMakeNewFrms, bool bCopyAll, SwPaM* pCpyRange ) const { SwDoc* pDoc = rPos.nNode.GetNode().GetDoc(); bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection(); @@ -1101,7 +1101,7 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, } } - if( aRg.aStart != aRg.aEnd ) + if( bCopyAll || aRg.aStart != aRg.aEnd ) { SfxItemSet aBrkSet( pDoc->GetAttrPool(), aBreakSetRange ); if( pSttNd && bCopyCollFmt && pDestNd->HasSwAttrSet() ) @@ -1116,13 +1116,13 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, if( aInsPos == pEnd->nNode ) { SwNodeIndex aSaveIdx( aInsPos, -1 ); - CopyWithFlyInFly( aRg, aInsPos, bMakeNewFrms, FALSE ); + CopyWithFlyInFly( aRg, 0,aInsPos, bMakeNewFrms, FALSE ); aSaveIdx++; pEnd->nNode = aSaveIdx; pEnd->nContent.Assign( aSaveIdx.GetNode().GetTxtNode(), 0 ); } else - CopyWithFlyInFly( aRg, aInsPos, bMakeNewFrms, FALSE ); + CopyWithFlyInFly( aRg, pEnd->nContent.GetIndex(), aInsPos, bMakeNewFrms, FALSE ); bCopyBookmarks = FALSE; @@ -1181,7 +1181,7 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, // ----- Copy-Methode vom SwDoc - "kopiere Fly's in Fly's" ------ -void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, +void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex, const SwNodeIndex& rInsPos, BOOL bMakeNewFrms, BOOL bDelRedlines, BOOL bCopyFlyAtFly ) const { @@ -1220,7 +1220,7 @@ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, // Undo abschalten BOOL bUndo = pDest->DoesUndo(); pDest->DoUndo( FALSE ); - _CopyFlyInFly( rRg, aSavePos, bCopyFlyAtFly ); + _CopyFlyInFly( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly ); pDest->DoUndo( bUndo ); SwNodeRange aCpyRange( aSavePos, rInsPos ); @@ -1256,7 +1256,7 @@ void lcl_ChainFmts( SwFlyFrmFmt *pSrc, SwFlyFrmFmt *pDest ) } } -void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const SwNodeIndex& rSttIdx, +void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndContentIndex, const SwNodeIndex& rSttIdx, BOOL bCopyFlyAtFly ) const { // Bug 22727: suche erst mal alle Flys zusammen, sortiere sie entsprechend @@ -1273,7 +1273,8 @@ void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const SwNodeIndex& rSttIdx, const SwFrmFmt* pFmt = (*GetSpzFrmFmts())[n]; const SwFmtAnchor* pAnchor = &pFmt->GetAnchor(); const SwPosition* pAPos; - if ( ( pAnchor->GetAnchorId() == FLY_AT_CNTNT || + bool bAtCntnt = pAnchor->GetAnchorId() == FLY_AT_CNTNT; + if ( ( bAtCntnt || pAnchor->GetAnchorId() == FLY_AT_FLY || pAnchor->GetAnchorId() == FLY_AUTO_CNTNT ) && 0 != ( pAPos = pAnchor->GetCntntAnchor()) && @@ -1282,9 +1283,53 @@ void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const SwNodeIndex& rSttIdx, : ( IsRedlineMove() ? rRg.aStart < pAPos->nNode : rRg.aStart <= pAPos->nNode )) && - pAPos->nNode < rRg.aEnd ) + pAPos->nNode <= rRg.aEnd ) { - aArr.Insert( _ZSortFly( pFmt, pAnchor, nArrLen + aArr.Count() )); + //frames at the last source node are not always copied: + //- if the node is empty and is the last node of the document or a table cell + // or a text frame then tey have to be copied + //- if the content index in this node is > 0 then paragph and frame bound objects are copied + //- to-character bound objects are copied if their index is <= nEndContentIndex + bool bAdd = false; + if( pAPos->nNode < rRg.aEnd ) + bAdd = true; + if( !bAdd ) + { + bool bEmptyNode = false; + bool bLastNode = false; + // is the node empty? + const SwNodes& rNodes = pAPos->nNode.GetNodes(); + SwTxtNode* pTxtNode; + if( 0 != ( pTxtNode = pAPos->nNode.GetNode().GetTxtNode() )) + { + bEmptyNode = !pTxtNode->GetTxt().Len(); + if( bEmptyNode ) + { + //last node information is only necessary to know for the last TextNode + SwNodeIndex aTmp( pAPos->nNode ); + ++aTmp;//goto next node + while( rNodes[aTmp ]->IsEndNode() ) + { + if( aTmp == rNodes.GetEndOfContent().GetIndex() ) + { + bLastNode = true; + break; + } + ++aTmp; + } + } + } + bAdd = bLastNode && bEmptyNode; + if( !bAdd ) + { + if( bAtCntnt ) + bAdd = nEndContentIndex > 0; + else + bAdd = pAPos->nContent <= nEndContentIndex; + } + } + if( bAdd ) + aArr.Insert( _ZSortFly( pFmt, pAnchor, nArrLen + aArr.Count() )); } } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 3ce045994b80..33cd325c669a 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1414,7 +1414,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, if( pSrcDoc != pDoc || pCpyPam->Start()->nNode > rInsPos || rInsPos >= pCpyPam->End()->nNode ) - pSrcDoc->Copy( *pCpyPam, *pPam->GetPoint() ); + pSrcDoc->Copy( *pCpyPam, *pPam->GetPoint(), false ); delete pCpyPam; } if( pCpyRg && pSrcDoc == pDoc && @@ -1443,7 +1443,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, SwTblNumFmtMerge aTNFM( *pSrcDoc, *pDoc ); - pSrcDoc->CopyWithFlyInFly( *pCpyRg, rInsPos, bCreateFrm ); + pSrcDoc->CopyWithFlyInFly( *pCpyRg, 0, rInsPos, bCreateFrm ); aSave++; if( !bCreateFrm ) diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 6737517c48c3..99a984e8f2db 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -2321,6 +2321,15 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence VOCOfDrawVirtObj::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const { +#ifdef DBG_UTIL + // #i101734# + static bool bCheckOtherThanTranslate(false); + static double fShearX(0.0); + static double fRotation(0.0); + static double fScaleX(0.0); + static double fScaleY(0.0); +#endif + const VCOfDrawVirtObj& rVC = static_cast< const VCOfDrawVirtObj& >(GetViewContact()); const SdrObject& rReferencedObject = rVC.GetSwDrawVirtObj().GetReferencedObj(); drawinglayer::primitive2d::Primitive2DSequence xRetval; @@ -2331,8 +2340,20 @@ namespace sdr if(aLocalOffset.X() || aLocalOffset.Y()) { +#ifdef DBG_UTIL + // #i101734# added debug code to check more complex transformations + // than just a translation + if(bCheckOtherThanTranslate) + { + aOffsetMatrix.scale(fScaleX, fScaleY); + aOffsetMatrix.shearX(tan(fShearX * F_PI180)); + aOffsetMatrix.rotate(fRotation * F_PI180); + } +#endif + aOffsetMatrix.set(0, 2, aLocalOffset.X()); aOffsetMatrix.set(1, 2, aLocalOffset.Y()); + } if(rReferencedObject.ISA(SdrObjGroup)) diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx index de6e43799d88..a5d8ccd24e61 100644 --- a/sw/source/core/draw/dpage.cxx +++ b/sw/source/core/draw/dpage.cxx @@ -203,8 +203,8 @@ BOOL SwDPage::RequestHelp( Window* pWindow, SdrView* pView, aPt -= pFly->Frm().Pos(); // ohne MapMode-Offset !!!!! // ohne MapMode-Offset, ohne Offset, o ... !!!!! - aPt = (Point&)(const Size&)pWindow->LogicToPixel( - (const Size&)aPt, MapMode( MAP_TWIP ) ); + aPt = pWindow->LogicToPixel( + aPt, MapMode( MAP_TWIP ) ); ((( sTxt += '?' ) += String::CreateFromInt32( aPt.X() )) += ',' ) += String::CreateFromInt32( aPt.Y() ); } diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index 665139b95844..3867d0a4a891 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -374,7 +374,7 @@ BOOL SwAutoCorrDoc::ChgAutoCorrWord( xub_StrLen & rSttPos, xub_StrLen nEndPos, SwDontExpandItem aExpItem; aExpItem.SaveDontExpandItems( *aPam.GetPoint() ); - pAutoDoc->Copy( aCpyPam, *aPam.GetPoint() ); + pAutoDoc->Copy( aCpyPam, *aPam.GetPoint(), false ); aExpItem.RestoreDontExpandItems( *aPam.GetPoint() ); diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index 4787877023f0..384aa414895a 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -249,7 +249,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) bFirstMove = FALSE; } - if( !GetDoc()->Copy( *PCURCRSR, *pPos )) + if( !GetDoc()->Copy( *PCURCRSR, *pPos, false )) continue; SwPaM aInsertPaM(*pPos, SwPosition(aSttNdIdx)); diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index f1d781e4080b..b408a1c33c81 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -168,7 +168,7 @@ USHORT SwEditShell::SaveGlossaryDoc( SwTextBlocks& rBlock, aStt = pGDoc->GetNodes().GetEndOfExtras(); pCntntNd = pGDoc->GetNodes().GoNext( &aStt ); SwPosition aInsPos( aStt, SwIndex( pCntntNd )); - pMyDoc->Copy( aCpyPam, aInsPos ); + pMyDoc->Copy( aCpyPam, aInsPos, false ); nRet = rBlock.PutDoc(); } @@ -250,13 +250,13 @@ BOOL SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd ) { PCURCRSR->SetMark(); PCURCRSR->Move( fnMoveForward, fnGoCntnt ); - bRet = GetDoc()->Copy( *PCURCRSR, aPos ) || bRet; + bRet = GetDoc()->Copy( *PCURCRSR, aPos, false ) || bRet; PCURCRSR->Exchange(); PCURCRSR->DeleteMark(); } } else - bRet = GetDoc()->Copy( *PCURCRSR, aPos ) || bRet; + bRet = GetDoc()->Copy( *PCURCRSR, aPos, false ) || bRet; FOREACHPAM_END() } diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 186174d28c9a..07c8a0911080 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -840,7 +840,7 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames ) { SwNodeIndex aIndexBefore(rInsPos.nNode); aIndexBefore--; - pClpDoc->Copy( rCopy, rInsPos ); + pClpDoc->Copy( rCopy, rInsPos, false ); { aIndexBefore++; SwPaM aPaM(SwPosition(aIndexBefore, 0), @@ -1069,7 +1069,7 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames ) aIndexBefore--; - pClpDoc->Copy( aCpyPam, rInsPos ); + pClpDoc->Copy( aCpyPam, rInsPos, false ); { aIndexBefore++; diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 1bb8039130ba..b6cc1bf56fad 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -1651,8 +1651,8 @@ const SwFrmFmt* SwFEShell::IsURLGrfAtPos( const Point& rPt, String* pURL, Point aPt( rPt ); aPt -= pFly->Frm().Pos(); // ohne MapMode-Offset, ohne Offset, o ... !!!!! - aPt = (Point&)(const Size&)GetOut()->LogicToPixel( - (const Size&)aPt, MapMode( MAP_TWIP ) ); + aPt = GetOut()->LogicToPixel( + aPt, MapMode( MAP_TWIP ) ); ((( *pURL += '?' ) += String::CreateFromInt32( aPt.X() )) += ',' ) += String::CreateFromInt32(aPt.Y() ); } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index dececa60560e..7dcbc4ef80a9 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -112,6 +112,9 @@ #include <EnhancedPDFExportHelper.hxx> // <-- +#include <ndole.hxx> +#include <svtools/chartprettypainter.hxx> + #include <PostItMgr.hxx> #include <tools/color.hxx> #define COL_NOTES_SIDEPANE RGB_COLORDATA(230,230,230) @@ -3512,6 +3515,19 @@ void SwFlyFrm::Paint( const SwRect& rRect ) const const SwNoTxtFrm *pNoTxt = Lower() && Lower()->IsNoTxtFrm() ? (SwNoTxtFrm*)Lower() : 0; + bool bIsChart = false; //#i102950# don't paint additional borders for charts + //check whether we have a chart + if(pNoTxt) + { + const SwNoTxtNode* pNoTNd = dynamic_cast<const SwNoTxtNode*>(pNoTxt->GetNode()); + if( pNoTNd ) + { + SwOLENode* pOLENd = const_cast<SwOLENode*>(pNoTNd->GetOLENode()); + if( pOLENd && ChartPrettyPainter::IsChart( pOLENd->GetOLEObj().GetObject() ) ) + bIsChart = true; + } + } + { bool bContour = GetFmt()->GetSurround().IsContour(); PolyPolygon aPoly; @@ -3641,7 +3657,8 @@ void SwFlyFrm::Paint( const SwRect& rRect ) const // OD 19.12.2002 #106318# - fly frame will paint it's subsidiary lines and // the subsidiary lines of its lowers on its own, due to overlapping with // other fly frames or other objects. - if( pGlobalShell->GetWin() ) + if( pGlobalShell->GetWin() + && !bIsChart ) //#i102950# don't paint additional borders for charts { bool bSubsLineRectsCreated; if ( pSubsLines ) diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 56b8ec9afdf4..64bb8be5fc12 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -254,8 +254,14 @@ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto ) // <-- ( ( bRTL && nCurrentAbsPos > nTabLeft - nForced ) || ( !bRTL && nCurrentAbsPos < nTabLeft + nForced ) ) && - nNextPos > nForced ) - // <-- + // --> OD 2009-07-21 #i103685# + // adjust condition: + // - back to pre OOo 3.0 condition, if tab stops are relative to indent + // - further checks needed, if tab stops are not relative to indent + ( nNextPos > 0 && + ( bTabsRelativeToIndent || + ( !pTabStop || nNextPos > nForced ) ) ) ) + // <-- { eAdj = SVX_TAB_ADJUST_DEFAULT; cFill = 0; diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 9c4728042d34..4b51e94e3404 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -310,7 +310,7 @@ void SwTxtFtn::CopyFtn( SwTxtFtn *pDest ) SwNodeIndex aEnd( *aStart.GetNode().EndOfSectionNode() ); ULONG nDestLen = aEnd.GetIndex() - aStart.GetIndex() - 1; - m_pTxtNode->GetDoc()->CopyWithFlyInFly( aRg, aEnd, TRUE ); + m_pTxtNode->GetDoc()->CopyWithFlyInFly( aRg, 0, aEnd, TRUE ); // Wenn die Dest-Sektion nicht leer war, so muessen die alten // Nodes geloescht werden: diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index dbe76f8a16fd..581e2185907e 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -346,7 +346,7 @@ void SwUndoInserts::Repeat( SwUndoIter& rUndoIter ) SwPaM aPam( *rUndoIter.pAktPam->GetPoint() ); SetPaM( aPam ); - aPam.GetDoc()->Copy( aPam, *rUndoIter.pAktPam->GetPoint() ); + aPam.GetDoc()->Copy( aPam, *rUndoIter.pAktPam->GetPoint(), false ); rUndoIter.pLastUndoObj = this; } diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index d58f7f86cab3..a922c5334f3e 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -286,7 +286,7 @@ uno::Reference< beans::XPropertySetInfo > SwXBookmark::getPropertySetInfo(void) static uno::Reference< beans::XPropertySetInfo > aRef; if(!aRef.is()) { - uno::Reference< beans::XPropertySetInfo > xInfo = aSwMapProvider.GetPropertySet(PROPERTY_MAP_BOOKMARK)->getPropertySetInfo(); + aRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_BOOKMARK)->getPropertySetInfo(); } return aRef; } diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 475438ec8d83..decd73e07e63 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -985,7 +985,8 @@ uno::Any SwXFrames::getByIndex(sal_Int32 nIndex) throw(IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - if(!IsValid()) throw uno::RuntimeException(); + if(!IsValid()) + throw uno::RuntimeException(); if(nIndex < 0 || nIndex >= USHRT_MAX) throw IndexOutOfBoundsException(); const Reference<XEnumeration> xEnum = createEnumeration(); while(xEnum->hasMoreElements()) @@ -1000,7 +1001,8 @@ uno::Any SwXFrames::getByName(const OUString& rName) throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - if(!IsValid()) throw uno::RuntimeException(); + if(!IsValid()) + throw uno::RuntimeException(); const Reference<XEnumeration> xEnum = createEnumeration(); while(xEnum->hasMoreElements()) { @@ -1016,7 +1018,8 @@ uno::Any SwXFrames::getByName(const OUString& rName) uno::Sequence<OUString> SwXFrames::getElementNames(void) throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - if(!IsValid()) throw uno::RuntimeException(); + if(!IsValid()) + throw uno::RuntimeException(); const Reference<XEnumeration> xEnum = createEnumeration(); ::std::vector<OUString> vNames; while(xEnum->hasMoreElements()) @@ -1063,7 +1066,8 @@ uno::Type SAL_CALL SwXFrames::getElementType() throw(uno::RuntimeException) sal_Bool SwXFrames::hasElements(void) throw(uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - if(IsValid()) throw uno::RuntimeException(); + if(!IsValid()) + throw uno::RuntimeException(); return createEnumeration()->hasMoreElements(); } diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 0511065e3bce..c00c21f5494e 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -542,96 +542,7 @@ void SwXText::insertTextContent(const uno::Reference< text::XTextRange > & xRang xTempRange = xRange; else xTempRange = xRange->getStart(); - SwXTextTable* pTable = reinterpret_cast< SwXTextTable * >( - sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXTextTable::getUnoTunnelId()) )); - - if(pTable) - pTable->attachToRange(xTempRange); - else - { - if(pBookmark) - pBookmark ->attachToRange(xTempRange); - else - { - if(pSection) - pSection ->attachToRange(xTempRange); - else - { - SwXFootnote* pFootnote = reinterpret_cast< SwXFootnote * >( - sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXFootnote::getUnoTunnelId()) )); - - if(pFootnote) - pFootnote->attachToRange(xTempRange); - else - { - if(pReferenceMark) - pReferenceMark->attachToRange(xTempRange); - else - { - SwXFrame* pFrame = reinterpret_cast< SwXFrame * >( - sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXFrame::getUnoTunnelId()) )); - - if(pFrame) - pFrame->attachToRange(xTempRange); - else - { - SwXDocumentIndex* pDocumentIndex = reinterpret_cast< SwXDocumentIndex * >( - sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXDocumentIndex::getUnoTunnelId()) )); - - if(pDocumentIndex) - pDocumentIndex->attachToRange(xTempRange); - else - { - if(pDocumentIndexMark) - pDocumentIndexMark->attachToRange(xTempRange); - else - { - SwXTextField* pTextField = reinterpret_cast< SwXTextField * >( - sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXTextField::getUnoTunnelId()) )); - - if(pTextField) - pTextField->attachToRange(xTempRange); - else - { - uno::Reference<beans::XPropertySet> xShapeProperties(xContent, uno::UNO_QUERY); - SwXShape* pShape = 0; - if(xShapeProperties.is()) - pShape = reinterpret_cast< SwXShape * >( - sal::static_int_cast< sal_IntPtr >( xContentTunnel->getSomething( SwXShape::getUnoTunnelId()) )); - if(pShape) - { - uno::Any aPos(&xRange, - ::getCppuType((uno::Reference<text::XTextRange>*)0)); - pShape->setPropertyValue(C2U("TextRange"), aPos); - - uno::Reference<frame::XModel> xModel = - pDoc->GetDocShell()->GetBaseModel(); - uno::Reference<drawing::XDrawPageSupplier> xPageSupp( - xModel, uno::UNO_QUERY); - - uno::Reference<drawing::XDrawPage> xPage = xPageSupp->getDrawPage(); - - uno::Reference<drawing::XShape> xShape((cppu::OWeakObject*)pShape, - uno::UNO_QUERY); - //nuer die XShapes haengen an der Sw-Drawpage - uno::Reference<drawing::XShapes> xShps(xPage, uno::UNO_QUERY); - xShps->add(xShape); - } - else - { - lang::IllegalArgumentException aArgException; - aArgException.Message = C2U("unknown text content"); - throw aArgException; - } - } - } - } - } - } - } - } - } - } + xContent->attach(xTempRange); } else { diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 168da78f51ed..b2f33dd5a152 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -823,7 +823,7 @@ SwDoc * ViewShell::CreatePrtDoc( /*Printer* pPrt,*/ SfxObjectShellRef &rDocShell // Wir bauen uns ein neues Dokument SwDoc *pPrtDoc = new SwDoc; pPrtDoc->acquire(); - pPrtDoc->SetRefForDocShell( (SfxObjectShellRef*)&(long&)rDocShellRef ); + pPrtDoc->SetRefForDocShell( boost::addressof(rDocShellRef) ); pPrtDoc->LockExpFlds(); /* TLPDF @@ -913,7 +913,7 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) // Wir bauen uns ein neues Dokument // SwDoc *pPrtDoc = new SwDoc; // pPrtDoc->acquire(); -// pPrtDoc->SetRefForDocShell( (SvEmbeddedObjectRef*)&(long&)rDocShellRef ); +// pPrtDoc->SetRefForDocShell( boost::addressof(rDocShellRef) ); pPrtDoc->LockExpFlds(); // Der Drucker wird uebernommen diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index aca80984160a..99df3307254c 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -107,6 +107,13 @@ #include "dbgoutsw.hxx" +#include <sfx2/docfile.hxx> +#include <svtools/stritem.hxx> +#include <unotools/tempfile.hxx> +#include <svx/mscodec.hxx> +#include <osl/time.h> +#include <rtl/random.h> + using namespace sw::util; using namespace sw::types; @@ -2687,6 +2694,28 @@ void SwWW8Writer::CollectOutlineBookmarks(const SwDoc &rDoc) } } +namespace +{ +#define WW_BLOCKSIZE 0x200 + + void EncryptRC4(svx::MSCodec_Std97& rCtx, SvStream &rIn, SvStream &rOut) + { + rIn.Seek(STREAM_SEEK_TO_END); + ULONG nLen = rIn.Tell(); + rIn.Seek(0); + + sal_uInt8 in[WW_BLOCKSIZE]; + for (ULONG nI = 0, nBlock = 0; nI < nLen; nI += WW_BLOCKSIZE, ++nBlock) + { + ULONG nBS = (nLen - nI > WW_BLOCKSIZE) ? WW_BLOCKSIZE : nLen - nI; + rIn.Read(in, nBS); + rCtx.InitCipher(nBlock); + rCtx.Encode(in, nBS, in, nBS); + rOut.Write(in, nBS); + } + } +} + ULONG SwWW8Writer::StoreDoc() { nCharFmtStart = ANZ_DEFAULT_STYLES; @@ -2785,6 +2814,41 @@ ULONG SwWW8Writer::StoreDoc() pStrm->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); + String sUniPassword; + if ( mpMedium ) + { + SfxItemSet* pSet = mpMedium->GetItemSet(); + + const SfxPoolItem* pPasswordItem = NULL; + if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_PASSWORD, sal_True, &pPasswordItem ) ) + if( pPasswordItem != NULL ) + sUniPassword = ( (const SfxStringItem*)pPasswordItem )->GetValue(); + } + + utl::TempFile aTempMain; + aTempMain.EnableKillingFile(); + utl::TempFile aTempTable; + aTempTable.EnableKillingFile(); + utl::TempFile aTempData; + aTempData.EnableKillingFile(); + + bool bEncrypt = false; + + xub_StrLen nLen = sUniPassword.Len(); + if ( nLen > 0 && nLen <= 15) // Password has been set + { + bEncrypt =true; + + pStrm = aTempMain.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE ); + + pTableStrm = aTempTable.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE ); + + pDataStrm = aTempData.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE ); + + sal_uInt8 aRC4EncryptionHeader[ 52 ] = {0}; + pTableStrm->Write( aRC4EncryptionHeader, 52 ); + } + const SwSectionFmt *pFmt=0; // Default: "Standard" pAktPageDesc = &const_cast<const SwDoc *>(pDoc)->GetPageDesc( 0 ); @@ -2883,6 +2947,62 @@ ULONG SwWW8Writer::StoreDoc() StoreDoc1(); + if ( bEncrypt ) + { + // Generate random number with a seed of time as salt. + TimeValue aTime; + osl_getSystemTime( &aTime ); + rtlRandomPool aRandomPool = rtl_random_createPool (); + rtl_random_addBytes ( aRandomPool, &aTime, 8 ); + + sal_uInt8 aDocId[ 16 ] = {0}; + rtl_random_getBytes( aRandomPool, aDocId, 16 ); + + rtl_random_destroyPool( aRandomPool ); + + sal_Unicode aPassword[16] = {0}; + for (xub_StrLen nChar = 0; nChar < nLen; ++nChar ) + aPassword[nChar] = sUniPassword.GetChar(nChar); + + svx::MSCodec_Std97 aCtx; + aCtx.InitKey(aPassword, aDocId); + + SvStream *pStrmTemp, *pTableStrmTemp, *pDataStrmTemp; + pStrmTemp = &xWwStrm; + pTableStrmTemp = &xTableStrm; + pDataStrmTemp = &xDataStrm; + + if ( pDataStrmTemp && pDataStrmTemp != pStrmTemp) + EncryptRC4(aCtx, *pDataStrm, *pDataStrmTemp); + + EncryptRC4(aCtx, *pTableStrm, *pTableStrmTemp); + + // Write Unencrypted Header 52 bytes to the start of the table stream + // EncryptionVersionInfo (4 bytes): A Version structure where Version.vMajor MUST be 0x0001, and Version.vMinor MUST be 0x0001. + pTableStrmTemp->Seek( 0 ); + sal_uInt32 nEncType = 0x10001; + *pTableStrmTemp << nEncType; + + sal_uInt8 pSaltData[16] = {0}; + sal_uInt8 pSaltDigest[16] = {0}; + aCtx.GetEncryptKey( aDocId, pSaltData, pSaltDigest ); + + pTableStrmTemp->Write( aDocId, 16 ); + pTableStrmTemp->Write( pSaltData, 16 ); + pTableStrmTemp->Write( pSaltDigest, 16 ); + + EncryptRC4(aCtx, *pStrm, *pStrmTemp); + + // Write Unencrypted Fib 68 bytes to the start of the workdocument stream + pFib->fEncrypted = 1; // fEncrypted indicates the document is encrypted. + pFib->fObfuscated = 0; // Must be 0 for RC4. + pFib->nHash = 0x34; // encrypt header bytes count of table stream. + pFib->nKey = 0; // lkey2 must be 0 for RC4. + + pStrmTemp->Seek( 0 ); + pFib->WriteHeader( *pStrmTemp ); + } + if (nRedlineMode != pDoc->GetRedlineMode()) pDoc->SetRedlineMode((RedlineMode_t)(nRedlineMode)); @@ -3064,11 +3184,38 @@ ULONG SwWW8Writer::WriteMedium( SfxMedium& ) return WriteStorage(); } +ULONG SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed, + const String* pFileName ) +{ + mpMedium = &rMed; + ULONG nRet = StgWriter::Write( rPaM, rMed, pFileName ); + mpMedium = NULL; + return nRet; +} + +ULONG SwWW8Writer::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage >& xStorage, const String* pFileName, SfxMedium* pMedium ) +{ + // this method was added to let the windows compiler be happy, otherwise it shows warning + return StgWriter::Write( rPaM, xStorage, pFileName, pMedium ); +} + +ULONG SwWW8Writer::Write( SwPaM& rPaM, SotStorage& rStorage, const String* pFileName ) +{ + // this method was added to let the windows compiler be happy, otherwise it shows warning + return StgWriter::Write( rPaM, rStorage, pFileName ); +} + +ULONG SwWW8Writer::Write( SwPaM& rPaM, SvStream& rStream, const String* pFileName ) +{ + // this method was added to let the solaris compiler be happy, otherwise it shows warning + return StgWriter::Write( rPaM, rStream, pFileName ); +} + SwWW8Writer::SwWW8Writer(const String& rFltName, const String& rBaseURL) : aMainStg(sMainStream), pISet(0), pUsedNumTbl(0), mpTopNodeOfHdFtPage(0), pBmpPal(0), pKeyMap(0), pOLEExp(0), pOCXExp(0), pOleMap(0), mpTableInfo(new ww8::WW8TableInfo()), nUniqueList(0), - mnHdFtIndex(0), pAktPageDesc(0), pPapPlc(0), pChpPlc(0), pChpIter(0), pO(0), + mnHdFtIndex(0), mpMedium(0), pAktPageDesc(0), pPapPlc(0), pChpPlc(0), pChpIter(0), pO(0), bHasHdr(false), bHasFtr(false) { SetBaseURL( rBaseURL ); diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 52c34625414f..82af29567353 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -405,6 +405,8 @@ friend Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ); USHORT nUniqueList; // current number for creating unique list names unsigned int mnHdFtIndex; + SfxMedium* mpMedium; + virtual ULONG WriteStorage(); virtual ULONG WriteMedium( SfxMedium& ); @@ -520,6 +522,10 @@ public: BYTE bHasFtr : 1; + virtual ULONG Write( SwPaM&, SfxMedium&, const String* = 0 ); + virtual ULONG Write( SwPaM&, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String* = 0, SfxMedium* = 0 ); + virtual ULONG Write( SwPaM&, SotStorage&, const String* = 0 ); + virtual ULONG Write( SwPaM&, SvStream&, const String* = 0 ); SvxMSExportOLEObjects& GetOLEExp() { return *pOLEExp; } diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index df036b03318c..81d605457e9c 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -187,7 +187,7 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, -1 ); pCNd = aIdx.GetNode().GetCntntNode(); SwPosition aPos( aIdx, SwIndex( pCNd, pCNd->Len() )); - pD->Copy( aPam, aPos ); + pD->Copy( aPam, aPos, false ); rBlocks.PutDoc(); } } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 2e51e34d1679..82682078e294 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4346,6 +4346,13 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) DecryptRC4(aCtx, *pDataStream, aDecryptData); pDataStream = &aDecryptData; } + SfxMedium* pMedium = mpDocShell->GetMedium(); + if ( pMedium ) + { + SfxItemSet* pSet = pMedium->GetItemSet(); + if ( pSet ) + pSet->Put( SfxStringItem(SID_PASSWORD, sUniPassword) ); + } } } } @@ -4360,8 +4367,6 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) pWwFib = new WW8Fib(*pStrm, nWantedVersion); if (pWwFib->nFibError) nErrRet = ERR_SWG_READ_ERROR; - if(!nErrRet && mpDocShell->GetDoc()) - mpDocShell->GetDoc()->SetWinEncryption(true); } } diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 8463145d1990..ec81c82bbebd 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2382,7 +2382,8 @@ void WW8TabDesc::CalcDefaults() } } */ - if (nMinLeft && ((!bIsBiDi && text::HoriOrientation::LEFT == eOri) || (bIsBiDi && text::HoriOrientation::RIGHT == eOri))) + if ((nMinLeft && !bIsBiDi && text::HoriOrientation::LEFT == eOri) || + (nMinLeft != -108 && bIsBiDi && text::HoriOrientation::RIGHT == eOri)) // Word sets the first nCenter value to -108 when no indent is used eOri = text::HoriOrientation::LEFT_AND_WIDTH; // absolutely positioned nDefaultSwCols = nMinCols; // da Zellen einfuegen billiger ist als Mergen @@ -2553,7 +2554,12 @@ void WW8TabDesc::CreateSwTable() if (!bIsBiDi) nLeft = GetMinLeft(); else - nLeft = pIo->maSectionManager.GetTextAreaWidth() - nPreferredWidth - nOrgDxaLeft; + { + if (nPreferredWidth) + nLeft = pIo->maSectionManager.GetTextAreaWidth() - nPreferredWidth - nOrgDxaLeft; + else + nLeft = -GetMinLeft(); + } aL.SetLeft(nLeft); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 0aceb981edff..f3a4c3630e4c 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -5624,14 +5624,15 @@ WW8Fib::WW8Fib(BYTE nVer) // <-- #i90932# } -bool WW8Fib::Write(SvStream& rStrm) +bool WW8Fib::WriteHeader(SvStream& rStrm) { - BYTE *pDataPtr = new BYTE[ fcMin ]; - BYTE *pData = pDataPtr; - memset( pData, 0, fcMin ); - bool bVer8 = 8 == nVersion; + size_t nUnencryptedHdr = bVer8 ? 0x44 : 0x24; + BYTE *pDataPtr = new BYTE[ nUnencryptedHdr ]; + BYTE *pData = pDataPtr; + memset( pData, 0, nUnencryptedHdr ); + ULONG nPos = rStrm.Tell(); cbMac = rStrm.Seek( STREAM_SEEK_TO_END ); rStrm.Seek( nPos ); @@ -5652,6 +5653,7 @@ bool WW8Fib::Write(SvStream& rStrm) if( fWhichTblStm ) nBits16 |= 0x0200; if( fExtChar ) nBits16 |= 0x1000; if( fFarEast ) nBits16 |= 0x4000; // #i90932# + if( fObfuscated ) nBits16 |= 0x8000; Set_UInt16( pData, nBits16 ); Set_UInt16( pData, nFibBack ); @@ -5697,6 +5699,27 @@ bool WW8Fib::Write(SvStream& rStrm) // Marke: "rglw" Beginning of the array of longs Set_UInt32( pData, cbMac ); + rStrm.Write( pDataPtr, nUnencryptedHdr ); + delete[] pDataPtr; + return 0 == rStrm.GetError(); +} + +bool WW8Fib::Write(SvStream& rStrm) +{ + bool bVer8 = 8 == nVersion; + + WriteHeader( rStrm ); + + size_t nUnencryptedHdr = bVer8 ? 0x44 : 0x24; + + BYTE *pDataPtr = new BYTE[ fcMin - nUnencryptedHdr ]; + BYTE *pData = pDataPtr; + memset( pData, 0, fcMin - nUnencryptedHdr ); + + ULONG nPos = rStrm.Tell(); + cbMac = rStrm.Seek( STREAM_SEEK_TO_END ); + rStrm.Seek( nPos ); + // 2 Longs uebergehen, da unwichtiger Quatsch pData += 2 * sizeof( INT32); @@ -5905,7 +5928,7 @@ bool WW8Fib::Write(SvStream& rStrm) Set_UInt32( pData, 0); } - rStrm.Write( pDataPtr, fcMin ); + rStrm.Write( pDataPtr, fcMin - nUnencryptedHdr ); delete[] pDataPtr; return 0 == rStrm.GetError(); } diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 68db5ea6c2c9..30bf841bdcdd 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -1040,6 +1040,7 @@ public: UINT16 fExtChar :1; // 1000 =1, when using extended character set in file UINT16 fFarEast :1; // 4000 =1, probably, when far-East language vaiants of Word is used to create a file #i90932# + UINT16 fObfuscated :1; // 8000=1. specifies whether the document is obfuscated using XOR obfuscation. otherwise this bit MUST be ignored. UINT16 nFibBack; // 0xc UINT16 nHash; // 0xe file encrypted hash @@ -1434,6 +1435,7 @@ public: /* leider falsch, man braucht auch noch einen fuer den Export */ WW8Fib( BYTE nVersion = 6 ); + bool WriteHeader(SvStream& rStrm); bool Write(SvStream& rStrm); static rtl_TextEncoding GetFIBCharset(UINT16 chs); ww::WordVersion GetFIBVersion() const; diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 444646a6281d..a25bfbb45659 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -699,7 +699,7 @@ void SwXMLTableCellContext_Impl::EndElement() SwPaM aSrcPaM( *pSrcPaM->GetPoint(), *pSrcPaM->GetMark() ); SwPosition aDstPos( *pDstTxtCrsr->GetPaM()->GetPoint() ); - pDoc->Copy( aSrcPaM, aDstPos ); + pDoc->Copy( aSrcPaM, aDstPos, false ); nColRepeat--; } diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index d7e2450dbebf..dd5ecb185c2d 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -578,17 +578,6 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) return FALSE; } - // if the imported word document is password protected - warn the user - // about saving it without the password. - if(pDoc->IsWinEncrypted()) - { - if(!SwWarnPassword::WarningOnPassword( rMedium )) - { - SetError(ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); - return FALSE; - } - } - //#i3370# remove quick help to prevent saving of autocorrection suggestions if(pView) pView->GetEditWin().StopQuickHelp(); diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index caa315999523..182bda09d7b8 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -918,33 +918,6 @@ void SwDocShell::Execute(SfxRequest& rReq) if(!pBool || !pBool->GetValue()) break; } - else - { - // try to store the document - sal_uInt32 nErrorCode = ERRCODE_NONE; - try - { - uno::Reference< frame::XStorable > xStorable( GetModel(), uno::UNO_QUERY_THROW ); - xStorable->store(); - } - catch( task::ErrorCodeIOException& aErrEx ) - { - nErrorCode = (sal_uInt32)aErrEx.ErrCode; - } - catch( uno::Exception& ) - { - nErrorCode = ERRCODE_IO_GENERAL; - } - - if ( nErrorCode != ERRCODE_NONE ) - { - // if the saving has failed show the error and break the action - if ( nErrorCode != ERRCODE_ABORT ) - ErrorHandler::HandleError( nErrorCode ); - - break; - } - } } #ifdef DBG_UTIL { diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx index 8a63254f42c1..863ef3c22f76 100644 --- a/sw/source/ui/app/swmodul1.cxx +++ b/sw/source/ui/app/swmodul1.cxx @@ -437,7 +437,7 @@ sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor) void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet, const AuthorCharAttr &rAttr ) { - Color aCol( (ColorData)rAttr.nColor ); + Color aCol( rAttr.nColor ); if( COL_TRANSPARENT == rAttr.nColor ) { diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 0d5883390ff6..736cbd881212 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -60,19 +60,19 @@ TabPage TP_CONTENT_OPT CheckBox CB_CROSS { Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 108 , 10 ) ; + Size = MAP_APPFONT ( 118 , 10 ) ; Text [ en-US ] = "Guides ~while moving"; }; CheckBox CB_HANDLE { Pos = MAP_APPFONT ( 12 , 27 ) ; - Size = MAP_APPFONT ( 108 , 10 ) ; + Size = MAP_APPFONT ( 118 , 10 ) ; Text [ en-US ] = "Sim~ple handles"; }; CheckBox CB_BIGHANDLE { Pos = MAP_APPFONT ( 12 , 40 ) ; - Size = MAP_APPFONT ( 108 , 10 ) ; + Size = MAP_APPFONT ( 118 , 10 ) ; Text [ en-US ] = "Large handles"; }; FixedLine FL_WINDOW @@ -103,7 +103,7 @@ TabPage TP_CONTENT_OPT CheckBox CB_HRULER { Pos = MAP_APPFONT ( 142 , 53 ) ; - Size = MAP_APPFONT ( 61 , 10 ) ; + Size = MAP_APPFONT ( 62 , 10 ) ; Text [ en-US ] = "Hori~zontal ruler" ; }; ListBox LB_HMETRIC @@ -115,7 +115,7 @@ TabPage TP_CONTENT_OPT CheckBox CB_VRULER { Pos = MAP_APPFONT ( 142 , 66 ) ; - Size = MAP_APPFONT ( 61 , 10 ) ; + Size = MAP_APPFONT ( 62 , 10 ) ; Text [ en-US ] = "Verti~cal ruler" ; }; CheckBox CB_VRULER_RIGHT diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 082269122539..4b85042d0003 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -1688,7 +1688,7 @@ struct CharAttr }; // Editieren entspricht Einfuegen-Attributen -static CharAttr __FAR_DATA aInsertAttr[] = +static CharAttr __FAR_DATA aRedlineAttr[] = { { SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_NOT_MAPPED }, { SID_ATTR_CHAR_WEIGHT, WEIGHT_BOLD }, @@ -1702,7 +1702,17 @@ static CharAttr __FAR_DATA aInsertAttr[] = { SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_TITEL }, { SID_ATTR_BRUSH, 0 } }; +// Items from aRedlineAttr relevant for InsertAttr: strikethrough is +// not used +static USHORT aInsertAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 }; +// Items from aRedlineAttr relevant for DeleteAttr: underline and +// double underline is not used +static USHORT aDeletedAttrMap[] = { 0, 1, 2, 5, 6, 7, 8, 9, 10 }; + +// Items from aRedlineAttr relevant for ChangeAttr: strikethrough is +// not used +static USHORT aChangedAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 }; /*----------------------------------------------------------------------- Beschreibung: Markierungsvorschau @@ -1860,6 +1870,23 @@ void SwMarkPreview::DrawRect(const Rectangle &rRect, const Color &rFillColor, co Window::DrawRect(rRect); } +namespace +{ + void lcl_FillRedlineAttrListBox( + ListBox& rLB, const AuthorCharAttr& rAttrToSelect, + const USHORT* pAttrMap, const USHORT nAttrMapSize) + { + for (USHORT i = 0; i != nAttrMapSize; ++i) + { + CharAttr& rAttr(aRedlineAttr[pAttrMap[i]]); + rLB.SetEntryData(i, &rAttr); + if (rAttr.nItemId == rAttrToSelect.nItemId && + rAttr.nAttr == rAttrToSelect.nAttr) + rLB.SelectEntryPos(i); + } + } +} + SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( Window* pParent, const SfxItemSet& rSet ) : SfxTabPage(pParent, SW_RES(TP_REDLINE_OPT), rSet), @@ -1908,6 +1935,13 @@ SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( Window* pParent, aChangedLB.InsertEntry(sEntry); }; + // remove strikethrough from insert and change and underline + double + // underline from delete + aInsertLB.RemoveEntry(5); + aChangedLB.RemoveEntry(5); + aDeletedLB.RemoveEntry(4); + aDeletedLB.RemoveEntry(3); + Link aLk = LINK(this, SwRedlineOptionsTabPage, AttribHdl); aInsertLB.SetSelectHdl( aLk ); aDeletedLB.SetSelectHdl( aLk ); @@ -1945,7 +1979,7 @@ BOOL SwRedlineOptionsTabPage::FillItemSet( SfxItemSet& ) AuthorCharAttr aOldDeletedAttr(pOpt->GetDeletedAuthorAttr()); AuthorCharAttr aOldChangedAttr(pOpt->GetFormatAuthorAttr()); - ULONG nOldMarkColor = pOpt->GetMarkAlignColor().GetColor(); + ColorData nOldMarkColor = pOpt->GetMarkAlignColor().GetColor(); USHORT nOldMarkMode = pOpt->GetMarkAlignMode(); USHORT nPos = aInsertLB.GetSelectEntryPos(); @@ -2105,7 +2139,7 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet& ) aChangedColorLB.SetUpdateMode( TRUE ); aMarkColorLB.SetUpdateMode( TRUE ); - ULONG nColor = rInsertAttr.nColor; + ColorData nColor = rInsertAttr.nColor; switch (nColor) { @@ -2149,41 +2183,16 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet& ) aMarkColorLB.SelectEntry(pOpt->GetMarkAlignColor()); - // Attributlistboxen initialisieren - USHORT nNum = sizeof(aInsertAttr) / sizeof(CharAttr); - aInsertLB.SelectEntryPos(0); aDeletedLB.SelectEntryPos(0); aChangedLB.SelectEntryPos(0); - for (i = 0; i < nNum; i++) - { - aInsertLB.SetEntryData(i, &aInsertAttr[i]); - if (aInsertAttr[i].nItemId == rInsertAttr.nItemId && - aInsertAttr[i].nAttr == rInsertAttr.nAttr) - aInsertLB.SelectEntryPos(i); - } - - for (i = 0; i < nNum; i++) - { - aDeletedLB.SetEntryData(i, &aInsertAttr[i]); - if (aInsertAttr[i].nItemId == rDeletedAttr.nItemId && - aInsertAttr[i].nAttr == rDeletedAttr.nAttr) - aDeletedLB.SelectEntryPos(i); - } - - for (i = 0; i < nNum; i++) - { - aChangedLB.SetEntryData(i, &aInsertAttr[i]); - if (aInsertAttr[i].nItemId == rChangedAttr.nItemId && - aInsertAttr[i].nAttr == rChangedAttr.nAttr) - aChangedLB.SelectEntryPos(i); - } - //remove strikethrough from insert and delete and underline+double underline from delete - aInsertLB.RemoveEntry(5); - aChangedLB.RemoveEntry(5); - aDeletedLB.RemoveEntry(4); - aDeletedLB.RemoveEntry(3); + lcl_FillRedlineAttrListBox(aInsertLB, rInsertAttr, aInsertAttrMap, + sizeof(aInsertAttrMap) / sizeof(USHORT)); + lcl_FillRedlineAttrListBox(aDeletedLB, rDeletedAttr, aDeletedAttrMap, + sizeof(aDeletedAttrMap) / sizeof(USHORT)); + lcl_FillRedlineAttrListBox(aChangedLB, rChangedAttr, aChangedAttrMap, + sizeof(aChangedAttrMap) / sizeof(USHORT)); USHORT nPos = 0; switch (pOpt->GetMarkAlignMode()) @@ -2266,7 +2275,8 @@ IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox *, pLB ) nPos = 0; CharAttr* pAttr = ( CharAttr* ) pLB->GetEntryData( nPos ); - + //switch off preview background color + pPrev->ResetColor(); switch (pAttr->nItemId) { case SID_ATTR_CHAR_WEIGHT: diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 7c0991bd39fe..a5cfd66a740a 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -35,7 +35,7 @@ #endif #include <stdio.h> - +#include <unotxdoc.hxx> #include <com/sun/star/text/NotePrintMode.hpp> #include <sfx2/app.hxx> #include <com/sun/star/sdb/CommandType.hpp> @@ -43,17 +43,13 @@ #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/XEventListener.hpp> -#ifndef _COM_SUN_STAR_UTIL_iXNUMBERFORMATTER_HPP_ #include <com/sun/star/util/XNumberFormatter.hpp> -#endif #include <com/sun/star/sdb/XCompletedConnection.hpp> #include <com/sun/star/sdb/XCompletedExecution.hpp> #include <com/sun/star/container/XChild.hpp> -#ifndef _COM_SUN_STAR_TEXT_MAILMERGEEVENT_ #include <com/sun/star/text/MailMergeEvent.hpp> -#endif #include <com/sun/star/frame/XStorable.hpp> -#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/ui/dialogs/XFilePicker.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> #include <com/sun/star/uno/XNamingService.hpp> @@ -65,9 +61,7 @@ #include <dbconfig.hxx> #include <swdbtoolsclient.hxx> #include <pagedesc.hxx> -#ifndef _LSTBOX_HXX //autogen #include <vcl/lstbox.hxx> -#endif #include <unotools/tempfile.hxx> #include <svtools/pathoptions.hxx> #include <svtools/urihelper.hxx> @@ -87,39 +81,25 @@ #include <goodies/mailenum.hxx> #include <cmdid.h> #include <swmodule.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif -#ifndef _DOCSH_HXX #include <docsh.hxx> -#endif #include <edtwin.hxx> #include <wrtsh.hxx> #include <fldbas.hxx> #include <initui.hxx> #include <swundo.hxx> #include <flddat.hxx> -#ifndef _MODCFG_HXX #include <modcfg.hxx> -#endif #include <swprtopt.hxx> #include <shellio.hxx> #include <dbui.hxx> -#ifndef _DBMGR_HXX #include <dbmgr.hxx> -#endif #include <doc.hxx> #include <swwait.hxx> #include <swunohelper.hxx> -#ifndef _DBUI_HRC #include <dbui.hrc> -#endif -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif -#ifndef _STATSTR_HRC #include <statstr.hrc> -#endif #include <mmconfigitem.hxx> #include <sfx2/request.hxx> #include <hintids.hxx> @@ -1782,6 +1762,7 @@ ULONG SwNewDBMgr::GetColumnFmt( const String& rDBName, uno::Reference< XConnection> xConnection; sal_Bool bUseMergeData = sal_False; uno::Reference< XColumnsSupplier> xColsSupp; + bool bDisposeConnection = false; if(pImpl->pMergeData && pImpl->pMergeData->sDataSource.equals(rDBName) && pImpl->pMergeData->sCommand.equals(rTableName)) { @@ -1806,6 +1787,7 @@ ULONG SwNewDBMgr::GetColumnFmt( const String& rDBName, { rtl::OUString sDBName(rDBName); xConnection = RegisterConnection( sDBName ); + bDisposeConnection = true; } if(bUseMergeData) pImpl->pMergeData->xConnection = xConnection; @@ -1836,6 +1818,10 @@ ULONG SwNewDBMgr::GetColumnFmt( const String& rDBName, { ::comphelper::disposeComponent( xColsSupp ); } + if(bDisposeConnection) + { + ::comphelper::disposeComponent( xConnection ); + } } else nRet = pNFmtr->GetFormatIndex( NF_NUMBER_STANDARD, LANGUAGE_SYSTEM ); @@ -3211,7 +3197,6 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, SwWrtShell& rSourceShell = rSourceView.GetWrtShell(); BOOL bSynchronizedDoc = rSourceShell.IsLabelDoc() && rSourceShell.GetSectionFmtCount() > 1; - String sSourceDocURL; //save the settings of the first rSourceShell.SttEndDoc(TRUE); USHORT nStartingPageNo = rSourceShell.GetVirtPageNum(); @@ -3221,22 +3206,6 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, try { - // save the working document into a temporary location - sSourceDocURL = URIHelper::SmartRel2Abs( - INetURLObject(), utl::TempFile::CreateTempName(), - URIHelper::GetMaybeFileHdl()); - const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat( - String::CreateFromAscii( FILTER_XML ), - SwDocShell::Factory().GetFilterContainer() ); - - SfxStringItem aFilterName( SID_FILTER_NAME, pSfxFlt->GetFilterName()); - uno::Sequence< beans::PropertyValue > aValues(1); - beans::PropertyValue* pValues = aValues.getArray(); - pValues[0].Name = C2U("FilterName"); - pValues[0].Value <<= ::rtl::OUString(pSfxFlt->GetFilterName()); - uno::Reference< frame::XStorable > xStore( rSourceView.GetDocShell()->GetModel(), uno::UNO_QUERY); - xStore->storeToURL( sSourceDocURL, aValues ); - // create a target docshell to put the merged document into SfxObjectShellRef xTargetDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xTargetDocShell->DoInitNew( 0 ); @@ -3285,116 +3254,120 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, Application::Reschedule(); } - // create a new docshell from the temporary document - SfxBoolItem aHidden( SID_HIDDEN, TRUE ); - SfxStringItem aReferer( SID_REFERER, String::CreateFromAscii(URL_PREFIX_PRIV_SOFFICE )); - SfxStringItem aTarget( SID_TARGETNAME, String::CreateFromAscii("_blank") ); - SfxStringItem aURL( SID_FILE_NAME, sSourceDocURL ); - const SfxPoolItem* pReturnValue = - rSourceView.GetViewFrame()->GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, - &aURL, &aFilterName, &aHidden, &aReferer, &aTarget, 0L); - if(pReturnValue) + // copy the source document + SfxObjectShellRef xWorkDocSh; + if(nDocNo == 1 ) { - SfxViewFrameItem* pVItem = (SfxViewFrameItem*)pReturnValue; - SwView* pWorkView = (SwView*) pVItem->GetFrame()->GetViewShell(); - SwWrtShell& rWorkShell = pWorkView->GetWrtShell(); - pWorkView->AttrChangedNotify( &rWorkShell );//Damit SelectShell gerufen wird. - - // merge the data - SwDoc* pWorkDoc = rWorkShell.GetDoc(); - SwNewDBMgr* pWorkDBMgr = pWorkDoc->GetNewDBMgr(); - pWorkDoc->SetNewDBMgr( this ); - pWorkDoc->EmbedAllLinks(); - if(UNDO_UI_DELETE_INVISIBLECNTNT == rWorkShell.GetUndoIds()) - rWorkShell.Undo(); - // create a layout - rWorkShell.CalcLayout(); - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, rWorkShell.GetView().GetViewFrame()->GetObjectShell())); - rWorkShell.ViewShell::UpdateFlds(); - SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, rWorkShell.GetView().GetViewFrame()->GetObjectShell())); - - // strip invisible content and convert fields to text - rWorkShell.RemoveInvisibleContent(); - rWorkShell.ConvertFieldsToText(); - rWorkShell.SetNumberingRestart(); - - - // insert the document into the target document - rWorkShell.SttEndDoc(FALSE); - rWorkShell.SttEndDoc(TRUE); - rWorkShell.SelAll(); - pTargetShell->SttEndDoc(FALSE); - - //#i63806# put the styles to the target document - //if the source uses headers or footers each new copy need to copy a new page styles - if(bPageStylesWithHeaderFooter) - { - //create a new pagestyle - //copy the pagedesc from the current document to the new document and change the name of the to-be-applied style - - SwDoc* pTargetDoc = pTargetShell->GetDoc(); - String sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo ); - pTargetShell->GetDoc()->MakePageDesc( sNewPageDescName ); - SwPageDesc* pTargetPageDesc = pTargetShell->FindPageDescByName( sNewPageDescName ); - if(pSourcePageDesc && pTargetPageDesc) - { - pTargetDoc->CopyPageDesc( *pSourcePageDesc, *pTargetPageDesc, sal_False ); - sModifiedStartingPageDesc = sNewPageDescName; - lcl_CopyFollowPageDesc( *pTargetShell, *pSourcePageDesc, *pTargetPageDesc, nDocNo ); - } - } - if(nDocNo == 1 || bPageStylesWithHeaderFooter) - { - pTargetView->GetDocShell()->_LoadStyles( *pWorkView->GetDocShell(), sal_True ); - } - if(nDocNo > 1) - { - pTargetShell->InsertPageBreak( &sModifiedStartingPageDesc, nStartingPageNo ); - } - else - { - pTargetShell->SetPageStyle(sModifiedStartingPageDesc); - } - USHORT nPageCountBefore = pTargetShell->GetPageCnt(); - DBG_ASSERT(!pTargetShell->GetTableFmt(),"target document ends with a table - paragraph should be appended"); - //#i51359# add a second paragraph in case there's only one + uno::Reference< util::XCloneable > xClone( rSourceView.GetDocShell()->GetModel(), uno::UNO_QUERY); + uno::Reference< lang::XUnoTunnel > xWorkDocShell( xClone->createClone(), uno::UNO_QUERY); + SwXTextDocument* pWorkModel = reinterpret_cast<SwXTextDocument*>(xWorkDocShell->getSomething(SwXTextDocument::getUnoTunnelId())); + xWorkDocSh = pWorkModel->GetDocShell(); + } + else + { + SwDoc* pNewDoc = rSourceView.GetDocShell()->GetDoc()->CreateCopy(); + xWorkDocSh = new SwDocShell( pNewDoc, SFX_CREATE_MODE_STANDARD ); + xWorkDocSh->DoInitNew(); + } + //create a ViewFrame + SwView* pWorkView = static_cast< SwView* >( SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, sal_True )->GetViewShell() ); + SwWrtShell& rWorkShell = pWorkView->GetWrtShell(); + pWorkView->AttrChangedNotify( &rWorkShell );//Damit SelectShell gerufen wird. + + // merge the data + SwDoc* pWorkDoc = rWorkShell.GetDoc(); + SwNewDBMgr* pWorkDBMgr = pWorkDoc->GetNewDBMgr(); + pWorkDoc->SetNewDBMgr( this ); + pWorkDoc->EmbedAllLinks(); + if(UNDO_UI_DELETE_INVISIBLECNTNT == rWorkShell.GetUndoIds()) + rWorkShell.Undo(); + // create a layout + rWorkShell.CalcLayout(); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, rWorkShell.GetView().GetViewFrame()->GetObjectShell())); + rWorkShell.ViewShell::UpdateFlds(); + SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, rWorkShell.GetView().GetViewFrame()->GetObjectShell())); + + // strip invisible content and convert fields to text + rWorkShell.RemoveInvisibleContent(); + rWorkShell.ConvertFieldsToText(); + rWorkShell.SetNumberingRestart(); + + + // insert the document into the target document + rWorkShell.SttEndDoc(FALSE); + rWorkShell.SttEndDoc(TRUE); + rWorkShell.SelAll(); + pTargetShell->SttEndDoc(FALSE); + + //#i63806# put the styles to the target document + //if the source uses headers or footers each new copy need to copy a new page styles + if(bPageStylesWithHeaderFooter) + { + //create a new pagestyle + //copy the pagedesc from the current document to the new document and change the name of the to-be-applied style + + SwDoc* pTargetDoc = pTargetShell->GetDoc(); + String sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo ); + pTargetShell->GetDoc()->MakePageDesc( sNewPageDescName ); + SwPageDesc* pTargetPageDesc = pTargetShell->FindPageDescByName( sNewPageDescName ); + if(pSourcePageDesc && pTargetPageDesc) { - SwNodeIndex aIdx( pWorkDoc->GetNodes().GetEndOfExtras(), 2 ); - SwPosition aTestPos( aIdx ); - SwCursor aTestCrsr(aTestPos,0,false); - if(!aTestCrsr.MovePara(fnParaNext, fnParaStart)) - { - //append a paragraph - pWorkDoc->AppendTxtNode( aTestPos ); - } + pTargetDoc->CopyPageDesc( *pSourcePageDesc, *pTargetPageDesc, sal_False ); + sModifiedStartingPageDesc = sNewPageDescName; + lcl_CopyFollowPageDesc( *pTargetShell, *pSourcePageDesc, *pTargetPageDesc, nDocNo ); } - pTargetShell->Paste( rWorkShell.GetDoc(), sal_True ); - //convert fields in page styles (header/footer - has to be done after the first document has been pasted - if(1 == nDocNo) + } + if(nDocNo == 1 || bPageStylesWithHeaderFooter) + { + pTargetView->GetDocShell()->_LoadStyles( *pWorkView->GetDocShell(), sal_True ); + } + if(nDocNo > 1) + { + pTargetShell->InsertPageBreak( &sModifiedStartingPageDesc, nStartingPageNo ); + } + else + { + pTargetShell->SetPageStyle(sModifiedStartingPageDesc); + } + USHORT nPageCountBefore = pTargetShell->GetPageCnt(); + DBG_ASSERT(!pTargetShell->GetTableFmt(),"target document ends with a table - paragraph should be appended"); + //#i51359# add a second paragraph in case there's only one + { + SwNodeIndex aIdx( pWorkDoc->GetNodes().GetEndOfExtras(), 2 ); + SwPosition aTestPos( aIdx ); + SwCursor aTestCrsr(aTestPos,0,false); + if(!aTestCrsr.MovePara(fnParaNext, fnParaStart)) { - pTargetShell->CalcLayout(); - pTargetShell->ConvertFieldsToText(); + //append a paragraph + pWorkDoc->AppendTxtNode( aTestPos ); } - //add the document info to the config item - SwDocMergeInfo aMergeInfo; - aMergeInfo.nStartPageInTarget = nPageCountBefore; - //#i72820# calculate layout to be able to find the correct page index + } + pTargetShell->Paste( rWorkShell.GetDoc(), sal_True ); + //convert fields in page styles (header/footer - has to be done after the first document has been pasted + if(1 == nDocNo) + { pTargetShell->CalcLayout(); - aMergeInfo.nEndPageInTarget = pTargetShell->GetPageCnt(); - aMergeInfo.nDBRow = nStartRow; - rMMConfig.AddMergedDocument( aMergeInfo ); - ++nRet; - - // the print monitor needs some time to act - for( USHORT i = 0; i < 25; i++) - Application::Reschedule(); - - //restore the ole DBMgr - pWorkDoc->SetNewDBMgr( pWorkDBMgr ); - //now the temporary document should be closed - SfxObjectShellRef xDocSh(pWorkView->GetDocShell()); - xDocSh->DoClose(); + pTargetShell->ConvertFieldsToText(); } + //add the document info to the config item + SwDocMergeInfo aMergeInfo; + aMergeInfo.nStartPageInTarget = nPageCountBefore; + //#i72820# calculate layout to be able to find the correct page index + pTargetShell->CalcLayout(); + aMergeInfo.nEndPageInTarget = pTargetShell->GetPageCnt(); + aMergeInfo.nDBRow = nStartRow; + rMMConfig.AddMergedDocument( aMergeInfo ); + ++nRet; + + // the print monitor needs some time to act + for( USHORT i = 0; i < 25; i++) + Application::Reschedule(); + + //restore the ole DBMgr + pWorkDoc->SetNewDBMgr( pWorkDBMgr ); + //now the temporary document should be closed + SfxObjectShellRef xDocSh(pWorkView->GetDocShell()); + xDocSh->DoClose(); nEndRow = pImpl->pMergeData->xResultSet->getRow(); ++nDocNo; } while( !bCancel && @@ -3416,8 +3389,6 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, { DBG_ERROR("exception caught in SwNewDBMgr::MergeDocuments"); } - if(sSourceDocURL.Len()) - File::remove( sSourceDocURL ); DELETEZ(pImpl->pMergeData); bInMerge = FALSE; return nRet; diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 627676707214..ab2a1d8e3d3c 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -93,7 +93,6 @@ #include <glossary.hxx> //add for SwGlossaryDlg #include <inpdlg.hxx> //add for SwFldInputDlg #include <insfnote.hxx> //add for SwInsFootNoteDlg -#include <insrc.hxx> //add for SwInsRowColDlg #include <insrule.hxx> //add for SwInsertGrfRulerDlg #include <instable.hxx> //add for SwInsTableDlg #include <javaedit.hxx> //add for SwJavaEditDialog @@ -1359,14 +1358,11 @@ AbstractInsFootNoteDlg* SwAbstractDialogFactory_Impl::CreateInsFootNoteDlg( int } VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclSwViewDialog( int nResId, - SwView& rView, BOOL bCol ) //add for SwInsRowColDlg, SwLineNumberingDlg + SwView& rView, BOOL /*bCol*/ ) //add for SwInsRowColDlg, SwLineNumberingDlg { Dialog* pDlg=NULL; switch ( nResId ) { - case DLG_INS_ROW_COL : - pDlg = new SwInsRowColDlg( rView, bCol ); - break; case DLG_LINE_NUMBERING : pDlg = new SwLineNumberingDlg( &rView ); break; diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 613e0c4c46db..ea6ab45f4ec1 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -468,7 +468,7 @@ sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor ) pClpDocFac = new SwDocFac; SwDoc* pTmpDoc = pClpDocFac->GetDoc(); - pTmpDoc->SetRefForDocShell( (SfxObjectShellRef*)&(long&)aDocShellRef ); + pTmpDoc->SetRefForDocShell( boost::addressof(aDocShellRef) ); pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen pWrtShell->Copy( pTmpDoc ); @@ -883,7 +883,7 @@ int SwTransferable::PrepareForCopy( BOOL bIsCut ) SwDoc* pTmpDoc = pClpDocFac->GetDoc(); pTmpDoc->SetClipBoard( true ); - pTmpDoc->SetRefForDocShell( (SfxObjectShellRef*)&(long&)aDocShellRef ); + pTmpDoc->SetRefForDocShell( boost::addressof(aDocShellRef) ); pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen pWrtShell->Copy( pTmpDoc ); @@ -1067,7 +1067,7 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, SwCntntNode* pCNd = rNds.GoNext( &aNodeIdx ); // gehe zum 1. ContentNode SwPaM aPam( *pCNd ); - pCDoc->SetRefForDocShell( (SfxObjectShellRef*)&(long&)aDocShellRef ); + pCDoc->SetRefForDocShell( boost::addressof(aDocShellRef) ); pCDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen pCDoc->InsertGlossary( rGlossary, rStr, aPam, 0 ); diff --git a/sw/source/ui/docvw/romenu.cxx b/sw/source/ui/docvw/romenu.cxx index 437f7eabb25c..50776ef80f11 100644 --- a/sw/source/ui/docvw/romenu.cxx +++ b/sw/source/ui/docvw/romenu.cxx @@ -34,12 +34,8 @@ #include <tools/urlobj.hxx> -#ifndef _GRAPH_HXX //autogen #include <vcl/graph.hxx> -#endif -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif #include <sot/formats.hxx> #include <svtools/eitem.hxx> #include <svtools/stritem.hxx> @@ -61,30 +57,18 @@ #include <fmturl.hxx> #include <fmtinfmt.hxx> #include <docsh.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <wrtsh.hxx> #include <viewopt.hxx> #include <swmodule.hxx> #include <romenu.hxx> #include <pagedesc.hxx> -#ifndef _MODCFG_HXX #include <modcfg.hxx> -#endif -#ifndef _CMDID_H #include <cmdid.h> -#endif -#ifndef _HELPID_H #include <helpid.h> -#endif -#ifndef _DOCVW_HRC #include <docvw.hrc> -#endif -#ifndef _DOCVW_HRC #include <docvw.hrc> -#endif #include <com/sun/star/ui/dialogs/XFilePicker.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> @@ -92,6 +76,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star; using namespace ::com::sun::star::ui::dialogs; using namespace ::sfx2; @@ -415,22 +400,13 @@ static void lcl_GetPreferedExtension( String &rExt, const Graphic &rGrf ) String SwReadOnlyPopup::SaveGraphic( USHORT nId ) { -/* SvtPathOptions aPathOpt; - String sGrfPath( aPathOpt.GetGraphicPath() ); - - FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_SIMPLE, 0 ); - Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker(); - -// aExpDlg.SetHelpId(HID_FILEDLG_ROMENU); - INetURLObject aPath; - aPath.SetSmartURL( sGrfPath);*/ //Namen der Grafik herausfischen. String aName; if ( MN_READONLY_SAVEBACKGROUND == nId ) { if ( pItem->GetGraphicLink() ) - aName = *pItem->GetGraphicLink(); + sGrfName = *pItem->GetGraphicLink(); ((SvxBrushItem*)pItem)->SetDoneLink( Link() ); const Graphic *pGrf = pItem->GetGraphic( rView.GetDocShell() ); if ( pGrf ) @@ -442,12 +418,10 @@ String SwReadOnlyPopup::SaveGraphic( USHORT nId ) else return aEmptyStr; } - else - aName = sGrfName; - return ExportGraphic( aGraphic, sGrfName, aName ); + return ExportGraphic( aGraphic, sGrfName ); } -String ExportGraphic( const Graphic &rGraphic, const String &rGrfName, const String &rName ) +String ExportGraphic( const Graphic &rGraphic, const String &rGrfName ) { SvtPathOptions aPathOpt; String sGrfPath( aPathOpt.GetGraphicPath() ); @@ -457,16 +431,16 @@ String ExportGraphic( const Graphic &rGraphic, const String &rGrfName, const Str // aExpDlg.SetHelpId(HID_FILEDLG_ROMENU); INetURLObject aPath; - aPath.SetSmartURL( rName ); + aPath.SetSmartURL( sGrfPath ); //Namen der Grafik herausfischen. String aName = rGrfName; + aDlgHelper.SetTitle( SW_RESSTR(STR_EXPORT_GRAFIK_TITLE)); + aDlgHelper.SetDisplayDirectory( aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) ); INetURLObject aURL; aURL.SetSmartURL( aName ); - aPath.Append( aURL.GetName() ); - xFP->setDisplayDirectory( aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) ); - xFP->setTitle( SW_RESSTR(STR_EXPORT_GRAFIK_TITLE)); + aDlgHelper.SetFileName( aURL.GetName() ); GraphicFilter& rGF = *GetGrfFilter(); const USHORT nCount = rGF.GetExportFormatCount(); diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 768ba451d885..fd9caec98c24 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -76,6 +76,8 @@ #include <unomid.h> +#include <algorithm> + using namespace rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::container; @@ -387,6 +389,8 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell, aLk = LINK(this, SwMailMergeDlg, ModifyHdl); aFromNF.SetModifyHdl(aLk); aToNF.SetModifyHdl(aLk); + aFromNF.SetMax(SAL_MAX_INT32); + aToNF.SetMax(SAL_MAX_INT32); SwNewDBMgr* pNewDBMgr = rSh.GetNewDBMgr(); if(_xConnection.is()) @@ -768,19 +772,16 @@ bool SwMailMergeDlg::ExecQryShell() if (aFromRB.IsChecked()) // Liste Einfuegen { - ULONG nStart = static_cast< ULONG >(aFromNF.GetValue()); - ULONG nEnd = static_cast< ULONG >(aToNF.GetValue()); + // Safe: the maximal value of the fields is limited + sal_Int32 nStart = sal::static_int_cast<sal_Int32>(aFromNF.GetValue()); + sal_Int32 nEnd = sal::static_int_cast<sal_Int32>(aToNF.GetValue()); if (nEnd < nStart) - { - ULONG nZw = nEnd; - nEnd = nStart; - nStart = nZw; - } + std::swap(nEnd, nStart); m_aSelection.realloc(nEnd - nStart + 1); Any* pSelection = m_aSelection.getArray(); - for (ULONG i = nStart; i <= nEnd; ++i, ++pSelection) + for (sal_Int32 i = nStart; i != nEnd; ++i, ++pSelection) *pSelection <<= i; } else if (aAllRB.IsChecked() ) diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index 03dd5fa36fdd..a9df9762ad92 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -230,6 +230,8 @@ SwColumnDlg::SwColumnDlg(Window* pParent, SwWrtShell& rSh) : //#i80458# if no columns can be set then disable OK if( !aApplyToLB.GetEntryCount() ) aOK.Enable( sal_False ); + //#i97810# set focus to the TabPage + pTabPage->ActivateColumnControl(); } /*-------------------------------------------------------------------- diff --git a/sw/source/ui/inc/column.hxx b/sw/source/ui/inc/column.hxx index 491a603d52ab..a8e6597cf757 100644 --- a/sw/source/ui/inc/column.hxx +++ b/sw/source/ui/inc/column.hxx @@ -223,6 +223,7 @@ public: void ShowBalance(BOOL bShow) {aBalanceColsCB.Show(bShow);} void SetInSection(BOOL bSet); + void ActivateColumnControl() {aCLNrEdt.GrabFocus();} }; #endif diff --git a/sw/source/ui/inc/table.hrc b/sw/source/ui/inc/table.hrc index 77ac72c12c33..0903a95453ad 100644 --- a/sw/source/ui/inc/table.hrc +++ b/sw/source/ui/inc/table.hrc @@ -33,7 +33,7 @@ #define DLG_INSERT_TABLE RC_TABLE_BEGIN #define DLG_FORMAT_TABLE (RC_TABLE_BEGIN + 1) #define DLG_CONV_TEXT_TABLE (RC_TABLE_BEGIN + 2) -#define DLG_INS_ROW_COL (RC_TABLE_BEGIN + 3) +//#define DLG_INS_ROW_COL (RC_TABLE_BEGIN + 3) moved to svx #define DLG_ROW_HEIGHT (RC_TABLE_BEGIN + 4) #define DLG_SPLIT (RC_TABLE_BEGIN + 5) #define DLG_COL_WIDTH (RC_TABLE_BEGIN + 6) diff --git a/sw/source/ui/inc/uivwimp.hxx b/sw/source/ui/inc/uivwimp.hxx index 65b8d0b9b95b..d23da67e4209 100644 --- a/sw/source/ui/inc/uivwimp.hxx +++ b/sw/source/ui/inc/uivwimp.hxx @@ -153,7 +153,7 @@ public: SfxObjectShellRef & GetTmpSelectionDoc() { return xTmpSelDocSh; } - SfxObjectShellRef& GetEmbeddedObjRef() { return (SfxObjectShellRef&)(long&)aEmbeddedObjRef; } + SfxObjectShellRef& GetEmbeddedObjRef() { return *boost::addressof(aEmbeddedObjRef); } void AddTransferable(SwTransferable& rTransferable); diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx index 70e509972ddb..5656f6df1ab4 100644 --- a/sw/source/ui/inc/wrtsh.hxx +++ b/sw/source/ui/inc/wrtsh.hxx @@ -157,6 +157,7 @@ public: void SetInsMode( BOOL bOn = TRUE ); void ToggleInsMode() { SetInsMode( !bIns ); } BOOL IsInsMode() const { return bIns; } + void SetRedlineModeAndCheckInsMode( USHORT eMode ); void EnterSelFrmMode(const Point *pStartDrag = 0); void LeaveSelFrmMode(); diff --git a/sw/source/ui/index/cnttab.src b/sw/source/ui/index/cnttab.src index 1bccc6c27765..8b84ca3d2b92 100644 --- a/sw/source/ui/index/cnttab.src +++ b/sw/source/ui/index/cnttab.src @@ -342,12 +342,12 @@ TabPage TP_TOX_SELECT CheckBox CB_FROMFILE { Pos = MAP_APPFONT ( 136 , 124 ) ; - Size = MAP_APPFONT ( 63 , 10 ) ; + Size = MAP_APPFONT ( 115 , 10 ) ; Text [ en-US ] = "~Concordance file"; }; MenuButton MB_AUTOMARK { - Pos = MAP_APPFONT ( 201 , 122 ) ; + Pos = MAP_APPFONT ( 136 , 137 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; ButtonMenu = Menu @@ -486,32 +486,32 @@ TabPage TP_TOX_SELECT }; FixedLine FL_SORTOPTIONS { - Pos = MAP_APPFONT ( 6, 150) ; + Pos = MAP_APPFONT ( 6, 153) ; Size = MAP_APPFONT ( 248, 8 ) ; Text [ en-US ] = "Sort"; }; FixedText FT_LANGUAGE { - Pos = MAP_APPFONT ( 12, 163) ; + Pos = MAP_APPFONT ( 12, 166) ; Size = MAP_APPFONT ( 33, 8 ) ; Text [ en-US ] = "Language"; }; ListBox LB_LANGUAGE { - Pos = MAP_APPFONT ( 47, 161) ; + Pos = MAP_APPFONT ( 47, 164) ; Size = MAP_APPFONT ( 80, 50 ) ; Border = TRUE; DropDown = TRUE; }; FixedText FT_SORTALG { - Pos = MAP_APPFONT ( 130, 163) ; + Pos = MAP_APPFONT ( 130, 166) ; Size = MAP_APPFONT ( 50, 8 ) ; Text [ en-US ] = "Key type"; }; ListBox LB_SORTALG { - Pos = MAP_APPFONT ( 201, 161) ; + Pos = MAP_APPFONT ( 201, 164) ; Size = MAP_APPFONT ( 50, 50 ) ; Border = TRUE; DropDown = TRUE; @@ -1049,7 +1049,7 @@ TabPage TP_TOX_STYLES FixedText FT_LEVEL { Pos = MAP_APPFONT ( 11 , 14 ) ; - Size = MAP_APPFONT ( 24 , 8 ) ; + Size = MAP_APPFONT ( 102 , 8 ) ; Text [ en-US ] = "~Levels" ; Left = TRUE ; }; @@ -1064,7 +1064,7 @@ TabPage TP_TOX_STYLES FixedText FT_TEMPLATE { Pos = MAP_APPFONT ( 142 , 14 ) ; - Size = MAP_APPFONT ( 54 , 8 ) ; + Size = MAP_APPFONT ( 102 , 8 ) ; Text [ en-US ] = "Paragraph ~Styles" ; Left = TRUE ; }; diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index 1f2f9e152c65..3fb0157b89f3 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -245,6 +245,7 @@ void SwTextGridPage::Reset(const SfxItemSet &rSet) default: pButton = &aCharsGridRB; } pButton->Check(); + aDisplayCB.Check(rGridItem.IsDisplayGrid()); GridTypeHdl(pButton); aSnapToCharsCB.Check(rGridItem.IsSnapToChars()); aLinesPerPageNF.SetValue(rGridItem.GetLines()); @@ -254,7 +255,6 @@ void SwTextGridPage::Reset(const SfxItemSet &rSet) aRubySizeMF.SetValue(aRubySizeMF.Normalize(rGridItem.GetRubyHeight()), FUNIT_TWIP); aCharWidthMF.SetValue(aCharWidthMF.Normalize(rGridItem.GetBaseWidth()), FUNIT_TWIP); aRubyBelowCB.Check(rGridItem.IsRubyTextBelow()); - aDisplayCB.Check(rGridItem.IsDisplayGrid()); aPrintCB.Check(rGridItem.IsPrintGrid()); aColorLB.SelectEntry(rGridItem.GetColor()); } diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index b9841b2c90e3..0c17c85dd301 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -1751,9 +1751,12 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) rSh.GetGraphic(FALSE); // start the loading } else if( rSh.IsFrmSelected() ) - bDisable = GRAPHIC_NONE == - rSh.GetIMapGraphic().GetType()|| - nSel & nsSelectionType::SEL_FRM; + { + // #i102253# applied patch from OD (see task) + bDisable = + nSel & nsSelectionType::SEL_FRM || + GRAPHIC_NONE == rSh.GetIMapGraphic().GetType(); + } } bSet = bDisable ? FALSE : rWrap.IsContour(); diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx index 1ecf506d19c2..62a3af2f6f28 100644 --- a/sw/source/ui/shells/grfsh.cxx +++ b/sw/source/ui/shells/grfsh.cxx @@ -114,7 +114,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) { String sGrfNm, sFilterNm; rSh.GetGrfNms( &sGrfNm, &sFilterNm ); - ExportGraphic( *pGraphic, sGrfNm, sGrfNm ); + ExportGraphic( *pGraphic, sGrfNm ); } } break; diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx index 2beb89f0458b..7ba4d0b8e954 100644 --- a/sw/source/ui/shells/tabsh.cxx +++ b/sw/source/ui/shells/tabsh.cxx @@ -970,13 +970,18 @@ void SwTableShell::Execute(SfxRequest &rReq) { if ( FN_TABLE_INSERT_ROW_DLG != nSlot || !rSh.IsInRepeatedHeadline()) { - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - VclAbstractDialog* pDlg = pFact->CreateVclSwViewDialog( DLG_INS_ROW_COL, - GetView(), FN_TABLE_INSERT_COL_DLG == nSlot ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - pDlg->Execute(); - delete pDlg; + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + ::std::auto_ptr<SvxAbstractInsRowColDlg> pDlg( pFact ? pFact->CreateSvxInsRowColDlg( GetView().GetWindow(), nSlot == FN_TABLE_INSERT_COL_DLG, nSlot) : 0); + + if( pDlg.get() && (pDlg->Execute() == 1) ) + { + USHORT nDispatchSlot = (nSlot == FN_TABLE_INSERT_COL_DLG) ? FN_TABLE_INSERT_COL : FN_TABLE_INSERT_ROW; + SfxUInt16Item aCountItem( nDispatchSlot, static_cast< UINT16 >(pDlg->getInsertCount()) ); + SfxBoolItem aAfter( FN_PARAM_INSERT_AFTER, !pDlg->isInsertBefore() ); + SfxViewFrame* pVFrame = GetView().GetViewFrame(); + if( pVFrame ) + pVFrame->GetDispatcher()->Execute( nDispatchSlot, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aCountItem, &aAfter, 0L); + } } } break; diff --git a/sw/source/ui/table/colwd.src b/sw/source/ui/table/colwd.src index 8f83a797d2ab..609b080941bc 100644 --- a/sw/source/ui/table/colwd.src +++ b/sw/source/ui/table/colwd.src @@ -38,39 +38,39 @@ ModalDialog DLG_COL_WIDTH HelpID = FN_TABLE_SET_COL_WIDTH ; OutputSize = TRUE ; SVLook = TRUE ; - Size = MAP_APPFONT ( 149 , 60 ) ; + Size = MAP_APPFONT ( 159 , 60 ) ; Text [ en-US ] = "Column Width" ; Moveable = TRUE ; OKButton BT_OK { - Pos = MAP_APPFONT ( 94 , 6 ) ; + Pos = MAP_APPFONT ( 104 , 6 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; DefButton = TRUE ; }; CancelButton BT_CANCEL { - Pos = MAP_APPFONT ( 94 , 23 ) ; + Pos = MAP_APPFONT ( 104 , 23 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; HelpButton BT_HELP { - Pos = MAP_APPFONT ( 94 , 43 ) ; + Pos = MAP_APPFONT ( 104 , 43 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; }; FixedText FT_WIDTH { Pos = MAP_APPFONT ( 12 , 31 ) ; - Size = MAP_APPFONT ( 22 , 8 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; Text [ en-US ] = "~Width" ; Left = TRUE ; }; MetricField ED_WIDTH { Border = TRUE ; - Pos = MAP_APPFONT ( 41 , 30 ) ; + Pos = MAP_APPFONT ( 51 , 30 ) ; Size = MAP_APPFONT ( 38 , 12 ) ; TabStop = TRUE ; Left = TRUE ; @@ -88,20 +88,20 @@ ModalDialog DLG_COL_WIDTH FixedLine FL_WIDTH { Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 81 , 8 ) ; + Size = MAP_APPFONT ( 91 , 8 ) ; Text [ en-US ] = "Width" ; }; FixedText FT_COL { Pos = MAP_APPFONT ( 12 , 16 ) ; - Size = MAP_APPFONT ( 29 , 8 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; Text [ en-US ] = "~Column" ; Left = TRUE ; }; NumericField ED_COL { Border = TRUE ; - Pos = MAP_APPFONT ( 41 , 14 ) ; + Pos = MAP_APPFONT ( 51 , 14 ) ; Size = MAP_APPFONT ( 38 , 12 ) ; TabStop = TRUE ; Left = TRUE ; diff --git a/sw/source/ui/table/makefile.mk b/sw/source/ui/table/makefile.mk index f862365cc35f..5e39d0af3af3 100644 --- a/sw/source/ui/table/makefile.mk +++ b/sw/source/ui/table/makefile.mk @@ -50,7 +50,6 @@ SRC1FILES = \ colwd.src \ convert.src \ chartins.src \ - insrc.src \ instable.src \ mergetbl.src \ rowht.src \ @@ -63,7 +62,6 @@ SLOFILES = \ $(SLO)$/colwd.obj \ $(SLO)$/convert.obj \ $(SLO)$/chartins.obj \ - $(SLO)$/insrc.obj \ $(SLO)$/instable.obj \ $(SLO)$/mergetbl.obj \ $(SLO)$/rowht.obj \ diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index c063c72c5892..6a03909d92f9 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -584,7 +584,7 @@ void __EXPORT SwView::Execute(SfxRequest &rReq) USHORT nOn = ((const SfxBoolItem*)pItem)->GetValue() ? nsRedlineMode_t::REDLINE_ON : 0; USHORT nMode = pWrtShell->GetRedlineMode(); - pWrtShell->SetRedlineMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn); + pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn); } } break; @@ -624,7 +624,7 @@ void __EXPORT SwView::Execute(SfxRequest &rReq) nOn = 0; } USHORT nMode = pIDRA->GetRedlineMode(); - pWrtShell->SetRedlineMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn); + pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn); rReq.AppendItem( SfxBoolItem( FN_REDLINE_PROTECT, ((nMode&nsRedlineMode_t::REDLINE_ON)==0) ) ); } else @@ -641,7 +641,7 @@ void __EXPORT SwView::Execute(SfxRequest &rReq) if( ((const SfxBoolItem*)pItem)->GetValue() ) nMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE; - pWrtShell->SetRedlineMode( nMode ); + pWrtShell->SetRedlineModeAndCheckInsMode( nMode ); } break; case FN_MAILMERGE_SENDMAIL_CHILDWINDOW: diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx index c5602411f324..690a1900749e 100644 --- a/sw/source/ui/uiview/viewsrch.cxx +++ b/sw/source/ui/uiview/viewsrch.cxx @@ -607,10 +607,10 @@ void SwView::Replace() { if (GetPostItMgr()->GetActivePostIt()) GetPostItMgr()->Replace(pSrchItem); - pWrtShell->SwEditShell::Replace( pSrchItem->GetReplaceString(), + sal_Bool bReplaced = pWrtShell->SwEditShell::Replace( pSrchItem->GetReplaceString(), pSrchItem->GetRegExp()); - if( pReplList && pReplList->Count() && pWrtShell->HasSelection() ) + if( bReplaced && pReplList && pReplList->Count() && pWrtShell->HasSelection() ) { SfxItemSet aReplSet( pWrtShell->GetAttrPool(), aTxtFmtCollSetRange ); diff --git a/sw/source/ui/uno/unoatxt.cxx b/sw/source/ui/uno/unoatxt.cxx index dfdbacab354b..0c67e24b8d10 100644 --- a/sw/source/ui/uno/unoatxt.cxx +++ b/sw/source/ui/uno/unoatxt.cxx @@ -416,7 +416,7 @@ sal_Bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTextR if(pxCursor) { SwPaM* pUnoCrsr = pxCursor->GetPaM(); - bRet |= (true == pxCursor->GetDoc()->Copy( *pUnoCrsr, aPos )); + bRet |= (true == pxCursor->GetDoc()->Copy( *pUnoCrsr, aPos, false )); } else { @@ -424,7 +424,7 @@ sal_Bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTextR if(pBkmk && pBkmk->IsExpanded()) { SwPaM aTmp(pBkmk->GetOtherMarkPos(), pBkmk->GetMarkPos()); - bRet |= (true == pxRange->GetDoc()->Copy(aTmp, aPos)); + bRet |= (true == pxRange->GetDoc()->Copy(aTmp, aPos, false)); } } } diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx index 5124cf66d687..f45c68ef7ec9 100644 --- a/sw/source/ui/wrtsh/select.cxx +++ b/sw/source/ui/wrtsh/select.cxx @@ -701,6 +701,13 @@ void SwWrtShell::SetInsMode( BOOL bOn ) StartAction(); EndAction(); } +//Overwrite mode is incompatible with red-lining +void SwWrtShell::SetRedlineModeAndCheckInsMode( USHORT eMode ) +{ + SetRedlineMode( eMode ); + if (IsRedlineOn()) + SetInsMode( true ); +} /* * Rahmen bearbeiten |