docsh2.cxx (baef7ff7) docsh2.cxx (8f79cfd8)
1/**************************************************************
1/**************************************************************
2 *
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
9 * with the License. You may obtain a copy of the License at
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
9 * with the License. You may obtain a copy of the License at
10 *
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_sw.hxx"
26
27#include <com/sun/star/lang/XMultiServiceFactory.hpp>

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

330 if( mpDoc && IsInPrepareClose() )
331 {
332 uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = mpDoc->GetVbaEventProcessor();
333 if( xVbaEvents.is() )
334 {
335 using namespace com::sun::star::script::vba::VBAEventId;
336 uno::Sequence< uno::Any > aArgs;
337 xVbaEvents->processVbaEvent( DOCUMENT_CLOSE, aArgs );
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_sw.hxx"
26
27#include <com/sun/star/lang/XMultiServiceFactory.hpp>

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

330 if( mpDoc && IsInPrepareClose() )
331 {
332 uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = mpDoc->GetVbaEventProcessor();
333 if( xVbaEvents.is() )
334 {
335 using namespace com::sun::star::script::vba::VBAEventId;
336 uno::Sequence< uno::Any > aArgs;
337 xVbaEvents->processVbaEvent( DOCUMENT_CLOSE, aArgs );
338 }
339 }
338 }
339 }
340#endif
341 return nRet;
340#endif
341 return nRet;
342}
342}
343
344/*--------------------------------------------------------------------
345 Beschreibung: Organizer
346 --------------------------------------------------------------------*/
347
348sal_Bool SwDocShell::Insert( SfxObjectShell &rSource,
349 sal_uInt16 nSourceIdx1, // SourcePool: oberste Inhaltsebene (Vorlagen/Makros)
350 sal_uInt16 nSourceIdx2, // Index in den Inhalt

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

362
363 sal_Bool bRet = sal_False;
364
365 if (INDEX_IGNORE == rIdx1 && CONTENT_STYLE == nSourceIdx1)
366 rIdx1 = CONTENT_STYLE;
367
368 if (CONTENT_STYLE == nSourceIdx1 && CONTENT_STYLE == rIdx1)
369 {
343
344/*--------------------------------------------------------------------
345 Beschreibung: Organizer
346 --------------------------------------------------------------------*/
347
348sal_Bool SwDocShell::Insert( SfxObjectShell &rSource,
349 sal_uInt16 nSourceIdx1, // SourcePool: oberste Inhaltsebene (Vorlagen/Makros)
350 sal_uInt16 nSourceIdx2, // Index in den Inhalt

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

362
363 sal_Bool bRet = sal_False;
364
365 if (INDEX_IGNORE == rIdx1 && CONTENT_STYLE == nSourceIdx1)
366 rIdx1 = CONTENT_STYLE;
367
368 if (CONTENT_STYLE == nSourceIdx1 && CONTENT_STYLE == rIdx1)
369 {
370 SfxStyleSheetBasePool* pHisPool = rSource.GetStyleSheetPool();
370 SfxStyleSheetBasePool* pHisPool = rSource.GetStyleSheetPool();
371 SwDocStyleSheetPool* pMyPool =
372 (SwDocStyleSheetPool*)GetStyleSheetPool();
373
374 // wir koennen nicht in uns selbst hin und her moven
375 if( pHisPool == pMyPool )
376 return sal_False;
377
378 if( INDEX_IGNORE == rIdx2 )

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

683 pDlg->Execute();
684 delete pDlg;
685
686 rACW.SetLockWordLstLocked( bOldLocked );
687
688 SwEditShell::SetAutoFmtFlags( pAFlags );
689 rACW.SetMinWordLen( pAFlags->nAutoCmpltWordLen );
690 rACW.SetMaxCount( pAFlags->nAutoCmpltListLen );
371 SwDocStyleSheetPool* pMyPool =
372 (SwDocStyleSheetPool*)GetStyleSheetPool();
373
374 // wir koennen nicht in uns selbst hin und her moven
375 if( pHisPool == pMyPool )
376 return sal_False;
377
378 if( INDEX_IGNORE == rIdx2 )

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

683 pDlg->Execute();
684 delete pDlg;
685
686 rACW.SetLockWordLstLocked( bOldLocked );
687
688 SwEditShell::SetAutoFmtFlags( pAFlags );
689 rACW.SetMinWordLen( pAFlags->nAutoCmpltWordLen );
690 rACW.SetMaxCount( pAFlags->nAutoCmpltListLen );
691 if( pAFlags->pAutoCmpltList ) // any changes?
691 if( pAFlags->pAutoCmpltList ) // any changes?
692 {
693 rACW.CheckChangedList( aTmpLst );
694 // clear the temp WordList pointer
695 pAFlags->pAutoCmpltList = 0;
696 }
697 // remove all pointer we never delete the strings
698 aTmpLst.Remove( (sal_uInt16)0, aTmpLst.Count() );
699

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

872 }
873
874 if( aFileName.Len() )
875 {
876 SwgReaderOption aOpt;
877 aOpt.SetTxtFmts( bText = (0 != (nFlags&SFX_LOAD_TEXT_STYLES) ));
878 aOpt.SetFrmFmts( bFrame = (0 != (nFlags&SFX_LOAD_FRAME_STYLES)));
879 aOpt.SetPageDescs( bPage = (0 != (nFlags&SFX_LOAD_PAGE_STYLES )));
692 {
693 rACW.CheckChangedList( aTmpLst );
694 // clear the temp WordList pointer
695 pAFlags->pAutoCmpltList = 0;
696 }
697 // remove all pointer we never delete the strings
698 aTmpLst.Remove( (sal_uInt16)0, aTmpLst.Count() );
699

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

872 }
873
874 if( aFileName.Len() )
875 {
876 SwgReaderOption aOpt;
877 aOpt.SetTxtFmts( bText = (0 != (nFlags&SFX_LOAD_TEXT_STYLES) ));
878 aOpt.SetFrmFmts( bFrame = (0 != (nFlags&SFX_LOAD_FRAME_STYLES)));
879 aOpt.SetPageDescs( bPage = (0 != (nFlags&SFX_LOAD_PAGE_STYLES )));
880 aOpt.SetNumRules( bNum = (0 != (nFlags&SFX_LOAD_NUM_STYLES )));
880 aOpt.SetNumRules( bNum = (0 != (nFlags&SFX_LOAD_NUM_STYLES )));
881 //different meaning between SFX_MERGE_STYLES and aOpt.SetMerge!
882 bMerge = 0 != (nFlags&SFX_MERGE_STYLES);
883 aOpt.SetMerge( !bMerge );
884
885 SetError( LoadStylesFromFile( aFileName, aOpt, sal_False ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
886 if ( !GetError() )
887 rReq.Done();
888 }
889 }
890 break;
891 case SID_SOURCEVIEW:
892 {
893 SfxViewShell* pViewShell = GetView()
894 ? (SfxViewShell*)GetView()
895 : SfxViewShell::Current();
881 //different meaning between SFX_MERGE_STYLES and aOpt.SetMerge!
882 bMerge = 0 != (nFlags&SFX_MERGE_STYLES);
883 aOpt.SetMerge( !bMerge );
884
885 SetError( LoadStylesFromFile( aFileName, aOpt, sal_False ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
886 if ( !GetError() )
887 rReq.Done();
888 }
889 }
890 break;
891 case SID_SOURCEVIEW:
892 {
893 SfxViewShell* pViewShell = GetView()
894 ? (SfxViewShell*)GetView()
895 : SfxViewShell::Current();
896 SfxViewFrame* pViewFrm = pViewShell->GetViewFrame();
896 SfxViewFrame* pViewFrm = pViewShell->GetViewFrame();
897 SwSrcView* pSrcView = dynamic_cast< SwSrcView *>( pViewShell );
898 if(!pSrcView)
899 {
900 // 3 possible state:
901 // 1 - file unsaved -> save as HTML
902 // 2 - file modified and HTML filter active -> save
903 // 3 - file saved in non-HTML -> QueryBox to save as HTML
904 const SfxFilter* pHtmlFlt =

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

1197 break;
1198 case FN_NEW_HTML_DOC:
1199 case FN_NEW_GLOBAL_DOC:
1200 {
1201 bDone = sal_False;
1202 sal_Bool bCreateHtml = FN_NEW_HTML_DOC == nWhich;
1203
1204 sal_Bool bCreateByOutlineLevel = false; //#outline level,add by zhaojianwei
897 SwSrcView* pSrcView = dynamic_cast< SwSrcView *>( pViewShell );
898 if(!pSrcView)
899 {
900 // 3 possible state:
901 // 1 - file unsaved -> save as HTML
902 // 2 - file modified and HTML filter active -> save
903 // 3 - file saved in non-HTML -> QueryBox to save as HTML
904 const SfxFilter* pHtmlFlt =

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

1197 break;
1198 case FN_NEW_HTML_DOC:
1199 case FN_NEW_GLOBAL_DOC:
1200 {
1201 bDone = sal_False;
1202 sal_Bool bCreateHtml = FN_NEW_HTML_DOC == nWhich;
1203
1204 sal_Bool bCreateByOutlineLevel = false; //#outline level,add by zhaojianwei
1205 sal_Int32 nTemplateOutlineLevel = 0 ; //#outline level,add by zhaojianwei
1205 sal_Int32 nTemplateOutlineLevel = 0 ; //#outline level,add by zhaojianwei
1206
1207 String aFileName, aTemplateName;
1208 if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nWhich, sal_False, &pItem ) )
1209 {
1210 aFileName = ((const SfxStringItem*)pItem)->GetValue();
1211 SFX_ITEMSET_ARG( pArgs, pTemplItem, SfxStringItem, SID_TEMPLATE_NAME, sal_False );
1212 if ( pTemplItem )
1213 aTemplateName = pTemplItem->GetValue();

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

1223 CommonFilePickerElementIds::LISTBOX_FILTER,
1224 CommonFilePickerElementIds::CONTROL_FILEVIEW,
1225 CommonFilePickerElementIds::EDIT_FILEURL,
1226 ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION,
1227 ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1228 0
1229 };
1230
1206
1207 String aFileName, aTemplateName;
1208 if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nWhich, sal_False, &pItem ) )
1209 {
1210 aFileName = ((const SfxStringItem*)pItem)->GetValue();
1211 SFX_ITEMSET_ARG( pArgs, pTemplItem, SfxStringItem, SID_TEMPLATE_NAME, sal_False );
1212 if ( pTemplItem )
1213 aTemplateName = pTemplItem->GetValue();

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

1223 CommonFilePickerElementIds::LISTBOX_FILTER,
1224 CommonFilePickerElementIds::CONTROL_FILEVIEW,
1225 CommonFilePickerElementIds::EDIT_FILEURL,
1226 ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION,
1227 ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1228 0
1229 };
1230
1231 const char* aHTMLHelpIds[] =
1232 {
1231 const char* aHTMLHelpIds[] =
1232 {
1233 HID_SEND_HTML_CTRL_PUSHBUTTON_OK,
1234 HID_SEND_HTML_CTRL_PUSHBUTTON_CANCEL,
1235 HID_SEND_HTML_CTRL_LISTBOX_FILTER,
1236 HID_SEND_HTML_CTRL_CONTROL_FILEVIEW,
1237 HID_SEND_HTML_CTRL_EDIT_FILEURL,
1238 HID_SEND_HTML_CTRL_CHECKBOX_AUTOEXTENSION,
1239 HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE,
1240 ""
1241 };
1242
1233 HID_SEND_HTML_CTRL_PUSHBUTTON_OK,
1234 HID_SEND_HTML_CTRL_PUSHBUTTON_CANCEL,
1235 HID_SEND_HTML_CTRL_LISTBOX_FILTER,
1236 HID_SEND_HTML_CTRL_CONTROL_FILEVIEW,
1237 HID_SEND_HTML_CTRL_EDIT_FILEURL,
1238 HID_SEND_HTML_CTRL_CHECKBOX_AUTOEXTENSION,
1239 HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE,
1240 ""
1241 };
1242
1243 const char* aMasterHelpIds[] =
1244 {
1243 const char* aMasterHelpIds[] =
1244 {
1245 HID_SEND_MASTER_CTRL_PUSHBUTTON_OK,
1246 HID_SEND_MASTER_CTRL_PUSHBUTTON_CANCEL,
1247 HID_SEND_MASTER_CTRL_LISTBOX_FILTER,
1248 HID_SEND_MASTER_CTRL_CONTROL_FILEVIEW,
1249 HID_SEND_MASTER_CTRL_EDIT_FILEURL,
1250 HID_SEND_MASTER_CTRL_CHECKBOX_AUTOEXTENSION,
1251 HID_SEND_MASTER_CTRL_LISTBOX_TEMPLATE,
1252 ""

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

1267 SwWebDocShell::Factory().GetFilterContainer() );
1268 nStrId = STR_LOAD_HTML_DOC;
1269 }
1270 else
1271 {
1272 // Fuer Global-Dokumente bieten wir jetzt auch nur
1273 // noch den aktuellen an.
1274 pFlt = SwGlobalDocShell::Factory().GetFilterContainer()->
1245 HID_SEND_MASTER_CTRL_PUSHBUTTON_OK,
1246 HID_SEND_MASTER_CTRL_PUSHBUTTON_CANCEL,
1247 HID_SEND_MASTER_CTRL_LISTBOX_FILTER,
1248 HID_SEND_MASTER_CTRL_CONTROL_FILEVIEW,
1249 HID_SEND_MASTER_CTRL_EDIT_FILEURL,
1250 HID_SEND_MASTER_CTRL_CHECKBOX_AUTOEXTENSION,
1251 HID_SEND_MASTER_CTRL_LISTBOX_TEMPLATE,
1252 ""

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

1267 SwWebDocShell::Factory().GetFilterContainer() );
1268 nStrId = STR_LOAD_HTML_DOC;
1269 }
1270 else
1271 {
1272 // Fuer Global-Dokumente bieten wir jetzt auch nur
1273 // noch den aktuellen an.
1274 pFlt = SwGlobalDocShell::Factory().GetFilterContainer()->
1275 GetFilter4Extension( String::CreateFromAscii("odm") );
1275 GetFilter4Extension( String::CreateFromAscii("odm") );
1276 nStrId = STR_LOAD_GLOBAL_DOC;
1277 }
1278
1279 if( pFlt )
1280 {
1281 uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
1282 const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard();
1283 xFltMgr->appendFilter( pFlt->GetUIName(), sWild );

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

1305 // SwTxtFmtColl *pFnd = 0, *pAny = 0;
1306 // for(sal_uInt16 i = 0; i < nCount; ++i)
1307 // {
1308 // SwTxtFmtColl &rTxtColl =
1309 // *pDoc->GetTxtFmtColls()->GetObject( i );
1310 // if( !rTxtColl.IsDefault() && rTxtColl.IsAtDocNodeSet() )
1311 // {
1312 // //if( MAXLEVEL >= rTxtColl.GetOutlineLevel() && ( !pFnd || //#outline level,zhaojianwei
1276 nStrId = STR_LOAD_GLOBAL_DOC;
1277 }
1278
1279 if( pFlt )
1280 {
1281 uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
1282 const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard();
1283 xFltMgr->appendFilter( pFlt->GetUIName(), sWild );

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

1305 // SwTxtFmtColl *pFnd = 0, *pAny = 0;
1306 // for(sal_uInt16 i = 0; i < nCount; ++i)
1307 // {
1308 // SwTxtFmtColl &rTxtColl =
1309 // *pDoc->GetTxtFmtColls()->GetObject( i );
1310 // if( !rTxtColl.IsDefault() && rTxtColl.IsAtDocNodeSet() )
1311 // {
1312 // //if( MAXLEVEL >= rTxtColl.GetOutlineLevel() && ( !pFnd || //#outline level,zhaojianwei
1313 //if( rTxtColl.IsAssignedToListLevelOfOutlineStyle() && ( !pFnd || //<-end,zhaojianwei
1313 //if( rTxtColl.IsAssignedToListLevelOfOutlineStyle() && ( !pFnd || //<-end,zhaojianwei
1314 // pFnd->GetAssignedOutlineStyleLevel() > rTxtColl.GetAssignedOutlineStyleLevel() ))
1315 // {
1316 // nSelect = (sal_Int16)nIdx;
1317 // pFnd = &rTxtColl;
1318 // sStartTemplate = rTxtColl.GetName();
1319 // }
1320 // else if( !pAny )
1321 // pAny = &rTxtColl;

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

1382 Any aSelectPos(&nSelect, ::getCppuType(&nSelect));
1383 xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1384 ListboxControlActions::SET_SELECT_ITEM, aSelectPos );
1385 xCtrlAcc->setLabel( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1386 String(SW_RES( STR_FDLG_TEMPLATE_NAME )));
1387 }
1388 catch(Exception& )
1389 {
1314 // pFnd->GetAssignedOutlineStyleLevel() > rTxtColl.GetAssignedOutlineStyleLevel() ))
1315 // {
1316 // nSelect = (sal_Int16)nIdx;
1317 // pFnd = &rTxtColl;
1318 // sStartTemplate = rTxtColl.GetName();
1319 // }
1320 // else if( !pAny )
1321 // pAny = &rTxtColl;

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

1382 Any aSelectPos(&nSelect, ::getCppuType(&nSelect));
1383 xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1384 ListboxControlActions::SET_SELECT_ITEM, aSelectPos );
1385 xCtrlAcc->setLabel( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
1386 String(SW_RES( STR_FDLG_TEMPLATE_NAME )));
1387 }
1388 catch(Exception& )
1389 {
1390 DBG_ERROR("control acces failed");
1390 DBG_ERROR("control access failed");
1391 }
1392
1393 xFP->setTitle( SW_RESSTR( nStrId ));
1394 SvtPathOptions aPathOpt;
1395 xFP->setDisplayDirectory( aPathOpt.GetWorkPath() );
1396 if( ERRCODE_NONE == aDlgHelper.Execute())
1397 {
1398 aFileName = xFP->getFiles().getConstArray()[0];

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

1407 sal_Int32 nColonPos = sTmpl.indexOf( sal_Unicode(':') );
1408 OUString sPrefix = sTmpl.copy( 0L, nColonPos );
1409 if( sPrefix.equalsAscii("Style"))
1410 {
1411 aTemplateName = sTmpl.copy( 7L ); //get string behind "Style: "
1412 }
1413 else if( sPrefix.equalsAscii("Outline"))
1414 {
1391 }
1392
1393 xFP->setTitle( SW_RESSTR( nStrId ));
1394 SvtPathOptions aPathOpt;
1395 xFP->setDisplayDirectory( aPathOpt.GetWorkPath() );
1396 if( ERRCODE_NONE == aDlgHelper.Execute())
1397 {
1398 aFileName = xFP->getFiles().getConstArray()[0];

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

1407 sal_Int32 nColonPos = sTmpl.indexOf( sal_Unicode(':') );
1408 OUString sPrefix = sTmpl.copy( 0L, nColonPos );
1409 if( sPrefix.equalsAscii("Style"))
1410 {
1411 aTemplateName = sTmpl.copy( 7L ); //get string behind "Style: "
1412 }
1413 else if( sPrefix.equalsAscii("Outline"))
1414 {
1415 nTemplateOutlineLevel = ( sTmpl.copy( 15L )).toInt32(); //get string behind "Outline: Leve ";
1415 nTemplateOutlineLevel = ( sTmpl.copy( 15L )).toInt32(); //get string behind "Outline: Level ";
1416 bCreateByOutlineLevel = true;
1417 }
1418 //<-end,zhaojianwei
1419
1420 if ( aFileName.Len() )
1421 {
1422 rReq.AppendItem( SfxStringItem( nWhich, aFileName ) );
1423 if( aTemplateName.Len() )

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

1657void SwDocShell::ReloadFromHtml( const String& rStreamName, SwSrcView* pSrcView )
1658{
1659 sal_Bool bModified = IsModified();
1660
1661 // MIB 23.6.97: Die HTTP-Header-Felder muessen geloescht werden,
1662 // sonst gibt es welche aus Meta-Tags hinter doppelt und dreifach.
1663 ClearHeaderAttributesForSourceViewHack();
1664
1416 bCreateByOutlineLevel = true;
1417 }
1418 //<-end,zhaojianwei
1419
1420 if ( aFileName.Len() )
1421 {
1422 rReq.AppendItem( SfxStringItem( nWhich, aFileName ) );
1423 if( aTemplateName.Len() )

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

1657void SwDocShell::ReloadFromHtml( const String& rStreamName, SwSrcView* pSrcView )
1658{
1659 sal_Bool bModified = IsModified();
1660
1661 // MIB 23.6.97: Die HTTP-Header-Felder muessen geloescht werden,
1662 // sonst gibt es welche aus Meta-Tags hinter doppelt und dreifach.
1663 ClearHeaderAttributesForSourceViewHack();
1664
1665 // MIB 24.07.97: Das Dokument-Basic muss auch noch d'ran glauben ...
1665 // MIB 24.07.97: Das Dokument-Basic muss auch noch dran glauben ...
1666 SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get();
1667 //#59620# HasBasic() zeigt an, dass es schon einen BasicManager an der DocShell
1668 // gibt. Der wurde im HTML-Import immer angelegt, wenn Macros im Quelltext
1669 // vorhanden sind.
1670 if( pHtmlOptions && pHtmlOptions->IsStarBasic() && HasBasic())
1671 {
1672 BasicManager *pBasicMan = GetBasicManager();
1673 if( pBasicMan && (pBasicMan != SFX_APP()->GetBasicManager()) )

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

1716
1717 const String& rMedname = GetMedium()->GetName();
1718
1719 // fix #51032#: Die HTML-Vorlage muss noch gesetzt werden
1720 SetHTMLTemplate( *GetDoc() ); //Styles aus HTML.vor
1721
1722 SfxViewShell* pViewShell = GetView() ? (SfxViewShell*)GetView()
1723 : SfxViewShell::Current();
1666 SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get();
1667 //#59620# HasBasic() zeigt an, dass es schon einen BasicManager an der DocShell
1668 // gibt. Der wurde im HTML-Import immer angelegt, wenn Macros im Quelltext
1669 // vorhanden sind.
1670 if( pHtmlOptions && pHtmlOptions->IsStarBasic() && HasBasic())
1671 {
1672 BasicManager *pBasicMan = GetBasicManager();
1673 if( pBasicMan && (pBasicMan != SFX_APP()->GetBasicManager()) )

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

1716
1717 const String& rMedname = GetMedium()->GetName();
1718
1719 // fix #51032#: Die HTML-Vorlage muss noch gesetzt werden
1720 SetHTMLTemplate( *GetDoc() ); //Styles aus HTML.vor
1721
1722 SfxViewShell* pViewShell = GetView() ? (SfxViewShell*)GetView()
1723 : SfxViewShell::Current();
1724 SfxViewFrame* pViewFrm = pViewShell->GetViewFrame();
1724 SfxViewFrame* pViewFrm = pViewShell->GetViewFrame();
1725 pViewFrm->GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_SYNCHRON );
1726
1727 SubInitNew();
1728
1729 SfxMedium aMed( rStreamName, STREAM_READ, sal_False );
1730 // --> OD 2005-08-01 #i48748# - use class <SwReloadFromHtmlReader>, because
1731 // the base URL has to be set to the filename of the document <rMedname>
1732 // and not to the base URL of the temporary file <aMed> in order to get

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

1766 INetURLObject aURLObj( rURL );
1767 String sURL( aURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
1768
1769 // Filter bestimmen:
1770// const SfxFilter* pFlt = SwIoSystem::GetFileFilter( rURL, aEmptyStr );
1771 String sFactory(String::CreateFromAscii(SwDocShell::Factory().GetShortName()));
1772 SfxFilterMatcher aMatcher( sFactory );
1773
1725 pViewFrm->GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_SYNCHRON );
1726
1727 SubInitNew();
1728
1729 SfxMedium aMed( rStreamName, STREAM_READ, sal_False );
1730 // --> OD 2005-08-01 #i48748# - use class <SwReloadFromHtmlReader>, because
1731 // the base URL has to be set to the filename of the document <rMedname>
1732 // and not to the base URL of the temporary file <aMed> in order to get

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

1766 INetURLObject aURLObj( rURL );
1767 String sURL( aURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
1768
1769 // Filter bestimmen:
1770// const SfxFilter* pFlt = SwIoSystem::GetFileFilter( rURL, aEmptyStr );
1771 String sFactory(String::CreateFromAscii(SwDocShell::Factory().GetShortName()));
1772 SfxFilterMatcher aMatcher( sFactory );
1773
1774 //#b6445961# search for filter in WebDocShell, too
1774 //#b6445961# search for filter in WebDocShell, too
1775 SfxMedium aMed( rURL, STREAM_STD_READ, sal_False );
1776 const SfxFilter* pFlt = 0;
1777 aMatcher.DetectFilter( aMed, &pFlt, sal_False, sal_False );
1778 if(!pFlt)
1779 {
1780 String sWebFactory(String::CreateFromAscii(SwWebDocShell::Factory().GetShortName()));
1781 SfxFilterMatcher aWebMatcher( sWebFactory );
1782 aWebMatcher.DetectFilter( aMed, &pFlt, sal_False, sal_False );
1783 }
1784 // --> OD #i117339# - trigger import only for own formats
1785// if( aMed.IsStorage() )
1786 bool bImport( false );
1787 {
1788 if ( aMed.IsStorage() )
1789 {
1775 SfxMedium aMed( rURL, STREAM_STD_READ, sal_False );
1776 const SfxFilter* pFlt = 0;
1777 aMatcher.DetectFilter( aMed, &pFlt, sal_False, sal_False );
1778 if(!pFlt)
1779 {
1780 String sWebFactory(String::CreateFromAscii(SwWebDocShell::Factory().GetShortName()));
1781 SfxFilterMatcher aWebMatcher( sWebFactory );
1782 aWebMatcher.DetectFilter( aMed, &pFlt, sal_False, sal_False );
1783 }
1784 // --> OD #i117339# - trigger import only for own formats
1785// if( aMed.IsStorage() )
1786 bool bImport( false );
1787 {
1788 if ( aMed.IsStorage() )
1789 {
1790 // As <SfxMedium.GetFilter().IsOwnFormat() resp. IsOwnTemplateFormat()
1791 // does not work correct (e.g., MS Word 2007 XML Template),
1790 // As <SfxMedium.GetFilter().IsOwnFormat() resp. IsOwnTemplateFormat()
1791 // does not work correct (e.g., MS Word 2007 XML Template),
1792 // use workaround provided by MAV.
1793 uno::Reference< embed::XStorage > xStorage = aMed.GetStorage();
1794 if ( xStorage.is() )
1795 {
1792 // use workaround provided by MAV.
1793 uno::Reference< embed::XStorage > xStorage = aMed.GetStorage();
1794 if ( xStorage.is() )
1795 {
1796 // use <try-catch> on retrieving <MediaType> in order to check,
1796 // use <try-catch> on retrieving <MediaType> in order to check,
1797 // if the storage is one of our own ones.
1798 try
1797 // if the storage is one of our own ones.
1798 try
1799 {
1799 {
1800 uno::Reference< beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY_THROW );
1801 const ::rtl::OUString aMediaTypePropName( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) );
1802 xProps->getPropertyValue( aMediaTypePropName );
1803 bImport = true;
1804 }
1805 catch( const uno::Exception& )
1806 {
1807 bImport = false;
1808 }
1800 uno::Reference< beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY_THROW );
1801 const ::rtl::OUString aMediaTypePropName( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) );
1802 xProps->getPropertyValue( aMediaTypePropName );
1803 bImport = true;
1804 }
1805 catch( const uno::Exception& )
1806 {
1807 bImport = false;
1808 }
1809 }
1809 }
1810 }
1811 }
1812 if ( bImport )
1810 }
1811 }
1812 if ( bImport )
1813 // <--
1813 // <--
1814 {
1815 DBG_ASSERT((pFlt ? pFlt->GetVersion() : 0) >= SOFFICE_FILEFORMAT_60, "which file version?");
1814 {
1815 DBG_ASSERT((pFlt ? pFlt->GetVersion() : 0) >= SOFFICE_FILEFORMAT_60, "which file version?");
1816 SwRead pRead = ReadXML;
1816 SwRead pRead = ReadXML;
1817 SwReader* pReader = 0;
1818 SwPaM* pPam = 0;
1819 // the SW3IO - Reader need the pam/wrtshell, because only then he
1820 // insert the styles!
1821 if( bUnoCall )
1822 {
1823 SwNodeIndex aIdx( mpDoc->GetNodes().GetEndOfContent(), -1 );
1824 pPam = new SwPaM( aIdx );
1825 pReader = new SwReader( aMed, rURL, *pPam );
1826 }
1827 else
1817 SwReader* pReader = 0;
1818 SwPaM* pPam = 0;
1819 // the SW3IO - Reader need the pam/wrtshell, because only then he
1820 // insert the styles!
1821 if( bUnoCall )
1822 {
1823 SwNodeIndex aIdx( mpDoc->GetNodes().GetEndOfContent(), -1 );
1824 pPam = new SwPaM( aIdx );
1825 pReader = new SwReader( aMed, rURL, *pPam );
1826 }
1827 else
1828 {
1828 {
1829 pReader = new SwReader( aMed, rURL, *mpWrtShell->GetCrsr() );
1830 }
1831
1832 pRead->GetReaderOpt().SetTxtFmts( rOpt.IsTxtFmts() );
1833 pRead->GetReaderOpt().SetFrmFmts( rOpt.IsFrmFmts() );
1834 pRead->GetReaderOpt().SetPageDescs( rOpt.IsPageDescs() );
1835 pRead->GetReaderOpt().SetNumRules( rOpt.IsNumRules() );
1836 pRead->GetReaderOpt().SetMerge( rOpt.IsMerge() );

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

1844 {
1845 mpWrtShell->StartAllAction();
1846 nErr = pReader->Read( *pRead );
1847 mpWrtShell->EndAllAction();
1848 }
1849 delete pPam;
1850 delete pReader;
1851 }
1829 pReader = new SwReader( aMed, rURL, *mpWrtShell->GetCrsr() );
1830 }
1831
1832 pRead->GetReaderOpt().SetTxtFmts( rOpt.IsTxtFmts() );
1833 pRead->GetReaderOpt().SetFrmFmts( rOpt.IsFrmFmts() );
1834 pRead->GetReaderOpt().SetPageDescs( rOpt.IsPageDescs() );
1835 pRead->GetReaderOpt().SetNumRules( rOpt.IsNumRules() );
1836 pRead->GetReaderOpt().SetMerge( rOpt.IsMerge() );

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

1844 {
1845 mpWrtShell->StartAllAction();
1846 nErr = pReader->Read( *pRead );
1847 mpWrtShell->EndAllAction();
1848 }
1849 delete pPam;
1850 delete pReader;
1851 }
1852
1852
1853 return nErr;
1854}
1855
1856/*--------------------------------------------------------------------
1857 Get a client for an embedded object if possible.
1858 --------------------------------------------------------------------*/
1859SfxInPlaceClient* SwDocShell::GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef )
1860{

--- 13 unchanged lines hidden ---
1853 return nErr;
1854}
1855
1856/*--------------------------------------------------------------------
1857 Get a client for an embedded object if possible.
1858 --------------------------------------------------------------------*/
1859SfxInPlaceClient* SwDocShell::GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef )
1860{

--- 13 unchanged lines hidden ---