diff options
Diffstat (limited to 'sd/source/ui/view')
22 files changed, 983 insertions, 109 deletions
diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx b/sd/source/ui/view/GraphicViewShellBase.cxx index 38409bb2376e..759103760bfe 100644..100755 --- a/sd/source/ui/view/GraphicViewShellBase.cxx +++ b/sd/source/ui/view/GraphicViewShellBase.cxx @@ -100,18 +100,18 @@ void GraphicViewShellBase::Execute (SfxRequest& rRequest) switch (nSlotId) { - case SID_RIGHT_PANE: case SID_NOTES_WINDOW: case SID_SLIDE_SORTER_MULTI_PANE_GUI: case SID_DIAMODE: case SID_OUTLINEMODE: case SID_NOTESMODE: case SID_HANDOUTMODE: - case SID_TASK_PANE: + case SID_SHOW_TOOL_PANEL: // Prevent some Impress-only slots from being executed. rRequest.Cancel(); break; + case SID_TASKPANE: case SID_SWITCH_SHELL: case SID_LEFT_PANE_DRAW: case SID_LEFT_PANE_IMPRESS: diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 5314f6dbe768..a7c9786dd160 100644..100755 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -57,6 +57,8 @@ #include <vcl/metric.hxx> #include <sfx2/viewfrm.hxx> #include <svtools/langtab.hxx> +#include <tools/diagnose_ex.h> + #include "strings.hrc" #include "sdstring.hrc" #include "eetext.hxx" @@ -974,7 +976,7 @@ void Outliner::ProvideNextTextObject (void) } catch (::com::sun::star::uno::Exception e) { - OSL_TRACE ("Outliner %p: caught exception while ending text edit mode", this); + DBG_UNHANDLED_EXCEPTION(); } SetUpdateMode(FALSE); OutlinerView* pOutlinerView = mpImpl->GetOutlinerView(); diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index 4919a9fe2bbb..4919a9fe2bbb 100644..100755 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 6640d2455c20..14da3ea1a526 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -64,9 +64,9 @@ #include "OutlineViewShell.hxx" #include "SlideSorterViewShell.hxx" #include "PresentationViewShell.hxx" -#include "TaskPaneViewShell.hxx" #include "FormShellManager.hxx" #include "ToolBarManager.hxx" +#include "taskpane/PanelId.hxx" #include "Window.hxx" #include "framework/ConfigurationController.hxx" #include "DocumentRenderer.hxx" @@ -91,6 +91,7 @@ #include <svl/whiter.hxx> #include <comphelper/processfactory.hxx> #include <vcl/msgbox.hxx> +#include <tools/diagnose_ex.h> #include "fubullet.hxx" @@ -808,7 +809,7 @@ void ViewShellBase::Execute (SfxRequest& rRequest) framework::FrameworkHelper::msSlideSorterURL); break; - case SID_RIGHT_PANE: + case SID_TASKPANE: mpImpl->SetPaneVisibility( rRequest, framework::FrameworkHelper::msRightPaneURL, @@ -829,7 +830,7 @@ void ViewShellBase::Execute (SfxRequest& rRequest) // The full screen mode is not supported. Ignore the request. break; - case SID_TASK_PANE: + case SID_SHOW_TOOL_PANEL: mpImpl->ProcessTaskPaneSlot(rRequest); break; @@ -1257,7 +1258,7 @@ CustomHandleManager& ViewShellBase::getCustomHandleManager() const return *mpImpl->mpCustomHandleManager.get(); } -::rtl::OUString ViewShellBase::RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) const +::rtl::OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const ::rtl::OUString& aCmdURL ) { ::rtl::OUString aLabel; @@ -1266,7 +1267,7 @@ CustomHandleManager& ViewShellBase::getCustomHandleManager() const Reference< XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); Reference< XModuleManager > xModuleManager( xServiceManager->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager") ) ), UNO_QUERY_THROW ); - Reference< XInterface > xIfac( GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY_THROW ); + Reference< XInterface > xIfac( xFrame, UNO_QUERY_THROW ); ::rtl::OUString aModuleIdentifier( xModuleManager->identify( xIfac ) ); @@ -1298,6 +1299,12 @@ CustomHandleManager& ViewShellBase::getCustomHandleManager() const return aLabel; } +::rtl::OUString ViewShellBase::RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) const +{ + Reference< XFrame > xFrame( GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); + return ImplRetrieveLabelFromCommand( xFrame, aCmdURL ); +} + //===== ViewShellBase::Implementation ========================================= @@ -1487,9 +1494,9 @@ void ViewShellBase::Implementation::SetPaneVisibility ( xConfigurationController->requestResourceDeactivation( xPaneId); } - catch (RuntimeException&) + catch (const Exception &) { - DBG_ASSERT(false, "ViewShellBase::Implementation::SetPaneVisibility(): caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } @@ -1534,7 +1541,7 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) xContext, FrameworkHelper::msLeftDrawPaneURL); break; - case SID_RIGHT_PANE: + case SID_TASKPANE: xResourceId = ResourceId::create( xContext, FrameworkHelper::msRightPaneURL); break; @@ -1625,7 +1632,7 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) } catch (RuntimeException&) { - DBG_ASSERT(false, "ViewShellBase::Implementation::GetSlotState(): caught exception"); + DBG_UNHANDLED_EXCEPTION(); } } @@ -1638,8 +1645,8 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) // Set the visibility state of the toolpanel and one of its top // level panels. BOOL bShowToolPanel = TRUE; - toolpanel::TaskPaneViewShell::PanelId nPanelId ( - toolpanel::TaskPaneViewShell::PID_UNKNOWN); + toolpanel::PanelId nPanelId ( + toolpanel::PID_UNKNOWN); bool bPanelIdGiven = false; // Extract the given arguments. @@ -1660,7 +1667,7 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) if (pPanelId != NULL) { nPanelId = static_cast< - toolpanel::TaskPaneViewShell::PanelId>( + toolpanel::PanelId>( pPanelId->GetValue()); bPanelIdGiven = true; } @@ -1670,7 +1677,7 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) // Ignore the request for some combinations of panels and view // shell types. if (bPanelIdGiven - && ! (nPanelId==toolpanel::TaskPaneViewShell::PID_LAYOUT + && ! (nPanelId==toolpanel::PID_LAYOUT && mrBase.GetMainViewShell()!=NULL && mrBase.GetMainViewShell()->GetShellType()==ViewShell::ST_OUTLINE)) { diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index 8193ae3004d2..926d579e93e9 100644..100755 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -47,11 +47,11 @@ #include "DrawController.hxx" #include "FactoryIds.hxx" #include "slideshow.hxx" -#include "TaskPaneViewShell.hxx" #include "ViewShellBase.hxx" #include "FrameView.hxx" #include "DrawViewShell.hxx" #include "ViewShellHint.hxx" +#include "taskpane/PanelId.hxx" #include "framework/FrameworkHelper.hxx" #include <sfx2/bindings.hxx> @@ -195,12 +195,12 @@ void ViewShell::Implementation::ProcessModifyPageSlot ( // Make the layout menu visible in the tool pane. SfxBoolItem aMakeToolPaneVisible (ID_VAL_ISVISIBLE, TRUE); SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX, - ::sd::toolpanel::TaskPaneViewShell::PID_LAYOUT); + ::sd::toolpanel::PID_LAYOUT); SfxViewFrame* pFrame = mrViewShell.GetViewFrame(); if (pFrame!=NULL && pFrame->GetDispatcher()!=NULL) { pFrame->GetDispatcher()->Execute ( - SID_TASK_PANE, + SID_SHOW_TOOL_PANEL, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aMakeToolPaneVisible, &aPanelId, @@ -319,30 +319,53 @@ void ViewShell::Implementation::ProcessModifyPageSlot ( rRequest.Done (); } +void ViewShell::Implementation::AssignLayout ( SfxRequest& rRequest, PageKind ePageKind ) +{ + const SfxUInt32Item* pWhatPage = static_cast< const SfxUInt32Item* > ( rRequest.GetArg( ID_VAL_WHATPAGE, FALSE, TYPE(SfxUInt32Item) ) ); + const SfxUInt32Item* pWhatLayout = static_cast< const SfxUInt32Item* > ( rRequest.GetArg( ID_VAL_WHATLAYOUT, FALSE, TYPE(SfxUInt32Item) ) ); + + SdDrawDocument* pDocument = mrViewShell.GetDoc(); + if( !pDocument ) + return; + + SdPage* pPage = 0; + if( pWhatPage ) + { + pPage = pDocument->GetSdPage(static_cast<USHORT>(pWhatPage->GetValue()), ePageKind); + } + if( pPage == 0 ) + pPage = mrViewShell.getCurrentPage(); + if( pPage ) + { + AutoLayout eLayout = pPage->GetAutoLayout(); -void ViewShell::Implementation::AssignLayout ( - SdPage* pPage, - AutoLayout aLayout) -{ - // Transform the given request into the four argument form that is - // understood by ProcessModifyPageSlot(). - SdrLayerAdmin& rLayerAdmin (mrViewShell.GetViewShellBase().GetDocument()->GetLayerAdmin()); - BYTE aBackground (rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), FALSE)); - BYTE aBackgroundObject (rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), FALSE)); - SetOfByte aVisibleLayers (pPage->TRG_GetMasterPageVisibleLayers()); - SfxRequest aRequest (mrViewShell.GetViewShellBase().GetViewFrame(), SID_MODIFYPAGE); - aRequest.AppendItem(SfxStringItem (ID_VAL_PAGENAME, pPage->GetName())); - aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, aLayout)); - aRequest.AppendItem(SfxBoolItem(ID_VAL_ISPAGEBACK, aVisibleLayers.IsSet(aBackground))); - aRequest.AppendItem(SfxBoolItem(ID_VAL_ISPAGEOBJ, aVisibleLayers.IsSet(aBackgroundObject))); - - // Forward the call with the new arguments. - ProcessModifyPageSlot ( - aRequest, - pPage, - pPage->GetPageKind()); + if( pWhatLayout ) + eLayout = static_cast< AutoLayout >( pWhatLayout->GetValue() ); + + // Transform the given request into the four argument form that is + // understood by ProcessModifyPageSlot(). + SdrLayerAdmin& rLayerAdmin (mrViewShell.GetViewShellBase().GetDocument()->GetLayerAdmin()); + BYTE aBackground (rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), FALSE)); + BYTE aBackgroundObject (rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), FALSE)); + + SetOfByte aVisibleLayers; + + if( pPage->GetPageKind() == PK_HANDOUT ) + aVisibleLayers.SetAll(); + else + aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers(); + + SfxRequest aRequest (mrViewShell.GetViewShellBase().GetViewFrame(), SID_MODIFYPAGE); + aRequest.AppendItem(SfxStringItem (ID_VAL_PAGENAME, pPage->GetName())); + aRequest.AppendItem(SfxUInt32Item (ID_VAL_WHATLAYOUT, eLayout)); + aRequest.AppendItem(SfxBoolItem(ID_VAL_ISPAGEBACK, aVisibleLayers.IsSet(aBackground))); + aRequest.AppendItem(SfxBoolItem(ID_VAL_ISPAGEOBJ, aVisibleLayers.IsSet(aBackgroundObject))); + + // Forward the call with the new arguments. + ProcessModifyPageSlot( aRequest, pPage, pPage->GetPageKind()); + } } diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx index 3ea4ef7a96f3..059e0fde06fb 100755 --- a/sd/source/ui/view/ViewShellManager.cxx +++ b/sd/source/ui/view/ViewShellManager.cxx @@ -42,7 +42,7 @@ #include <hash_map> #undef VERBOSE -#define VERBOSE 2 +//#define VERBOSE 2 namespace sd { diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index 280252a61621..a12412bf7f7d 100644..100755 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -54,6 +54,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <comphelper/processfactory.hxx> +#include <tools/diagnose_ex.h> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -472,7 +473,7 @@ bool ViewTabBar::ActivatePage (void) } catch (RuntimeException&) { - DBG_ASSERT(false,"ViewTabBar::ActivatePage(): caught exception"); + DBG_UNHANDLED_EXCEPTION(); } return false; diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx index 81e69f36300c..b32cd1fe023a 100644..100755 --- a/sd/source/ui/view/drawview.cxx +++ b/sd/source/ui/view/drawview.cxx @@ -1,4 +1,4 @@ -/************************************************************************* + /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -578,6 +578,8 @@ void DrawView::HideSdrPage() void DrawView::DeleteMarked() { + OSL_TRACE( "DrawView::DeleteMarked() - enter" ); + sd::UndoManager* pUndoManager = mpDoc->GetUndoManager(); DBG_ASSERT( pUndoManager, "sd::DrawView::DeleteMarked(), ui action without undo manager!?" ); @@ -590,33 +592,60 @@ void DrawView::DeleteMarked() } SdPage* pPage = 0; + bool bResetLayout = false; - const SdrMarkList& rList = GetMarkedObjectList(); - ULONG nMarkCount = rList.GetMarkCount(); - for (ULONG nMark = 0; nMark < nMarkCount; nMark++) + const ULONG nMarkCount = GetMarkedObjectList().GetMarkCount(); + if( nMarkCount ) { - SdrObject* pObj = rList.GetMark(nMark)->GetMarkedSdrObj(); - if( pObj && !pObj->IsEmptyPresObj() && pObj->GetUserCall() ) + SdrMarkList aList( GetMarkedObjectList() ); + for (ULONG nMark = 0; nMark < nMarkCount; nMark++) { - pPage = dynamic_cast< SdPage* >( pObj->GetPage() ); - PresObjKind ePresObjKind; - if( pPage && ((ePresObjKind = pPage->GetPresObjKind(pObj)) != PRESOBJ_NONE)) + SdrObject* pObj = aList.GetMark(nMark)->GetMarkedSdrObj(); + if( pObj && !pObj->IsEmptyPresObj() && pObj->GetUserCall() ) { - SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj ); - bool bVertical = pTextObj && pTextObj->IsVerticalWriting(); - Rectangle aRect( pObj->GetLogicRect() ); - pPage->InsertAutoLayoutShape( 0, ePresObjKind, bVertical, aRect, true ); + pPage = static_cast< SdPage* >( pObj->GetPage() ); + PresObjKind ePresObjKind; + if( pPage && ((ePresObjKind = pPage->GetPresObjKind(pObj)) != PRESOBJ_NONE)) + { + switch( ePresObjKind ) + { + case PRESOBJ_GRAPHIC: + case PRESOBJ_OBJECT: + case PRESOBJ_CHART: + case PRESOBJ_ORGCHART: + case PRESOBJ_TABLE: + case PRESOBJ_CALC: + case PRESOBJ_IMAGE: + case PRESOBJ_MEDIA: + ePresObjKind = PRESOBJ_OUTLINE; + break; + default: + break; + } + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj ); + bool bVertical = pTextObj && pTextObj->IsVerticalWriting(); + Rectangle aRect( pObj->GetLogicRect() ); + SdrObject* pNewObj = pPage->InsertAutoLayoutShape( 0, ePresObjKind, bVertical, aRect, true ); + + pPage->SetObjectOrdNum( pNewObj->GetOrdNum(), pObj->GetOrdNum() ); + + bResetLayout = true; + + OSL_TRACE( "DrawView::InsertAutoLayoutShape() - InsertAutoLayoutShape" ); + } } } } ::sd::View::DeleteMarked(); - if( pPage ) + if( pPage && bResetLayout ) pPage->SetAutoLayout( pPage->GetAutoLayout() ); if( pUndoManager ) pUndoManager->LeaveListAction(); + + OSL_TRACE( "DrawView::InsertAutoLayoutShape() - leave" ); } } // end of namespace sd diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 55ba07c3fa23..55479228f918 100644..100755 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -68,6 +68,8 @@ #include <svx/dialogs.hrc> +#include "view/viewoverlaymanager.hxx" + #include "glob.hrc" #include "app.hrc" #include "res_bmp.hrc" @@ -314,6 +316,7 @@ void DrawViewShell::SetZoom( long nZoom ) ViewShell::SetZoom( nZoom ); GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM ); GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER ); + mpViewOverlayManager->onZoomChanged(); } /************************************************************************* @@ -327,6 +330,7 @@ void DrawViewShell::SetZoomRect( const Rectangle& rZoomRect ) ViewShell::SetZoomRect( rZoomRect ); GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM ); GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER ); + mpViewOverlayManager->onZoomChanged(); } /************************************************************************* @@ -1240,6 +1244,7 @@ BOOL DrawViewShell::SwitchPage(USHORT nSelectedPage) rBindings.Invalidate(SID_STATUS_PAGE, TRUE, FALSE); rBindings.Invalidate(SID_DELETE_MASTER_PAGE, TRUE, FALSE); rBindings.Invalidate(SID_DELETE_PAGE, TRUE, FALSE); + rBindings.Invalidate(SID_ASSIGN_LAYOUT,TRUE,FALSE); UpdatePreview( mpActualPage ); mpDrawView->AdjustMarkHdl(); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index aa1a0f53c15a..2e33ab909f00 100644..100755 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -425,18 +425,12 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_ASSIGN_LAYOUT: { - if (mePageKind==PK_STANDARD - || mePageKind==PK_NOTES - || (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE)) + if (mePageKind==PK_STANDARD || mePageKind==PK_NOTES || (mePageKind==PK_HANDOUT && meEditMode==EM_MASTERPAGE)) { if ( mpDrawView->IsTextEdit() ) mpDrawView->SdrEndTextEdit(); - SFX_REQUEST_ARG (rReq, pWhatPage, SfxUInt32Item, ID_VAL_WHATPAGE, FALSE); - SFX_REQUEST_ARG (rReq, pWhatLayout, SfxUInt32Item, ID_VAL_WHATLAYOUT, FALSE); - ::sd::ViewShell::mpImpl->AssignLayout ( - GetDoc()->GetSdPage((USHORT)pWhatPage->GetValue(), mePageKind), - (AutoLayout)pWhatLayout->GetValue()); + ::sd::ViewShell::mpImpl->AssignLayout(rReq, mePageKind); } Cancel(); rReq.Done (); diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 852e56096a76..28f8d909031b 100644..100755 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -90,6 +90,7 @@ #include "DrawDocShell.hxx" #include "sdabstdlg.hxx" #include <sfx2/ipclient.hxx> +#include <tools/diagnose_ex.h> #include "ViewShellBase.hxx" #include "FormShellManager.hxx" #include "LayerTabBar.hxx" @@ -413,7 +414,7 @@ void DrawViewShell::ExecCtrl(SfxRequest& rReq) } catch (RuntimeException&) { - DBG_ASSERT(false, "caught exception while handline SID_RELOAD"); + DBG_UNHANDLED_EXCEPTION(); } // We have to return immediately to avoid accessing this object. diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx index 4dd3c61556e1..c4c6b20f8ca8 100644..100755 --- a/sd/source/ui/view/drviews6.cxx +++ b/sd/source/ui/view/drviews6.cxx @@ -81,7 +81,6 @@ #include "FrameView.hxx" #include "Window.hxx" #include "DrawDocShell.hxx" -#include "TaskPaneViewShell.hxx" #include "framework/FrameworkHelper.hxx" namespace sd { diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index e0cb78095bd0..e853d3944ce0 100644..100755 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -294,6 +294,26 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) GetMenuStateSel(rSet); + if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ASSIGN_LAYOUT)) + { + bool bDisable = true; + if( pPageView ) + { + SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() ); + + if( pPage ) + { + rSet.Put( SfxUInt32Item( SID_ASSIGN_LAYOUT, static_cast< sal_uInt32 >(pPage->GetAutoLayout()) ) ); + bDisable = false; + } + } + + if(bDisable) + { + rSet.DisableItem(SID_EXPAND_PAGE); + } + } + if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_EXPAND_PAGE)) { bool bDisable = true; @@ -342,6 +362,26 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) } } + if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ASSIGN_LAYOUT)) + { + bool bDisable = true; + if( pPageView ) + { + SdPage* pPage = dynamic_cast< SdPage* >( pPageView->GetPage() ); + + if( pPage && !pPage->IsMasterPage() ) + { + rSet.Put( SfxUInt32Item(SID_ASSIGN_LAYOUT, pPage->GetAutoLayout()) ); + bDisable = false; + } + } + + if(bDisable) + { + rSet.DisableItem(SID_ASSIGN_LAYOUT); + } + } + // Starten der Praesentation moeglich? if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PRESENTATION ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_REHEARSE_TIMINGS ) ) diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 4d30831f4e2a..ad42a9251878 100644..100755 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -62,6 +62,7 @@ #include <svtools/cliplistener.hxx> #include <svx/float3d.hxx> +#include "view/viewoverlaymanager.hxx" #include "app.hrc" #include "helpids.h" #include "strings.hrc" @@ -171,7 +172,8 @@ DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ::Window* pParentWindow, con DrawViewShell::~DrawViewShell() { - mpAnnotationManager.release(); + mpAnnotationManager.reset(); + mpViewOverlayManager.reset(); OSL_ASSERT (GetViewShell()!=NULL); @@ -416,6 +418,7 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind) } mpAnnotationManager.reset( new AnnotationManager( GetViewShellBase() ) ); + mpViewOverlayManager.reset( new ViewOverlayManager( GetViewShellBase() ) ); } diff --git a/sd/source/ui/view/drvwshrg.cxx b/sd/source/ui/view/drvwshrg.cxx index a8b2d0814c3e..76590dd45003 100644..100755 --- a/sd/source/ui/view/drvwshrg.cxx +++ b/sd/source/ui/view/drvwshrg.cxx @@ -106,6 +106,7 @@ SFX_IMPL_INTERFACE(GraphicViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL)) //SOH { SFX_POPUPMENU_REGISTRATION( SdResId(RID_DRAW_TEXTOBJ_INSIDE_POPUP) ); SFX_CHILDWINDOW_CONTEXT_REGISTRATION( SID_NAVIGATOR ); + SFX_CHILDWINDOW_REGISTRATION( SID_TASKPANE ); SFX_CHILDWINDOW_REGISTRATION( SfxTemplateDialogWrapper::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SvxFontWorkChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SvxColorChildWindow::GetChildWindowId() ); diff --git a/sd/source/ui/view/makefile.mk b/sd/source/ui/view/makefile.mk index 3b3bca4ff3d5..2cc2a96d46a2 100644 --- a/sd/source/ui/view/makefile.mk +++ b/sd/source/ui/view/makefile.mk @@ -53,6 +53,7 @@ SLOFILES = \ $(SLO)$/sdview2.obj \ $(SLO)$/sdview3.obj \ $(SLO)$/sdview4.obj \ + $(SLO)$/sdview5.obj \ $(SLO)$/viewshel.obj \ $(SLO)$/viewshe2.obj \ $(SLO)$/viewshe3.obj \ @@ -113,7 +114,8 @@ SLOFILES = \ $(SLO)$/ViewShellManager.obj \ $(SLO)$/ViewShellHint.obj \ $(SLO)$/ViewTabBar.obj \ - $(SLO)$/WindowUpdater.obj + $(SLO)$/WindowUpdater.obj \ + $(SLO)$/viewoverlaymanager.obj # --- Tagets ------------------------------------------------------- diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 44e5127bfb25..a980496cecf3 100644..100755 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -114,11 +114,25 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, if( mnAction == DND_ACTION_LINK && pPickObj && pPV ) { - if( pPickObj->ISA( SdrGrafObj ) ) + const bool bIsGraphic = pPickObj->ISA( SdrGrafObj ); + if( bIsGraphic || pObj->IsEmptyPresObj() ) { - // Das Objekt wird mit der Bitmap gefuellt - pNewGrafObj = (SdrGrafObj*) pPickObj->Clone(); - pNewGrafObj->SetGraphic(rGraphic); + if( IsUndoEnabled() ) + BegUndo(String(SdResId(STR_INSERTGRAPHIC))); + + SdPage* pPage = (SdPage*) pPickObj->GetPage(); + + if( bIsGraphic ) + { + // Das Objekt wird mit der Bitmap gefuellt + pNewGrafObj = (SdrGrafObj*) pPickObj->Clone(); + pNewGrafObj->SetGraphic(rGraphic); + } + else + { + pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetLogicRect() ); + pNewGrafObj->SetEmptyPresObj(TRUE); + } if ( pNewGrafObj->IsEmptyPresObj() ) { @@ -128,28 +142,11 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, pNewGrafObj->SetEmptyPresObj(FALSE); } - const bool bUndo = IsUndoEnabled(); - if( bUndo ) - BegUndo(String(SdResId(STR_UNDO_DRAGDROP))); - - SdPage* pPage = (SdPage*) pPickObj->GetPage(); - - if (pPage && pPage->GetPresObjKind(pPickObj) == PRESOBJ_GRAPHIC) + if (pPage && pPage->IsPresObj(pPickObj)) { // Neues PresObj in die Liste eintragen + pPage->InsertPresObj( pNewGrafObj, PRESOBJ_GRAPHIC ); pNewGrafObj->SetUserCall(pPickObj->GetUserCall()); - if( bUndo ) - { - AddUndo( new sd::UndoObjectPresentationKind( *pPickObj ) ); - AddUndo( new sd::UndoObjectPresentationKind( *pNewGrafObj ) ); - } - pPage->RemovePresObj(pPickObj); - pPage->InsertPresObj(pNewGrafObj, PRESOBJ_GRAPHIC); - - if( !bUndo ) - { - SdrObject::Free( pPickObj ); - } } if (pImageMap) @@ -157,7 +154,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView - if( bUndo ) + if( IsUndoEnabled() ) EndUndo(); } else if (pPickObj->IsClosedObj() && !pPickObj->ISA(SdrOle2Obj)) @@ -295,7 +292,7 @@ SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAc SdrMediaObj* pNewMediaObj = NULL; SdrPageView* pPV = GetSdrPageView(); - SdrObject* pPickObj = NULL; + SdrObject* pPickObj = GetEmptyPresentationObject( PRESOBJ_MEDIA ); if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView )) { @@ -320,10 +317,37 @@ SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAc } else if( pPV ) { - pNewMediaObj = new SdrMediaObj( Rectangle( rPos, rSize ) ); + Rectangle aRect( rPos, rSize ); + if( pPickObj ) + aRect = pPickObj->GetLogicRect(); + - if( pPV && InsertObjectAtView( pNewMediaObj, *pPV, SDRINSERT_SETDEFLAYER ) ) - pNewMediaObj->setURL( rMediaURL ); + pNewMediaObj = new SdrMediaObj( aRect ); + + bool bIsPres = false; + if( pPickObj ) + { + SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage()); + bIsPres = pPage && pPage->IsPresObj(pPickObj); + if( bIsPres ) + { + pPage->InsertPresObj( pNewMediaObj, PRESOBJ_MEDIA ); + } + } + + if( pPickObj ) + ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj); + else + InsertObjectAtView( pNewMediaObj, *pPV, SDRINSERT_SETDEFLAYER ); + + pNewMediaObj->setURL( rMediaURL ); + + if( pPickObj ) + { + pNewMediaObj->AdjustToMaxRect( pPickObj->GetLogicRect() ); + if( bIsPres ) + pNewMediaObj->SetUserCall(pPickObj->GetUserCall()); + } } rAction = mnAction; diff --git a/sd/source/ui/view/sdview5.cxx b/sd/source/ui/view/sdview5.cxx new file mode 100755 index 000000000000..156544c235ab --- /dev/null +++ b/sd/source/ui/view/sdview5.cxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "sdpage.hxx" +#include "View.hxx" +#include "pres.hxx" + +namespace sd { + +static bool implIsMultiPresObj( PresObjKind eKind ) +{ + switch( eKind ) + { + case PRESOBJ_OUTLINE: + case PRESOBJ_GRAPHIC: + case PRESOBJ_OBJECT: + case PRESOBJ_CHART: + case PRESOBJ_ORGCHART: + case PRESOBJ_TABLE: + case PRESOBJ_IMAGE: + case PRESOBJ_MEDIA: + return true; + default: + return false; + } +} + +SdrObject* View::GetEmptyPresentationObject( PresObjKind eKind ) +{ + SdrObject* pEmptyObj = 0; + + SdrPageView* pPV = GetSdrPageView(); + if( pPV ) + { + SdPage* pPage = static_cast< SdPage* >( pPV->GetPage() ); + if( pPage ) + { + // first try selected shape + if ( AreObjectsMarked() ) + { + /********************************************************** + * Is an empty graphic object available? + **********************************************************/ + const SdrMarkList& rMarkList = GetMarkedObjectList(); + + if (rMarkList.GetMarkCount() == 1) + { + SdrMark* pMark = rMarkList.GetMark(0); + SdrObject* pObj = pMark->GetMarkedSdrObj(); + + if( pObj->IsEmptyPresObj() && implIsMultiPresObj( pPage->GetPresObjKind(pObj) ) ) + pEmptyObj = pObj; + } + } + + // try to find empty pres obj of same type + if( !pEmptyObj ) + { + int nIndex = 1; + do + { + pEmptyObj = pPage->GetPresObj(eKind, nIndex++ ); + } + while( (pEmptyObj != 0) && (!pEmptyObj->IsEmptyPresObj()) ); + } + + // last try to find empty pres obj of multiple type + if( !pEmptyObj ) + { + const std::list< SdrObject* >& rShapes = pPage->GetPresentationShapeList().getList(); + + for( std::list< SdrObject* >::const_iterator iter( rShapes.begin() ); iter != rShapes.end(); iter++ ) + { + if( (*iter)->IsEmptyPresObj() && implIsMultiPresObj(pPage->GetPresObjKind(*iter)) ) + { + pEmptyObj = (*iter); + break; + } + } + } + } + } + + return pEmptyObj; +} + +} diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index 7cae5d452a1b..5ae673b8769f 100644..100755 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -36,7 +36,6 @@ #include <svx/svxids.hrc> #include <editeng/outliner.hxx> - #include <editeng/editview.hxx> #include "app.hrc" diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx new file mode 100755 index 000000000000..ab165eea600b --- /dev/null +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -0,0 +1,609 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sd.hxx" + +#include "sddll.hxx" + +#include <com/sun/star/frame/XFrame.hpp> +#include <sfx2/imagemgr.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/app.hxx> +#include <sfx2/request.hxx> +#include <sfx2/dispatch.hxx> + +#include <tools/rcid.h> + +#include <vcl/help.hxx> +#include <vcl/imagerepository.hxx> + +#include <svx/sdrpagewindow.hxx> +#include <svx/sdrpaintwindow.hxx> +#include <svx/sdr/overlay/overlayanimatedbitmapex.hxx> +#include <svx/sdr/overlay/overlaybitmapex.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> +#include <svx/svxids.hrc> + +#include "view/viewoverlaymanager.hxx" + +#include "res_bmp.hrc" +#include "DrawDocShell.hxx" +#include "DrawViewShell.hxx" +#include "DrawController.hxx" +#include "glob.hrc" +#include "strings.hrc" +#include "sdresid.hxx" +#include "EventMultiplexer.hxx" +#include "ViewShellManager.hxx" +#include "helpids.h" +#include "sdpage.hxx" +#include "drawdoc.hxx" +#include "smarttag.hxx" + +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; + +namespace sd { + +class ImageButtonHdl; + +// -------------------------------------------------------------------- + +BitmapEx ViewOverlayManager::maSmallButtonImages[BMP_PLACEHOLDER_SMALL_END - BMP_PLACEHOLDER_SMALL_START]; +BitmapEx ViewOverlayManager::maLargeButtonImages[BMP_PLACEHOLDER_LARGE_END - BMP_PLACEHOLDER_LARGE_START]; + +static USHORT gButtonSlots[] = { SID_INSERT_TABLE, SID_INSERT_DIAGRAM, SID_INSERT_GRAPHIC, SID_INSERT_AVMEDIA }; +static USHORT gButtonToolTips[] = { STR_INSERT_TABLE, STR_INSERT_CHART, STR_INSERT_PICTURE, STR_INSERT_MOVIE }; + +// -------------------------------------------------------------------- + +static BitmapEx loadImageResource( USHORT nId ) +{ + SdResId aResId( nId ); + aResId.SetRT( RSC_BITMAP ); + + return BitmapEx( aResId ); +} + +// -------------------------------------------------------------------- + +const sal_uInt32 SMART_TAG_HDL_NUM = SAL_MAX_UINT32; + +class ChangePlaceholderTag : public SmartTag +{ + friend class ImageButtonHdl; +public: + ChangePlaceholderTag( ViewOverlayManager& rManager, ::sd::View& rView, SdrObject& rPlaceholderObj ); + virtual ~ChangePlaceholderTag(); + + /** returns true if the SmartTag handled the event. */ + virtual bool MouseButtonDown( const MouseEvent&, SmartHdl& ); + + /** returns true if the SmartTag consumes this event. */ + virtual bool KeyInput( const KeyEvent& rKEvt ); + + BitmapEx createOverlayImage( int nHighlight = -1 ); + +protected: + virtual void addCustomHandles( SdrHdlList& rHandlerList ); + virtual void disposing(); + virtual void select(); + virtual void deselect(); + +private: + ViewOverlayManager& mrManager; + SdrObjectWeakRef mxPlaceholderObj; +}; + +class ImageButtonHdl : public SmartHdl +{ +public: + ImageButtonHdl( const SmartTagReference& xTag, /* USHORT nSID, const Image& rImage, const Image& rImageMO, */ const Point& rPnt ); + virtual ~ImageButtonHdl(); + virtual void CreateB2dIAObject(); + virtual BOOL IsFocusHdl() const; + virtual Pointer GetPointer() const; + virtual bool isMarkable() const; + + virtual void onMouseEnter(const MouseEvent& rMEvt); + virtual void onMouseLeave(); + + int getHighlightId() const { return mnHighlightId; } + + void HideTip(); + +private: + rtl::Reference< ChangePlaceholderTag > mxTag; + + int mnHighlightId; + Size maImageSize; + ULONG mnTip; +}; + +// -------------------------------------------------------------------- + +ImageButtonHdl::ImageButtonHdl( const SmartTagReference& xTag /*, USHORT nSID, const Image& rImage, const Image& rImageMO*/, const Point& rPnt ) +: SmartHdl( xTag, rPnt ) +, mxTag( dynamic_cast< ChangePlaceholderTag* >( xTag.get() ) ) +, mnHighlightId( -1 ) +, maImageSize( 42, 42 ) +, mnTip( 0 ) +{ +} + +// -------------------------------------------------------------------- + +ImageButtonHdl::~ImageButtonHdl() +{ + HideTip(); +} + +// -------------------------------------------------------------------- + +void ImageButtonHdl::HideTip() +{ + if( mnTip ) + { + Help::HideTip( mnTip ); + mnTip = 0; + } +} + +// -------------------------------------------------------------------- + +extern ::rtl::OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const OUString& aCmdURL ); + +void ImageButtonHdl::onMouseEnter(const MouseEvent& rMEvt) +{ + int nHighlightId = 0; + + if( pHdlList && pHdlList->GetView()) + { + OutputDevice* pDev = pHdlList->GetView()->GetFirstOutputDevice(); + if( pDev == 0 ) + pDev = Application::GetDefaultDevice(); + + Point aMDPos( rMEvt.GetPosPixel() ); + aMDPos -= pDev->LogicToPixel( GetPos() ); + + nHighlightId += aMDPos.X() > maImageSize.Width() ? 1 : 0; + nHighlightId += aMDPos.Y() > maImageSize.Height() ? 2 : 0; + + if( mnHighlightId != nHighlightId ) + { + HideTip(); + + mnHighlightId = nHighlightId; + + if( pHdlList ) + { + SdResId aResId( gButtonToolTips[mnHighlightId] ); + aResId.SetRT( RSC_STRING ); + + String aHelpText( aResId ); + Rectangle aScreenRect( pDev->LogicToPixel( GetPos() ), maImageSize ); + mnTip = Help::ShowTip( static_cast< ::Window* >( pHdlList->GetView()->GetFirstOutputDevice() ), aScreenRect, aHelpText, 0 ) ; + } + Touch(); + } + } +} + +// -------------------------------------------------------------------- + +void ImageButtonHdl::onMouseLeave() +{ + mnHighlightId = -1; + HideTip(); + Touch(); +} + +// -------------------------------------------------------------------- + +void ImageButtonHdl::CreateB2dIAObject() +{ + // first throw away old one + GetRidOfIAObject(); + + const Point aTagPos( GetPos() ); + basegfx::B2DPoint aPosition( aTagPos.X(), aTagPos.Y() ); + + BitmapEx aBitmapEx( mxTag->createOverlayImage( mnHighlightId ) ); // maImageMO.GetBitmapEx() : maImage.GetBitmapEx() ); + maImageSize = aBitmapEx.GetSizePixel(); + maImageSize.Width() >>= 1; + maImageSize.Height() >>= 1; + + if(pHdlList) + { + SdrMarkView* pView = pHdlList->GetView(); + + if(pView && !pView->areMarkHandlesHidden()) + { + SdrPageView* pPageView = pView->GetSdrPageView(); + + if(pPageView) + { + for(sal_uInt32 b = 0; b < pPageView->PageWindowCount(); b++) + { + const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b); + + SdrPaintWindow& rPaintWindow = rPageWindow.GetPaintWindow(); + if(rPaintWindow.OutputToWindow() && rPageWindow.GetOverlayManager() ) + { + ::sdr::overlay::OverlayObject* pOverlayObject = 0; + + pOverlayObject = new ::sdr::overlay::OverlayBitmapEx( aPosition, aBitmapEx, 0, 0 ); + rPageWindow.GetOverlayManager()->add(*pOverlayObject); + maOverlayGroup.append(*pOverlayObject); + } + } + } + } + } +} + +// -------------------------------------------------------------------- + +BOOL ImageButtonHdl::IsFocusHdl() const +{ + return false; +} + +// -------------------------------------------------------------------- + +bool ImageButtonHdl::isMarkable() const +{ + return false; +} + +// -------------------------------------------------------------------- + +Pointer ImageButtonHdl::GetPointer() const +{ + return Pointer( POINTER_ARROW ); +} + +// ==================================================================== + +ChangePlaceholderTag::ChangePlaceholderTag( ViewOverlayManager& rManager, ::sd::View& rView, SdrObject& rPlaceholderObj ) +: SmartTag( rView ) +, mrManager( rManager ) +, mxPlaceholderObj( &rPlaceholderObj ) +{ +} + +// -------------------------------------------------------------------- + +ChangePlaceholderTag::~ChangePlaceholderTag() +{ +} + +// -------------------------------------------------------------------- + +/** returns true if the ChangePlaceholderTag handled the event. */ +bool ChangePlaceholderTag::MouseButtonDown( const MouseEvent& /*rMEvt*/, SmartHdl& rHdl ) +{ + int nHighlightId = static_cast< ImageButtonHdl& >(rHdl).getHighlightId(); + if( nHighlightId >= 0 ) + { + USHORT nSID = gButtonSlots[nHighlightId]; + + if( mxPlaceholderObj.get() ) + { + // mark placeholder if it is not currently marked (or if also others are marked) + if( !mrView.IsObjMarked( mxPlaceholderObj.get() ) || (mrView.GetMarkedObjectList().GetMarkCount() != 1) ) + { + SdrPageView* pPV = mrView.GetSdrPageView(); + mrView.UnmarkAllObj(pPV ); + mrView.MarkObj(mxPlaceholderObj.get(), pPV, FALSE); + } + } + + mrView.GetViewShell()->GetViewFrame()->GetDispatcher()->Execute( nSID, SFX_CALLMODE_ASYNCHRON); + } + return false; +} + +// -------------------------------------------------------------------- + +/** returns true if the SmartTag consumes this event. */ +bool ChangePlaceholderTag::KeyInput( const KeyEvent& rKEvt ) +{ + USHORT nCode = rKEvt.GetKeyCode().GetCode(); + switch( nCode ) + { + case KEY_DOWN: + case KEY_UP: + case KEY_LEFT: + case KEY_RIGHT: + case KEY_ESCAPE: + case KEY_TAB: + case KEY_RETURN: + case KEY_SPACE: + default: + return false; + } +} + +// -------------------------------------------------------------------- + +BitmapEx ChangePlaceholderTag::createOverlayImage( int nHighlight ) +{ + BitmapEx aRet; + if( mxPlaceholderObj.is() ) + { + SdrObject* pPlaceholder = mxPlaceholderObj.get(); + SmartTagReference xThis( this ); + const Rectangle& rSnapRect = pPlaceholder->GetSnapRect(); + const Point aPoint; + + OutputDevice* pDev = mrView.GetFirstOutputDevice(); + if( pDev == 0 ) + pDev = Application::GetDefaultDevice(); + + Size aShapeSizePix = pDev->LogicToPixel(rSnapRect.GetSize()); + long nShapeSizePix = std::min(aShapeSizePix.Width(),aShapeSizePix.Height()); + + BitmapEx* pImages = (nShapeSizePix > 250) ? &ViewOverlayManager::maLargeButtonImages[0] : &ViewOverlayManager::maSmallButtonImages[0]; + + Size aSize( pImages->GetSizePixel() ); + + aRet.SetSizePixel( Size( aSize.Width() << 1, aSize.Height() << 1 ) ); + + const Rectangle aRectSrc( Point( 0, 0 ), aSize ); + + aRet = pImages[(nHighlight == 0) ? 4 : 0]; + aRet.Expand( aSize.Width(), aSize.Height(), NULL, TRUE ); + + aRet.CopyPixel( Rectangle( Point( aSize.Width(), 0 ), aSize ), aRectSrc, &pImages[(nHighlight == 1) ? 5 : 1] ); + aRet.CopyPixel( Rectangle( Point( 0, aSize.Height() ), aSize ), aRectSrc, &pImages[(nHighlight == 2) ? 6 : 2] ); + aRet.CopyPixel( Rectangle( Point( aSize.Width(), aSize.Height() ), aSize ), aRectSrc, &pImages[(nHighlight == 3) ? 7 : 3] ); + } + + return aRet; +} + +void ChangePlaceholderTag::addCustomHandles( SdrHdlList& rHandlerList ) +{ + if( mxPlaceholderObj.is() ) + { + SdrObject* pPlaceholder = mxPlaceholderObj.get(); + SmartTagReference xThis( this ); + const Rectangle& rSnapRect = pPlaceholder->GetSnapRect(); + const Point aPoint; + + OutputDevice* pDev = mrView.GetFirstOutputDevice(); + if( pDev == 0 ) + pDev = Application::GetDefaultDevice(); + + Size aShapeSizePix = pDev->LogicToPixel(rSnapRect.GetSize()); + long nShapeSizePix = std::min(aShapeSizePix.Width(),aShapeSizePix.Height()); + if( 50 > nShapeSizePix ) + return; + + BitmapEx* pImages = (nShapeSizePix > 250) ? &ViewOverlayManager::maLargeButtonImages[0] : &ViewOverlayManager::maSmallButtonImages[0]; + + Size aButtonSize( pDev->PixelToLogic(pImages[0].GetSizePixel()) ); + + const int nColumns = 2; + const int nRows = 2; + + long all_width = nColumns * aButtonSize.Width(); + long all_height = nRows * aButtonSize.Height(); + + Point aPos( rSnapRect.Center() ); + aPos.X() -= all_width >> 1; + aPos.Y() -= all_height >> 1; + + ImageButtonHdl* pHdl = new ImageButtonHdl( xThis, aPoint ); + pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM ); + pHdl->SetPageView( mrView.GetSdrPageView() ); + + pHdl->SetPos( aPos ); + + rHandlerList.AddHdl( pHdl ); + } +} + +// -------------------------------------------------------------------- + +void ChangePlaceholderTag::disposing() +{ + SmartTag::disposing(); +} + +// -------------------------------------------------------------------- + +void ChangePlaceholderTag::select() +{ + SmartTag::select(); +} + +// -------------------------------------------------------------------- + +void ChangePlaceholderTag::deselect() +{ + SmartTag::deselect(); +} + +// -------------------------------------------------------------------- + +ViewOverlayManager::ViewOverlayManager( ViewShellBase& rViewShellBase ) +: mrBase( rViewShellBase ) +, mnUpdateTagsEvent( 0 ) +{ + Link aLink( LINK(this,ViewOverlayManager,EventMultiplexerListener) ); + mrBase.GetEventMultiplexer()->AddEventListener(aLink, tools::EventMultiplexerEvent::EID_CURRENT_PAGE + | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED + | tools::EventMultiplexerEvent::EID_VIEW_ADDED + | tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT + | tools::EventMultiplexerEvent::EID_END_TEXT_EDIT ); + + StartListening( *mrBase.GetDocShell() ); +} + +// -------------------------------------------------------------------- + +ViewOverlayManager::~ViewOverlayManager() +{ + Link aLink( LINK(this,ViewOverlayManager,EventMultiplexerListener) ); + mrBase.GetEventMultiplexer()->RemoveEventListener( aLink ); + + if( mnUpdateTagsEvent ) + { + Application::RemoveUserEvent( mnUpdateTagsEvent ); + mnUpdateTagsEvent = 0; + } + + DisposeTags(); +} + +// -------------------------------------------------------------------- + +void ViewOverlayManager::UpdateImages() +{ + for( sal_uInt16 i = 0; i < (BMP_PLACEHOLDER_SMALL_END-BMP_PLACEHOLDER_SMALL_START); i++ ) + { + maSmallButtonImages[i] = loadImageResource( BMP_PLACEHOLDER_SMALL_START + i ); + maLargeButtonImages[i] = loadImageResource( BMP_PLACEHOLDER_LARGE_START + i ); + } +} + +// -------------------------------------------------------------------- + +void ViewOverlayManager::Notify(SfxBroadcaster&, const SfxHint& rHint) +{ + const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint); + if (pSimpleHint != NULL) + { + if (pSimpleHint->GetId() == SFX_HINT_DOCCHANGED) + { + UpdateTags(); + } + } +} + +void ViewOverlayManager::onZoomChanged() +{ + if( !maTagVector.empty() ) + { + UpdateTags(); + } +} + +void ViewOverlayManager::UpdateTags() +{ + if( !mnUpdateTagsEvent ) + mnUpdateTagsEvent = Application::PostUserEvent( LINK( this, ViewOverlayManager, UpdateTagsHdl ) ); +} + +IMPL_LINK(ViewOverlayManager,UpdateTagsHdl, void *, EMPTYARG) +{ + OSL_TRACE("ViewOverlayManager::UpdateTagsHdl"); + + mnUpdateTagsEvent = 0; + bool bChanges = DisposeTags(); + bChanges |= CreateTags(); + + if( bChanges && mrBase.GetDrawView() ) + static_cast< ::sd::View* >( mrBase.GetDrawView() )->updateHandles(); + return 0; +} + +bool ViewOverlayManager::CreateTags() +{ + bool bChanges = false; + + SdPage* pPage = mrBase.GetMainViewShell()->getCurrentPage(); + + if( pPage ) + { + if( !maSmallButtonImages[0] ) + UpdateImages(); + + const std::list< SdrObject* >& rShapes = pPage->GetPresentationShapeList().getList(); + + for( std::list< SdrObject* >::const_iterator iter( rShapes.begin() ); iter != rShapes.end(); iter++ ) + { + if( (*iter)->IsEmptyPresObj() && ((*iter)->GetObjIdentifier() == OBJ_OUTLINETEXT) && (mrBase.GetDrawView()->GetTextEditObject() != (*iter)) ) + { + rtl::Reference< SmartTag > xTag( new ChangePlaceholderTag( *this, *mrBase.GetMainViewShell()->GetView(), *(*iter) ) ); + maTagVector.push_back(xTag); + bChanges = true; + } + } + } + + return bChanges; +} + +// -------------------------------------------------------------------- + +bool ViewOverlayManager::DisposeTags() +{ + if( !maTagVector.empty() ) + { + ViewTagVector vec; + vec.swap( maTagVector ); + + ViewTagVector::iterator iter = vec.begin(); + do + { + (*iter++)->Dispose(); + } + while( iter != vec.end() ); + return true; + } + + return false; +} + +// -------------------------------------------------------------------- + +IMPL_LINK(ViewOverlayManager,EventMultiplexerListener, + tools::EventMultiplexerEvent*,pEvent) +{ + switch (pEvent->meEventId) + { + case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED: + case tools::EventMultiplexerEvent::EID_VIEW_ADDED: + case tools::EventMultiplexerEvent::EID_BEGIN_TEXT_EDIT: + case tools::EventMultiplexerEvent::EID_END_TEXT_EDIT: + case tools::EventMultiplexerEvent::EID_CURRENT_PAGE: + UpdateTags(); + break; + } + return 0; +} + +} diff --git a/sd/source/ui/view/viewshe3.cxx b/sd/source/ui/view/viewshe3.cxx index 4ec163d813ca..8bfdefd240da 100644..100755 --- a/sd/source/ui/view/viewshe3.cxx +++ b/sd/source/ui/view/viewshe3.cxx @@ -69,7 +69,6 @@ #endif #include "DrawViewShell.hxx" #include "OutlineViewShell.hxx" -#include "TaskPaneViewShell.hxx" #include "drawview.hxx" #include "sdattr.hxx" @@ -80,6 +79,7 @@ #include "Window.hxx" #include "DrawDocShell.hxx" #include "FrameView.hxx" +#include "framework/FrameworkHelper.hxx" #include "optsitem.hxx" #include "sdresid.hxx" @@ -246,6 +246,7 @@ SdPage* ViewShell::CreateOrDuplicatePage ( const SfxItemSet* pArgs = rRequest.GetArgs(); if (! pArgs) { +/* // Make the layout menu visible in the tool pane. const ViewShellBase& rBase (GetViewShellBase()); if (rBase.GetMainViewShell()!=NULL @@ -253,8 +254,9 @@ SdPage* ViewShell::CreateOrDuplicatePage ( && rBase.GetMainViewShell()->GetShellType()!=ViewShell::ST_DRAW) { framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel( - framework::FrameworkHelper::msLayoutTaskPanelURL); + framework::FrameworkHelper::msLayoutTaskPanelURL); } +*/ // AutoLayouts muessen fertig sein pDocument->StopWorkStartupDelay(); @@ -263,23 +265,31 @@ SdPage* ViewShell::CreateOrDuplicatePage ( if (pTemplatePage != NULL) { eStandardLayout = pTemplatePage->GetAutoLayout(); + if( eStandardLayout == AUTOLAYOUT_TITLE ) + eStandardLayout = AUTOLAYOUT_ENUM; + SdPage* pNotesTemplatePage = static_cast<SdPage*>(pDocument->GetPage(pTemplatePage->GetPageNum()+1)); if (pNotesTemplatePage != NULL) eNotesLayout = pNotesTemplatePage->GetAutoLayout(); } } - else if (pArgs->Count () != 4) + else if (pArgs->Count() == 1) { - Cancel(); - - if(HasCurrentFunction(SID_BEZIER_EDIT) ) - GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); - - StarBASIC::FatalError (SbERR_WRONG_ARGS); - rRequest.Ignore (); - return NULL; + pDocument->StopWorkStartupDelay(); + SFX_REQUEST_ARG (rRequest, pLayout, SfxUInt32Item, ID_VAL_WHATLAYOUT, FALSE); + if( pLayout ) + { + if (ePageKind == PK_NOTES) + { + eNotesLayout = (AutoLayout) pLayout->GetValue (); + } + else + { + eStandardLayout = (AutoLayout) pLayout->GetValue (); + } + } } - else + else if (pArgs->Count() == 4) { // AutoLayouts muessen fertig sein pDocument->StopWorkStartupDelay(); @@ -317,6 +327,17 @@ SdPage* ViewShell::CreateOrDuplicatePage ( return NULL; } } + else + { + Cancel(); + + if(HasCurrentFunction(SID_BEZIER_EDIT) ) + GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON); + + StarBASIC::FatalError (SbERR_WRONG_ARGS); + rRequest.Ignore (); + return NULL; + } // 2. Create a new page or duplicate an existing one. View* pDrView = GetView(); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 578026018b9f..578026018b9f 100644..100755 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx |