From 3868442ba92baf4b3090fdb9f3fb1ed3e4d0b0ea Mon Sep 17 00:00:00 2001 From: Release Engineers Date: Thu, 7 May 2009 12:38:03 +0000 Subject: CWS-TOOLING: integrate CWS impress170 2009-04-28 10:31:12 +0200 wg r271308 : i101397 2009-04-14 17:56:43 +0200 af r270805 : #i100829# Removed line that became obsolete in last change. 2009-04-14 15:12:19 +0200 af r270782 : #i97199# Made accelerators in text attribute dialog unique. 2009-04-14 14:42:53 +0200 af r270775 : #i98364# Create regular task pane master previews even in high contrast mode. 2009-04-09 14:43:32 +0200 af r270708 : #i92792# Show icon instead of text and register resource for 'Table Design'. 2009-04-09 14:42:51 +0200 af r270707 : #i92792# Show icon instead of text and register resource for 'Table Design'. 2009-04-09 11:15:32 +0200 af r270683 : #i85921# Applied patch that adds direct activation of master mode to task pane context menu. 2009-04-08 15:12:54 +0200 af r270654 : #i94775# Passing snap line index from context menu to FuSnapLine. 2009-04-06 15:33:04 +0200 af r270555 : #i95371# Return early from MoveToTop() when the dispatcher is (not yet) available. 2009-04-06 13:15:42 +0200 af r270538 : #i97571# Fixed forwarding MouseButtonUp() calls to parent. 2009-04-03 16:10:08 +0200 af r270498 : #i100830# Adjusted the sizes of some rectangles displayed by the slide sorter. 2009-04-03 16:02:08 +0200 af r270496 : #i93086# Storing position of insertion indicator explicitly at SelectionManager. 2009-04-03 15:55:59 +0200 af r270493 : #i100829# Calling UpdatePageBorders() when the model is changed. --- .../ui/animations/CustomAnimationCreateDialog.cxx | 4 +- sd/source/ui/app/popup.src | 7 ++ .../ui/framework/factories/TaskPanelFactory.cxx | 5 ++ sd/source/ui/func/fusnapln.cxx | 57 +++++++++++----- sd/source/ui/inc/DrawViewShell.hxx | 18 +++++ sd/source/ui/inc/PreviewRenderer.hxx | 19 +++++- .../controller/SlideSorterController.cxx | 15 ++--- .../ui/slidesorter/controller/SlsClipboard.cxx | 14 +--- .../slidesorter/controller/SlsSelectionManager.cxx | 47 +++++++++++++ .../inc/controller/SlsSelectionManager.hxx | 22 ++++++- .../ui/slidesorter/inc/view/SlsViewOverlay.hxx | 5 +- sd/source/ui/slidesorter/view/SlideSorterView.cxx | 4 ++ sd/source/ui/slidesorter/view/SlsLayouter.cxx | 2 +- .../view/SlsPageObjectViewObjectContact.cxx | 77 +++++++++++----------- sd/source/ui/slidesorter/view/SlsViewOverlay.cxx | 64 ++++++++++++------ .../toolpanel/controls/AllMasterPagesSelector.cxx | 15 ++++- .../toolpanel/controls/AllMasterPagesSelector.hxx | 2 + .../controls/CurrentMasterPagesSelector.cxx | 13 +++- .../controls/MasterPageContainerProviders.cxx | 3 +- .../ui/toolpanel/controls/MasterPagesSelector.cxx | 21 ++++++ .../controls/RecentMasterPagesSelector.cxx | 14 ++++ .../controls/RecentMasterPagesSelector.hxx | 2 + sd/source/ui/tools/PreviewRenderer.cxx | 17 +++-- sd/source/ui/view/ViewShellManager.cxx | 10 ++- sd/source/ui/view/drviews4.cxx | 68 ++++++++++++++++++- 25 files changed, 406 insertions(+), 119 deletions(-) (limited to 'sd/source/ui') diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx index cdb894984edd..ce651b2965be 100644 --- a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx @@ -183,15 +183,15 @@ IMPL_LINK( CategoryListBox, implDoubleClickHdl, Control*, EMPTYARG ) void CategoryListBox::MouseButtonUp( const MouseEvent& rMEvt ) { + ReleaseMouse(); if( rMEvt.IsLeft() && (rMEvt.GetClicks() == 2) ) { - ReleaseMouse(); if( maDoubleClickHdl.IsSet() ) maDoubleClickHdl.Call( this ); } else { - CategoryListBox::MouseButtonUp( rMEvt ); + ListBox::MouseButtonUp( rMEvt ); } } diff --git a/sd/source/ui/app/popup.src b/sd/source/ui/app/popup.src index c98218f9ab22..cdcf3d353dc8 100644 --- a/sd/source/ui/app/popup.src +++ b/sd/source/ui/app/popup.src @@ -355,6 +355,13 @@ Menu RID_TASKPANE_CURRENT_MASTERPAGESSELECTOR_POPUP SEPARATOR + MenuItem + { + Identifier = SID_TP_EDIT_MASTER; + HelpID = SID_TP_EDIT_MASTER; + Text[ en-US ] = "~Edit Master..."; + }; + MN_DELETE_MASTER SEPARATOR diff --git a/sd/source/ui/framework/factories/TaskPanelFactory.cxx b/sd/source/ui/framework/factories/TaskPanelFactory.cxx index 6d2d398e0e6f..65a2bb23cb33 100644 --- a/sd/source/ui/framework/factories/TaskPanelFactory.cxx +++ b/sd/source/ui/framework/factories/TaskPanelFactory.cxx @@ -176,6 +176,7 @@ void SAL_CALL TaskPanelFactory::initialize( xCM->getConfigurationController(), UNO_QUERY_THROW); xCC->addResourceFactory(FrameworkHelper::msMasterPagesTaskPanelURL, this); xCC->addResourceFactory(FrameworkHelper::msLayoutTaskPanelURL, this); + xCC->addResourceFactory(FrameworkHelper::msTableDesignPanelURL, this); xCC->addResourceFactory(FrameworkHelper::msCustomAnimationTaskPanelURL, this); xCC->addResourceFactory(FrameworkHelper::msSlideTransitionTaskPanelURL, this); } @@ -211,6 +212,10 @@ Reference SAL_CALL TaskPanelFactory::createResource ( { ePaneId = TaskPaneViewShell::PID_LAYOUT; } + else if (sResourceURL.equals(FrameworkHelper::msTableDesignPanelURL)) + { + ePaneId = TaskPaneViewShell::PID_TABLE_DESIGN; + } else if (sResourceURL.equals(FrameworkHelper::msCustomAnimationTaskPanelURL)) { ePaneId = TaskPaneViewShell::PID_CUSTOM_ANIMATION; diff --git a/sd/source/ui/func/fusnapln.cxx b/sd/source/ui/func/fusnapln.cxx index dfd50a00ec5d..28bb58538d85 100644 --- a/sd/source/ui/func/fusnapln.cxx +++ b/sd/source/ui/func/fusnapln.cxx @@ -49,6 +49,7 @@ #include "sdenumdef.hxx" #include "sdresid.hxx" #include "sdabstdlg.hxx" +#include "app.hrc" #include namespace sd { @@ -81,32 +82,52 @@ void FuSnapLine::DoExecute( SfxRequest& rReq ) USHORT nHelpLine = 0; BOOL bCreateNew = TRUE; - if ( !pArgs ) + // Get index of snap line or snap point from the request. + SFX_REQUEST_ARG (rReq, pHelpLineIndex, SfxUInt32Item, ID_VAL_INDEX, FALSE); + if (pHelpLineIndex != NULL) { - SfxItemSet aNewAttr(mpViewShell->GetPool(), ATTR_SNAPLINE_START, - ATTR_SNAPLINE_END); - Point aLinePos = static_cast(mpViewShell)->GetMousePos(); - static_cast(mpViewShell)->SetMousePosFreezed( FALSE ); - BOOL bLineExist = FALSE; + nHelpLine = static_cast(pHelpLineIndex->GetValue()); + // Reset the argument pointer to trigger the display of the dialog. + pArgs = NULL; + } + if ( !pArgs ) + { + SfxItemSet aNewAttr(mpViewShell->GetPool(), ATTR_SNAPLINE_START, ATTR_SNAPLINE_END); + bool bLineExist (false); pPV = mpView->GetSdrPageView(); + Point aLinePos; - if ( aLinePos.X() >= 0 ) + if (pHelpLineIndex == NULL) { - aLinePos = mpWindow->PixelToLogic(aLinePos); - USHORT nHitLog = (USHORT) mpWindow->PixelToLogic(Size(HITPIX,0)).Width(); - bLineExist = mpView->PickHelpLine(aLinePos, nHitLog, *mpWindow, - nHelpLine, pPV); - if ( bLineExist ) - aLinePos = (pPV->GetHelpLines())[nHelpLine].GetPos(); - else - pPV = mpView->GetSdrPageView(); + // The index of the snap line is not provided as argument to the + // request. Determine it from the mouse position. + + aLinePos = static_cast(mpViewShell)->GetMousePos(); + static_cast(mpViewShell)->SetMousePosFreezed( FALSE ); + - pPV->LogicToPagePos(aLinePos); + if ( aLinePos.X() >= 0 ) + { + aLinePos = mpWindow->PixelToLogic(aLinePos); + USHORT nHitLog = (USHORT) mpWindow->PixelToLogic(Size(HITPIX,0)).Width(); + bLineExist = mpView->PickHelpLine(aLinePos, nHitLog, *mpWindow, nHelpLine, pPV); + if ( bLineExist ) + aLinePos = (pPV->GetHelpLines())[nHelpLine].GetPos(); + else + pPV = mpView->GetSdrPageView(); + + pPV->LogicToPagePos(aLinePos); + } + else + aLinePos = Point(0,0); } else - aLinePos = Point(0,0); - + { + OSL_ASSERT(pPV!=NULL); + aLinePos = (pPV->GetHelpLines())[nHelpLine].GetPos(); + bLineExist = true; + } aNewAttr.Put(SfxUInt32Item(ATTR_SNAPLINE_X, aLinePos.X())); aNewAttr.Put(SfxUInt32Item(ATTR_SNAPLINE_Y, aLinePos.Y())); diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index 7a4ad2865140..d85b09d6ab07 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -475,6 +475,24 @@ private: */ void StopSlideShow (bool bCloseFrame); + /** Show the context menu for snap lines and points. Because snap lines + can not be selected the index of the snap line/point for which the + popup menu is opened has to be passed to the processing slot + handlers. This can be done only by manually showing the popup menu. + @param rPageView + The page view is used to access the help lines. + @param nSnapLineIndex + Index of the snap line or snap point for which to show the + context menu. + @param rMouseLocation + The mouse location defines the location at which to display the + context menu. + */ + void ShowSnapLineContextMenu ( + SdrPageView& rPageView, + const USHORT nSnapLineIndex, + const Point& rMouseLocation); + using ViewShell::Notify; }; diff --git a/sd/source/ui/inc/PreviewRenderer.hxx b/sd/source/ui/inc/PreviewRenderer.hxx index 54cd483272d5..c508410045aa 100644 --- a/sd/source/ui/inc/PreviewRenderer.hxx +++ b/sd/source/ui/inc/PreviewRenderer.hxx @@ -78,11 +78,17 @@ public: When the actual preview can not be created for some reason, then this text is painted in an empty rectangle of the requested size instead. + @param bObeyHighContrastMode + When then the high contrast mode of the application is + ignored and the preview is rendered in normal mode. When + and high contrast mode is active then the preview is + rendered in high contrast mode. */ Image RenderPage ( const SdPage* pPage, const sal_Int32 nWidth, - const String& sSubstitutionText); + const String& sSubstitutionText, + const bool bObeyHighContrastMode = true); /** Render a page with the given pixel size. @param pPage @@ -93,11 +99,17 @@ public: When the actual preview can not be created for some reason, then this text is painted in an empty rectangle of the requested size instead. + @param bObeyHighContrastMode + When then the high contrast mode of the application is + ignored and the preview is rendered in normal mode. When + and high contrast mode is active then the preview is + rendered in high contrast mode. */ Image RenderPage ( const SdPage* pPage, const Size aPreviewPixelSize, - const String& sSubstitutionText); + const String& sSubstitutionText, + const bool bObeyHighContrastMode = true); /** Render an image that contains the given substitution text instead of a slide preview. @@ -131,7 +143,8 @@ private: bool Initialize ( const SdPage* pPage, - const Size& rPixelSize); + const Size& rPixelSize, + const bool bObeyHighContrastMode); void Cleanup (void); void PaintPage (const SdPage* pPage); void PaintSubstitutionText (const String& rSubstitutionText); diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index 43c568b375d4..0c1cbd47f8e5 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -429,9 +429,8 @@ bool SlideSorterController::Command ( // When there is no selection, then we show the insertion // indicator so that the user knows where a page insertion // would take place. - mrView.GetOverlay().GetInsertionIndicatorOverlay() - .SetPosition( - pWindow->PixelToLogic(rEvent.GetMousePosPixel())); + mrView.GetOverlay().GetInsertionIndicatorOverlay().SetPosition( + pWindow->PixelToLogic(rEvent.GetMousePosPixel())); mrView.GetOverlay().GetInsertionIndicatorOverlay().Show(); } @@ -473,11 +472,11 @@ bool SlideSorterController::Command ( mbIsContextMenuOpen = false; if (pPage == NULL) { - // Select slide before the insertion indicator before it is - // hidden, so that a pending slide insertion slot finds the - // right place to insert a new slide. - mpPageSelector->SelectPage( - mrView.GetOverlay().GetInsertionIndicatorOverlay().GetInsertionPageIndex()-1); + // Remember the position of the insertion indicator before + // it is hidden, so that a pending slide insertion slot call + // finds the right place to insert a new slide. + GetSelectionManager()->SetInsertionPosition( + mrView.GetOverlay().GetInsertionIndicatorOverlay().GetInsertionPageIndex()); mrView.GetOverlay().GetInsertionIndicatorOverlay().Hide(); } bEventHasBeenHandled = true; diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index 192a5b58e224..f157968d6c2d 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -251,19 +251,7 @@ sal_Int32 Clipboard::GetInsertionPosition (::Window* pWindow) } else { - model::PageEnumeration aSelectedPages - (model::PageEnumerationProvider::CreateSelectedPagesEnumeration( - mrSlideSorter.GetModel())); - // Initialize (for the case of an empty selection) with the position - // at the end of the document. - nInsertPosition = mrSlideSorter.GetModel().GetPageCount(); - while (aSelectedPages.HasMoreElements()) - { - nInsertPosition = aSelectedPages.GetNextElement()->GetPage()->GetPageNum(); - // Convert *2+1 index to straight index ((n-1)/2) after the page - // (+1). - nInsertPosition = (nInsertPosition-1)/2 + 1; - } + nInsertPosition = mrController.GetSelectionManager()->GetInsertionPosition(); } return nInsertPosition; diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx index 5bbef1103a6b..c3040bd48853 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx @@ -338,6 +338,10 @@ void SelectionManager::SelectionHasChanged (const bool bMakeSelectionVisible) { iListener->Call(NULL); } + + // Reset the insertion position: until set again it is calculated from + // the current selection. + mnInsertionPosition = -1; } } @@ -594,6 +598,49 @@ Rectangle SelectionManager::ResolveLargeSelection ( +sal_Int32 SelectionManager::GetInsertionPosition (void) const +{ + sal_Int32 nInsertionPosition (mnInsertionPosition); + if (nInsertionPosition < 0) + { + model::PageEnumeration aSelectedPages + (model::PageEnumerationProvider::CreateSelectedPagesEnumeration( + mrSlideSorter.GetModel())); + // Initialize (for the case of an empty selection) with the position + // at the end of the document. + nInsertionPosition = mrSlideSorter.GetModel().GetPageCount(); + while (aSelectedPages.HasMoreElements()) + { + const sal_Int32 nPosition (aSelectedPages.GetNextElement()->GetPage()->GetPageNum()); + // Convert *2+1 index to straight index (n-1)/2 after the page + // (+1). + nInsertionPosition = (nPosition-1)/2 + 1; + } + + } + return nInsertionPosition; +} + + + + +void SelectionManager::SetInsertionPosition (const sal_Int32 nInsertionPosition) +{ + if (nInsertionPosition < 0) + mnInsertionPosition = -1; + else if (nInsertionPosition > mrSlideSorter.GetModel().GetPageCount()) + { + // Assert but then ignore invalid values. + OSL_ASSERT(nInsertionPosition<=mrSlideSorter.GetModel().GetPageCount()); + return; + } + else + mnInsertionPosition = nInsertionPosition; +} + + + + //===== VerticalVisibleAreaScroller =========================================== namespace { diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx index 554c2fb1911f..10b3167af563 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx @@ -132,6 +132,21 @@ public: */ void RemoveSelectionChangeListener (const Link& rListener); + /** Return the position where to insert pasted slides based on the + current selection. When there is a selection then the insert + position is behind the last slide. When the selection is empty then + most of the time the insert position is at the end of the document. + There is an exception right after the display of a popup-menu. The + position of the associated insertion marker is stored here and reset + the next time the selection changes. + */ + sal_Int32 GetInsertionPosition (void) const; + + /** Store an insertion position temporarily. It is reset when the + selection changes the next time. + */ + void SetInsertionPosition (const sal_Int32 nInsertionPosition); + private: SlideSorter& mrSlideSorter; SlideSorterController& mrController; @@ -149,6 +164,12 @@ private: */ bool mbIsMakeSelectionVisiblePending; + /** The insertion position is only temporarily valid. Negative values + indicate that the explicit insertion position is not valid. In this + case GetInsertionPosition() calculates it from the current selection. + */ + sal_Int32 mnInsertionPosition; + /** Delete the given list of normal pages. This method is a helper function for DeleteSelectedPages(). @param rSelectedNormalPages @@ -187,7 +208,6 @@ private: const model::SharedPageDescriptor& rpFirst, const model::SharedPageDescriptor& rpLast, const SelectionHint eSelectionHint); - }; } } } // end of namespace ::sd::slidesorter::controller diff --git a/sd/source/ui/slidesorter/inc/view/SlsViewOverlay.hxx b/sd/source/ui/slidesorter/inc/view/SlsViewOverlay.hxx index 4e415eba03b2..a7652d87d35c 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsViewOverlay.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsViewOverlay.hxx @@ -140,8 +140,9 @@ protected: private: Point maPosition; - basegfx::B2DRange maBoundingBox; - basegfx::B2DPolyPolygon maShapes; + Point maTranslation; + Rectangle maBoundingBox; + ::std::vector maShapes; }; diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx index f92b0161a04d..69ef5f75be72 100644 --- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx +++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx @@ -241,6 +241,9 @@ void SlideSorterView::ModelHasChanged (void) } } + + + void SlideSorterView::LocalModelHasChanged(void) { mbModelChangedWhileModifyEnabled = false; @@ -290,6 +293,7 @@ void SlideSorterView::PostModelChange (void) model::PageEnumeration aPageEnumeration ( model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel)); + UpdatePageBorders(); while (aPageEnumeration.HasMoreElements()) { SdrPageObj* pPageObject = aPageEnumeration.GetNextElement()->GetPageObject(); diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx index 26811df931b4..f3d91fff96dd 100644 --- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx +++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx @@ -235,7 +235,7 @@ bool Layouter::RearrangeHorizontal ( // Adapt the layout of the given output device to the new layout of // page objects. The zoom factor is set so that the page objects in - // one row fill the screen. + // one column fill the screen. Fraction aScaleFactor (nTargetHeight, nPagePixelHeight); SetZoom (aMapMode.GetScaleX() * aScaleFactor, pDevice); diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx index 4c96c113ef1a..fbea240c5a25 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx @@ -68,6 +68,8 @@ using namespace ::sdr::contact; using namespace ::sd::slidesorter::model; +using drawinglayer::primitive2d::Primitive2DReference; +using drawinglayer::primitive2d::Primitive2DSequence; namespace sd { namespace slidesorter { namespace view { @@ -306,7 +308,7 @@ private: protected: // method which is to be used to implement the local decomposition of a 2D primitive. - virtual drawinglayer::primitive2d::Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: // constructor and destructor @@ -325,7 +327,7 @@ public: DeclPrimitrive2DIDBlock() }; -drawinglayer::primitive2d::Primitive2DSequence SdPageObjectPageBitmapPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const +Primitive2DSequence SdPageObjectPageBitmapPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const { // add bitmap primitive // to avoid scaling, use the Bitmap pixel size as primitive size @@ -341,9 +343,9 @@ drawinglayer::primitive2d::Primitive2DSequence SdPageObjectPageBitmapPrimitive:: aBitmapTransform.set(1L, 2L, getPageObjectRange().getMinY()); // add a BitmapPrimitive2D to the result - const drawinglayer::primitive2d::Primitive2DReference xReference( + const Primitive2DReference xReference( new drawinglayer::primitive2d::BitmapPrimitive2D(getBitmapEx(), aBitmapTransform)); - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + return Primitive2DSequence(&xReference, 1); } SdPageObjectPageBitmapPrimitive::SdPageObjectPageBitmapPrimitive( @@ -385,7 +387,7 @@ private: protected: // method which is to be used to implement the local decomposition of a 2D primitive. - virtual drawinglayer::primitive2d::Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: // constructor and destructor @@ -399,9 +401,9 @@ public: const sal_Int32 SdPageObjectSelectPrimitive::mnSelectionIndicatorOffset(1); const sal_Int32 SdPageObjectSelectPrimitive::mnSelectionIndicatorThickness(3); -drawinglayer::primitive2d::Primitive2DSequence SdPageObjectSelectPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const +Primitive2DSequence SdPageObjectSelectPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const { - drawinglayer::primitive2d::Primitive2DSequence xRetval(2); + Primitive2DSequence xRetval(2); // since old Width/Height calculations always added a single pixel value, // it is necessary to create a inner range which is one display unit less @@ -415,11 +417,12 @@ drawinglayer::primitive2d::Primitive2DSequence SdPageObjectSelectPrimitive::crea basegfx::B2DRange aDiscreteOuterRange(aAdaptedInnerRange); aDiscreteOuterRange.grow(mnSelectionIndicatorOffset * aDiscretePixel.getX()); - // remeber inner border. Make it one bigger in top left since polygons + // Remember inner border. Make it one bigger in top left since polygons // do not paint their lower-right corners. Since this is the inner polygon, // the top-left corders are the ones to grow here const basegfx::B2DRange aDiscreteInnerRange( - aDiscreteOuterRange.getMinimum() + aDiscretePixel, aDiscreteOuterRange.getMaximum()); + aDiscreteOuterRange.getMinimum() + aDiscretePixel, + aDiscreteOuterRange.getMaximum() - aDiscretePixel); // grow by line width aDiscreteOuterRange.grow((mnSelectionIndicatorThickness - 1) * aDiscretePixel.getX()); @@ -440,12 +443,12 @@ drawinglayer::primitive2d::Primitive2DSequence SdPageObjectSelectPrimitive::crea static bool bTestWithBrightColors(false); const basegfx::BColor aFrameColor(bTestWithBrightColors ? basegfx::BColor(0,1,0) : Application::GetSettings().GetStyleSettings().GetMenuHighlightColor().getBColor()); - xRetval[0] = drawinglayer::primitive2d::Primitive2DReference( + xRetval[0] = Primitive2DReference( new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(aFramePolyPolygon, aFrameColor)); // add aRoundedOuterPolygon again as non-filled line polygon to get the roundungs // painted correctly - xRetval[1] = drawinglayer::primitive2d::Primitive2DReference( + xRetval[1] = Primitive2DReference( new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aRoundedOuterPolygon, aFrameColor)); return xRetval; @@ -469,7 +472,7 @@ class SdPageObjectBorderPrimitive : public SdPageObjectBasePrimitive { protected: // method which is to be used to implement the local decomposition of a 2D primitive. - virtual drawinglayer::primitive2d::Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: // constructor and destructor @@ -480,7 +483,7 @@ public: DeclPrimitrive2DIDBlock() }; -drawinglayer::primitive2d::Primitive2DSequence SdPageObjectBorderPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const +Primitive2DSequence SdPageObjectBorderPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const { // since old Width/Height calculations always added a single pixel value, // it is necessary to create a inner range which is one display unit less @@ -495,9 +498,9 @@ drawinglayer::primitive2d::Primitive2DSequence SdPageObjectBorderPrimitive::crea const svtools::ColorConfig aColorConfig; const basegfx::BColor aBorderColor(bTestWithBrightColors ? basegfx::BColor(1,0,0) : Color(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor).getBColor()); - const drawinglayer::primitive2d::Primitive2DReference xReference( + const Primitive2DReference xReference( new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(basegfx::tools::createPolygonFromRect(aAdaptedInnerRange), aBorderColor)); - return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + return Primitive2DSequence(&xReference, 1); } SdPageObjectBorderPrimitive::SdPageObjectBorderPrimitive(const basegfx::B2DRange& rRange) @@ -522,7 +525,7 @@ private: protected: // method which is to be used to implement the local decomposition of a 2D primitive. - virtual drawinglayer::primitive2d::Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: // constructor and destructor @@ -535,9 +538,9 @@ public: const sal_Int32 SdPageObjectFocusPrimitive::mnFocusIndicatorOffset(2); -drawinglayer::primitive2d::Primitive2DSequence SdPageObjectFocusPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const +Primitive2DSequence SdPageObjectFocusPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const { - drawinglayer::primitive2d::Primitive2DSequence xRetval(2); + Primitive2DSequence xRetval(2); // since old Width/Height calculations always added a single pixel value, // it is necessary to create a inner range which is one display unit less @@ -556,7 +559,7 @@ drawinglayer::primitive2d::Primitive2DSequence SdPageObjectFocusPrimitive::creat const basegfx::B2DPolygon aIndicatorPolygon(basegfx::tools::createPolygonFromRect(aFocusIndicatorRange)); // white rectangle - xRetval[0] = drawinglayer::primitive2d::Primitive2DReference( + xRetval[0] = Primitive2DReference( new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aIndicatorPolygon, Color(COL_WHITE).getBColor())); // dotted black rectangle with same geometry @@ -569,7 +572,7 @@ drawinglayer::primitive2d::Primitive2DSequence SdPageObjectFocusPrimitive::creat const drawinglayer::attribute::LineAttribute aLineAttribute(Color(COL_BLACK).getBColor()); const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(aDotDashArray, 2.0 * aDiscretePixel.getX()); - xRetval[1] = drawinglayer::primitive2d::Primitive2DReference( + xRetval[1] = Primitive2DReference( new drawinglayer::primitive2d::PolygonStrokePrimitive2D(aIndicatorPolygon, aLineAttribute, aStrokeAttribute)); return xRetval; @@ -609,15 +612,15 @@ private: Size maPageNumberAreaModelSize; // bitfield - unsigned mbShowFadeEffectIcon : 1; - unsigned mbExcluded : 1; + bool mbShowFadeEffectIcon : 1; + bool mbExcluded : 1; // private helpers const BitmapEx& getFadeEffectIconBitmap() const; protected: // method which is to be used to implement the local decomposition of a 2D primitive. - virtual drawinglayer::primitive2d::Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; + virtual Primitive2DSequence createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; public: // constructor and destructor @@ -665,7 +668,7 @@ const BitmapEx& SdPageObjectFadeNameNumberPrimitive::getFadeEffectIconBitmap() c return *mpFadeEffectIconBitmap; } -drawinglayer::primitive2d::Primitive2DSequence SdPageObjectFadeNameNumberPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const +Primitive2DSequence SdPageObjectFadeNameNumberPrimitive::createLocalDecomposition(const drawinglayer::geometry::ViewInformation2D& rViewInformation) const { const xub_StrLen nTextLength(getPageName().Len()); const sal_uInt32 nCount( @@ -675,7 +678,7 @@ drawinglayer::primitive2d::Primitive2DSequence SdPageObjectFadeNameNumberPrimiti (getExcluded() ? 2 : 0) // PageNumber crossed out ); sal_uInt32 nInsert(0); - drawinglayer::primitive2d::Primitive2DSequence xRetval(nCount); + Primitive2DSequence xRetval(nCount); // since old Width/Height calculations always added a single pixel value, // it is necessary to create a inner range which is one display unit less @@ -724,7 +727,7 @@ drawinglayer::primitive2d::Primitive2DSequence SdPageObjectFadeNameNumberPrimiti aBitmapTransform.set(0L, 2L, aAdaptedInnerRange.getMinX()); aBitmapTransform.set(1L, 2L, aAdaptedInnerRange.getMaxY() + ((mnFadeEffectIndicatorOffset + 1) * aDiscretePixel.getX())); - xRetval[nInsert++] = drawinglayer::primitive2d::Primitive2DReference( + xRetval[nInsert++] = Primitive2DReference( new drawinglayer::primitive2d::BitmapPrimitive2D(getFadeEffectIconBitmap(), aBitmapTransform)); } @@ -790,7 +793,7 @@ drawinglayer::primitive2d::Primitive2DSequence SdPageObjectFadeNameNumberPrimiti aTextMatrix.set(1L, 2L, fStartY); // create Text primitive and add to target - xRetval[nInsert++] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( + xRetval[nInsert++] = Primitive2DReference(new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( aTextMatrix, aPageName, 0, aPageName.Len(), aDXArray, aFontAttributes, aLocale, aFontColor)); } @@ -820,7 +823,7 @@ drawinglayer::primitive2d::Primitive2DSequence SdPageObjectFadeNameNumberPrimiti aTextMatrix.set(1L, 2L, fStartY); // create Text primitive - xRetval[nInsert++] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( + xRetval[nInsert++] = Primitive2DReference(new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( aTextMatrix, aPageNumber, 0, nNumberLen, aDXArray, aFontAttributes, aLocale, aFontColor)); if(getExcluded()) @@ -832,10 +835,10 @@ drawinglayer::primitive2d::Primitive2DSequence SdPageObjectFadeNameNumberPrimiti aStrikethrough.append(aNumberRange.getMinimum()); aStrikethrough.append(aNumberRange.getMaximum()); - xRetval[nInsert++] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + xRetval[nInsert++] = Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( basegfx::tools::createPolygonFromRect(aNumberRange), aActiveColor)); - xRetval[nInsert++] = drawinglayer::primitive2d::Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + xRetval[nInsert++] = Primitive2DReference(new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( aStrikethrough, aActiveColor)); } } @@ -890,7 +893,7 @@ ImplPrimitrive2DIDBlock(SdPageObjectFadeNameNumberPrimitive, PRIMITIVE2D_ID_SDPA // This method will replace the whole painting mechanism. Task is no longer to paint stuff to an OutDev, // but to provide the necessary geometrical information using primitives. -drawinglayer::primitive2d::Primitive2DSequence PageObjectViewObjectContact::createPrimitive2DSequence(const sdr::contact::DisplayInfo& rDisplayInfo) const +Primitive2DSequence PageObjectViewObjectContact::createPrimitive2DSequence(const sdr::contact::DisplayInfo& rDisplayInfo) const { // OutputDevice* pDevice = rDisplayInfo.GetDIOutputDevice(); OutputDevice* pDevice = GetObjectContact().TryToGetOutputDevice(); @@ -1005,24 +1008,24 @@ drawinglayer::primitive2d::Primitive2DSequence PageObjectViewObjectContact::crea (bCreateSelected ? 1 : 0) // create selected ); sal_uInt32 nInsert(0); - drawinglayer::primitive2d::Primitive2DSequence xRetval(nCount); + Primitive2DSequence xRetval(nCount); if(bCreateBitmap) { // add selection indicator if used - xRetval[nInsert++] = drawinglayer::primitive2d::Primitive2DReference(new SdPageObjectPageBitmapPrimitive(aInnerRange, aBitmapEx)); + xRetval[nInsert++] = Primitive2DReference(new SdPageObjectPageBitmapPrimitive(aInnerRange, aBitmapEx)); } if(true) { // add border (always) - xRetval[nInsert++] = drawinglayer::primitive2d::Primitive2DReference(new SdPageObjectBorderPrimitive(aInnerRange)); + xRetval[nInsert++] = Primitive2DReference(new SdPageObjectBorderPrimitive(aInnerRange)); } if(true) { // add fade effext, page name and number if used - xRetval[nInsert++] = drawinglayer::primitive2d::Primitive2DReference(new SdPageObjectFadeNameNumberPrimitive( + xRetval[nInsert++] = Primitive2DReference(new SdPageObjectFadeNameNumberPrimitive( aInnerRange, aPageName, nPageNumber, @@ -1035,13 +1038,13 @@ drawinglayer::primitive2d::Primitive2DSequence PageObjectViewObjectContact::crea if(bCreateSelected) { // add selection indicator if used - xRetval[nInsert++] = drawinglayer::primitive2d::Primitive2DReference(new SdPageObjectSelectPrimitive(aInnerRange)); + xRetval[nInsert++] = Primitive2DReference(new SdPageObjectSelectPrimitive(aInnerRange)); } if(bCreateFocused) { // add focus indicator if used - xRetval[nInsert++] = drawinglayer::primitive2d::Primitive2DReference(new SdPageObjectFocusPrimitive(aInnerRange)); + xRetval[nInsert++] = Primitive2DReference(new SdPageObjectFocusPrimitive(aInnerRange)); } return xRetval; diff --git a/sd/source/ui/slidesorter/view/SlsViewOverlay.cxx b/sd/source/ui/slidesorter/view/SlsViewOverlay.cxx index cc8037bac0d9..c1f5c984d3bc 100644 --- a/sd/source/ui/slidesorter/view/SlsViewOverlay.cxx +++ b/sd/source/ui/slidesorter/view/SlsViewOverlay.cxx @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -267,21 +268,17 @@ void SubstitutionOverlay::Create ( EnsureRegistration(); maPosition = rPosition; + maTranslation = Point(0,0); maShapes.clear(); while (rSelection.HasMoreElements()) { const Rectangle aBox (rSelection.GetNextElement()->GetPageObject()->GetCurrentBoundRect()); - basegfx::B2DRectangle aB2DBox( - aBox.Left(), - aBox.Top(), - aBox.Right(), - aBox.Bottom()); - maShapes.append(basegfx::tools::createPolygonFromRect(aB2DBox), 4); + maShapes.push_back(aBox); + maBoundingBox.Union(aBox); } - maBoundingBox = basegfx::tools::getRange(maShapes); - setVisible(maShapes.count() > 0); + setVisible(maShapes.size() > 0); // The selection indicator may have been visible already so call // objectChange() to enforce an update. objectChange(); @@ -293,7 +290,7 @@ void SubstitutionOverlay::Create ( void SubstitutionOverlay::Clear (void) { maShapes.clear(); - maBoundingBox = basegfx::B2DRange(); + maBoundingBox.SetEmpty(); setVisible(false); } @@ -302,10 +299,8 @@ void SubstitutionOverlay::Clear (void) void SubstitutionOverlay::Move (const Point& rOffset) { - basegfx::B2DHomMatrix aTranslation; - aTranslation.translate(rOffset.X(), rOffset.Y()); - maShapes.transform(aTranslation); - maBoundingBox.transform(aTranslation); + maTranslation += rOffset; + maBoundingBox.Move(rOffset.X(), rOffset.Y()); maPosition += rOffset; @@ -327,14 +322,31 @@ void SubstitutionOverlay::drawGeometry (OutputDevice& rOutputDevice) { if (getOverlayManager() != NULL) { - const sal_uInt32 nOldStripeLength (getOverlayManager()->getStripeLengthPixel()); - getOverlayManager()->setStripeLengthPixel(gnSubstitutionStripeLength); + const sal_uInt32 nSavedStripeLength (getOverlayManager()->getStripeLengthPixel()); - const sal_uInt32 nCount (maShapes.count()); - for (sal_uInt32 nIndex=0; nIndex::const_iterator + iBox (maShapes.begin()), + iEnd (maShapes.end()); + iBox!=iEnd; + ++iBox) + { + // Reduce width and height by one pixel to make the box the same + // size as the frame of the page object. + Rectangle aScreenBox (rOutputDevice.LogicToPixel(*iBox)); + aScreenBox.Right() -= 1; + aScreenBox.Bottom() -= 1; + + // Add accumulated translation. + Rectangle aBox (rOutputDevice.PixelToLogic(aScreenBox)); + aBox.Move(maTranslation.X(), maTranslation.Y()); + + ImpDrawPolygonStriped(rOutputDevice, + basegfx::tools::createPolygonFromRect( + basegfx::B2DRange( + basegfx::B2IRange(aBox.Left(), aBox.Top(), aBox.Right(),aBox.Bottom())))); + } - getOverlayManager()->setStripeLengthPixel(nOldStripeLength); + getOverlayManager()->setStripeLengthPixel(nSavedStripeLength); } } @@ -345,7 +357,12 @@ void SubstitutionOverlay::createBaseRange (OutputDevice& rOutputDevice) { (void)rOutputDevice; - maBaseRange = maBoundingBox; + maBaseRange = basegfx::B2DRange( + basegfx::B2IRange( + maBoundingBox.Left(), + maBoundingBox.Top(), + maBoundingBox.Right(), + maBoundingBox.Bottom())); } @@ -533,7 +550,12 @@ void InsertionIndicatorOverlay::drawGeometry (OutputDevice& rOutputDevice) const Color aColor (rOutputDevice.GetSettings().GetStyleSettings().GetFontColor()); rOutputDevice.SetLineColor(aColor); rOutputDevice.SetFillColor(aColor); - rOutputDevice.DrawRect (maBoundingBox); + + // Reduce width of indicator by one pixel to be of the same width as + // the page objects. + Rectangle aBox (rOutputDevice.LogicToPixel(maBoundingBox)); + aBox.Right() -= 1; + rOutputDevice.DrawRect(rOutputDevice.PixelToLogic(aBox)); } rOutputDevice.SetFillColor(aFillColor); diff --git a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx index de7d46d07c4e..647f2c1ad7d7 100644 --- a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx +++ b/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.cxx @@ -33,7 +33,7 @@ #include "AllMasterPagesSelector.hxx" #include "PreviewValueSet.hxx" - +#include "app.hrc" #include "MasterPageContainer.hxx" #include "MasterPageDescriptor.hxx" #include @@ -197,4 +197,15 @@ void AllMasterPagesSelector::UpdatePageSet (ItemList& rItemList) -} } } // end of namespace ::sd::toolpanel::controls +void AllMasterPagesSelector::GetState (SfxItemSet& rItemSet) +{ + MasterPagesSelector::GetState(rItemSet); + + if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE) + rItemSet.DisableItem(SID_TP_EDIT_MASTER); +} + + + + +} } } // end of namespace ::sd::toolpanel::control diff --git a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx b/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx index e5b06b33a9cf..375a8bc882ce 100644 --- a/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx +++ b/sd/source/ui/toolpanel/controls/AllMasterPagesSelector.hxx @@ -58,6 +58,8 @@ public: */ virtual void Fill (ItemList& rItemList); + virtual void GetState (SfxItemSet& rItemSet); + protected: virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent); diff --git a/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx index 81ae854ad9f5..25cb015d2d1d 100644 --- a/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx +++ b/sd/source/ui/toolpanel/controls/CurrentMasterPagesSelector.cxx @@ -34,6 +34,7 @@ #include "CurrentMasterPagesSelector.hxx" #include "PreviewValueSet.hxx" #include "ViewShellBase.hxx" +#include "DrawViewShell.hxx" #include "drawdoc.hxx" #include "sdpage.hxx" #include "MasterPageContainer.hxx" @@ -250,11 +251,21 @@ void CurrentMasterPagesSelector::Execute (SfxRequest& rRequest) void CurrentMasterPagesSelector::GetState (SfxItemSet& rItemSet) { // Disable the SID_DELTE_MASTER slot when there is only one master page. - if (mrDocument.GetMasterPageUserCount(GetSelectedMasterPage()) > 0) + if (rItemSet.GetItemState(SID_DELETE_MASTER_PAGE) == SFX_ITEM_AVAILABLE + && mrDocument.GetMasterPageUserCount(GetSelectedMasterPage()) > 0) { rItemSet.DisableItem(SID_DELETE_MASTER_PAGE); } + ::boost::shared_ptr pDrawViewShell ( + ::boost::dynamic_pointer_cast(mrBase.GetMainViewShell())); + if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE + && pDrawViewShell + && pDrawViewShell->GetEditMode() == EM_MASTERPAGE) + { + rItemSet.DisableItem (SID_TP_EDIT_MASTER); + } + MasterPagesSelector::GetState(rItemSet); } diff --git a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx b/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx index f247f3596ac3..d01a86a94276 100644 --- a/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx +++ b/sd/source/ui/toolpanel/controls/MasterPageContainerProviders.cxx @@ -75,7 +75,8 @@ Image PagePreviewProvider::operator () ( aPreview = rRenderer.RenderPage( pPage, nWidth, - String::CreateFromAscii("")); + String::CreateFromAscii(""), + false); } return aPreview; diff --git a/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx index 135be992a1c0..9356dac3f7f9 100644 --- a/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx +++ b/sd/source/ui/toolpanel/controls/MasterPagesSelector.cxx @@ -46,6 +46,7 @@ #include "strings.hrc" #include "showview.hxx" #include "DrawViewShell.hxx" +#include "DrawController.hxx" #include "SlideSorterViewShell.hxx" #include "PreviewValueSet.hxx" #include "ViewShellBase.hxx" @@ -570,6 +571,26 @@ void MasterPagesSelector::Execute (SfxRequest& rRequest) break; } + case SID_TP_EDIT_MASTER: + { + using namespace ::com::sun::star; + uno::Reference xSelectedMaster ( + GetSelectedMasterPage()->getUnoPage(), uno::UNO_QUERY); + SfxViewFrame* pViewFrame = mrBase.GetViewFrame(); + if (pViewFrame != NULL && xSelectedMaster.is()) + { + SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); + if (pDispatcher != NULL) + { + USHORT nIndex = mpPageSet->GetSelectItemId(); + pDispatcher->Execute(SID_MASTERPAGE, SFX_CALLMODE_SYNCHRON); + mpPageSet->SelectItem (nIndex); + mrBase.GetDrawController().setCurrentPage(xSelectedMaster); + } + } + break; + } + case SID_CUT: case SID_COPY: case SID_PASTE: diff --git a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx b/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx index 569f877f74c4..72dbc094de6a 100644 --- a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx +++ b/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.cxx @@ -39,6 +39,7 @@ #include "MasterPageObserver.hxx" #include "sdpage.hxx" #include "drawdoc.hxx" +#include "app.hrc" #include #include @@ -145,4 +146,17 @@ void RecentMasterPagesSelector::AssignMasterPageToPageList ( } } + + + +void RecentMasterPagesSelector::GetState (SfxItemSet& rItemSet) +{ + MasterPagesSelector::GetState (rItemSet); + if (rItemSet.GetItemState(SID_TP_EDIT_MASTER) == SFX_ITEM_AVAILABLE) + rItemSet.DisableItem (SID_TP_EDIT_MASTER); +} + + + + } } } // end of namespace ::sd::toolpanel::controls diff --git a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx b/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx index 04506f8575c3..84534cf97a21 100644 --- a/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx +++ b/sd/source/ui/toolpanel/controls/RecentMasterPagesSelector.hxx @@ -51,6 +51,8 @@ public: virtual void LateInit (void); + virtual void GetState (SfxItemSet& rItemSet); + protected: DECL_LINK(MasterPageListListener, void*); virtual void Fill (ItemList& rItemList); diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index 55003f33d147..770ca7fabf6c 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -86,7 +86,8 @@ PreviewRenderer::~PreviewRenderer (void) Image PreviewRenderer::RenderPage ( const SdPage* pPage, const sal_Int32 nWidth, - const String& rSubstitutionText) + const String& rSubstitutionText, + const bool bObeyHighContrastMode) { if (pPage != NULL) { @@ -96,7 +97,7 @@ Image PreviewRenderer::RenderPage ( const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0); const sal_Int32 nHeight (sal::static_int_cast( (nWidth - 2*nFrameWidth) / nAspectRatio + 2*nFrameWidth + 0.5)); - return RenderPage (pPage, Size(nWidth,nHeight), rSubstitutionText); + return RenderPage (pPage, Size(nWidth,nHeight), rSubstitutionText, bObeyHighContrastMode); } else return Image(); @@ -108,7 +109,8 @@ Image PreviewRenderer::RenderPage ( Image PreviewRenderer::RenderPage ( const SdPage* pPage, Size aPixelSize, - const String& rSubstitutionText) + const String& rSubstitutionText, + const bool bObeyHighContrastMode) { Image aPreview; @@ -116,7 +118,7 @@ Image PreviewRenderer::RenderPage ( { try { - if (Initialize (pPage, aPixelSize)) + if (Initialize (pPage, aPixelSize, bObeyHighContrastMode)) { PaintPage (pPage); PaintSubstitutionText (rSubstitutionText); @@ -205,7 +207,8 @@ Image PreviewRenderer::RenderSubstitution ( bool PreviewRenderer::Initialize ( const SdPage* pPage, - const Size& rPixelSize) + const Size& rPixelSize, + const bool bObeyHighContrastMode) { bool bSuccess = false; do @@ -229,8 +232,8 @@ bool PreviewRenderer::Initialize ( break; // Adjust contrast mode. - bool bUseContrast = Application::GetSettings().GetStyleSettings(). - GetHighContrastMode(); + bool bUseContrast (bObeyHighContrastMode + && Application::GetSettings().GetStyleSettings().GetHighContrastMode()); mpPreviewDevice->SetDrawMode (bUseContrast ? ViewShell::OUTPUT_DRAWMODE_CONTRAST : ViewShell::OUTPUT_DRAWMODE_COLOR); diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx index 0391d44cfb3a..e8337c97dfb3 100755 --- a/sd/source/ui/view/ViewShellManager.cxx +++ b/sd/source/ui/view/ViewShellManager.cxx @@ -45,7 +45,7 @@ #include #undef VERBOSE -//#define VERBOSE 2 +#define VERBOSE 2 namespace sd { @@ -839,6 +839,14 @@ void ViewShellManager::Implementation::MoveToTop (const SfxShell& rShell) { ::osl::MutexGuard aGuard (maMutex); + // Check that we have access to a dispatcher. If not, then we are + // (probably) called while the view shell is still being created or + // initialized. Without dispatcher we can not rebuild the shell stack + // to move the requested shell to the top. So return right away instead + // of making a mess without being able to clean up afterwards. + if (mrBase.GetDispatcher() == NULL) + return; + ActiveShellList::iterator iShell (::std::find_if ( maActiveViewShells.begin(), maActiveViewShells.end(), diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 83f896e3d5ad..229e0b8c6eb1 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -68,6 +68,7 @@ #include "drawdoc.hxx" #include "Window.hxx" #include "fupoor.hxx" +#include "fusnapln.hxx" #include "app.hxx" #include "Ruler.hxx" #include "sdresid.hxx" @@ -558,7 +559,8 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) if ( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) { nSdResId = RID_DRAW_SNAPOBJECT_POPUP; - mbMousePosFreezed = TRUE; + ShowSnapLineContextMenu(*pPV, nHelpLine, rCEvt.GetMousePosPixel()); + return; } // Klebepunkt unter dem Mauszeiger markiert? else if( mpDrawView->PickGluePoint( aMPos, pObj, nPickId, pPV ) && @@ -926,6 +928,70 @@ void DrawViewShell::UnlockInput() } + + +void DrawViewShell::ShowSnapLineContextMenu ( + SdrPageView& rPageView, + const USHORT nSnapLineIndex, + const Point& rMouseLocation) +{ + const SdrHelpLine& rHelpLine (rPageView.GetHelpLines()[nSnapLineIndex]); + ::boost::scoped_ptr pMenu (new PopupMenu ()); + + if (rHelpLine.GetKind() == SDRHELPLINE_POINT) + { + pMenu->InsertItem( + SID_SET_SNAPITEM, + String(SdResId(STR_POPUP_EDIT_SNAPPOINT))); + pMenu->InsertSeparator(); + pMenu->InsertItem( + SID_DELETE_SNAPITEM, + String(SdResId(STR_POPUP_DELETE_SNAPPOINT))); + } + else + { + pMenu->InsertItem( + SID_SET_SNAPITEM, + String(SdResId(STR_POPUP_EDIT_SNAPLINE))); + pMenu->InsertSeparator(); + pMenu->InsertItem( + SID_DELETE_SNAPITEM, + String(SdResId(STR_POPUP_DELETE_SNAPLINE))); + } + + pMenu->RemoveDisabledEntries(FALSE, FALSE); + + const USHORT nResult = pMenu->Execute( + GetActiveWindow(), + Rectangle(rMouseLocation, Size(10,10)), + POPUPMENU_EXECUTE_DOWN); + switch (nResult) + { + case SID_SET_SNAPITEM: + { + SfxUInt32Item aHelpLineItem (ID_VAL_INDEX, nSnapLineIndex); + const SfxPoolItem* aArguments[] = {&aHelpLineItem, NULL}; + GetViewFrame()->GetDispatcher()->Execute( + SID_SET_SNAPITEM, + SFX_CALLMODE_SLOT, + aArguments); + } + break; + + case SID_DELETE_SNAPITEM: + { + rPageView.DeleteHelpLine(nSnapLineIndex); + } + break; + + default: + break; + } +} + + + + #ifdef _MSC_VER #pragma optimize ( "", on ) #endif -- cgit