diff options
author | Christian Lippka <christian.lippka@sun.com> | 2009-12-08 17:33:39 +0100 |
---|---|---|
committer | Christian Lippka <christian.lippka@sun.com> | 2009-12-08 17:33:39 +0100 |
commit | dada72080460ab3a1bf4228a38454339b1d5f204 (patch) | |
tree | c9d9fc732e58f1e7ebab52a2452510ca01310030 | |
parent | f0efe6abc4156df0834f8e6953a8bcee9ead9506 (diff) |
renaissance01: #i107213# more work on layout popup
-rw-r--r-- | sd/source/ui/app/layoutctrl.cxx | 30 | ||||
-rw-r--r-- | sd/source/ui/app/sddll2.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/dlg/layoutdialog.cxx | 61 | ||||
-rw-r--r-- | sd/source/ui/dlg/layoutdialog.hrc | 2 | ||||
-rw-r--r-- | sd/source/ui/dlg/layoutdialog.src | 5 | ||||
-rw-r--r-- | sd/source/ui/inc/layoutdialog.hxx | 6 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 45 |
7 files changed, 108 insertions, 44 deletions
diff --git a/sd/source/ui/app/layoutctrl.cxx b/sd/source/ui/app/layoutctrl.cxx index 41e71f3066ff..71069cadab8f 100644 --- a/sd/source/ui/app/layoutctrl.cxx +++ b/sd/source/ui/app/layoutctrl.cxx @@ -52,6 +52,7 @@ #include <svx/toolbarmenu.hxx> +#include "layoutdialog.hxx" #include "sdresid.hxx" #include "res_bmp.hrc" #include "strings.hrc" @@ -116,6 +117,8 @@ public: SdLayoutControl::SdLayoutControl( USHORT _nSlotId, USHORT _nId, ToolBox& rTbx ) : SfxToolBoxControl( _nSlotId, _nId, rTbx ) { + rTbx.SetItemBits( _nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( _nId ) ); + rTbx.Invalidate(); } // ----------------------------------------------------------------------- @@ -147,18 +150,29 @@ SfxPopupWindowType SdLayoutControl::GetPopupWindowType() const SfxPopupWindow* SdLayoutControl::CreatePopupWindow() { - ToolBox& rTbx = GetToolBox(); - SdLayoutDialogContent* pWin = new SdLayoutDialogContent( GetId(), m_xFrame, &rTbx ); -// pWin->StartPopupMode( &rTbx, FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE ); - pWin->EnableDocking(true); + OUString sResourceName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/dockingwindow/" ) ); + sResourceName += OUString::valueOf( static_cast<sal_Int32>(GetId()) ); + createAndPositionSubToolBar( sResourceName ); +/* + SfxPopupWindow* pWin = 0; - Window::GetDockingManager()->StartPopupMode( &rTbx, pWin ); -// SetPopupWindow( pWin ); -// return pWin; + ToolBox& rTbx = GetToolBox(); + SfxViewFrame* pViewFrame = SfxViewFrame::Current(); + if( pViewFrame ) + { + pWin = sd::LayoutDialogChildWindow::createChildWindow( *pViewFrame, &rTbx ); + if( pWin ) + { + pWin->EnableDocking(true); + Window::GetDockingManager()->StartPopupMode( &rTbx, pWin ); + } + } + SetPopupWindow( pWin ); + */ return 0; } -#ifdef 0 +#if 0 // ----------------------------------------------------------------------- struct snewfoil_value_info diff --git a/sd/source/ui/app/sddll2.cxx b/sd/source/ui/app/sddll2.cxx index b0906e278b33..3c56631aadf7 100644 --- a/sd/source/ui/app/sddll2.cxx +++ b/sd/source/ui/app/sddll2.cxx @@ -93,6 +93,7 @@ #include "tmplctrl.hxx" #include "layoutctrl.hxx" +#include "layoutdialog.hxx" /************************************************************************* |* @@ -231,5 +232,7 @@ void SdDLL::RegisterControllers() SvxFrameLineColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod ); SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER, pMod ); SvxSubToolBoxControl::RegisterControl(SID_OPTIMIZE_TABLE, pMod); + SdLayoutControl::RegisterControl( SID_ASSIGN_LAYOUT, pMod ); + sd::LayoutDialogChildWindow::RegisterChildWindow( sal_False, pMod ); } diff --git a/sd/source/ui/dlg/layoutdialog.cxx b/sd/source/ui/dlg/layoutdialog.cxx index 6a1a4db12413..c431db29d651 100644 --- a/sd/source/ui/dlg/layoutdialog.cxx +++ b/sd/source/ui/dlg/layoutdialog.cxx @@ -31,6 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" +#include <com/sun/star/frame/XFrame.hpp> #include "layoutdialog.hxx" #include <sfx2/dockwin.hxx> #include "app.hrc" @@ -46,6 +47,8 @@ SFX_IMPL_DOCKINGWINDOW(LayoutDialogChildWindow, SID_LAYOUT_DIALOG_WIN) #include <vcl/image.hxx> #include <sfx2/dispatch.hxx> +#include <sfx2/imagemgr.hxx> +#include <sfx2/tbxctrl.hxx> #include <svtools/languageoptions.hxx> #include <svtools/valueset.hxx> @@ -69,14 +72,15 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::text; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::frame; namespace sd { /// -class SdLayoutDialogContent : public SfxDockingWindow +class SdLayoutDialogContent : public SfxPopupWindow { public: - SdLayoutDialogContent( SfxBindings* pBindings, SfxChildWindow *pCW, ::Window* pParent, ViewShellBase& rBase); + SdLayoutDialogContent( ViewShellBase& rBase, Window* pParent); virtual ~SdLayoutDialogContent(); protected: @@ -97,14 +101,26 @@ LayoutDialogChildWindow::LayoutDialogChildWindow(::Window* _pParent, USHORT nId, : SfxChildWindow (_pParent, nId) { ViewShellBase& rBase (*ViewShellBase::GetViewShellBase(pBindings->GetDispatcher()->GetFrame())); - SdLayoutDialogContent* pContent = new SdLayoutDialogContent (pBindings, this, _pParent, rBase); + SdLayoutDialogContent* pContent = new SdLayoutDialogContent (rBase, _pParent); pWindow = pContent; eChildAlignment = SFX_ALIGN_NOALIGNMENT; - pContent->Initialize(pInfo); +// pContent->Initialize(pInfo); } LayoutDialogChildWindow::~LayoutDialogChildWindow (void) { + +} + +SfxPopupWindow* LayoutDialogChildWindow::createChildWindow(SfxViewFrame& rViewFrame, ::Window* pParent) +{ + SfxPopupWindow* pWin = 0; + sd::ViewShellBase* pViewShellBase = sd::ViewShellBase::GetViewShellBase( &rViewFrame ); + if( pViewShellBase ) + { + pWin = new SdLayoutDialogContent( *pViewShellBase, pParent ); + } + return pWin; } // ----------------------------------------------------------------------- @@ -143,11 +159,15 @@ static snewfoil_value_info standard[] = // ----------------------------------------------------------------------- -SdLayoutDialogContent::SdLayoutDialogContent( SfxBindings* pInBindings, SfxChildWindow *pCW, Window* pParent, ViewShellBase& rBase) -: SfxDockingWindow(pInBindings, pCW, pParent, SdResId( FLT_WIN_LAYOUT_DIALOG )) +SdLayoutDialogContent::SdLayoutDialogContent( ViewShellBase& rBase, Window* pParent ) +: SfxPopupWindow(SID_ASSIGN_LAYOUT, rBase.GetFrame()->GetTopFrame()->GetFrameInterface(), pParent, SdResId( FLT_WIN_LAYOUT_DIALOG )) , meCurrentLayout( AUTOLAYOUT_NONE ) , mrBase(rBase) { + String sResetSlideLayout( SdResId( STR_RESET_LAYOUT ) ); + + FreeResource(); + // SetHelpId( HID_POPUP_LAYOUT ); const Color aMenuColor( GetSettings().GetStyleSettings().GetMenuColor() ); @@ -194,7 +214,17 @@ SdLayoutDialogContent::SdLayoutDialogContent( SfxBindings* pInBindings, SfxChild mpToolbarMenu->appendEntry( -1, String( SdResId( STR_UNDO_MODIFY_PAGE ) ) ); mpToolbarMenu->appendEntry( 0, mpLayoutSet ); mpToolbarMenu->appendSeparator(); - mpToolbarMenu->appendEntry( 1, String( RTL_CONSTASCII_USTRINGPARAM("Reset Slide Layout") )); + + Reference< XFrame > xFrame( GetFrame(), UNO_QUERY ); + if( xFrame.is() ) + { + Image aImg( ::GetImage( xFrame, OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Undo") ), FALSE, FALSE ) ); + mpToolbarMenu->appendEntry( 1, sResetSlideLayout, aImg); + } + else + { + mpToolbarMenu->appendEntry( 1, sResetSlideLayout); + } SetOutputSizePixel( mpToolbarMenu->getMenuSize() ); mpToolbarMenu->SetOutputSizePixel( GetOutputSizePixel() ); @@ -202,13 +232,15 @@ SdLayoutDialogContent::SdLayoutDialogContent( SfxBindings* pInBindings, SfxChild mpToolbarMenu->Show(); // AddStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AssignLayout" ))); +} - FreeResource(); +SdLayoutDialogContent::~SdLayoutDialogContent() +{ } void SdLayoutDialogContent::Resize (void) { - SfxDockingWindow::Resize(); + SfxPopupWindow::Resize(); mpToolbarMenu->SetPosSizePixel( Point(0,0), GetSizePixel() ); } @@ -247,21 +279,16 @@ void SdLayoutDialogContent::StateChanged( USHORT nSID, SfxItemState eState, cons IMPL_LINK( SdLayoutDialogContent, SelectHdl, void *, pControl ) { -/* if ( IsInPopupMode() ) EndPopupMode(); +/* AutoLayout eLayout = meCurrentLayout; if( pControl == mpLayoutSet ) eLayout = static_cast< AutoLayout >(mpLayoutSet->GetSelectItemId()-1); - const rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:AssignLayout" )); - - Sequence< PropertyValue > aArgs( 1 ); - aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("WhatLayout") ); - aArgs[0].Value <<= static_cast<sal_Int32>(eLayout); - - SfxToolBoxControl::Dispatch( Reference< ::com::sun::star::frame::XDispatchProvider >( mxFrame->getController(), UNO_QUERY ), aCommand, aArgs ); + const SfxUInt32Item aItem(ID_VAL_WHATLAYOUT, eLayout); + GetBindings().GetDispatcher()->Execute(SID_ASSIGN_LAYOUT,SFX_CALLMODE_ASYNCHRON,&aItem,0); */ return 0; } diff --git a/sd/source/ui/dlg/layoutdialog.hrc b/sd/source/ui/dlg/layoutdialog.hrc index 6fd97b2d09cc..c53f5342f2b5 100644 --- a/sd/source/ui/dlg/layoutdialog.hrc +++ b/sd/source/ui/dlg/layoutdialog.hrc @@ -29,3 +29,5 @@ ************************************************************************/ #define FLT_WIN_LAYOUT_DIALOG 795 + +#define STR_RESET_LAYOUT 1 diff --git a/sd/source/ui/dlg/layoutdialog.src b/sd/source/ui/dlg/layoutdialog.src index 21477e8db993..a9a3d315faf0 100644 --- a/sd/source/ui/dlg/layoutdialog.src +++ b/sd/source/ui/dlg/layoutdialog.src @@ -44,5 +44,10 @@ DockingWindow FLT_WIN_LAYOUT_DIALOG Zoomable = TRUE ; Dockable = TRUE ; EnableResizing = TRUE ; + + String STR_RESET_LAYOUT + { + Text[ en-US ] = "Reset Slide Layout"; + }; }; diff --git a/sd/source/ui/inc/layoutdialog.hxx b/sd/source/ui/inc/layoutdialog.hxx index e53cd7944fa4..6dd427901856 100644 --- a/sd/source/ui/inc/layoutdialog.hxx +++ b/sd/source/ui/inc/layoutdialog.hxx @@ -33,6 +33,10 @@ #include <sfx2/childwin.hxx> +class SfxViewFrame; +class ::Window; +class SfxPopupWindow; + namespace sd { class LayoutDialogChildWindow : public SfxChildWindow @@ -42,6 +46,8 @@ public: virtual ~LayoutDialogChildWindow (void); SFX_DECL_CHILDWINDOW(LayerDialogChildWindow); + + static SfxPopupWindow* createChildWindow(SfxViewFrame& rViewFrame, ::Window* pParent); }; } // end of namespace sd diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 7c814ff9d718..865ca7bd21a6 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -101,6 +101,8 @@ #include <strings.hrc> +#include "layoutdialog.hxx" + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -428,30 +430,35 @@ 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)) { - const SfxUInt32Item* pWhatPage = static_cast< const SfxUInt32Item* > ( rReq.GetArg( ID_VAL_WHATPAGE, FALSE, TYPE(SfxUInt32Item) ) ); - const SfxUInt32Item* pWhatLayout = static_cast< const SfxUInt32Item* > ( rReq.GetArg( ID_VAL_WHATLAYOUT, FALSE, TYPE(SfxUInt32Item) ) ); - - if( pWhatLayout ) + if( rReq.GetArgs() ) { - if ( mpDrawView->IsTextEdit() ) - mpDrawView->SdrEndTextEdit(); + const SfxUInt32Item* pWhatPage = static_cast< const SfxUInt32Item* > ( rReq.GetArg( ID_VAL_WHATPAGE, FALSE, TYPE(SfxUInt32Item) ) ); + const SfxUInt32Item* pWhatLayout = static_cast< const SfxUInt32Item* > ( rReq.GetArg( ID_VAL_WHATLAYOUT, FALSE, TYPE(SfxUInt32Item) ) ); - USHORT nPage; - if( pWhatPage ) + if( pWhatLayout ) { - nPage = pWhatPage->GetValue(); - } - else - { - nPage = maTabControl.GetCurPageId() - 1; - } + if ( mpDrawView->IsTextEdit() ) + mpDrawView->SdrEndTextEdit(); - ::sd::ViewShell::mpImpl->AssignLayout(GetDoc()->GetSdPage((USHORT)nPage, mePageKind),(AutoLayout)pWhatLayout->GetValue()); - } + USHORT nPage; + if( pWhatPage ) + { + nPage = pWhatPage->GetValue(); + } + else + { + nPage = maTabControl.GetCurPageId() - 1; + } + + ::sd::ViewShell::mpImpl->AssignLayout(GetDoc()->GetSdPage((USHORT)nPage, mePageKind),(AutoLayout)pWhatLayout->GetValue()); + } + } + else + { + GetViewFrame()->ToggleChildWindow( sd::LayoutDialogChildWindow::GetChildWindowId() ); + } } Cancel(); rReq.Done (); |