update dev300-m57
[ooovba.git] / sfx2 / source / view / frame.cxx
blobd1487d3ebb13507e8bfb1af73d356e30cde40a09
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: frame.cxx,v $
10 * $Revision: 1.55.142.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sfx2.hxx"
33 #include <com/sun/star/embed/EmbedStates.hpp>
34 #include <com/sun/star/uno/Reference.h>
35 #include <com/sun/star/awt/XWindow.hpp>
36 #include <com/sun/star/util/XURLTransformer.hpp>
37 #include <com/sun/star/util/XCloseable.hpp>
38 #include <com/sun/star/util/CloseVetoException.hpp>
39 #include <com/sun/star/lang/XComponent.hpp>
40 #include <com/sun/star/lang/DisposedException.hpp>
41 #include <com/sun/star/container/XChild.hpp>
43 #ifndef _MENU_HXX //autogen
44 #include <vcl/menu.hxx>
45 #endif
46 #include <svtools/intitem.hxx>
47 #ifndef _SPLITWIN_HXX //autogen
48 #include <vcl/splitwin.hxx>
49 #endif
50 #include <svtools/eitem.hxx>
51 #include <svtools/stritem.hxx>
52 #ifndef _TOOLKIT_UNOHLP_HXX
53 #include <toolkit/helper/vclunohelper.hxx>
54 #endif
55 #include <com/sun/star/awt/PosSize.hpp>
56 #ifndef _UNOTOOLS_PROCESSFACTORY_HXX
57 #include <comphelper/processfactory.hxx>
58 #endif
59 #include <vcl/msgbox.hxx>
61 #ifndef GCC
62 #endif
64 // wg. pTopFrames
65 #include "appdata.hxx"
66 #include <sfx2/app.hxx>
67 #include <sfx2/event.hxx>
68 #include <sfx2/unoctitm.hxx>
69 #include <sfx2/frame.hxx>
70 #include "arrdecl.hxx"
71 #include <sfx2/objsh.hxx>
72 #include <sfx2/dispatch.hxx>
73 #include <sfx2/docfile.hxx>
74 #include <sfx2/docfilt.hxx>
75 #include <sfx2/frmdescr.hxx>
76 #include "openflag.hxx"
77 #include <sfx2/viewsh.hxx>
78 #include <sfx2/viewfrm.hxx>
79 #include <sfx2/request.hxx>
80 #include <sfx2/fcontnr.hxx>
81 #include "impframe.hxx"
82 #include <sfx2/appuno.hxx>
83 #include <sfx2/topfrm.hxx>
84 #include "workwin.hxx"
85 #include <sfx2/sfxuno.hxx>
86 #include <sfx2/msgpool.hxx>
87 #include "objshimp.hxx"
88 #include <sfx2/ipclient.hxx>
90 #ifdef DBG_UTIL
91 #include <sfx2/frmhtmlw.hxx>
92 #endif
94 using namespace com::sun::star;
96 static SfxFrameArr_Impl* pFramesArr_Impl=0;
98 using namespace ::com::sun::star::uno;
99 using namespace ::com::sun::star::util;
100 using namespace ::com::sun::star::frame;
101 using namespace ::com::sun::star::container;
103 TYPEINIT1(SfxFrame, SfxListener);
104 TYPEINIT1_AUTOFACTORY(SfxFrameItem, SfxPoolItem);
105 TYPEINIT1(SfxUsrAnyItem, SfxPoolItem);
107 SfxFrame::SfxFrame(SfxFrame* pParent):
108 pParentFrame( pParent ),
109 pChildArr(0),
110 pUnoImp(0)
112 pImp = new SfxFrame_Impl( this );
113 if ( pParent )
114 pParent->InsertChildFrame_Impl( this );
115 if ( !pFramesArr_Impl )
116 pFramesArr_Impl = new SfxFrameArr_Impl;
117 pFramesArr_Impl->Insert( this, pFramesArr_Impl->Count() );
120 SvCompatWeakHdl* SfxFrame::GetHdl()
122 return pImp->GetHdl();
125 SfxCancelManager* SfxFrame::GetCancelManager() const
127 SfxFrame *pFrame = GetTopFrame();
128 SfxCancelManager*& rpMgr = pFrame->pImp->pCancelMgr;
129 if ( !rpMgr )
131 rpMgr = new SfxCancelManager( SFX_APP()->GetCancelManager() );
132 pFrame->pImp->StartListening( *rpMgr );
134 return rpMgr;
137 //--------------------------------------------------------------------
139 SfxFrame::~SfxFrame()
141 pFramesArr_Impl->Remove( pFramesArr_Impl->GetPos( this ) );
143 if ( pParentFrame )
145 pParentFrame->RemoveChildFrame_Impl( this );
146 pParentFrame = 0;
149 delete pImp->pDescr;
151 if ( pChildArr )
153 DBG_ASSERT( !pChildArr->Count(), "Childs nicht entfernt!" );
154 delete pChildArr;
157 delete pImp;
160 sal_Bool SfxFrame::DoClose()
162 // Eigentlich wird noch ein PrepareClose gebraucht !!!
163 BOOL bRet = FALSE;
164 if ( !pImp->bClosing )
166 pImp->bClosing = sal_True;
167 CancelTransfers();
169 // now close frame; it will be deleted if this call is successful, so don't use any members after that!
170 bRet = TRUE;
173 Reference< XCloseable > xCloseable ( pImp->xFrame, UNO_QUERY );
174 if ( (!GetCurrentDocument() || !GetCurrentDocument()->Get_Impl()->bDisposing ) && xCloseable.is())
175 xCloseable->close(sal_True);
176 else if ( pImp->xFrame.is() )
178 Reference < XFrame > xFrame = pImp->xFrame;
179 xFrame->setComponent( Reference < com::sun::star::awt::XWindow >(), Reference < XController >() );
180 xFrame->dispose();
182 else
183 bRet = DoClose_Impl();
185 catch( ::com::sun::star::util::CloseVetoException& )
187 pImp->bClosing = sal_False;
188 bRet = FALSE;
190 catch( ::com::sun::star::lang::DisposedException& )
195 return bRet;
198 sal_Bool SfxFrame::DoClose_Impl()
200 sal_Bool bRet = sal_True;
201 SfxBindings* pBindings = NULL;
202 if ( pImp->pCurrentViewFrame )
203 pBindings = &pImp->pCurrentViewFrame->GetBindings();
205 // Bei internen Tasks m"ussen Controller und Tools abger"aumt werden
206 if ( pImp->pWorkWin )
207 pImp->pWorkWin->DeleteControllers_Impl();
209 if ( pImp->pCurrentViewFrame )
210 bRet = pImp->pCurrentViewFrame->Close();
212 if ( pImp->bOwnsBindings )
213 DELETEZ( pBindings );
215 bRet = Close();
216 DBG_ASSERT( bRet, "Impossible state: frame closes, but controller refuses!");
217 return bRet;
220 void SfxFrame::Clear_Impl()
222 CancelTransfers();
224 // Bei FrameSets verhindern, da\s das Closen der Childs zu st"andigen
225 // ReCalcs im SplitWindow f"uhrt; SetUpdateMode am FrameWindow wirkt
226 // leider nicht auf dem MAC
227 Window *pWin = NULL;
228 SfxViewShell *pViewSh;
229 if ( pImp->pCurrentViewFrame &&
230 0 != ( pViewSh = pImp->pCurrentViewFrame->GetViewShell() ) )
232 pWin = pViewSh->GetWindow();
233 if ( pWin )
234 pWin->Hide();
237 sal_Bool bRet = sal_True;
238 SfxBindings* pBindings = NULL;
239 if ( pImp->pCurrentViewFrame )
241 pBindings = &pImp->pCurrentViewFrame->GetBindings();
242 pImp->bClosing = sal_True;
243 bRet = pImp->pCurrentViewFrame->Close();
244 pImp->bClosing = sal_False;
247 if ( bRet )
249 // Bei internen Tasks m"ussen Controller und Tools abger"aumt werden
250 if ( pImp->pWorkWin )
252 pImp->pWorkWin->DeleteControllers_Impl();
253 DELETEZ( pImp->pWorkWin );
256 if ( pImp->bOwnsBindings )
257 delete pBindings;
259 else
261 if ( pWin )
262 pWin->Show();
267 sal_Bool SfxFrame::DocIsModified_Impl()
269 if ( pImp->pCurrentViewFrame && pImp->pCurrentViewFrame->GetObjectShell() &&
270 pImp->pCurrentViewFrame->GetObjectShell()->IsModified() )
271 return sal_True;
272 for( sal_uInt16 nPos = GetChildFrameCount(); nPos--; )
273 if( pChildArr->GetObject( nPos )->DocIsModified_Impl() )
274 return sal_True;
275 return sal_False;
278 sal_uInt16 SfxFrame::PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing )
280 sal_uInt16 nRet = RET_OK;
282 // prevent recursive calls
283 if( !pImp->bPrepClosing )
285 pImp->bPrepClosing = sal_True;
287 SfxObjectShell* pCur = GetCurrentDocument() ;
288 if( pCur )
290 // SFX components have a known behaviour
291 // First check if this frame is the only view to its current document
292 int bOther = sal_False;
293 for ( const SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pCur );
294 !bOther && pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pCur ) )
296 bOther = ( pFrame->GetFrame() != this );
299 SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEVIEW, pCur) );
301 if ( bOther )
302 // if there are other views only the current view of this frame must be asked
303 nRet = GetCurrentViewFrame()->GetViewShell()->PrepareClose( bUI, bForBrowsing );
304 else
305 // otherwise ask the document
306 nRet = pCur->PrepareClose( bUI, bForBrowsing );
309 if ( nRet == RET_OK )
311 // if this frame has child frames, ask them too
312 for( USHORT nPos = GetChildFrameCount(); nRet == RET_OK && nPos--; )
313 nRet = pChildArr->GetObject( nPos )->PrepareClose_Impl( bUI, bForBrowsing );
316 pImp->bPrepClosing = sal_False;
319 if ( nRet == RET_OK && pImp->pWorkWin )
320 // if closing was accepted by the component the UI subframes must be asked also
321 nRet = pImp->pWorkWin->PrepareClose_Impl();
323 return nRet;
326 //--------------------------------------------------------------------
328 SfxFrame* SfxFrame::GetChildFrame( sal_uInt16 nPos ) const
330 if ( pChildArr && pChildArr->Count() > nPos )
332 DBG_ASSERT( nPos < pChildArr->Count(), "Falscher Index!");
333 return (*pChildArr)[nPos];
336 return 0L;
339 void SfxFrame::InsertChildFrame_Impl( SfxFrame* pFrame, sal_uInt16 nPos )
341 if ( !pChildArr )
342 pChildArr = new SfxFrameArr_Impl;
343 pChildArr->Insert( pFrame, nPos );
344 pFrame->pParentFrame = this;
347 void SfxFrame::RemoveChildFrame_Impl( sal_uInt16 nPos )
349 DBG_ASSERT( pChildArr, "Unbekannter Frame!");
350 pChildArr->Remove( nPos );
353 void SfxFrame::RemoveChildFrame_Impl( SfxFrame* pFrame )
355 DBG_ASSERT( pChildArr, "Unbekannter Frame!");
356 sal_uInt16 nPos = pChildArr->GetPos(pFrame);
357 RemoveChildFrame_Impl( nPos );
360 sal_Bool SfxFrame::CloseChildFrames()
362 sal_Bool bRet = sal_True;
363 if ( pChildArr )
365 // Childs closen
366 sal_uInt16 nCount = pChildArr->Count();
367 for ( sal_uInt16 n=nCount; n>0; n--)
369 SfxFrame* pFrame = (*pChildArr)[n-1];
370 // pFrame removed sich selbst
371 bRet = pFrame->DoClose();
372 if ( !bRet )
373 break;
377 return bRet;
380 SfxFrame* SfxFrame::SearchChildrenForName_Impl( const String& rName, sal_Bool bDeep ) const
382 if ( pChildArr )
384 sal_uInt16 nCount = pChildArr->Count();
385 for ( sal_uInt16 n=nCount; n>0; n--)
387 SfxFrame* pFrame = (*pChildArr)[n-1];
388 if ( rName.CompareIgnoreCaseToAscii( pFrame->GetFrameName() ) == COMPARE_EQUAL )
389 return pFrame;
390 if( bDeep )
392 pFrame = pFrame->SearchChildrenForName_Impl( rName );
393 if ( pFrame )
394 return pFrame;
399 return NULL;
402 SfxFrame* SfxFrame::GetTopFrame() const
404 SfxFrame *pParent = (SfxFrame*) this;
405 while ( pParent->pParentFrame )
406 pParent = pParent->pParentFrame;
407 return pParent;
410 SfxFrame* SfxFrame::SearchFrame( const String& rName, SfxMedium* /*pMedium*/ )
412 // Weil Netscape f"uhrende BLANKS "uberliest, m"ussen wir das wohl auch
413 // Sollte besser auch bei den FrameNames gemacht werden!
414 String aFrameName( rName );
415 aFrameName.EraseLeadingChars();
417 SfxFrame *pFrame = this;
418 if( !aFrameName.Len() || aFrameName.CompareIgnoreCaseToAscii("_self") == COMPARE_EQUAL )
420 return pFrame;
422 else if ( aFrameName.CompareIgnoreCaseToAscii("_smartself") == COMPARE_EQUAL )
424 DBG_ERROR("Not supported!");
425 return pFrame;
427 else if ( aFrameName.CompareIgnoreCaseToAscii( GetFrameName() ) == COMPARE_EQUAL)
429 // Eigener Name, kein Name oder Selbstbezug
430 return pFrame;
432 else if ( aFrameName.CompareIgnoreCaseToAscii("_parent") == COMPARE_EQUAL )
434 // Gesucht ist das Parent Frameset
435 return pParentFrame ? pParentFrame : this;
437 else if ( aFrameName.CompareIgnoreCaseToAscii("_blank") == COMPARE_EQUAL )
439 return NULL;
441 else if ( aFrameName.CompareIgnoreCaseToAscii("_top") == COMPARE_EQUAL )
443 while ( pFrame->GetParentFrame() )
444 pFrame = pFrame->GetParentFrame();
445 return pFrame;
447 else
449 // Zuerst unterhalb dieses Frames absuchen
450 pFrame = SearchChildrenForName_Impl( aFrameName );
453 if ( !pFrame && GetParentFrame() )
455 // Noch nichts gefunden, nach oben weitergehen
456 // Eigentlich m"u\sten Frames, die schon abgesucht wurden, aus
457 // Performance-Gr"unden markiert werden
458 SfxFrame *pParent = GetParentFrame();
461 // Ist es der Parent ?
462 if ( aFrameName.CompareIgnoreCaseToAscii( pParent->GetFrameName() ) == COMPARE_EQUAL )
463 return pParent;
465 // Weiter nach oben
466 pParent = pParent->GetParentFrame();
468 while ( pParent );
471 if( !pFrame )
473 SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames;
474 // keinen Frame im MDI-Fenster gefunden. Jetzt die anderen
475 // Toplevel Frames checken.
476 SfxFrame *pTop = GetTopFrame();
477 for( sal_uInt16 nPos = rArr.Count(); nPos--; )
479 // Unser Topframe wurde bereits durchsucht
480 SfxFrame* pCurFrame = rArr[ nPos ];
481 if( pCurFrame != pTop )
483 if( aFrameName.CompareIgnoreCaseToAscii( pCurFrame->GetFrameName() ) ==
484 COMPARE_EQUAL )
485 return pCurFrame;
486 else
488 pFrame = pCurFrame->SearchChildrenForName_Impl( aFrameName );
489 if( pFrame )
490 return pFrame;
496 return pFrame;
499 sal_Bool SfxFrame::IsClosing_Impl() const
501 return pImp->bClosing;
504 void SfxFrame::SetIsClosing_Impl()
506 pImp->bClosing = TRUE;
509 void SfxFrame::DocumentInserted( SfxObjectShell* /*pDoc*/ )
513 sal_uInt16 SfxFrame::GetChildFrameCount() const
515 return pChildArr ? pChildArr->Count() : 0;
518 sal_Bool SfxFrame::InsertDocument( SfxObjectShell* pDoc )
520 DocumentInserted( pDoc );
521 return sal_True;
524 void SfxFrame::CancelTransfers( sal_Bool /*bCancelLoadEnv*/ )
526 if( !pImp->bInCancelTransfers )
528 pImp->bInCancelTransfers = sal_True;
529 SfxObjectShell* pObj = GetCurrentDocument();
530 if( pObj ) //&& !( pObj->Get_Impl()->nLoadedFlags & SFX_LOADED_ALL ))
532 SfxViewFrame* pFrm;
533 for( pFrm = SfxViewFrame::GetFirst( pObj );
534 pFrm && pFrm->GetFrame() == this;
535 pFrm = SfxViewFrame::GetNext( *pFrm, pObj ) ) ;
536 // Keine anderer Frame mehr auf Doc -> Cancel
537 if( !pFrm )
539 pObj->CancelTransfers();
540 GetCurrentDocument()->Broadcast( SfxSimpleHint(SFX_HINT_TITLECHANGED) );
544 // zuerst Nachladende Frames stoppen
545 sal_uInt16 nCount = GetChildFrameCount();
546 for( sal_uInt16 n = 0; n<nCount; n++ )
547 GetChildFrame( n )->CancelTransfers();
549 // ggf. StarOne-Loader canceln
550 SfxFrameWeak wFrame( this );
551 if (wFrame.Is())
552 pImp->bInCancelTransfers = sal_False;
556 SfxViewFrame* SfxFrame::GetCurrentViewFrame() const
558 return pImp->pCurrentViewFrame;
561 SfxDispatcher* SfxFrame::GetDispatcher_Impl() const
563 if ( pImp->pCurrentViewFrame )
564 return pImp->pCurrentViewFrame->GetDispatcher();
565 return GetParentFrame()->GetDispatcher_Impl();
568 SfxObjectShell* SfxFrame::GetCurrentDocument() const
570 return pImp->pCurrentViewFrame ?
571 pImp->pCurrentViewFrame->GetObjectShell() :
572 pImp->pCurrentObjectShell;
575 void SfxFrame::SetCurrentDocument_Impl( SfxObjectShell *pDoc )
577 pImp->pCurrentObjectShell = pDoc;
580 void SfxFrame::SetCurrentViewFrame_Impl( SfxViewFrame *pFrame )
582 pImp->pCurrentViewFrame = pFrame;
585 sal_uInt32 SfxFrame::GetFrameType() const
587 return pImp->nType;
590 void SfxFrame::SetFrameType_Impl( sal_uInt32 n )
592 pImp->nType = n;
595 void SfxFrame::CopyHistory_Impl( SfxFrame* /*pFrame*/ ) const
600 void SfxFrame::ClearHistory()
604 sal_Bool SfxFrame::ExecuteHistoryMenu_Impl( sal_uInt16 /*nWhich*/, const Rectangle& /*rRect*/, sal_uInt16 /*nFlags*/ )
606 return sal_True;
609 sal_Bool SfxFrame::Browse( sal_Bool /*bForward*/, sal_uInt16 /*nSteps*/, sal_Bool /*bNewFrame*/ )
611 return FALSE;
614 void SfxFrame::UpdatePickEntries()
618 void SfxFrame::UpdatePickEntries( const ::com::sun::star::uno::Any& /*rValue*/ )
622 void SfxFrame::UpdateUndoHistory_Impl( SfxObjectShell* /*pDocSh*/, const String* /*pNew*/, const String* /*pTitle*/ )
626 void SfxFrame::UpdateCurrentHistory_Impl( SfxObjectShell* /*pDocSh*/, const String* /*pNew*/ )
630 void SfxFrame::UpdateHistory( SfxObjectShell* /*pDocSh*/, const String* /*pNew*/ )
634 void SfxFrame::UpdateHistory(
635 const ::rtl::OUString& /*aURL*/,
636 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& /*aArgs*/,
637 const ::rtl::OUString& /*rTitle*/ )
641 void SfxFrame::GetViewData_Impl()
643 // Alle zwischen Laden und Entfernen "anderbaren Daten aktualisieren; die
644 // festen Daten werden nur einmal ( nach InsertDocument in UpdateDescriptor )
645 // geholt, um Zeit zu sparen.
646 SfxViewFrame* pViewFrame = GetCurrentViewFrame();
647 if( pViewFrame && pViewFrame->GetViewShell() )
649 const SfxMedium *pMed = GetCurrentDocument()->GetMedium();
650 sal_Bool bReadOnly = pMed->GetOpenMode() == SFX_STREAM_READONLY;
651 GetDescriptor()->SetReadOnly( bReadOnly );
653 String aUserData;
654 pViewFrame->GetViewShell()->WriteUserData( aUserData, sal_True );
655 SfxItemSet *pSet = GetDescriptor()->GetArgs();
656 pSet->Put( SfxStringItem( SID_USER_DATA, aUserData ));
657 sal_Bool bGetViewData = sal_False;
658 if ( GetController().is() && pSet->GetItemState( SID_VIEW_DATA ) != SFX_ITEM_SET )
660 ::com::sun::star::uno::Any aData = GetController()->getViewData();
661 pSet->Put( SfxUsrAnyItem( SID_VIEW_DATA, aData ) );
662 bGetViewData = sal_True;
665 if ( pViewFrame->GetCurViewId() )
666 pSet->Put( SfxUInt16Item( SID_VIEW_ID, pViewFrame->GetCurViewId() ) );
667 if ( pChildArr )
669 // Bei Framesets m"ussen auch die Daten der ChildViews geholt werden
670 sal_uInt16 nCount = pChildArr->Count();
671 for ( sal_uInt16 n=nCount; n>0; n--)
673 SfxFrame* pFrame = (*pChildArr)[n-1];
674 if ( bGetViewData )
675 pFrame->GetDescriptor()->GetArgs()->ClearItem( SID_VIEW_DATA );
676 pFrame->GetViewData_Impl();
682 void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc )
684 // Beim InsertDocument wird der Descriptor des Frames aktualisiert
685 // und sein ItemSet neu initialisiert. Alle Daten, die f"ur ein sp"ateres
686 // Restaurieren der ::com::sun::star::sdbcx::View n"otig sind, sind damit festgehalten.
687 // Soll das Dokument ersetzt werden, wird durch GetViewData_Impl (s.o.)
688 // die neueste Information hinzugef"ugt. Alles zusammen wird dann in der
689 // Browse-History gesichert. Beim Aktivieren eines solchen FramePickEntry
690 // wird das komplette ItemSet und der Descriptor im OpenDoc mitgeschickt.
691 // Hier werden nur die festen Eigenschaften gesichert; die "anderbaren werden
692 // durch GetViewData geholt ( spart Zeit ).
693 DBG_ASSERT( pDoc, "NULL-Document inserted ?!" );
695 GetParentFrame();
696 const SfxMedium *pMed = pDoc->GetMedium();
697 GetDescriptor()->SetActualURL( pMed->GetOrigURL() );
699 SFX_ITEMSET_ARG( pMed->GetItemSet(), pItem, SfxBoolItem, SID_EDITDOC, sal_False );
700 sal_Bool bEditable = ( !pItem || pItem->GetValue() );
702 GetDescriptor()->SetEditable( bEditable );
704 // FileOpen-Parameter merken
705 SfxItemSet* pItemSet = pMed->GetItemSet();
706 String aMedName( pMed->GetName() );
708 const SfxFilter* pFilter = pMed->GetOrigFilter();
709 String aFilter;
710 if ( pFilter )
711 aFilter = pFilter->GetFilterName();
713 SFX_ITEMSET_ARG( pItemSet, pRefererItem, SfxStringItem, SID_REFERER, sal_False);
714 SFX_ITEMSET_ARG( pItemSet, pOptionsItem, SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False);
715 SFX_ITEMSET_ARG( pItemSet, pTitle1Item, SfxStringItem, SID_DOCINFO_TITLE, sal_False);
717 SfxItemSet *pSet = GetDescriptor()->GetArgs();
719 // Alle alten Items l"oschen
720 pSet->ClearItem();
722 if ( pRefererItem )
723 pSet->Put( *pRefererItem );
724 else
725 pSet->Put( SfxStringItem( SID_REFERER, String() ) );
727 if ( pOptionsItem )
728 pSet->Put( *pOptionsItem );
730 if ( pTitle1Item )
731 pSet->Put( *pTitle1Item );
733 pSet->Put( SfxStringItem( SID_FILTER_NAME, aFilter ));
736 //-------------------------------------------------------------------------
738 sal_Bool SfxFrame::CanBrowseBackward() const
740 return FALSE;
743 //-------------------------------------------------------------------------
745 sal_Bool SfxFrame::CanBrowseForward() const
747 return FALSE;
750 //-------------------------------------------------------------------------
752 void SfxFrame::SetDescriptor( SfxFrameDescriptor *pD )
754 DBG_ASSERT( pD, "Kein Descriptor!" );
755 DBG_ASSERT( pD != pImp->pDescr, "Descriptor ist schon gesetzt!" );
757 if ( pImp->pDescr )
759 // Nur TopLevel-Frames verwalten ihren Descriptor selbst, bei den
760 // anderen tut es das Frameset
761 if ( !pParentFrame )
762 delete pImp->pDescr;
764 pImp->pDescr = pD;
767 //-------------------------------------------------------------------------
769 SfxFrameDescriptor* SfxFrame::GetDescriptor() const
771 // On Demand einen FrameDescriptor anlegen; wenn es kein TopLevel-Frame
772 // ist, f"uhrt es zu Fehlern, da keine g"ulige Verkettung hergestellt wird
774 if ( !pImp->pDescr )
776 DBG_ASSERT( !GetParentFrame(), "Kein TopLevel-Frame, aber kein Descriptor!" );
777 pImp->pDescr = new SfxFrameDescriptor;
778 if ( GetCurrentDocument() )
779 pImp->pDescr->SetURL( GetCurrentDocument()->GetMedium()->GetOrigURL() );
781 return pImp->pDescr;
784 //-------------------------------------------------------------------------
786 void SfxFrame::GetTargetList( TargetList& rList ) const
788 if ( !GetParentFrame() )
790 // Einen Leerstring f"ur 'Kein Target'
791 rList.Insert( new String() );
792 rList.Insert( new String( DEFINE_CONST_UNICODE( "_top" ) ) );
793 rList.Insert( new String( DEFINE_CONST_UNICODE( "_parent" ) ) );
794 rList.Insert( new String( DEFINE_CONST_UNICODE( "_blank" ) ) );
795 rList.Insert( new String( DEFINE_CONST_UNICODE( "_self" ) ) );
798 SfxViewFrame* pView = GetCurrentViewFrame();
799 if( pView && pView->GetViewShell() && !pView->GetViewShell()->IsImplementedAsFrameset_Impl() && pChildArr )
801 sal_uInt16 nCount = pChildArr->Count();
802 for ( sal_uInt16 n=0; n<nCount; n++)
804 SfxFrame* pFrame = (*pChildArr)[n];
805 if ( pFrame->GetFrameName().Len() )
806 rList.Insert( new String (pFrame->GetFrameName()) );
807 pFrame->GetTargetList( rList );
812 //-------------------------------------------------------------------------
814 void SfxFrame::SetFrameId_Impl( sal_uInt16 nId )
816 pImp->nFrameId = nId;
817 if ( GetCurrentViewFrame() )
818 GetCurrentViewFrame()->UpdateTitle();
821 sal_uInt16 SfxFrame::GetFrameId_Impl() const
823 return pImp->nFrameId;
826 void SfxFrame::SetFrameIdName_Impl( const String& rName )
828 pImp->aFrameIdName = rName;
831 //-------------------------------------------------------------------------
833 SfxFrame* SfxFrame::SearchFrame_Impl( sal_uInt16 nId, sal_Bool bDeep )
835 if ( pImp->nFrameId == nId )
836 return this;
838 if ( pChildArr )
840 sal_uInt16 nCount = pChildArr->Count();
841 for ( sal_uInt16 n=0; n<nCount; n++)
843 SfxFrame* pFrame = (*pChildArr)[n];
844 if ( pFrame->pImp->nFrameId == nId )
845 return pFrame;
846 if ( bDeep )
848 pFrame = pFrame->SearchFrame_Impl( nId, sal_True );
849 if ( pFrame )
850 return pFrame;
855 return NULL;
858 SfxFrame* SfxFrame::SearchFrame_Impl( const String& rName, sal_Bool bDeep )
860 if ( pImp->aFrameIdName == rName )
861 return this;
863 if ( pChildArr )
865 sal_uInt16 nCount = pChildArr->Count();
866 for ( sal_uInt16 n=0; n<nCount; n++)
868 SfxFrame* pFrame = (*pChildArr)[n];
869 if ( pFrame->pImp->aFrameIdName == rName )
870 return pFrame;
871 if ( bDeep )
873 pFrame = pFrame->SearchFrame_Impl( rName );
874 if ( pFrame )
875 return pFrame;
880 return NULL;
883 //-------------------------------------------------------------------------
885 //-------------------------------------------------------------------------
887 void SfxFrame::Activate_Impl( sal_Bool bBeamerOn )
889 /* [Description]
891 Internal Activate-Handler, called from derived classes which supports
892 Activate-Handling.
896 if ( GetParentFrame() )
897 GetParentFrame()->Activate_Impl( bBeamerOn );
900 SfxBroadcaster& SfxFrame::GetBroadcaster() const
902 return *pImp;
905 //-------------------------------------------------------------------------
907 void SfxFrame::Deactivate_Impl()
909 /* [Description]
911 Internal Deactivate-Handler, called from derived classes which supports
912 Activate-Handling.
916 if( GetParentFrame() )
917 GetParentFrame()->Deactivate_Impl();
920 String SfxFrame::GetContent() const
922 SfxObjectShell *pObj = GetCurrentDocument();
923 if ( !pObj || !pObj->GetMedium() )
924 return String();
925 else
926 return pObj->GetMedium()->GetName();
929 sal_Bool SfxFrame::CheckContentForLoad_Impl()
931 if ( GetCurrentDocument() )
933 SfxMedium* pMedium = GetCurrentDocument()->GetMedium();
934 #ifdef DEBUG
935 SfxItemSet* pSet;
936 pSet = pMedium->GetItemSet();
937 #endif
938 SfxItemSet* pNew = GetDescriptor()->GetArgs();
940 // Falls URLs nicht uebereinstimmen
941 if ( INetURLObject( GetDescriptor()->GetActualURL() ) != INetURLObject( pMedium->GetOrigURL() ) )
942 return sal_True;
944 // Falls die Filter nicht uebereinstimmen
945 SFX_ITEMSET_ARG( pNew, pFilterItem, SfxStringItem, SID_FILTER_NAME, sal_False );
946 if( pMedium->GetOrigFilter() && pFilterItem && pFilterItem->GetValue() != pMedium->GetOrigFilter()->GetFilterName() )
947 return sal_True;
949 return sal_False;
952 return (GetDescriptor()->GetActualURL().GetMainURL( INetURLObject::NO_DECODE ).getLength() != 0);
955 sal_Bool SfxFrame::IsParent( SfxFrame *pFrame ) const
957 SfxFrame *pParent = pParentFrame;
958 while ( pParent )
960 if ( pParent == pFrame )
961 return sal_True;
962 pParent = pParent->pParentFrame;
965 return sal_False;
968 void SfxFrame::InsertTopFrame_Impl( SfxFrame* pFrame )
970 SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames;
971 rArr.Insert( pFrame, rArr.Count() );
974 void SfxFrame::RemoveTopFrame_Impl( SfxFrame* pFrame )
976 SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames;
977 rArr.Remove( rArr.GetPos( pFrame ) );
980 SfxFrameItem::SfxFrameItem( sal_uInt16 nWhichId, SfxViewFrame *p )
981 : SfxPoolItem( nWhichId ), pFrame( p ? p->GetFrame() : NULL )
983 wFrame = pFrame;
986 SfxFrameItem::SfxFrameItem( sal_uInt16 nWhichId, SfxFrame *p ):
987 SfxPoolItem( nWhichId ),
988 pFrame( p ), wFrame( p )
992 SfxFrameItem::SfxFrameItem( SfxFrame *p ):
993 SfxPoolItem( 0 ),
994 pFrame( p ), wFrame( p )
998 int SfxFrameItem::operator==( const SfxPoolItem &rItem ) const
1000 return ((SfxFrameItem&)rItem).pFrame == pFrame &&
1001 ((SfxFrameItem&)rItem).wFrame == wFrame;
1004 //--------------------------------------------------------------------
1006 String SfxFrameItem::GetValueText() const
1008 return String();
1011 SfxPoolItem* SfxFrameItem::Clone( SfxItemPool *) const
1013 SfxFrameItem* pNew = new SfxFrameItem( wFrame);
1014 pNew->SetFramePtr_Impl( pFrame );
1015 return pNew;
1018 sal_Bool SfxFrameItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const
1020 if ( wFrame )
1022 rVal <<= wFrame->GetFrameInterface();
1023 return TRUE;
1026 return FALSE;
1029 sal_Bool SfxFrameItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE )
1031 Reference < XFrame > xFrame;
1032 if ( (rVal >>= xFrame) && xFrame.is() )
1034 SfxFrame* pFr = SfxFrame::GetFirst();
1035 while ( pFr )
1037 if ( pFr->GetFrameInterface() == xFrame )
1039 wFrame = pFrame = pFr;
1040 return TRUE;
1043 pFr = SfxFrame::GetNext( *pFr );
1045 return TRUE;
1048 return FALSE;
1052 SfxUsrAnyItem::SfxUsrAnyItem( sal_uInt16 nWhichId, const ::com::sun::star::uno::Any& rAny )
1053 : SfxPoolItem( nWhichId )
1055 aValue = rAny;
1058 int SfxUsrAnyItem::operator==( const SfxPoolItem& /*rItem*/ ) const
1060 // return rItem.ISA( SfxUsrAnyItem ) && ((SfxUsrAnyItem&)rItem).aValue == aValue;
1061 return sal_False;
1064 String SfxUsrAnyItem::GetValueText() const
1066 return String();
1069 SfxPoolItem* SfxUsrAnyItem::Clone( SfxItemPool *) const
1071 return new SfxUsrAnyItem( Which(), aValue );
1074 sal_Bool SfxUsrAnyItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const
1076 rVal = aValue;
1077 return sal_True;
1080 sal_Bool SfxUsrAnyItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ )
1082 aValue = rVal;
1083 return sal_True;
1086 sal_Bool SfxFrame::BrowseInFrame( int /*nDelta*/ )
1088 return sal_False;
1091 SfxFrameIterator::SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecur )
1092 : pFrame( &rFrame )
1093 , bRecursive( bRecur )
1096 SfxFrame* SfxFrameIterator::FirstFrame()
1098 // GetFirst beginnt die Iteration beim ersten ChildFrame
1099 return pFrame->GetChildFrame( 0 );
1102 SfxFrame* SfxFrameIterator::NextFrame( SfxFrame& rPrev )
1104 // Zuerst auf Kinder testen, wenn Rekursion erw"unscht
1105 SfxFrame *pRet = NULL;
1106 if ( bRecursive )
1107 pRet = rPrev.GetChildFrame( 0 );
1108 if ( !pRet )
1110 // Anderenfalls mit den Geschwistern von rPrev weitermachen
1111 pRet = NextSibling_Impl( rPrev );
1114 return pRet;
1118 SfxFrame* SfxFrameIterator::NextSibling_Impl( SfxFrame& rPrev )
1120 SfxFrame *pRet = NULL;
1121 if ( &rPrev != pFrame )
1123 SfxFrameArr_Impl& rArr = *rPrev.pParentFrame->pChildArr;
1124 sal_uInt16 nPos = rArr.GetPos( &rPrev );
1125 if ( nPos+1 < rArr.Count() )
1126 pRet = rArr[nPos+1];
1128 if ( !pRet && rPrev.pParentFrame->pParentFrame )
1129 pRet = NextSibling_Impl( *rPrev.pParentFrame );
1132 return pRet;
1135 void SfxFrame::SetFrameName( const String& rName )
1137 if ( pImp->pDescr )
1138 pImp->pDescr->SetName( rName );
1139 aName = rName;
1140 if ( pImp->pCurrentViewFrame )
1141 pImp->pCurrentViewFrame->UpdateTitle();
1142 if ( GetFrameInterface().is() )
1143 GetFrameInterface()->setName( rName );
1146 void SfxFrame::LoadFinished_Impl()
1150 SfxFrame* SfxFrame::findFrame(const ::rtl::OUString& aTargetframename, sal_Int32 nSearchFlags)
1152 // Weil Netscape f"uhrende BLANKS "uberliest, m"ussen wir das wohl auch
1153 // Sollte besser auch bei den FrameNames gemacht werden!
1154 String aTargetName( aTargetframename );
1155 aTargetName.EraseLeadingChars();
1157 SfxFrame *pFrame = this;
1159 if ( !aTargetName.Len() && GetParentFrame() && GetParentFrame()->GetCurrentViewFrame()->GetViewShell()->IsImplementedAsFrameset_Impl() )
1160 return GetParentFrame();
1162 if( !aTargetName.Len() || aTargetName.CompareIgnoreCaseToAscii("_self") == COMPARE_EQUAL )
1163 return pFrame;
1165 if ( aTargetName.CompareIgnoreCaseToAscii("_smartself") == COMPARE_EQUAL )
1167 DBG_ERROR("Not supported!");
1168 return pFrame;
1171 if ( aTargetName.CompareIgnoreCaseToAscii("_parent") == COMPARE_EQUAL )
1173 // Gesucht ist das Parent Frameset
1174 return pFrame->GetParentFrame();
1176 else if ( aTargetName.CompareIgnoreCaseToAscii("_blank") == COMPARE_EQUAL )
1178 return NULL;
1181 else if ( aTargetName.CompareIgnoreCaseToAscii("_top") == COMPARE_EQUAL )
1183 while ( pFrame->GetParentFrame() )
1184 pFrame = pFrame->GetParentFrame();
1185 return pFrame;
1188 if ( ( nSearchFlags & FRAME_SEARCH_SELF ) && aTargetName.CompareIgnoreCaseToAscii( GetFrameName() ) == COMPARE_EQUAL )
1190 // Eigener Name
1191 return pFrame;
1194 if ( nSearchFlags & FRAME_SEARCH_CHILDREN )
1196 // Zuerst unterhalb dieses Frames absuchen
1197 pFrame = SearchChildrenForName_Impl( aTargetName );
1200 if ( ( nSearchFlags & FRAME_SEARCH_CHILDREN ) && !pFrame && GetParentFrame() )
1202 // Noch nichts gefunden, nach oben weitergehen
1203 // Eigentlich m"u\sten Frames, die schon abgesucht wurden, aus
1204 // Performance-Gr"unden markiert werden
1205 SfxFrame *pParent = GetParentFrame();
1208 // Ist es der Parent ?
1209 if ( aTargetName.CompareIgnoreCaseToAscii( pParent->GetFrameName() ) == COMPARE_EQUAL )
1210 return pParent;
1212 // Weiter nach oben
1213 pParent = pParent->GetParentFrame();
1215 while ( pParent );
1218 if( !pFrame )
1220 SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames;
1221 // keinen Frame im MDI-Fenster gefunden. Jetzt die anderen
1222 // Toplevel Frames checken.
1223 SfxFrame *pTop = GetTopFrame();
1224 for( sal_uInt16 nPos = rArr.Count(); nPos--; )
1226 // Unser Topframe wurde bereits durchsucht
1227 SfxFrame* pCurFrame = rArr[ nPos ];
1228 if( pCurFrame != pTop )
1230 if( aTargetName.CompareIgnoreCaseToAscii( pCurFrame->GetFrameName() ) == COMPARE_EQUAL )
1231 return pCurFrame;
1232 else
1234 pFrame = pCurFrame->SearchChildrenForName_Impl( aTargetName );
1235 if( pFrame )
1236 return pFrame;
1242 return pFrame;
1245 sal_Bool SfxFrame::IsTop() const
1247 return GetFrameInterface().is() ? GetFrameInterface()->isTop() : sal_False;
1250 sal_Bool SfxFrame::HasComponent() const
1252 return sal_False;
1255 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > SfxFrame::GetController() const
1257 if ( pImp->pCurrentViewFrame && pImp->pCurrentViewFrame->GetViewShell() )
1258 return pImp->pCurrentViewFrame->GetViewShell()->GetController();
1259 else
1260 return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > ();
1263 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SfxFrame::GetFrameInterface() const
1265 return pImp->xFrame;
1268 void SfxFrame::SetFrameInterface_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame )
1270 pImp->xFrame = rFrame;
1271 com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder;
1272 if ( !rFrame.is() && GetCurrentViewFrame() )
1273 GetCurrentViewFrame()->GetBindings().SetRecorder_Impl( xRecorder );
1276 void SfxFrame::SetItemSet_Impl( const SfxItemSet* pSet )
1278 pImp->pSet = pSet;
1281 const SfxItemSet* SfxFrame::GetItemSet_Impl()
1283 return pImp->pSet;
1286 void SfxFrame::Appear()
1288 if ( GetCurrentViewFrame() )
1290 GetCurrentViewFrame()->Show();
1291 GetWindow().Show();
1292 pImp->xFrame->getContainerWindow()->setVisible( sal_True );
1293 if ( pParentFrame )
1294 pParentFrame->Appear();
1295 Reference < ::com::sun::star::awt::XTopWindow > xTopWindow( pImp->xFrame->getContainerWindow(), UNO_QUERY );
1296 if ( xTopWindow.is() )
1297 xTopWindow->toFront();
1301 void SfxFrame::AppearWithUpdate()
1303 Appear();
1304 if ( GetCurrentViewFrame() )
1305 GetCurrentViewFrame()->GetDispatcher()->Update_Impl( sal_True );
1308 void SfxFrame::SetOwnsBindings_Impl( sal_Bool bSet )
1310 pImp->bOwnsBindings = bSet;
1313 sal_Bool SfxFrame::OwnsBindings_Impl() const
1315 return pImp->bOwnsBindings;
1318 void SfxFrame::SetToolSpaceBorderPixel_Impl( const SvBorder& rBorder )
1320 pImp->aBorder = rBorder;
1321 SfxViewFrame *pF = GetCurrentViewFrame();
1322 if ( pF )
1324 Point aPos ( rBorder.Left(), rBorder.Top() );
1325 Size aSize( GetWindow().GetOutputSizePixel() );
1326 long nDeltaX = rBorder.Left() + rBorder.Right();
1327 if ( aSize.Width() > nDeltaX )
1328 aSize.Width() -= nDeltaX;
1329 else
1330 aSize.Width() = 0;
1332 long nDeltaY = rBorder.Top() + rBorder.Bottom();
1333 if ( aSize.Height() > nDeltaY )
1334 aSize.Height() -= nDeltaY;
1335 else
1336 aSize.Height() = 0;
1338 if ( GetParentFrame() )
1340 sal_Bool bHasTools = rBorder.Left() != rBorder.Right() || rBorder.Top() != rBorder.Bottom();
1341 pF->GetWindow().SetBorderStyle( bHasTools ? WINDOW_BORDER_NORMAL : WINDOW_BORDER_NOBORDER );
1344 pF->GetWindow().SetPosSizePixel( aPos, aSize );
1348 Rectangle SfxFrame::GetTopOuterRectPixel_Impl() const
1350 Size aSize( GetWindow().GetOutputSizePixel() );
1351 Point aPoint;
1352 return ( Rectangle ( aPoint, aSize ) );
1355 SfxWorkWindow* SfxFrame::GetWorkWindow_Impl() const
1357 if ( pImp->pWorkWin )
1358 return pImp->pWorkWin;
1359 else if ( pParentFrame )
1360 return pParentFrame->GetWorkWindow_Impl();
1361 else
1362 return NULL;
1365 void SfxFrame::SetWorkWindow_Impl( SfxWorkWindow* pWorkwin )
1367 pImp->pWorkWin = pWorkwin;
1370 void SfxFrame::CreateWorkWindow_Impl()
1372 SfxFrame* pFrame = this;
1374 if ( IsInPlace() )
1376 // this makes sence only for inplace activated objects
1379 Reference < XChild > xChild( GetCurrentDocument()->GetModel(), UNO_QUERY );
1380 if ( xChild.is() )
1382 Reference < XModel > xParent( xChild->getParent(), UNO_QUERY );
1383 if ( xParent.is() )
1385 Reference< XController > xParentCtrler = xParent->getCurrentController();
1386 if ( xParentCtrler.is() )
1388 Reference < XFrame > xFrame( xParentCtrler->getFrame() );
1389 SfxFrame* pFr = SfxFrame::GetFirst();
1390 while ( pFr )
1392 if ( pFr->GetFrameInterface() == xFrame )
1394 pFrame = pFr;
1395 break;
1398 pFr = SfxFrame::GetNext( *pFr );
1404 catch(Exception&)
1406 OSL_ENSURE(0,"SfxFrame::CreateWorkWindow_Impl: Exception cachted. Please try to submit a repoducable bug !");
1410 pImp->pWorkWin = new SfxFrameWorkWin_Impl( &pFrame->GetWindow(), this, pFrame );
1413 const SvBorder& SfxFrame::GetBorder_Impl() const
1415 return pImp->aBorder;
1418 void SfxFrame::GrabFocusOnComponent_Impl()
1420 if ( pImp->bReleasingComponent )
1422 GetWindow().GrabFocus();
1423 return;
1426 Window* pWindow = &GetWindow();
1427 if ( GetCurrentViewFrame() && GetCurrentViewFrame()->GetViewShell() && GetCurrentViewFrame()->GetViewShell()->GetWindow() )
1428 pWindow = GetCurrentViewFrame()->GetViewShell()->GetWindow();
1430 if( !pWindow->HasChildPathFocus() )
1431 pWindow->GrabFocus();
1434 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > SfxFrame::GetInterceptor_Impl()
1436 //(mba)/compview: hier fehlt der Zugriff auf den Interceptor !!!!!
1437 return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > ();
1440 void SfxFrame::ReleasingComponent_Impl( sal_Bool bSet )
1442 pImp->bReleasingComponent = bSet;
1445 sal_Bool SfxFrame::LoadSfxComponent(
1446 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & /*aFrame*/,
1447 const ::rtl::OUString& /*aURL*/,
1448 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& /*aArgs*/,
1449 const SfxObjectFactory* /*pFact*/ )
1451 // get Implementation of xComponents ...
1452 DBG_ERROR( "Should not be called anymore!" );
1453 return sal_False;
1456 void SfxFrame::LockFocus_Impl( sal_Bool bLock )
1458 if ( pChildArr && pChildArr->Count() )
1460 sal_uInt16 nCount = pChildArr->Count();
1461 for ( sal_uInt16 n=0; n<nCount; n++ )
1463 SfxFrame* pFrame = (*pChildArr)[n];
1464 pFrame->pImp->bFocusLocked = bLock;
1465 pFrame->LockFocus_Impl( bLock );
1470 sal_Bool SfxFrame::IsFocusLocked_Impl() const
1472 return pImp->bFocusLocked;
1475 sal_Bool SfxFrame::IsInPlace() const
1477 return pImp->bInPlace;
1480 void SfxFrame::SetInPlace_Impl( sal_Bool bSet )
1482 pImp->bInPlace = bSet;
1485 void SfxFrame::Resize()
1487 if ( IsClosing_Impl() )
1488 return;
1490 if ( OwnsBindings_Impl() )
1492 if ( IsInPlace() )
1494 SetToolSpaceBorderPixel_Impl( SvBorder() );
1496 else
1498 // check for IPClient that contains UIactive object or object that is currently UI activating
1499 SfxWorkWindow *pWork = GetWorkWindow_Impl();
1500 SfxInPlaceClient* pClient = GetCurrentViewFrame()->GetViewShell() ? GetCurrentViewFrame()->GetViewShell()->GetUIActiveIPClient_Impl() : 0;
1501 if ( pClient )
1503 uno::Reference < lang::XUnoTunnel > xObj( pClient->GetObject()->getComponent(), uno::UNO_QUERY );
1504 uno::Sequence < sal_Int8 > aSeq( SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence() );
1505 sal_Int64 nHandle = (xObj.is()? xObj->getSomething( aSeq ): 0);
1506 if ( nHandle )
1508 SfxObjectShell* pDoc = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle ));
1509 pWork = SfxViewFrame::GetFirst( pDoc )->GetFrame()->GetWorkWindow_Impl();
1513 if ( pWork )
1515 pWork->ArrangeChilds_Impl();
1516 pWork->ShowChilds_Impl();
1519 // problem in presence of UIActive object: when the window is resized, but the toolspace border
1520 // remains the same, setting the toolspace border at the ContainerEnvironment doesn't force a
1521 // resize on the IPEnvironment; without that no resize is called for the SfxViewFrame. So always
1522 // set the window size of the SfxViewFrame explicit.
1523 SetToolSpaceBorderPixel_Impl( pImp->aBorder );
1526 else if ( pImp->pCurrentViewFrame )
1528 pImp->pCurrentViewFrame->GetWindow().SetSizePixel( GetWindow().GetOutputSizePixel() );
1533 SfxFrame* SfxFrame::GetFirst()
1535 if ( !pFramesArr_Impl )
1536 return 0;
1537 return pFramesArr_Impl->Count() ? pFramesArr_Impl->GetObject(0) : 0;
1540 SfxFrame* SfxFrame::GetNext( SfxFrame& rFrame )
1542 USHORT nPos = pFramesArr_Impl->GetPos( &rFrame );
1543 if ( nPos+1 < pFramesArr_Impl->Count() )
1544 return pFramesArr_Impl->GetObject(nPos+1);
1545 else
1546 return NULL;
1549 const SfxPoolItem* SfxFrame::LoadDocumentSynchron( SfxItemSet& aSet )
1551 aSet.Put( SfxFrameItem( SID_DOCFRAME, this ) );
1552 aSet.ClearItem( SID_TARGETNAME );
1553 return SFX_APP()->GetDispatcher_Impl()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, aSet );