diff options
Diffstat (limited to 'sd/source/ui/view')
-rw-r--r-- | sd/source/ui/view/ToolBarManager.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellBase.cxx | 25 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellImplementation.cxx | 7 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellManager.cxx | 61 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob.cxx | 45 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob1.cxx | 83 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 311 | ||||
-rw-r--r-- | sd/source/ui/view/drviews3.cxx | 93 | ||||
-rw-r--r-- | sd/source/ui/view/drviews7.cxx | 7 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsa.cxx | 38 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsf.cxx | 276 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsj.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/view/drvwshrg.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvs2.cxx | 14 | ||||
-rw-r--r-- | sd/source/ui/view/outlnvsh.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/sdview.cxx | 190 | ||||
-rw-r--r-- | sd/source/ui/view/viewshel.cxx | 101 |
17 files changed, 1210 insertions, 59 deletions
diff --git a/sd/source/ui/view/ToolBarManager.cxx b/sd/source/ui/view/ToolBarManager.cxx index 578561a3fa27..c5be674a8b3c 100644 --- a/sd/source/ui/view/ToolBarManager.cxx +++ b/sd/source/ui/view/ToolBarManager.cxx @@ -1199,7 +1199,7 @@ void ToolBarRules::MainViewShellChanged (ViewShell::ShellType nShellType) case ViewShell::ST_NONE: case ViewShell::ST_PRESENTATION: - case ViewShell::ST_TASK_PANE: + case ViewShell::ST_SIDEBAR: default: break; } diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 09006ed1f38e..3348c198ff76 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -54,7 +54,7 @@ #include "PresentationViewShell.hxx" #include "FormShellManager.hxx" #include "ToolBarManager.hxx" -#include "taskpane/PanelId.hxx" +#include "SidebarPanelId.hxx" #include "Window.hxx" #include "framework/ConfigurationController.hxx" #include "DocumentRenderer.hxx" @@ -697,13 +697,6 @@ void ViewShellBase::Execute (SfxRequest& rRequest) framework::FrameworkHelper::msSlideSorterURL); break; - case SID_TASKPANE: - mpImpl->SetPaneVisibility( - rRequest, - framework::FrameworkHelper::msRightPaneURL, - framework::FrameworkHelper::msTaskPaneURL); - break; - case SID_NORMAL_MULTI_PANE_GUI: case SID_SLIDE_SORTER_MULTI_PANE_GUI: case SID_DRAWINGMODE: @@ -1394,11 +1387,6 @@ void ViewShellBase::Implementation::GetSlotState (SfxItemSet& rSet) xContext, FrameworkHelper::msLeftDrawPaneURL); break; - case SID_TASKPANE: - xResourceId = ResourceId::create( - xContext, FrameworkHelper::msRightPaneURL); - break; - case SID_NORMAL_MULTI_PANE_GUI: xResourceId = ResourceId::createWithAnchorURL( xContext, @@ -1497,8 +1485,7 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) { // Set the visibility state of the toolpanel and one of its top // level panels. - toolpanel::PanelId nPanelId ( - toolpanel::PID_UNKNOWN); + sidebar::PanelId nPanelId (sidebar::PID_UNKNOWN); bool bPanelIdGiven = false; // Extract the given arguments. @@ -1511,9 +1498,7 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) ID_VAL_PANEL_INDEX, sal_False); if (pPanelId != NULL) { - nPanelId = static_cast< - toolpanel::PanelId>( - pPanelId->GetValue()); + nPanelId = static_cast<sidebar::PanelId>(pPanelId->GetValue()); bPanelIdGiven = true; } } @@ -1522,11 +1507,11 @@ void ViewShellBase::Implementation::ProcessTaskPaneSlot (SfxRequest& rRequest) // Ignore the request for some combinations of panels and view // shell types. if (bPanelIdGiven - && ! (nPanelId==toolpanel::PID_LAYOUT + && ! (nPanelId==sidebar::PID_LAYOUT && mrBase.GetMainViewShell()!=NULL && mrBase.GetMainViewShell()->GetShellType()==ViewShell::ST_OUTLINE)) { - framework::FrameworkHelper::Instance(mrBase)->RequestTaskPanel( + framework::FrameworkHelper::Instance(mrBase)->RequestSidebarPanel( framework::FrameworkHelper::msLayoutTaskPanelURL); } } diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx index cea72846ce1d..84c31813b5d8 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -40,7 +40,7 @@ #include "FrameView.hxx" #include "DrawViewShell.hxx" #include "ViewShellHint.hxx" -#include "taskpane/PanelId.hxx" +#include "SidebarPanelId.hxx" #include "framework/FrameworkHelper.hxx" #include <sfx2/bindings.hxx> @@ -126,8 +126,7 @@ void ViewShell::Implementation::ProcessModifyPageSlot ( // Make the layout menu visible in the tool pane. SfxBoolItem aMakeToolPaneVisible (ID_VAL_ISVISIBLE, sal_True); - SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX, - ::sd::toolpanel::PID_LAYOUT); + SfxUInt32Item aPanelId (ID_VAL_PANEL_INDEX, sidebar::PID_LAYOUT); SfxViewFrame* pFrame = mrViewShell.GetViewFrame(); if (pFrame!=NULL && pFrame->GetDispatcher()!=NULL) { @@ -331,7 +330,7 @@ sal_uInt16 ViewShell::Implementation::GetViewId (void) // Since we have to return a view id for every possible shell type // and there is not (yet) a proper ViewShellBase sub class for the // remaining types we chose the Impress factory as a fall back. - case ViewShell::ST_TASK_PANE: + case ViewShell::ST_SIDEBAR: case ViewShell::ST_NONE: default: return IMPRESS_FACTORY_ID; diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx index 109da58163c0..a6393d8a523d 100644 --- a/sd/source/ui/view/ViewShellManager.cxx +++ b/sd/source/ui/view/ViewShellManager.cxx @@ -53,6 +53,8 @@ public: SfxShell* mpShell; ShellId mnId; ViewShellManager::SharedShellFactory mpFactory; + bool mbIsListenerAddedToWindow; + ShellDescriptor (); ShellDescriptor (SfxShell* pShell, ShellId nId); ShellDescriptor (const ShellDescriptor& rDescriptor); @@ -233,7 +235,7 @@ private: ShellId nShellId, ::Window* pParentWindow, FrameView* pFrameView); - void DestroyViewShell (const ShellDescriptor& rDescriptor); + void DestroyViewShell (ShellDescriptor& rDescriptor); void DestroySubShell ( const SfxShell& rViewShell, const ShellDescriptor& rDescriptor); @@ -511,8 +513,11 @@ void ViewShellManager::Implementation::ActivateViewShell (ViewShell* pViewShell) { ::Window* pWindow = aResult.GetWindow(); if (pWindow != NULL) + { pWindow->AddEventListener( LINK(this, ViewShellManager::Implementation, WindowEventHandler)); + aResult.mbIsListenerAddedToWindow = true; + } else { DBG_ASSERT(false, @@ -1160,6 +1165,23 @@ IMPL_LINK(ViewShellManager::Implementation, WindowEventHandler, VclWindowEvent*, case VCLEVENT_WINDOW_LOSEFOCUS: break; + + case VCLEVENT_OBJECT_DYING: + // Remember that we do not have to remove the window + // listener for this window. + for (ActiveShellList::iterator + iShell(maActiveViewShells.begin()), + iEnd(maActiveViewShells.end()); + iShell!=iEnd; + ++iShell) + { + if (iShell->GetWindow() == pEventWindow) + { + iShell->mbIsListenerAddedToWindow = false; + break; + } + } + break; } } return sal_True; @@ -1204,15 +1226,19 @@ ShellDescriptor ViewShellManager::Implementation::CreateSubShell ( void ViewShellManager::Implementation::DestroyViewShell ( - const ShellDescriptor& rDescriptor) + ShellDescriptor& rDescriptor) { OSL_ASSERT(rDescriptor.mpShell != NULL); - ::Window* pWindow = rDescriptor.GetWindow(); - if (pWindow != NULL) + if (rDescriptor.mbIsListenerAddedToWindow) { - pWindow->RemoveEventListener( - LINK(this, ViewShellManager::Implementation, WindowEventHandler)); + rDescriptor.mbIsListenerAddedToWindow = false; + ::Window* pWindow = rDescriptor.GetWindow(); + if (pWindow != NULL) + { + pWindow->RemoveEventListener( + LINK(this, ViewShellManager::Implementation, WindowEventHandler)); + } } // Destroy the sub shell factories. @@ -1374,7 +1400,8 @@ namespace { ShellDescriptor::ShellDescriptor (void) : mpShell(NULL), mnId(0), - mpFactory() + mpFactory(), + mbIsListenerAddedToWindow(false) { } @@ -1386,7 +1413,8 @@ ShellDescriptor::ShellDescriptor ( ShellId nId) : mpShell(pShell), mnId(nId), - mpFactory() + mpFactory(), + mbIsListenerAddedToWindow(false) { } @@ -1394,9 +1422,10 @@ ShellDescriptor::ShellDescriptor ( ShellDescriptor::ShellDescriptor (const ShellDescriptor& rDescriptor) - : mpShell(rDescriptor.mpShell), - mnId(rDescriptor.mnId), - mpFactory(rDescriptor.mpFactory) + : mpShell(rDescriptor.mpShell), + mnId(rDescriptor.mnId), + mpFactory(rDescriptor.mpFactory), + mbIsListenerAddedToWindow(rDescriptor.mbIsListenerAddedToWindow) { } @@ -1405,9 +1434,13 @@ ShellDescriptor::ShellDescriptor (const ShellDescriptor& rDescriptor) ShellDescriptor& ShellDescriptor::operator= (const ShellDescriptor& rDescriptor) { - mpShell = rDescriptor.mpShell; - mnId = rDescriptor.mnId; - mpFactory = rDescriptor.mpFactory; + if (this != &rDescriptor) + { + mpShell = rDescriptor.mpShell; + mnId = rDescriptor.mnId; + mpFactory = rDescriptor.mpFactory; + mbIsListenerAddedToWindow = rDescriptor.mbIsListenerAddedToWindow; + } return *this; } diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index f285f815ad96..d65fa4320775 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -30,6 +30,7 @@ #include <editeng/editeng.hxx> #include <editeng/outliner.hxx> #include <editeng/unolingu.hxx> +#include <editeng/kernitem.hxx> #include <vcl/vclenum.hxx> #include <sfx2/app.hxx> #include <svl/whiter.hxx> @@ -128,10 +129,30 @@ TextObjectBar::~TextObjectBar() SetRepeatTarget(NULL); } +void TextObjectBar::GetCharState( SfxItemSet& rSet ) +{ + SfxItemSet aCharAttrSet( mpView->GetDoc().GetPool() ); + mpView->GetAttributes( aCharAttrSet ); + + SfxItemSet aNewAttr( mpViewShell->GetPool(),EE_ITEMS_START,EE_ITEMS_END); + + aNewAttr.Put(aCharAttrSet, sal_False); + rSet.Put(aNewAttr, sal_False); + + SvxKerningItem aKern = ( (const SvxKerningItem&) aCharAttrSet.Get( EE_CHAR_KERNING ) ); + //aKern.SetWhich(SID_ATTR_CHAR_KERNING); + rSet.Put(aKern); + + SfxItemState eState = aCharAttrSet.GetItemState( EE_CHAR_KERNING, sal_True ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_CHAR_KERNING); + } +} + /** * Status of attribute items. */ - void TextObjectBar::GetAttrState( SfxItemSet& rSet ) { SfxWhichIter aIter( rSet ); @@ -155,6 +176,8 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) case SID_ATTR_CHAR_FONTHEIGHT: case SID_ATTR_CHAR_WEIGHT: case SID_ATTR_CHAR_POSTURE: + case SID_ATTR_CHAR_SHADOWED: + case SID_ATTR_CHAR_STRIKEOUT: { sal_uInt16 stretchX = 100; sal_uInt16 stretchY = 100; @@ -452,6 +475,8 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) } // paragraph justification + SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) ); + rSet.Put(aLR); SvxAdjust eAdj = ( (const SvxAdjustItem&) aAttrSet.Get( EE_PARA_JUST ) ).GetAdjust(); switch( eAdj ) { @@ -471,6 +496,13 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) break; } + Invalidate(SID_ATTR_PARA_ADJUST_LEFT); + Invalidate(SID_ATTR_PARA_ADJUST_CENTER); + Invalidate(SID_ATTR_PARA_ADJUST_RIGHT); + Invalidate(SID_ATTR_PARA_ADJUST_BLOCK); + Invalidate(SID_ATTR_PARA_LINESPACE); + Invalidate(SID_ATTR_PARA_ULSPACE); + // paragraph text direction if( bDisableParagraphTextDirection ) { @@ -519,6 +551,17 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) } } + SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrSet.Get( EE_PARA_LRSPACE ) ); + aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE); + rSet.Put(aLRSpace); + Invalidate(SID_ATTR_PARA_LRSPACE); + //Added by xuxu + SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_LRSPACE); + rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE); + } sal_uInt16 nLineSpace = (sal_uInt16) ( (const SvxLineSpacingItem&) aAttrSet. Get( EE_PARA_SBL ) ).GetPropLineSpace(); switch( nLineSpace ) diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 9d5cf273e53e..04137a3ee153 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -228,6 +228,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) break; case SID_OUTLINE_LEFT: + case SID_ATTR_PARA_LEFT: { if (pOLV) { @@ -243,6 +244,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) break; case SID_OUTLINE_RIGHT: + case SID_ATTR_PARA_RIGHT: { if (pOLV) { @@ -257,6 +259,22 @@ void TextObjectBar::Execute( SfxRequest &rReq ) } break; + case SID_ATTR_PARA_LRSPACE: + { + sal_uInt16 nSpaceSlot = SID_ATTR_PARA_LRSPACE; + SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get( + GetPool().GetWhich(nSpaceSlot)); + + SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); + aLRSpace.SetWhich( EE_PARA_LRSPACE ); + + aEditAttr.Put( aLRSpace ); + mpView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_LRSPACE); + } + break; + case SID_OUTLINE_UP: { if (pOLV) @@ -558,6 +576,71 @@ void TextObjectBar::Execute( SfxRequest &rReq ) rReq.Done( aNewAttr ); pArgs = rReq.GetArgs(); } + else if (nSlot == SID_ATTR_PARA_ADJUST_LEFT || + nSlot == SID_ATTR_PARA_ADJUST_CENTER || + nSlot == SID_ATTR_PARA_ADJUST_RIGHT || + nSlot == SID_ATTR_PARA_ADJUST_BLOCK) + { + switch( nSlot ) + { + case SID_ATTR_PARA_ADJUST_LEFT: + { + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) ); + } + break; + case SID_ATTR_PARA_ADJUST_CENTER: + { + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) ); + } + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + { + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) ); + } + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + { + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) ); + } + break; + } + rReq.Done( aNewAttr ); + pArgs = rReq.GetArgs(); + } + else if(nSlot == SID_ATTR_CHAR_KERNING) + { + aNewAttr.Put(pArgs->Get(pArgs->GetPool()->GetWhich(nSlot))); + rReq.Done( aNewAttr ); + pArgs = rReq.GetArgs(); + } + else if(nSlot == SID_SET_SUPER_SCRIPT ) + { + SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT ); + aNewAttr.Put( aItem ); + rReq.Done( aNewAttr ); + pArgs = rReq.GetArgs(); + } + else if( nSlot == SID_SET_SUB_SCRIPT ) + { + SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + + if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT ); + aNewAttr.Put( aItem ); + rReq.Done( aNewAttr ); + pArgs = rReq.GetArgs(); + } mpView->SetAttributes(*pArgs); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index de3c663c994f..e5c12ca7dbee 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -83,6 +83,26 @@ #include <vcl/svapp.hxx> #include <vcl/waitobj.hxx> +#include <editeng/escapementitem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/crossedoutitem.hxx> +#include <editeng/contouritem.hxx> +#include <editeng/shdditem.hxx> +#include <svx/xtable.hxx> +#include <svx/svdobj.hxx> +#include <editeng/outlobj.hxx> +#include <editeng/flstitem.hxx> +#include <editeng/scripttypeitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/brushitem.hxx> + +#include <svl/whiter.hxx> + #include "app.hrc" #include "glob.hrc" #include "strings.hrc" @@ -131,6 +151,7 @@ #include "futransf.hxx" #include "futxtatt.hxx" #include "fuvect.hxx" +#include "futext.hxx" #include "fuzoom.hxx" #include "helpids.h" #include "optsitem.hxx" @@ -237,12 +258,19 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: case SID_ATTR_FILL_SHADOW: + case SID_ATTR_FILL_TRANSPARENCE: + case SID_ATTR_FILL_FLOATTRANSPARENCE: case SID_ATTR_LINE_STYLE: case SID_ATTR_LINE_DASH: case SID_ATTR_LINE_WIDTH: case SID_ATTR_LINE_COLOR: case SID_ATTR_LINEEND_STYLE: + case SID_ATTR_LINE_START: + case SID_ATTR_LINE_END: + case SID_ATTR_LINE_TRANSPARENCE: + case SID_ATTR_LINE_JOINT: + case SID_ATTR_LINE_CAP: case SID_ATTR_TEXT_FITTOSIZE: { @@ -389,12 +417,17 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) case SID_ATTR_FILL_GRADIENT: case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: + case SID_ATTR_FILL_TRANSPARENCE: + case SID_ATTR_FILL_FLOATTRANSPARENCE: GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA, SFX_CALLMODE_ASYNCHRON ); break; case SID_ATTR_LINE_STYLE: case SID_ATTR_LINE_DASH: case SID_ATTR_LINE_WIDTH: case SID_ATTR_LINE_COLOR: + case SID_ATTR_LINE_TRANSPARENCE: + case SID_ATTR_LINE_JOINT: + case SID_ATTR_LINE_CAP: GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE, SFX_CALLMODE_ASYNCHRON ); break; case SID_ATTR_TEXT_FITTOSIZE: @@ -1143,6 +1176,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: // BASIC { SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); @@ -1157,7 +1191,25 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } break; + case FN_NUM_BULLET_ON: + { + // The value (sal_uInt16)0xFFFF means set bullet on/off. + SfxUInt16Item aItem(FN_SVX_SET_BULLET, (sal_uInt16)0xFFFF); + GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_BULLET, SFX_CALLMODE_RECORD, &aItem, 0L ); + } + break; + + case FN_NUM_NUMBERING_ON: + { + // The value (sal_uInt16)0xFFFF means set bullet on/off. + SfxUInt16Item aItem(FN_SVX_SET_NUMBER, (sal_uInt16)0xFFFF); + GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_NUMBER, SFX_CALLMODE_RECORD, &aItem, 0L ); + } + break; + case SID_OUTLINE_BULLET: + case FN_SVX_SET_BULLET: + case FN_SVX_SET_NUMBER: { SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); Cancel(); @@ -2467,6 +2519,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) break; case SID_HORIZONTAL: // BASIC + case SID_FLIP_HORIZONTAL: { mpDrawView->MirrorAllMarkedHorizontal(); Cancel(); @@ -2475,6 +2528,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) break; case SID_VERTICAL: // BASIC + case SID_FLIP_VERTICAL: { mpDrawView->MirrorAllMarkedVertical(); Cancel(); @@ -2766,7 +2820,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { // Make the slide transition panel visible (expand it) in the // tool pane. - framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel( + framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel( framework::FrameworkHelper::msCustomAnimationTaskPanelURL); Cancel(); @@ -2778,7 +2832,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { // Make the slide transition panel visible (expand it) in the // tool pane. - framework::FrameworkHelper::Instance(GetViewShellBase())->RequestTaskPanel( + framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel( framework::FrameworkHelper::msSlideTransitionTaskPanelURL); Cancel(); @@ -2945,6 +2999,177 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } } +void DrawViewShell::ExecChar( SfxRequest &rReq ) +{ + SdDrawDocument* pDoc = GetDoc(); + if (!pDoc || !mpDrawView) + return; + + SfxItemSet aEditAttr( pDoc->GetPool() ); + mpDrawView->GetAttributes( aEditAttr ); + + //modified by wj for sym2_1580, if put old itemset into new set, + //when mpDrawView->SetAttributes(aNewAttr) it will invalidate all the item + // and use old attr to update all the attributes +// SfxItemSet aNewAttr( GetPool(), +// EE_ITEMS_START, EE_ITEMS_END ); +// aNewAttr.Put( aEditAttr, sal_False ); + SfxItemSet aNewAttr( pDoc->GetPool() ); + //modified end + + sal_uInt16 nSId = rReq.GetSlot(); + + MapSlot( nSId ); + + switch ( nSId ) + { + case SID_ATTR_CHAR_FONT: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxFontItem, SID_ATTR_CHAR_FONT , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_FONTHEIGHT: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxFontHeightItem, SID_ATTR_CHAR_FONTHEIGHT , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_WEIGHT: + if( rReq.GetArgs() ) + { + //const SvxWeightItem *pItem = (const SvxWeightItem*) rReq.GetArg( SID_ATTR_CHAR_WEIGHT, sal_False, TYPE(SvxWeightItem) ); + SFX_REQUEST_ARG( rReq, pItem, SvxWeightItem, SID_ATTR_CHAR_WEIGHT , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_POSTURE: + if( rReq.GetArgs() ) + { + //const SvxPostureItem *pItem = (const SvxPostureItem*) rReq.GetArg( SID_ATTR_CHAR_POSTURE, sal_False, TYPE(SvxPostureItem) ); + SFX_REQUEST_ARG( rReq, pItem, SvxPostureItem, SID_ATTR_CHAR_POSTURE , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_UNDERLINE: + if( rReq.GetArgs() ) + { + //<<modify by wj for sym2_1873 + //SFX_REQUEST_ARG( rReq, pItem, SvxTextLineItem, SID_ATTR_CHAR_UNDERLINE , sal_False ); + SFX_REQUEST_ARG( rReq, pItem, SvxUnderlineItem, SID_ATTR_CHAR_UNDERLINE , sal_False ); + //end>> + if (pItem) + { + aNewAttr.Put(*pItem); + } + else + { + FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle(); + aNewAttr.Put( SvxUnderlineItem( eFU != UNDERLINE_NONE ?UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE ) ); + }//aNewAttr.Put( (const SvxUnderlineItem&)aEditAttr.Get( EE_CHAR_UNDERLINE ) ); + } + break; + case SID_ATTR_CHAR_SHADOWED: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxShadowedItem, SID_ATTR_CHAR_SHADOWED , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_STRIKEOUT: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxCrossedOutItem, SID_ATTR_CHAR_STRIKEOUT , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_COLOR: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxColorItem, SID_ATTR_CHAR_COLOR , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_ATTR_CHAR_KERNING: + if( rReq.GetArgs() ) + { + SFX_REQUEST_ARG( rReq, pItem, SvxKerningItem, SID_ATTR_CHAR_KERNING , sal_False ); + if (pItem) + { + aNewAttr.Put(*pItem); + } + } + break; + case SID_SET_SUB_SCRIPT: + if( rReq.GetArgs() ) + { + SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT ); + SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT ); + aNewAttr.Put( aItem ); + } + break; + case SID_SET_SUPER_SCRIPT: + if( rReq.GetArgs() ) + { + SvxEscapementItem aItem( EE_CHAR_ESCAPEMENT ); + SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT ); + aNewAttr.Put( aItem ); + } + break; + case SID_SHRINK_FONT_SIZE: + case SID_GROW_FONT_SIZE: + //if (rReq.GetArgs()) + { + const SvxFontListItem* pFonts = dynamic_cast<const SvxFontListItem*>(GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); + const FontList* pFontList = pFonts->GetFontList(); + if( pFontList ) + { + FuText::ChangeFontSize( nSId == SID_GROW_FONT_SIZE, NULL, pFontList, mpView ); + GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); + } + } + default: + ; + } + + mpDrawView->SetAttributes(aNewAttr); + rReq.Done(); + Cancel(); +} + /** This method consists basically of three parts: 1. Process the arguments of the SFX request. 2. Use the model to create a new page or duplicate an existing one. @@ -2968,6 +3193,88 @@ SdPage* DrawViewShell::CreateOrDuplicatePage ( return pNewPage; } +void DrawViewShell::ExecutePropPanelAttr (SfxRequest& rReq) +{ + if(SlideShow::IsRunning( GetViewShellBase() )) + return; + + SdDrawDocument* pDoc = GetDoc(); + if (!pDoc || !mpDrawView) + return; + + sal_uInt16 nSId = rReq.GetSlot(); + SfxItemSet aAttrs( pDoc->GetPool() ); + + switch ( nSId ) + { + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: + SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP; + if (nSId == SID_TABLE_VERT_CENTER) + eTVA = SDRTEXTVERTADJUST_CENTER; + else if (nSId == SID_TABLE_VERT_BOTTOM) + eTVA = SDRTEXTVERTADJUST_BOTTOM; + + aAttrs.Put( SdrTextVertAdjustItem(eTVA) ); + mpDrawView->SetAttributes(aAttrs); + + break; + } +} + +void DrawViewShell::GetStatePropPanelAttr(SfxItemSet& rSet) +{ + SfxWhichIter aIter( rSet ); + sal_uInt16 nWhich = aIter.FirstWhich(); + + SdDrawDocument* pDoc = GetDoc(); + if (!pDoc || !mpDrawView) + return; + + SfxItemSet aAttrs( pDoc->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + while ( nWhich ) + { + sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich) + ? GetPool().GetSlotId(nWhich) + : nWhich; + switch ( nSlotId ) + { + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: + sal_Bool bContour = sal_False; + SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME ); + if( eConState != SFX_ITEM_DONTCARE ) + { + bContour = ( ( const SdrTextContourFrameItem& )aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue(); + } + if (bContour) break; + + SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ); + //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ); + + //if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState) + if(SFX_ITEM_DONTCARE != eVState) + { + SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue(); + sal_Bool bSet = (nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP) || + (nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER) || + (nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM); + rSet.Put(SfxBoolItem(nSlotId, bSet)); + } + else + { + rSet.Put(SfxBoolItem(nSlotId, sal_False)); + } + break; + } + nWhich = aIter.NextWhich(); + } +} + } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx index 3b533be70a3a..04bd60741427 100644 --- a/sd/source/ui/view/drviews3.cxx +++ b/sd/source/ui/view/drviews3.cxx @@ -26,6 +26,7 @@ #include <editeng/lrspitem.hxx> #include <editeng/protitem.hxx> #include <editeng/frmdiritem.hxx> +#include <editeng/adjustitem.hxx> #include <svx/ruler.hxx> #include <editeng/numitem.hxx> #include <svx/rulritem.hxx> @@ -82,7 +83,8 @@ #include <com/sun/star/drawing/framework/XConfigurationController.hpp> #include <com/sun/star/drawing/framework/XConfiguration.hpp> #include <com/sun/star/frame/XFrame.hpp> - +#include <editeng/lspcitem.hxx> +#include <editeng/ulspitem.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::drawing::framework; using ::com::sun::star::frame::XFrame; @@ -647,8 +649,97 @@ void DrawViewShell::ExecRuler(SfxRequest& rReq) break; } + case SID_ATTR_PARA_LINESPACE: + { + sal_uInt16 nSlot = SID_ATTR_PARA_LINESPACE; + SvxLineSpacingItem aParaLineSP = (const SvxLineSpacingItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + + SfxItemSet aEditAttr( GetPool(), EE_PARA_SBL, EE_PARA_SBL ); + aParaLineSP.SetWhich( EE_PARA_SBL ); + + aEditAttr.Put( aParaLineSP ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_LINESPACE); + } + break; + case SID_ATTR_PARA_ADJUST_LEFT: + { + SvxAdjustItem aItem( SVX_ADJUST_LEFT, EE_PARA_JUST ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST ); + + aEditAttr.Put( aItem ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ADJUST_LEFT); + } + break; + case SID_ATTR_PARA_ADJUST_CENTER: + { + SvxAdjustItem aItem( SVX_ADJUST_CENTER, EE_PARA_JUST ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST ); + + aEditAttr.Put( aItem ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ADJUST_CENTER); + } + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + { + SvxAdjustItem aItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST ); + + aEditAttr.Put( aItem ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ADJUST_RIGHT); + } + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + { + SvxAdjustItem aItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_JUST, EE_PARA_JUST ); + + aEditAttr.Put( aItem ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ADJUST_BLOCK); + } + break; + case SID_ATTR_PARA_ULSPACE: + { + sal_uInt16 nSlot = SID_ATTR_PARA_ULSPACE; + SvxULSpaceItem aULSP = (const SvxULSpaceItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + SfxItemSet aEditAttr( GetPool(), EE_PARA_ULSPACE, EE_PARA_ULSPACE ); + aULSP.SetWhich( EE_PARA_ULSPACE ); + + aEditAttr.Put( aULSP ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_ULSPACE); + } + break; + case SID_ATTR_PARA_LRSPACE: { + sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE; + SvxLRSpaceItem aLRSpace = (const SvxLRSpaceItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + + SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); + aLRSpace.SetWhich( EE_PARA_LRSPACE ); + + aEditAttr.Put( aLRSpace ); + mpDrawView->SetAttributes( aEditAttr ); + + Invalidate(SID_ATTR_PARA_LRSPACE); + break; + } + case SID_ATTR_LRSPACE: + { if( mpDrawView->IsTextEdit() ) { sal_uInt16 nId = SID_ATTR_PARA_LRSPACE; diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index d3651b09568e..5579fe337118 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -203,6 +203,11 @@ IMPL_LINK( DrawViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper return 0; } +void DrawViewShell::GetDrawAttrState(SfxItemSet& rSet) +{ + SfxItemSet aSet( mpDrawView->GetGeoAttrFromMarked() ); + rSet.Put(aSet,sal_False); +} void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { @@ -503,6 +508,8 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { rSet.DisableItem( SID_HORIZONTAL ); rSet.DisableItem( SID_VERTICAL ); + rSet.DisableItem( SID_FLIP_HORIZONTAL ); + rSet.DisableItem( SID_FLIP_VERTICAL ); } if( !mpDrawView->IsMirrorAllowed() ) diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 840979562272..cad4da25a7e8 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -49,6 +49,7 @@ #include <svx/fmshell.hxx> #include <svtools/cliplistener.hxx> #include <svx/float3d.hxx> +#include <svx/sidebar/SelectionAnalyzer.hxx> #include "helpids.h" #include "view/viewoverlaymanager.hxx" @@ -69,10 +70,14 @@ #include "slideshow.hxx" #include "ToolBarManager.hxx" #include "annotationmanager.hxx" +#include "DrawController.hxx" + +#include <boost/bind.hpp> using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using sfx2::sidebar::EnumContext; namespace sd { @@ -115,22 +120,31 @@ void SAL_CALL ScannerEventListener::disposing( const lang::EventObject& rEventOb DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, ::Window* pParentWindow, PageKind ePageKind, FrameView* pFrameViewArgument ) -: ViewShell (pFrame, pParentWindow, rViewShellBase) -, maTabControl(this, pParentWindow) -, mbIsLayerModeActive(false) -, mbIsInSwitchPage(false) + : ViewShell (pFrame, pParentWindow, rViewShellBase) + , maTabControl(this, pParentWindow) + , mbIsLayerModeActive(false) + , mbIsInSwitchPage(false) + , mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler( + ::boost::bind(&DrawViewShell::GetContextForSelection, this), + uno::Reference<frame::XController>(&rViewShellBase.GetDrawController()), + sfx2::sidebar::EnumContext::Context_Default)) { if (pFrameViewArgument != NULL) mpFrameView = pFrameViewArgument; else mpFrameView = new FrameView(GetDoc()); Construct(GetDocSh(), ePageKind); + + mpSelectionChangeHandler->Connect(); + doShow(); } DrawViewShell::~DrawViewShell() { + mpSelectionChangeHandler->Disconnect(); + mpAnnotationManager.reset(); mpViewOverlayManager.reset(); @@ -810,6 +824,22 @@ void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet ) } +EnumContext::Context DrawViewShell::GetContextForSelection (void) const +{ + if (mpDrawView->GetMarkedObjectList().GetMarkCount() == 1) + if (mpDrawView->GetTextEditObject() != NULL) + if (mpDrawView->GetTextEditOutlinerView() != NULL) + return EnumContext::Context_DrawText; + + // All other cases are handled by the SelectionAnalyzer. + return ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SD( + mpDrawView->GetMarkedObjectList(), + meEditMode == EM_MASTERPAGE, + mePageKind == PK_HANDOUT, + mePageKind == PK_NOTES); +} + + } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index f1e04babdc82..4989cd2a5a07 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -58,6 +58,16 @@ #include "cfgids.hxx" #include "anminfo.hxx" +#include <editeng/lspcitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/escapementitem.hxx> +#include <editeng/numitem.hxx> +#include <editeng/adjustitem.hxx> +#include <svx/nbdtmgfact.hxx> +#include <svx/nbdtmg.hxx> + +using namespace svx::sidebar; using namespace ::com::sun::star; namespace sd { @@ -277,17 +287,133 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) : nWhich; switch ( nSlotId ) { + case SID_ATTR_PARA_ADJUST_LEFT: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) ); + SvxAdjust eAdj = aItem.GetAdjust(); + if ( eAdj == SVX_ADJUST_LEFT) + { + rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) ); + } + + bAttr = sal_True; + + Invalidate(nSlotId); + } + break; + case SID_ATTR_PARA_ADJUST_CENTER: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) ); + SvxAdjust eAdj = aItem.GetAdjust(); + if ( eAdj == SVX_ADJUST_CENTER) + { + rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) ); + } + + bAttr = sal_True; + + Invalidate(nSlotId); + } + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) ); + SvxAdjust eAdj = aItem.GetAdjust(); + if ( eAdj == SVX_ADJUST_RIGHT) + { + rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) ); + } + + bAttr = sal_True; + + Invalidate(nSlotId); + } + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + + SvxAdjustItem aItem= ( (const SvxAdjustItem&) aAttrs.Get( EE_PARA_JUST ) ); + SvxAdjust eAdj = aItem.GetAdjust(); + if ( eAdj == SVX_ADJUST_BLOCK) + { + rSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) ); + } + + bAttr = sal_True; + + Invalidate(nSlotId); + } + break; + case SID_ATTR_PARA_LRSPACE: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrs.Get( EE_PARA_LRSPACE ) ); + aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE); + rSet.Put(aLRSpace); + bAttr = sal_True; + Invalidate(SID_ATTR_PARA_LRSPACE); + } + break; + case SID_ATTR_PARA_LINESPACE: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + SvxLineSpacingItem aLineLR = ( (const SvxLineSpacingItem&) aAttrs.Get( EE_PARA_SBL ) ); + rSet.Put(aLineLR); + bAttr = sal_True; + Invalidate(SID_ATTR_PARA_LINESPACE); + } + break; + case SID_ATTR_PARA_ULSPACE: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + SvxULSpaceItem aULSP = ( (const SvxULSpaceItem&) aAttrs.Get( EE_PARA_ULSPACE ) ); + aULSP.SetWhich(SID_ATTR_PARA_ULSPACE); + rSet.Put(aULSP); + bAttr = sal_True; + Invalidate(SID_ATTR_PARA_ULSPACE); + } + break; case SID_ATTR_FILL_STYLE: case SID_ATTR_FILL_COLOR: case SID_ATTR_FILL_GRADIENT: case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: case SID_ATTR_FILL_SHADOW: + case SID_ATTR_FILL_TRANSPARENCE: + case SID_ATTR_FILL_FLOATTRANSPARENCE: case SID_ATTR_LINE_STYLE: case SID_ATTR_LINE_DASH: case SID_ATTR_LINE_WIDTH: case SID_ATTR_LINE_COLOR: + case SID_ATTR_LINE_TRANSPARENCE: + case SID_ATTR_LINE_JOINT: + case SID_ATTR_LINE_CAP: case SID_ATTR_TEXT_FITTOSIZE: + case SID_ATTR_CHAR_FONT: + case SID_ATTR_CHAR_FONTHEIGHT: + case SID_ATTR_CHAR_SHADOWED: + case SID_ATTR_CHAR_POSTURE: + case SID_ATTR_CHAR_UNDERLINE: + case SID_ATTR_CHAR_STRIKEOUT: + case SID_ATTR_CHAR_WEIGHT: + case SID_ATTR_CHAR_COLOR: + case SID_ATTR_CHAR_KERNING: + case SID_SET_SUB_SCRIPT: + case SID_SET_SUPER_SCRIPT: { bAttr = sal_True; } @@ -427,6 +553,118 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) } } break; + case FN_BUL_NUM_RULE_INDEX: + case FN_NUM_NUM_RULE_INDEX: + { + SfxItemSet aEditAttr( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aEditAttr ); + + SfxItemSet aNewAttr( GetPool(), EE_ITEMS_START, EE_ITEMS_END ); + aNewAttr.Put( aEditAttr, sal_False ); + + + sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF; + SvxNumRule* pNumRule = NULL; + const SfxPoolItem* pTmpItem=NULL; + sal_uInt16 nNumItemId = SID_ATTR_NUMBERING_RULE; + + //if(SFX_ITEM_SET == aNewAttr.GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pTmpItem)) + // nActNumLvl = ((const SfxUInt16Item*)pTmpItem)->GetValue(); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE)); + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE)); + nActNumLvl = mpDrawView->GetSelectionLevel(); + pTmpItem=GetNumBulletItem(aNewAttr, nNumItemId); + + if (pTmpItem) + pNumRule = new SvxNumRule(*((SvxNumBulletItem*)pTmpItem)->GetNumRule()); + + if ( pNumRule ) + { + sal_uInt16 nMask = 1; + sal_uInt16 nCount = 0; + sal_uInt16 nCurLevel = (sal_uInt16)0xFFFF; + for(sal_uInt16 i = 0; i < pNumRule->GetLevelCount(); i++) + { + if(nActNumLvl & nMask) + { + nCount++; + nCurLevel = i; + } + nMask <<= 1; + } + if ( nCount == 1 ) + { + sal_Bool bBullets = sal_False; + const SvxNumberFormat* pNumFmt = pNumRule->Get(nCurLevel); + if ( pNumFmt ) + { + switch(pNumFmt->GetNumberingType()) + { + case SVX_NUM_CHAR_SPECIAL: + case SVX_NUM_BITMAP: + bBullets = sal_True; + break; + + default: + bBullets = sal_False; + } + + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF)); + if ( bBullets ) + { + NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); + if ( pBullets ) + { + sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(*pNumRule,nActNumLvl); + rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex)); + } + }else + { + NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING); + if ( pNumbering ) + { + sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(*pNumRule,nActNumLvl); + rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex)); + } + } + } + } + } + } + break; + //End + // Added by Li Hui for story 179. + case FN_NUM_BULLET_ON: + case FN_NUM_NUMBERING_ON: + { + sal_Bool bEnable = sal_False; + const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); + const sal_uInt32 nMarkCount = rMarkList.GetMarkCount(); + for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++) + { + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(rMarkList.GetMark(nIndex)->GetMarkedSdrObj()); + if (pTextObj && pTextObj->GetObjInventor() == SdrInventor) + { + if (pTextObj->GetObjIdentifier() != OBJ_OLE2) + { + bEnable = sal_True; + break; + } + } + } + if (bEnable) + { + rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON, sal_False)); + rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON, sal_False)); + } + else + { + rSet.DisableItem(FN_NUM_BULLET_ON); + rSet.DisableItem(FN_NUM_NUMBERING_ON); + } + } + break; } nWhich = aIter.NextWhich(); } @@ -461,9 +699,45 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) nWhich = aNewIter.NextWhich(); } } + + SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_LRSPACE); + rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE); + } + eState = pSet->GetItemState( EE_PARA_SBL ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_SBL); + rSet.InvalidateItem(SID_ATTR_PARA_LINESPACE); + } + eState = pSet->GetItemState( EE_PARA_ULSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_PARA_ULSPACE); + rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE); + } + + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + pSet->Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + { + rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) ); + } + else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + { + rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) ); + } + + eState = pSet->GetItemState( EE_CHAR_KERNING, sal_True ); + if ( eState == SFX_ITEM_DONTCARE ) + { + rSet.InvalidateItem(EE_CHAR_KERNING); + rSet.InvalidateItem(SID_ATTR_CHAR_KERNING); + } delete pSet; } - } diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx index 4be97a05403f..61e33f900463 100644 --- a/sd/source/ui/view/drviewsj.cxx +++ b/sd/source/ui/view/drviewsj.cxx @@ -75,6 +75,8 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OBJECT_TITLE_DESCRIPTION ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_STYLE ) || + SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_TRANSPARENCE ) || + SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_FILL_FLOATTRANSPARENCE ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEBEZIER ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHANGEPOLYGON ) || SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_LINEEND_POLYGON ) || @@ -166,6 +168,8 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) { //rSet.DisableItem( SID_ATTRIBUTES_AREA ); // remove again! rSet.DisableItem( SID_ATTR_FILL_STYLE ); + rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE ); + rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE ); } if( (!pObj->ISA( SdrPathObj ) && !aInfoRec.bCanConvToPath) || pObj->ISA( SdrObjGroup ) ) // As long as JOE handles it incorrectly! { // JOE: a group object may can be converted into a PathObj @@ -364,6 +368,8 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) if( bLine && !bText && !bDrawObj &&!b3dObj) { rSet.DisableItem( SID_ATTR_FILL_STYLE ); + rSet.DisableItem( SID_ATTR_FILL_TRANSPARENCE ); + rSet.DisableItem( SID_ATTR_FILL_FLOATTRANSPARENCE ); } if( !bEdgeObj ) rSet.DisableItem( SID_CONNECTION_DLG ); @@ -482,6 +488,8 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) rSet.DisableItem( SID_COPYOBJECTS ); rSet.DisableItem( SID_HORIZONTAL ); rSet.DisableItem( SID_VERTICAL ); + rSet.DisableItem( SID_FLIP_HORIZONTAL ); + rSet.DisableItem( SID_FLIP_VERTICAL ); rSet.DisableItem( SID_GROUP ); rSet.DisableItem( SID_UNGROUP ); rSet.DisableItem( SID_NAME_GROUP ); diff --git a/sd/source/ui/view/drvwshrg.cxx b/sd/source/ui/view/drvwshrg.cxx index 384ffa0e803b..abe2d38f8c44 100644 --- a/sd/source/ui/view/drvwshrg.cxx +++ b/sd/source/ui/view/drvwshrg.cxx @@ -28,6 +28,7 @@ #include <svx/imapdlg.hxx> #include <svx/colrctrl.hxx> #include <sfx2/objface.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include <svx/f3dchild.hxx> #include <svx/tbxcustomshapes.hxx> @@ -79,6 +80,7 @@ SFX_IMPL_INTERFACE(DrawViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL)) SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() ); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); } @@ -104,6 +106,7 @@ SFX_IMPL_INTERFACE(GraphicViewShell, SfxShell, SdResId(STR_DRAWVIEWSHELL)) //SOH SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); SFX_CHILDWINDOW_REGISTRATION( ::avmedia::MediaPlayer::GetChildWindowId() ); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); } TYPEINIT1( GraphicViewShell, DrawViewShell ); diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx index 93db7ea6ccfd..87086ac60af3 100644 --- a/sd/source/ui/view/outlnvs2.cxx +++ b/sd/source/ui/view/outlnvs2.cxx @@ -63,6 +63,7 @@ #include "sdabstdlg.hxx" #include "framework/FrameworkHelper.hxx" #include "DrawViewShell.hxx" +#include <boost/scoped_ptr.hpp> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::presentation; @@ -365,12 +366,16 @@ void OutlineViewShell::ShowSlideShow(SfxRequest& rReq) void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) { - OutlineViewModelChangeGuard aGuard( *pOlView ); - + sal_uInt16 nSId = rReq.GetSlot(); + boost::scoped_ptr< OutlineViewModelChangeGuard > aGuard; + if (nSId != SID_OUTLINE_BULLET && nSId != FN_SVX_SET_BULLET && nSId != FN_SVX_SET_NUMBER) + { + aGuard.reset( new OutlineViewModelChangeGuard(*pOlView) ); + } DeactivateCurrentFunction(); OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() ); - sal_uInt16 nSId = rReq.GetSlot(); + //sal_uInt16 nSId = rReq.GetSlot(); switch( nSId ) { @@ -415,6 +420,8 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) break; case SID_OUTLINE_BULLET: + case FN_SVX_SET_BULLET: + case FN_SVX_SET_NUMBER: { SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) ); Cancel(); @@ -429,6 +436,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq) } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: { SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) ); diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 743a6b22b7a2..494101834ce8 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -46,6 +46,8 @@ #include <editeng/editstat.hxx> #include <svl/itempool.hxx> #include <sfx2/tplpitem.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/svdorect.hxx> #include <sot/formats.hxx> #include <com/sun/star/linguistic2/XThesaurus.hpp> @@ -117,6 +119,7 @@ SFX_IMPL_INTERFACE(OutlineViewShell, SfxShell, SdResId(STR_OUTLINEVIEWSHELL)) SFX_CHILDWINDOW_REGISTRATION( SvxHlinkDlgWrapper::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() ); SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); } @@ -209,6 +212,8 @@ OutlineViewShell::OutlineViewShell ( Construct(GetDocSh()); + SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OutlineText)); + doShow(); } diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 06249b80bc2b..ed0579050984 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -43,11 +43,13 @@ #include <svx/dialogs.hrc> #include <sfx2/viewfrm.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/svdopage.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <svx/xlndsit.hxx> #include <svx/xlineit0.hxx> #include <svx/xlnclit.hxx> +#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <vcl/virdev.hxx> #include "app.hrc" @@ -70,6 +72,7 @@ #include "undo/undomanager.hxx" #include <svx/sdr/contact/viewobjectcontact.hxx> #include <svx/sdr/contact/viewcontact.hxx> +#include <svx/svdotable.hxx> #include "EventMultiplexer.hxx" #include "ViewShellBase.hxx" #include "ViewShellManager.hxx" @@ -80,6 +83,7 @@ #include <drawinglayer/primitive2d/textlayoutdevice.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <svx/sdr/contact/objectcontact.hxx> +#include <svx/sdr/table/tablecontroller.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx> #include <svx/unoapi.hxx> @@ -89,6 +93,7 @@ using namespace com::sun::star; using namespace com::sun::star::uno; +using namespace sdr::table; namespace sd { TYPEINIT1(View, FmFormView); @@ -690,6 +695,10 @@ sal_Bool View::SdrBeginTextEdit( pGivenOutlinerView, bDontDeleteOutliner, bOnlyOneView, bGrabFocus); + ContextChangeEventMultiplexer::NotifyContextChange( + &GetViewShell()->GetViewShellBase(), + ::sfx2::sidebar::EnumContext::Context_DrawText); + if (bReturn) { ::Outliner* pOL = GetTextEditOutliner(); @@ -705,11 +714,15 @@ sal_Bool View::SdrBeginTextEdit( { aBackground = pObj->GetPage()->GetPageBackgroundColor(pPV); } - pOL->SetBackgroundColor( aBackground ); + if (pOL != NULL) + pOL->SetBackgroundColor( aBackground ); } - pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl)); - pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl)); + if (pOL != NULL) + { + pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl)); + pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl)); + } } return(bReturn); @@ -746,10 +759,16 @@ SdrEndTextEditKind View::SdrEndTextEdit(sal_Bool bDontDeleteReally ) } } - GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT, (void*)xObj.get() ); + GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent( + sd::tools::EventMultiplexerEvent::EID_END_TEXT_EDIT, + (void*)xObj.get() ); if( xObj.is() ) { + ContextChangeEventMultiplexer::NotifyContextChange( + &GetViewShell()->GetViewShellBase(), + ::sfx2::sidebar::EnumContext::Context_Default); + SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() ); if( pPage ) pPage->onEndTextEdit( xObj.get() ); @@ -1208,6 +1227,169 @@ void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfos ) } } +sal_Bool View::ShouldToggleOn(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet) +{ + // If setting bullets/numbering by the dialog, always should toggle on. + if (!bBulletOnOffMode) + return sal_True; + SdrModel* pSdrModel = GetModel(); + if (!pSdrModel) + return sal_False; + + sal_Bool bToggleOn = sal_False; + SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel); + sal_uInt32 nMarkCount = GetMarkedObjectCount(); + for (sal_uInt32 nIndex = 0; nIndex < nMarkCount && !bToggleOn; nIndex++) + { + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex)); + if (!pTextObj || pTextObj->IsTextEditActive()) + continue; + if (pTextObj->ISA(SdrTableObj)) + { + SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj); + if (!pTableObj) + continue; + CellPos aStart, aEnd; + SvxTableController* pTableController = dynamic_cast< SvxTableController* >(getSelectionController().get()); + if (pTableController) + { + pTableController->getSelectedCells(aStart, aEnd); + } + else + { + aStart = pTableObj->getFirstCell(); + aEnd = pTableObj->getLastCell(); + } + sal_Int32 nColCount = pTableObj->getColumnCount(); + for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow && !bToggleOn; nRow++) + { + for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol && !bToggleOn; nCol++) + { + sal_Int32 nCellIndex = nRow * nColCount + nCol; + SdrText* pText = pTableObj->getText(nCellIndex); + if (!pText || !pText->GetOutlinerParaObject()) + continue; + pOutliner->SetText(*(pText->GetOutlinerParaObject())); + sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus(); + bToggleOn = ((bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1)) ? sal_True : bToggleOn; + pOutliner->Clear(); + } + } + } + else + { + OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject(); + if (!pParaObj) + continue; + pOutliner->SetText(*pParaObj); + sal_Int16 nStatus = pOutliner->GetBulletsNumberingStatus(); + bToggleOn = ((bNormalBullet && nStatus != 0) || (!bNormalBullet && nStatus != 1)) ? sal_True : bToggleOn; + pOutliner->Clear(); + } + } + delete pOutliner; + return bToggleOn; +} + +void View::ToggleMarkedObjectsBullets(sal_Bool bBulletOnOffMode, sal_Bool bNormalBullet, sal_Bool bMasterView, SvxNumRule* pNumRule, sal_Bool bForceBulletOnOff) +{ + SdrModel* pSdrModel = GetModel(); + Window* pWindow = dynamic_cast< Window* >(GetFirstOutputDevice()); + if (!pSdrModel || !pWindow) + return; + + sal_Bool bUndoEnabled = pSdrModel->IsUndoEnabled(); + sal_Bool bToggleOn = ShouldToggleOn(bBulletOnOffMode, bNormalBullet); + if ( bForceBulletOnOff ) { + bToggleOn = bBulletOnOffMode; + } + SdrUndoGroup* pUndoGroup = new SdrUndoGroup(*pSdrModel); + SdrOutliner* pOutliner = SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrModel); + OutlinerView* pOutlinerView = new OutlinerView(pOutliner, pWindow); + + sal_uInt32 nMarkCount = GetMarkedObjectCount(); + for (sal_uInt32 nIndex = 0; nIndex < nMarkCount; nIndex++) + { + SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(GetMarkedObjectByIndex(nIndex)); + if (!pTextObj || pTextObj->IsTextEditActive()) + continue; + if (pTextObj->ISA(SdrTableObj)) + { + SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >(pTextObj); + if (!pTableObj) + continue; + CellPos aStart, aEnd; + SvxTableController* pTableController = dynamic_cast< SvxTableController* >(getSelectionController().get()); + if (pTableController) + { + pTableController->getSelectedCells(aStart, aEnd); + } + else + { + aStart = pTableObj->getFirstCell(); + aEnd = pTableObj->getLastCell(); + } + sal_Int32 nColCount = pTableObj->getColumnCount(); + for (sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++) + { + for (sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++) + { + sal_Int32 nCellIndex = nRow * nColCount + nCol; + SdrText* pText = pTableObj->getText(nCellIndex); + if (!pText || !pText->GetOutlinerParaObject()) + continue; + + pOutliner->SetText(*(pText->GetOutlinerParaObject())); + if (bUndoEnabled) + { + SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, nCellIndex)); + pUndoGroup->AddAction(pTxtUndo); + } + pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule); + sal_uInt32 nParaCount = pOutliner->GetParagraphCount(); + pText->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount)); + pOutliner->Clear(); + } + } + // Broadcast the object change event. + if (!pTextObj->AdjustTextFrameWidthAndHeight()) + { + pTextObj->SetChanged(); + pTextObj->BroadcastObjectChange(); + } + } + else + { + OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject(); + if (!pParaObj) + continue; + pOutliner->SetText(*pParaObj); + if (bUndoEnabled) + { + SdrUndoObjSetText* pTxtUndo = dynamic_cast< SdrUndoObjSetText* >(pSdrModel->GetSdrUndoFactory().CreateUndoObjectSetText(*pTextObj, 0)); + pUndoGroup->AddAction(pTxtUndo); + } + pOutlinerView->ToggleAllParagraphsBullets(bBulletOnOffMode, bNormalBullet, bToggleOn, bMasterView, pNumRule); + sal_uInt32 nParaCount = pOutliner->GetParagraphCount(); + pTextObj->SetOutlinerParaObject(pOutliner->CreateParaObject(0, (sal_uInt16)nParaCount)); + pOutliner->Clear(); + } + } + + if (pUndoGroup->GetActionCount() > 0 && bUndoEnabled) + { + pSdrModel->BegUndo(); + pSdrModel->AddUndo(pUndoGroup); + pSdrModel->EndUndo(); + } + else + { + delete pUndoGroup; + } + delete pOutliner; + delete pOutlinerView; +} + } // end of namespace sd /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 50716b156818..6fe1ba2cded2 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -75,6 +75,11 @@ #include "Window.hxx" #include "fupoor.hxx" +#include <editeng/numitem.hxx> +#include <editeng/eeitem.hxx> +#include <svl/poolitem.hxx> +#include <glob.hrc> + namespace sd { namespace ui { namespace table { extern SfxShell* CreateTableObjectBar( ViewShell& rShell, ::sd::View* pView ); } } } @@ -147,7 +152,8 @@ ViewShell::~ViewShell() { // Keep the content window from accessing in its destructor the // WindowUpdater. - mpContentWindow->SetViewShell(NULL); + if (mpContentWindow) + mpContentWindow->SetViewShell(NULL); delete mpZoomList; @@ -156,6 +162,13 @@ ViewShell::~ViewShell() if (mpImpl->mpSubShellFactory.get() != NULL) GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory( this,mpImpl->mpSubShellFactory); + + if (mpContentWindow) + { + OSL_TRACE("destroying mpContentWindow at %x with parent %x", mpContentWindow.get(), + mpContentWindow->GetParent()); + mpContentWindow.reset(); + } } @@ -729,7 +742,86 @@ void ViewShell::SetupRulers (void) } } +const SfxPoolItem* ViewShell::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId) +{ + const SfxPoolItem* pTmpItem = NULL; + + if(aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem) == SFX_ITEM_SET) + { + return pTmpItem; + } + else + { + nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem); + if (eState == SFX_ITEM_SET) + return pTmpItem; + else + { + sal_Bool bOutliner = sal_False; + sal_Bool bTitle = sal_False; + + if( mpView ) + { + const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); + const sal_uInt32 nCount = rMarkList.GetMarkCount(); + + for(sal_uInt32 nNum = 0; nNum < nCount; nNum++) + { + SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj(); + if( pObj->GetObjInventor() == SdrInventor ) + { + switch(pObj->GetObjIdentifier()) + { + case OBJ_TITLETEXT: + bTitle = sal_True; + break; + case OBJ_OUTLINETEXT: + bOutliner = sal_True; + break; + } + } + } + } + + const SvxNumBulletItem *pItem = NULL; + if(bOutliner) + { + SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool(); + String aStyleName((SdResId(STR_LAYOUT_OUTLINE))); + aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) ); + SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO); + if( pFirstStyleSheet ) + pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem); + } + + if( pItem == NULL ) + pItem = (SvxNumBulletItem*) aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET); + + aNewAttr.Put(*pItem, EE_PARA_NUMBULLET); + + if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON ) + { + SvxNumBulletItem* pBulletItem = (SvxNumBulletItem*)aNewAttr.GetItem(EE_PARA_NUMBULLET,sal_True); + SvxNumRule* pRule = pBulletItem->GetNumRule(); + if(pRule) + { + SvxNumRule aNewRule( *pRule ); + aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True ); + + SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET ); + aNewAttr.Put(aNewItem); + } + } + SfxItemState eNumState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem); + if (eNumState == SFX_ITEM_SET) + return pTmpItem; + + } + } + return pTmpItem; +} sal_Bool ViewShell::HasRuler (void) @@ -885,9 +977,10 @@ void ViewShell::ArrangeGUIElements (void) { OSL_ASSERT (GetViewShell()!=NULL); - mpContentWindow->SetPosSizePixel( - Point(nLeft,nTop), - Size(nRight-nLeft,nBottom-nTop)); + if (mpContentWindow) + mpContentWindow->SetPosSizePixel( + Point(nLeft,nTop), + Size(nRight-nLeft,nBottom-nTop)); } // Windows in the center and rulers at the left and top side. |