diff options
Diffstat (limited to 'sw/source/ui/app/docsh.cxx')
-rw-r--r-- | sw/source/ui/app/docsh.cxx | 217 |
1 files changed, 117 insertions, 100 deletions
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index 01ae832fc669..e46b0f3b106a 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -81,6 +81,7 @@ #include <shellio.hxx> // I/O #include <docstyle.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docstat.hxx> #include <pagedesc.hxx> #include <pview.hxx> @@ -147,11 +148,11 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr, SwCrsrShell *pCrsrShell, SwPaM* pPaM ) { - BOOL bAPICall = FALSE; + sal_Bool bAPICall = sal_False; const SfxPoolItem* pApiItem; const SfxItemSet* pMedSet; if( 0 != ( pMedSet = rMedium.GetItemSet() ) && SFX_ITEM_SET == - pMedSet->GetItemState( FN_API_CALL, TRUE, &pApiItem ) ) + pMedSet->GetItemState( FN_API_CALL, sal_True, &pApiItem ) ) bAPICall = ((const SfxBoolItem*)pApiItem)->GetValue(); const SfxFilter* pFlt = rMedium.GetFilter(); @@ -195,7 +196,7 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr, { const SfxItemSet* pSet = rMedium.GetItemSet(); const SfxPoolItem *pPassItem; - if(pSet && SFX_ITEM_SET == pSet->GetItemState(SID_PASSWORD, TRUE, &pPassItem)) + if(pSet && SFX_ITEM_SET == pSet->GetItemState(SID_PASSWORD, sal_True, &pPassItem)) aPasswd = ((const SfxStringItem *)pPassItem)->GetValue(); } @@ -221,7 +222,7 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr, const SfxItemSet* pSet; const SfxPoolItem* pItem; if( 0 != ( pSet = rMedium.GetItemSet() ) && SFX_ITEM_SET == - pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) ) + pSet->GetItemState( SID_FILE_FILTEROPTIONS, sal_True, &pItem ) ) aOpt.ReadUserData( ((const SfxStringItem*)pItem)->GetValue() ); if( pRead ) @@ -235,17 +236,17 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr, Beschreibung: Laden --------------------------------------------------------------------*/ -BOOL SwDocShell::ConvertFrom( SfxMedium& rMedium ) +sal_Bool SwDocShell::ConvertFrom( SfxMedium& rMedium ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::ConvertFrom" ); SwReader* pRdr; SwRead pRead = StartConvertFrom(rMedium, &pRdr); if (!pRead) - return FALSE; // #129881# return if no reader is found + return sal_False; // #129881# return if no reader is found SotStorageRef pStg=pRead->getSotStorageRef(); // #i45333# save sot storage ref in case of recursive calls - SwWait aWait( *this, TRUE ); + SwWait aWait( *this, sal_True ); // SfxProgress unterdruecken, wenn man Embedded ist SW_MOD()->SetEmbeddedLoadSave( @@ -256,7 +257,7 @@ BOOL SwDocShell::ConvertFrom( SfxMedium& rMedium ) /* #106748# Restore the pool default if reading a saved document. */ pDoc->RemoveAllFmtLanguageDependencies(); - ULONG nErr = pRdr->Read( *pRead ); + sal_uLong nErr = pRdr->Read( *pRead ); // Evtl. ein altes Doc weg if ( pDoc != pRdr->GetDoc() ) @@ -276,10 +277,10 @@ BOOL SwDocShell::ConvertFrom( SfxMedium& rMedium ) delete pRdr; - SW_MOD()->SetEmbeddedLoadSave( FALSE ); + SW_MOD()->SetEmbeddedLoadSave( sal_False ); SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); - BOOL bOk = !IsError( nErr ); + sal_Bool bOk = !IsError( nErr ); // --> OD 2006-11-07 #i59688# // // StartFinishedLoading rufen. Nicht bei asynchronen Filtern! @@ -302,13 +303,13 @@ BOOL SwDocShell::ConvertFrom( SfxMedium& rMedium ) --------------------------------------------------------------------*/ -BOOL SwDocShell::Save() +sal_Bool SwDocShell::Save() { RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::Save" ); //#i3370# remove quick help to prevent saving of autocorrection suggestions if(pView) pView->GetEditWin().StopQuickHelp(); - SwWait aWait( *this, TRUE ); + SwWait aWait( *this, sal_True ); CalcLayoutForOLEObjects(); // format for OLE objets // --> OD 2006-03-17 #i62875# @@ -321,7 +322,7 @@ BOOL SwDocShell::Save() } // <-- - ULONG nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; + sal_uLong nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; if( SfxObjectShell::Save() ) { switch( GetCreateMode() ) @@ -334,16 +335,16 @@ BOOL SwDocShell::Save() { WriterRef xWrt; ::GetXMLWriter( aEmptyStr, GetMedium()->GetBaseURL( true ), xWrt ); - xWrt->SetOrganizerMode( TRUE ); + xWrt->SetOrganizerMode( sal_True ); SwWriter aWrt( *GetMedium(), *pDoc ); nErr = aWrt.Write( xWrt ); - xWrt->SetOrganizerMode( FALSE ); + xWrt->SetOrganizerMode( sal_False ); } break; case SFX_CREATE_MODE_EMBEDDED: // SfxProgress unterdruecken, wenn man Embedded ist - SW_MOD()->SetEmbeddedLoadSave( TRUE ); + SW_MOD()->SetEmbeddedLoadSave( sal_True ); // kein break; case SFX_CREATE_MODE_STANDARD: @@ -354,10 +355,10 @@ BOOL SwDocShell::Save() { //TODO/MBA: it looks as that this code can be removed! //SvxImportMSVBasic aTmp( *this, pIo->GetStorage() ); - //aTmp.SaveOrDelMSVBAStorage( FALSE, aEmptyStr ); + //aTmp.SaveOrDelMSVBAStorage( sal_False, aEmptyStr ); if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() ) nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) (*this) ); - pDoc->SetContainsMSVBasic( FALSE ); + pDoc->SetContainsMSVBasic( sal_False ); } // TabellenBox Edit beenden! @@ -367,11 +368,11 @@ BOOL SwDocShell::Save() WriterRef xWrt; ::GetXMLWriter( aEmptyStr, GetMedium()->GetBaseURL( true ), xWrt ); - BOOL bLockedView(FALSE); + sal_Bool bLockedView(sal_False); if ( pWrtShell ) { bLockedView = pWrtShell->IsViewLocked(); - pWrtShell->LockView( TRUE ); //lock visible section + pWrtShell->LockView( sal_True ); //lock visible section } SwWriter aWrt( *GetMedium(), *pDoc ); @@ -382,7 +383,7 @@ BOOL SwDocShell::Save() } break; } - SW_MOD()->SetEmbeddedLoadSave( FALSE ); + SW_MOD()->SetEmbeddedLoadSave( sal_False ); } SetError( nErr ? nErr : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); @@ -403,7 +404,7 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SaveAs" ); - SwWait aWait( *this, TRUE ); + SwWait aWait( *this, sal_True ); //#i3370# remove quick help to prevent saving of autocorrection suggestions if(pView) pView->GetEditWin().StopQuickHelp(); @@ -452,7 +453,7 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) } // <-- - ULONG nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; + sal_uLong nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; uno::Reference < embed::XStorage > xStor = rMedium.GetOutputStorage(); if( SfxObjectShell::SaveAs( rMedium ) ) { @@ -465,7 +466,9 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) // will set the wrong class id. SvGlobalName aClassName; String aAppName, aLongUserName, aUserName; - SfxObjectShellRef xDocSh = + + // The document is closed explicitly, but using SfxObjectShellLock is still more correct here + SfxObjectShellLock xDocSh = new SwGlobalDocShell( SFX_CREATE_MODE_INTERNAL ); // the global document can not be a template xDocSh->SetupStorage( xStor, SotStorage::GetVersion( xStor ), sal_False ); @@ -476,10 +479,10 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) { //TODO/MBA: it looks as that this code can be removed! //SvxImportMSVBasic aTmp( *this, pIo->GetStorage() ); - //aTmp.SaveOrDelMSVBAStorage( FALSE, aEmptyStr ); + //aTmp.SaveOrDelMSVBAStorage( sal_False, aEmptyStr ); if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() ) nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) *this ); - pDoc->SetContainsMSVBasic( FALSE ); + pDoc->SetContainsMSVBasic( sal_False ); } // TabellenBox Edit beenden! @@ -488,8 +491,8 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) // Modified-Flag merken und erhalten ohne den Link zu Callen // (fuer OLE; nach Anweisung von MM) - BOOL bIsModified = pDoc->IsModified(); - SwUndoNoModifiedPosition aOldPos = pDoc->getUndoNoModifiedPosition(); + sal_Bool bIsModified = pDoc->IsModified(); + pDoc->GetIDocumentUndoRedo().LockUndoNoModifiedPosition(); Link aOldOLELnk( pDoc->GetOle2Link() ); pDoc->SetOle2Link( Link() ); @@ -500,11 +503,11 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) WriterRef xWrt; ::GetXMLWriter( aEmptyStr, rMedium.GetBaseURL( true ), xWrt ); - BOOL bLockedView(FALSE); + sal_Bool bLockedView(sal_False); if ( pWrtShell ) { bLockedView = pWrtShell->IsViewLocked(); - pWrtShell->LockView( TRUE ); //lock visible section + pWrtShell->LockView( sal_True ); //lock visible section } SwWriter aWrt( rMedium, *pDoc ); @@ -516,11 +519,11 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) if( bIsModified ) { pDoc->SetModified(); - pDoc->setUndoNoModifiedPosition( aOldPos ); + pDoc->GetIDocumentUndoRedo().UnLockUndoNoModifiedPosition(); } pDoc->SetOle2Link( aOldOLELnk ); - SW_MOD()->SetEmbeddedLoadSave( FALSE ); + SW_MOD()->SetEmbeddedLoadSave( sal_False ); } SetError( nErr ? nErr : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); @@ -538,12 +541,12 @@ SwSrcView* lcl_GetSourceView( SwDocShell* pSh ) return PTR_CAST( SwSrcView, pViewShell); } -BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) +sal_Bool SwDocShell::ConvertTo( SfxMedium& rMedium ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::ConvertTo" ); const SfxFilter* pFlt = rMedium.GetFilter(); if( !pFlt ) - return FALSE; + return sal_False; WriterRef xWriter; SwReaderWriter::GetWriter( pFlt->GetUserData(), rMedium.GetBaseURL( true ), xWriter ); @@ -551,7 +554,7 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) { // Der Filter ist nicht vorhanden InfoBox( 0, SW_RESSTR(STR_DLLNOTFOUND) ).Execute(); - return FALSE; + return sal_False; } //#i3370# remove quick help to prevent saving of autocorrection suggestions @@ -566,22 +569,22 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin(); } - ULONG nVBWarning = 0; + sal_uLong nVBWarning = 0; if( pDoc->ContainsMSVBasic() ) { - BOOL bSave = pFlt->GetUserData().EqualsAscii( "CWW8" ) + sal_Bool bSave = pFlt->GetUserData().EqualsAscii( "CWW8" ) && SvtFilterOptions::Get()->IsLoadWordBasicStorage(); if ( bSave ) { - SvStorageRef xStg = new SotStorage( rMedium.GetOutStream(), FALSE ); + SvStorageRef xStg = new SotStorage( rMedium.GetOutStream(), sal_False ); DBG_ASSERT( !xStg->GetError(), "No storage available for storing VBA macros!" ); if ( !xStg->GetError() ) { nVBWarning = SaveOrDelMSVBAStorage( (SfxObjectShell&) *this, *xStg, bSave, String::CreateFromAscii("Macros") ); xStg->Commit(); - pDoc->SetContainsMSVBasic( TRUE ); + pDoc->SetContainsMSVBasic( sal_True ); } } } @@ -639,15 +642,15 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) pFlt->GetUserData().EqualsAscii( FILTER_XMLVW ) ) ) { // eigenen Typ ermitteln - BYTE nMyType = 0; + sal_uInt8 nMyType = 0; if( ISA( SwWebDocShell) ) nMyType = 1; else if( ISA( SwGlobalDocShell) ) nMyType = 2; // gewuenschten Typ ermitteln - BYTE nSaveType = 0; - ULONG nSaveClipId = pFlt->GetFormat(); + sal_uInt8 nSaveType = 0; + sal_uLong nSaveClipId = pFlt->GetFormat(); if( SOT_FORMATSTR_ID_STARWRITERWEB_8 == nSaveClipId || SOT_FORMATSTR_ID_STARWRITERWEB_60 == nSaveClipId || SOT_FORMATSTR_ID_STARWRITERWEB_50 == nSaveClipId || @@ -660,9 +663,9 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) nSaveType = 2; // Flags am Dokument entsprechend umsetzen - BOOL bIsHTMLModeSave = GetDoc()->get(IDocumentSettingAccess::HTML_MODE); - BOOL bIsGlobalDocSave = GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT); - BOOL bIsGlblDocSaveLinksSave = GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS); + sal_Bool bIsHTMLModeSave = GetDoc()->get(IDocumentSettingAccess::HTML_MODE); + sal_Bool bIsGlobalDocSave = GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT); + sal_Bool bIsGlblDocSaveLinksSave = GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS); if( nMyType != nSaveType ) { GetDoc()->set(IDocumentSettingAccess::HTML_MODE, 1 == nSaveType); @@ -689,7 +692,7 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) } // Jetzt das Dokument normal speichern - BOOL bRet = SaveAs( rMedium ); + sal_Bool bRet = SaveAs( rMedium ); if( nMyType != nSaveType ) { @@ -698,25 +701,6 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, bIsGlblDocSaveLinksSave); } - if( bRet && nMyType != nSaveType ) - { - SvGlobalName aClassName; - String aAppName, aLongUserName, aUserName; - SfxObjectShellRef xDocSh; - switch( nSaveType ) - { - case 0: - xDocSh = new SwDocShell( SFX_CREATE_MODE_INTERNAL ); - break; - case 1: - xDocSh = new SwWebDocShell( SFX_CREATE_MODE_INTERNAL ); - break; - case 2: - xDocSh = new SwGlobalDocShell( SFX_CREATE_MODE_INTERNAL ); - break; - } - } - return bRet; } @@ -730,7 +714,7 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) if( 0 != ( pSet = rMedium.GetItemSet() ) ) { if( SFX_ITEM_SET == pSet->GetItemState( SID_FILE_FILTEROPTIONS, - TRUE, &pItem ) ) + sal_True, &pItem ) ) sItemOpt = ((const SfxStringItem*)pItem)->GetValue(); } if(sItemOpt.Len()) @@ -744,26 +728,26 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) SFX_CREATE_MODE_EMBEDDED == GetCreateMode()); // Kontext aufspannen, um die Anzeige der Selektion zu unterbinden - ULONG nErrno; + sal_uLong nErrno; String aFileName( rMedium.GetName() ); //Keine View also das ganze Dokument! if ( pWrtShell ) { - SwWait aWait( *this, TRUE ); + SwWait aWait( *this, sal_True ); // --> OD 2009-12-31 #i106906# const sal_Bool bFormerLockView = pWrtShell->IsViewLocked(); pWrtShell->LockView( sal_True ); // <-- pWrtShell->StartAllAction(); pWrtShell->Push(); - SwWriter aWrt( rMedium, *pWrtShell, TRUE ); + SwWriter aWrt( rMedium, *pWrtShell, sal_True ); nErrno = aWrt.Write( xWriter, &aFileName ); //JP 16.05.97: falls der SFX uns die View waehrend des speicherns // entzieht if( pWrtShell ) { - pWrtShell->Pop(FALSE); + pWrtShell->Pop(sal_False); pWrtShell->EndAllAction(); // --> OD 2009-12-31 #i106906# pWrtShell->LockView( bFormerLockView ); @@ -786,7 +770,7 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) } } - SW_MOD()->SetEmbeddedLoadSave( FALSE ); + SW_MOD()->SetEmbeddedLoadSave( sal_False ); SetError( nErrno ? nErrno : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); if( !rMedium.IsStorage() ) rMedium.CloseOutStream(); @@ -800,14 +784,14 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) /*-------------------------------------------------------------------- - Beschreibung: ??? noch nicht zu aktivieren, muss TRUE liefern + Beschreibung: ??? noch nicht zu aktivieren, muss sal_True liefern --------------------------------------------------------------------*/ sal_Bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SaveCompleted" ); - BOOL bRet = SfxObjectShell::SaveCompleted( xStor ); + sal_Bool bRet = SfxObjectShell::SaveCompleted( xStor ); if( bRet ) { // erst hier entscheiden, ob das Speichern geklappt hat oder nicht @@ -819,9 +803,9 @@ sal_Bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xS if( pOLEChildList ) { - BOOL bResetModified = IsEnableSetModified(); + sal_Bool bResetModified = IsEnableSetModified(); if( bResetModified ) - EnableSetModified( FALSE ); + EnableSetModified( sal_False ); uno::Sequence < rtl::OUString > aNames = pOLEChildList->GetObjectNames(); for( sal_Int32 n = aNames.getLength(); n; n-- ) @@ -838,7 +822,7 @@ sal_Bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xS DELETEZ( pOLEChildList ); if( bResetModified ) - EnableSetModified( TRUE ); + EnableSetModified( sal_True ); } return bRet; } @@ -848,12 +832,12 @@ sal_Bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xS --------------------------------------------------------------------*/ void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup, - USHORT nAspect ) + sal_uInt16 nAspect ) { //fix #25341# Draw sollte das Modified nicht beeinflussen - BOOL bResetModified; - if ( TRUE == (bResetModified = IsEnableSetModified()) ) - EnableSetModified( FALSE ); + sal_Bool bResetModified; + if ( sal_True == (bResetModified = IsEnableSetModified()) ) + EnableSetModified( sal_False ); //sollte am Document ein JobSetup haengen, dann kopieren wir uns diesen, //um nach dem PrtOle2 diesen wieder am Doc zu verankern. @@ -875,7 +859,7 @@ void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup, pDev->SetFillColor(); pDev->SetLineColor(); pDev->SetBackground(); - BOOL bWeb = 0 != PTR_CAST(SwWebDocShell, this); + sal_Bool bWeb = 0 != PTR_CAST(SwWebDocShell, this); SwPrintData aOpts; ViewShell::PrtOle2( pDoc, SW_MOD()->GetUsrPref(bWeb), aOpts, pDev, aRect ); pDev->Pop(); @@ -886,7 +870,7 @@ void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup, delete pOrig; } if ( bResetModified ) - EnableSetModified( TRUE ); + EnableSetModified( sal_True ); } @@ -908,14 +892,14 @@ void SwDocShell::SetVisArea( const Rectangle &rRect ) aRect.Move( nMoveX, nMoveY ); //Ruft das SfxInPlaceObject::SetVisArea()! - pView->SetVisArea( aRect, TRUE ); + pView->SetVisArea( aRect, sal_True ); } else SfxObjectShell::SetVisArea( aRect ); } -Rectangle SwDocShell::GetVisArea( USHORT nAspect ) const +Rectangle SwDocShell::GetVisArea( sal_uInt16 nAspect ) const { if ( nAspect == ASPECT_THUMBNAIL ) { @@ -923,8 +907,37 @@ Rectangle SwDocShell::GetVisArea( USHORT nAspect ) const SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 1 ); SwCntntNode* pNd = pDoc->GetNodes().GoNext( &aIdx ); - const SwRect aPageRect = pNd->FindPageFrmRect( FALSE, 0, FALSE ); + const SwRect aPageRect = pNd->FindPageFrmRect( sal_False, 0, sal_False ); return aPageRect.SVRect(); +<<<<<<< local +======= + + // Why does this have to be that complicated? I replaced this by the + // call of FindPageFrmRect(): + /* + //PageDesc besorgen, vom ersten Absatz oder den default. + const SwFmtPageDesc &rDesc = pNd->GetSwAttrSet().GetPageDesc(); + const SwPageDesc* pDesc = rDesc.GetPageDesc(); + if( !pDesc ) + pDesc = &const_cast<const SwDoc *>(pDoc)->GetPageDesc( 0 ); + + //Das Format wird evtl. von der virtuellen Seitennummer bestimmt. + const sal_uInt16 nPgNum = rDesc.GetNumOffset(); + const sal_Bool bOdd = nPgNum % 2 ? sal_True : sal_False; + const SwFrmFmt *pFmt = bOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt(); + if ( !pFmt ) //#40568# + pFmt = bOdd ? pDesc->GetLeftFmt() : pDesc->GetRightFmt(); + + if ( pFmt->GetFrmSize().GetWidth() == LONG_MAX ) + //Jetzt wird es aber Zeit fuer die Initialisierung + pDoc->getPrinter( true ); + + const SwFmtFrmSize& rFrmSz = pFmt->GetFrmSize(); + const Size aSz( rFrmSz.GetWidth(), rFrmSz.GetHeight() ); + const Point aPt( DOCUMENTBORDER, DOCUMENTBORDER ); + const Rectangle aRect( aPt, aSz ); + return aRect;*/ +>>>>>>> other } return SfxObjectShell::GetVisArea( nAspect ); } @@ -947,7 +960,7 @@ void SwDocShell::OnDocumentPrinterChanged( Printer * pNewPrinter ) GetDoc()->setPrinter( 0, true, true ); } -ULONG SwDocShell::GetMiscStatus() const +sal_uLong SwDocShell::GetMiscStatus() const { return SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE; } @@ -996,7 +1009,7 @@ sal_uInt16 SwDocShell::GetHiddenInformationState( sal_uInt16 nStates ) void SwDocShell::GetState(SfxItemSet& rSet) { SfxWhichIter aIter(rSet); - USHORT nWhich = aIter.FirstWhich(); + sal_uInt16 nWhich = aIter.FirstWhich(); while (nWhich) { @@ -1004,8 +1017,12 @@ void SwDocShell::GetState(SfxItemSet& rSet) { case SID_PRINTPREVIEW: { +<<<<<<< local BOOL bDisable = IsInPlaceActive(); // Disable "multiple layout" +======= + sal_Bool bDisable = IsInPlaceActive(); +>>>>>>> other if ( !bDisable ) { SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this); @@ -1014,7 +1031,7 @@ void SwDocShell::GetState(SfxItemSet& rSet) if ( PTR_CAST(SwView, pTmpFrm->GetViewShell()) && ((SwView*)pTmpFrm->GetViewShell())->GetWrtShell().GetViewOptions()->getBrowseMode() ) { - bDisable = TRUE; + bDisable = sal_True; break; } pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this); @@ -1025,9 +1042,9 @@ void SwDocShell::GetState(SfxItemSet& rSet) rSet.DisableItem( SID_PRINTPREVIEW ); else { - SfxBoolItem aBool( SID_PRINTPREVIEW, FALSE ); + SfxBoolItem aBool( SID_PRINTPREVIEW, sal_False ); if( PTR_CAST( SwPagePreView, SfxViewShell::Current()) ) - aBool.SetValue( TRUE ); + aBool.SetValue( sal_True ); rSet.Put( aBool ); } } @@ -1036,7 +1053,7 @@ void SwDocShell::GetState(SfxItemSet& rSet) { SfxViewShell* pCurrView = GetView() ? (SfxViewShell*)GetView() : SfxViewShell::Current(); - BOOL bSourceView = 0 != PTR_CAST(SwSrcView, pCurrView); + sal_Bool bSourceView = 0 != PTR_CAST(SwSrcView, pCurrView); rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView)); } break; @@ -1081,7 +1098,7 @@ void SwDocShell::GetState(SfxItemSet& rSet) case SID_ATTR_YEAR2000: { - const SvNumberFormatter* pFmtr = pDoc->GetNumberFormatter(FALSE); + const SvNumberFormatter* pFmtr = pDoc->GetNumberFormatter(sal_False); rSet.Put( SfxUInt16Item( nWhich, static_cast< sal_uInt16 >( pFmtr ? pFmtr->GetYear2000() @@ -1130,7 +1147,7 @@ IMPL_LINK( SwDocShell, Ole2ModifiedHdl, void *, p ) // Bit 1: -> neuer Zustand long nStatus = (long)p; if( IsEnableSetModified() ) - SetModified( (nStatus & 2) ? TRUE : FALSE ); + SetModified( (nStatus & 2) ? sal_True : sal_False ); return 0; } @@ -1179,7 +1196,7 @@ void SwDocShell::LoadingFinished() // if ( IsEnableSetModified() && // pDoc->IsModified() && pDoc->LinksUpdated() ) // { -// EnableSetModified( FALSE ); +// EnableSetModified( sal_False ); // bResetEnableSetModified = true; // } // <-- @@ -1187,7 +1204,7 @@ void SwDocShell::LoadingFinished() // // --> OD 2005-02-11 #i38810# // if ( bResetEnableSetModified ) // { -// EnableSetModified( TRUE ); +// EnableSetModified( sal_True ); // } // // <-- SfxViewFrame* pVFrame = SfxViewFrame::GetFirst(this); @@ -1268,7 +1285,7 @@ void SwDocShell::CalcLayoutForOLEObjects() // read by the binary filter: void SwDocShell::UpdateLinks() { - GetDoc()->UpdateLinks(TRUE); + GetDoc()->UpdateLinks(sal_True); // --> FME 2005-07-27 #i50703# Update footnote numbers SwTxtFtn::SetUniqueSeqRefNo( *GetDoc() ); SwNodeIndex aTmp( GetDoc()->GetNodes() ); @@ -1345,8 +1362,8 @@ bool SwDocShell::HasChangeRecordProtection() const void SwDocShell::SetChangeRecording( bool bActivate ) { - USHORT nOn = bActivate ? nsRedlineMode_t::REDLINE_ON : 0; - USHORT nMode = pWrtShell->GetRedlineMode(); + sal_uInt16 nOn = bActivate ? nsRedlineMode_t::REDLINE_ON : 0; + sal_uInt16 nMode = pWrtShell->GetRedlineMode(); pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn); } @@ -1359,7 +1376,7 @@ bool SwDocShell::SetProtectionPassword( const String &rNewPassword ) IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess(); Sequence< sal_Int8 > aPasswd = pIDRA->GetRedlinePassword(); - if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_REDLINE_PROTECT, FALSE, &pItem ) + if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_REDLINE_PROTECT, sal_False, &pItem ) && ((SfxBoolItem*)pItem)->GetValue() == (aPasswd.getLength() > 0)) return false; @@ -1395,7 +1412,7 @@ bool SwDocShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess(); Sequence< sal_Int8 > aPasswdHash( pIDRA->GetRedlinePassword() ); - if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_REDLINE_PROTECT, FALSE, &pItem ) + if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_REDLINE_PROTECT, sal_False, &pItem ) && ((SfxBoolItem*)pItem)->GetValue() == (aPasswdHash.getLength() != 0)) return false; rPasswordHash = aPasswdHash; |