docsh.cxx (ad54a8fd) docsh.cxx (25cebbc8)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 63 unchanged lines hidden (view full) ---

72#include <viewopt.hxx>
73#include <wdocsh.hxx>
74#include <swmodule.hxx>
75#include <globdoc.hxx>
76#include <usrpref.hxx>
77#include <shellio.hxx> // I/O
78#include <docstyle.hxx>
79#include <doc.hxx>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 63 unchanged lines hidden (view full) ---

72#include <viewopt.hxx>
73#include <wdocsh.hxx>
74#include <swmodule.hxx>
75#include <globdoc.hxx>
76#include <usrpref.hxx>
77#include <shellio.hxx> // I/O
78#include <docstyle.hxx>
79#include <doc.hxx>
80#include <unotxdoc.hxx>
80#include <IDocumentUndoRedo.hxx>
81#include <docstat.hxx>
82#include <pagedesc.hxx>
83#include <pview.hxx>
84#include <mdiexp.hxx>
85#include <swbaslnk.hxx>
86#include <srcview.hxx>
87#include <ndindex.hxx>

--- 693 unchanged lines hidden (view full) ---

781
782/*--------------------------------------------------------------------
783 Beschreibung: ??? noch nicht zu aktivieren, muss sal_True liefern
784 --------------------------------------------------------------------*/
785
786
787sal_Bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor )
788{
81#include <IDocumentUndoRedo.hxx>
82#include <docstat.hxx>
83#include <pagedesc.hxx>
84#include <pview.hxx>
85#include <mdiexp.hxx>
86#include <swbaslnk.hxx>
87#include <srcview.hxx>
88#include <ndindex.hxx>

--- 693 unchanged lines hidden (view full) ---

782
783/*--------------------------------------------------------------------
784 Beschreibung: ??? noch nicht zu aktivieren, muss sal_True liefern
785 --------------------------------------------------------------------*/
786
787
788sal_Bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor )
789{
789 RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SaveCompleted" );
790 RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SaveCompleted" );
790 sal_Bool bRet = SfxObjectShell::SaveCompleted( xStor );
791 sal_Bool bRet = SfxObjectShell::SaveCompleted( xStor );
791 if( bRet )
792 {
793 // erst hier entscheiden, ob das Speichern geklappt hat oder nicht
794 if( IsModified() )
795 pDoc->SetModified();
796 else
797 pDoc->ResetModified();
798 }
792 if( bRet )
793 {
794 // erst hier entscheiden, ob das Speichern geklappt hat oder nicht
795 if( IsModified() )
796 pDoc->SetModified();
797 else
798 pDoc->ResetModified();
799 }
799
800 if( pOLEChildList )
800
801 if( pOLEChildList )
801 {
802 sal_Bool bResetModified = IsEnableSetModified();
803 if( bResetModified )
804 EnableSetModified( sal_False );
802 {
803 sal_Bool bResetModified = IsEnableSetModified();
804 if( bResetModified )
805 EnableSetModified( sal_False );
805
806 uno::Sequence < rtl::OUString > aNames = pOLEChildList->GetObjectNames();
807 for( sal_Int32 n = aNames.getLength(); n; n-- )
806
807 uno::Sequence < rtl::OUString > aNames = pOLEChildList->GetObjectNames();
808 for( sal_Int32 n = aNames.getLength(); n; n-- )
808 {
809 {
809 if ( !pOLEChildList->MoveEmbeddedObject( aNames[n-1], GetEmbeddedObjectContainer() ) )
810 {
811 DBG_ERROR( "Copying of objects didn't work!" );
812 }
813
814 //SvPersist* pPersist = this;
815 //SvInfoObjectRef aRef( pInfList->GetObject( --n ));
816 //pPersist->Move( &aRef, aRef->GetStorageName() );
810 if ( !pOLEChildList->MoveEmbeddedObject( aNames[n-1], GetEmbeddedObjectContainer() ) )
811 {
812 DBG_ERROR( "Copying of objects didn't work!" );
813 }
814
815 //SvPersist* pPersist = this;
816 //SvInfoObjectRef aRef( pInfList->GetObject( --n ));
817 //pPersist->Move( &aRef, aRef->GetStorageName() );
817 }
818 }
818
819 DELETEZ( pOLEChildList );
819
820 DELETEZ( pOLEChildList );
820 if( bResetModified )
821 EnableSetModified( sal_True );
821 if( bResetModified )
822 EnableSetModified( sal_True );
822 }
823 }
823 return bRet;
824
825 // #121125#, #122868#
826 // Clean up rendering data created by the usage of <XRenderable> interface
827 // of <SwXDocument> (e.g. export to PDF) and which is not cleaned up by
828 // "rendering the last page".
829 // This is needed to restore former <ViewOptions>. This is performed via
830 // a <ViewShell> reference hold by the rendering data. The rendering data
831 // also needs to loose the hold <ViewShell> reference. Otherwise, the application
832 // will crash on closing the document.
833 uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
834 ((SwXTextDocument*)xDoc.get())->CleanUpRenderingData();
835
836 return bRet;
824}
825
826/*--------------------------------------------------------------------
827 Beschreibung: Draw()-Overload fuer OLE2 (Sfx)
828 --------------------------------------------------------------------*/
829
830void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup,
831 sal_uInt16 nAspect )

--- 288 unchanged lines hidden (view full) ---

1120
1121
1122SfxStyleSheetBasePool* SwDocShell::GetStyleSheetPool()
1123{
1124 return mxBasePool.get();
1125}
1126
1127
837}
838
839/*--------------------------------------------------------------------
840 Beschreibung: Draw()-Overload fuer OLE2 (Sfx)
841 --------------------------------------------------------------------*/
842
843void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup,
844 sal_uInt16 nAspect )

--- 288 unchanged lines hidden (view full) ---

1133
1134
1135SfxStyleSheetBasePool* SwDocShell::GetStyleSheetPool()
1136{
1137 return mxBasePool.get();
1138}
1139
1140
1128#include <unotxdoc.hxx>
1129
1130void SwDocShell::SetView(SwView* pVw)
1131{
1141void SwDocShell::SetView(SwView* pVw)
1142{
1132 bool bChanged(false);
1133
1134 if(0 != (pView = pVw))
1135 {
1136 pWrtShell = &pView->GetWrtShell();
1143 if(0 != (pView = pVw))
1144 {
1145 pWrtShell = &pView->GetWrtShell();
1137 bChanged = true;
1138 }
1139 else
1140 {
1141 pWrtShell = 0;
1146 }
1147 else
1148 {
1149 pWrtShell = 0;
1142 bChanged = true;
1143 }
1150 }
1144
1145 if(bChanged)
1146 {
1147 // #121125# SwXTextDocument may hold references to the ViewShell, so inform
1148 // it about changes to allow to react on it. This happens e.g. when printing
1149 // and/or PDF export (SwViewOptionAdjust_Impl holds a reference to the view
1150 // and needs to be destroyed)
1151 uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
1152 ((SwXTextDocument*)xDoc.get())->ReactOnViewShellChange();
1153 }
1154}
1155
1156
1157void SwDocShell::PrepareReload()
1158{
1159 ::DelAllGrfCacheEntries( pDoc );
1160}
1161
1151}
1152
1153
1154void SwDocShell::PrepareReload()
1155{
1156 ::DelAllGrfCacheEntries( pDoc );
1157}
1158
1162// --> OD 2006-11-07 #i59688#
1163// linked graphics are now loaded on demand.
1164// Thus, loading of linked graphics no longer needed and necessary for
1165// the load of document being finished.
1166void SwDocShell::LoadingFinished()
1167{
1159// linked graphics are now loaded on demand.
1160// Thus, loading of linked graphics no longer needed and necessary for
1161// the load of document being finished.
1162void SwDocShell::LoadingFinished()
1163{
1168 // --> OD 2007-10-08 #i38810#
1169 // Original fix fails after integration of cws xmlsec11:
1170 // interface <SfxObjectShell::EnableSetModified(..)> no longer works, because
1171 // <SfxObjectShell::FinishedLoading(..)> doesn't care about its status and
1172 // enables the document modification again.
1173 // Thus, manuell modify the document, if its modified and its links are updated
1174 // before <FinishedLoading(..)> is called.
1175 const bool bHasDocToStayModified( pDoc->IsModified() && pDoc->LinksUpdated() );
1164 // interface <SfxObjectShell::EnableSetModified(..)> no longer works, because
1165 // <SfxObjectShell::FinishedLoading(..)> doesn't care about its status and
1166 // enables the document modification again.
1167 // Thus, manuell modify the document, if its modified and its links are updated
1168 // before <FinishedLoading(..)> is called.
1169 const bool bHasDocToStayModified( pDoc->IsModified() && pDoc->LinksUpdated() );
1176// // --> OD 2005-02-11 #i38810# - disable method <SetModified(..)>, if document
1177// // has stay in modified state, due to the update of its links during load.
1178// bool bResetEnableSetModified(false);
1179// if ( IsEnableSetModified() &&
1180// pDoc->IsModified() && pDoc->LinksUpdated() )
1181// {
1182// EnableSetModified( sal_False );
1183// bResetEnableSetModified = true;
1184// }
1185 // <--
1186 FinishedLoading( SFX_LOADED_ALL );
1170 FinishedLoading( SFX_LOADED_ALL );
1187// // --> OD 2005-02-11 #i38810#
1188// if ( bResetEnableSetModified )
1189// {
1190// EnableSetModified( sal_True );
1191// }
1192// // <--
1193 SfxViewFrame* pVFrame = SfxViewFrame::GetFirst(this);
1194 if(pVFrame)
1195 {
1196 SfxViewShell* pShell = pVFrame->GetViewShell();
1197 if(PTR_CAST(SwSrcView, pShell))
1198 ((SwSrcView*)pShell)->Load(this);
1199 }
1171 SfxViewFrame* pVFrame = SfxViewFrame::GetFirst(this);
1172 if(pVFrame)
1173 {
1174 SfxViewShell* pShell = pVFrame->GetViewShell();
1175 if(PTR_CAST(SwSrcView, pShell))
1176 ((SwSrcView*)pShell)->Load(this);
1177 }
1200
1178
1201 // --> OD 2007-10-08 #i38810#
1202 if ( bHasDocToStayModified && !pDoc->IsModified() )
1203 {
1204 pDoc->SetModified();
1205 }
1179 if ( bHasDocToStayModified && !pDoc->IsModified() )
1180 {
1181 pDoc->SetModified();
1182 }
1206 // <--
1207}
1208
1209// eine Uebertragung wird abgebrochen (wird aus dem SFX gerufen)
1210void SwDocShell::CancelTransfers()
1211{
1212 // alle Links vom LinkManager Canceln
1213 aFinishedTimer.Stop();
1214 pDoc->GetLinkManager().CancelTransfers();

--- 194 unchanged lines hidden ---
1183}
1184
1185// eine Uebertragung wird abgebrochen (wird aus dem SFX gerufen)
1186void SwDocShell::CancelTransfers()
1187{
1188 // alle Links vom LinkManager Canceln
1189 aFinishedTimer.Stop();
1190 pDoc->GetLinkManager().CancelTransfers();

--- 194 unchanged lines hidden ---