diff options
Diffstat (limited to 'sd')
19 files changed, 288 insertions, 501 deletions
diff --git a/sd/inc/sd_primitivetypes2d.hxx b/sd/inc/sd_primitivetypes2d.hxx index 398359276f91..6f3130b87cf6 100644 --- a/sd/inc/sd_primitivetypes2d.hxx +++ b/sd/inc/sd_primitivetypes2d.hxx @@ -43,6 +43,7 @@ #define PRIMITIVE2D_ID_SDPAGEOBJECTPAGEBITMAPPRIMITIVE (PRIMITIVE2D_ID_RANGE_SD| 2) #define PRIMITIVE2D_ID_SDPAGEOBJECTBORDERPRIMITIVE (PRIMITIVE2D_ID_RANGE_SD| 3) #define PRIMITIVE2D_ID_SDPAGEOBJECTFADENAMENUMBERPRIMITIVE (PRIMITIVE2D_ID_RANGE_SD| 4) +#define PRIMITIVE2D_ID_SDMOUSEOVEREFFECTPRIMITIVE (PRIMITIVE2D_ID_RANGE_SD| 5) ////////////////////////////////////////////////////////////////////////////// diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index 17ab179c949b..887c6014f29c 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -41,7 +41,6 @@ #include <sfx2/dispatch.hxx> #include <svx/sdr/overlay/overlaymanager.hxx> -#include <svx/sdr/overlay/overlaysdrobject.hxx> #include <svx/sdr/overlay/overlaypolypolygon.hxx> #include <svx/svdpagv.hxx> #include <svx/sdrpagewindow.hxx> @@ -68,6 +67,9 @@ #include "app.hrc" #include "Window.hxx" +#include <svx/sdr/contact/viewcontact.hxx> +#include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx> + using ::rtl::OUString; using ::sdr::PolyPolygonEditor; using namespace ::com::sun::star::uno; @@ -310,26 +312,18 @@ void SdPathHdl::CreateB2dIAObject() { for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++) { - // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b]; const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b); if(rPageWindow.GetPaintWindow().OutputToWindow()) { - if(rPageWindow.GetOverlayManager()) + if(rPageWindow.GetOverlayManager() && mpPathObj) { - const SdrPathObj& rPath = *mpPathObj; - - ::sdr::overlay::OverlayObject* pNewOverlayObject = new - ::sdr::overlay::OverlaySdrObject(basegfx::B2DPoint(), rPath); - //::sdr::overlay::OverlayPolyPolygonStriped( maPolyPolygon ); - DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!"); + const sdr::contact::ViewContact& rVC = mpPathObj->GetViewContact(); + const drawinglayer::primitive2d::Primitive2DSequence aSequence = rVC.getViewIndependentPrimitive2DSequence(); + sdr::overlay::OverlayObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence); - // OVERLAYMANAGER - if(pNewOverlayObject) - { - rPageWindow.GetOverlayManager()->add(*pNewOverlayObject); - maOverlayGroup.append(*pNewOverlayObject); - } + rPageWindow.GetOverlayManager()->add(*pNew); + maOverlayGroup.append(*pNew); } } } diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx index 8786f8eed399..3f9d8151ef4e 100644 --- a/sd/source/ui/func/fuconstr.cxx +++ b/sd/source/ui/func/fuconstr.cxx @@ -220,7 +220,7 @@ BOOL FuConstruct::MouseButtonUp(const MouseEvent& rMEvt) SdrPageView* pPV; USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() ); - if (!mpView->PickObj(aPnt, pObj, pPV)) + if (!mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV)) { mpView->MarkObj(aPnt, nHitLog); } diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx index a0d7c47d9841..6c6c0c3aaa81 100644 --- a/sd/source/ui/func/fudraw.cxx +++ b/sd/source/ui/func/fudraw.cxx @@ -78,8 +78,8 @@ #include "fusel.hxx" #include <svtools/aeitem.hxx> #include <vcl/msgbox.hxx> - #include "slideshow.hxx" +#include <svx/sdrhittesthelper.hxx> using namespace ::com::sun::star; @@ -690,7 +690,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt) if (eHit == SDRHIT_NONE) { // found nothing -> look after at the masterpage - mpView->PickObj(aPnt, pObj, pPV, SDRSEARCH_ALSOONMASTER); + mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER); } else if (eHit == SDRHIT_UNMARKEDOBJECT) { @@ -719,7 +719,7 @@ void FuDraw::ForcePointer(const MouseEvent* pMEvt) if (bDefPointer && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene))) { // In die Gruppe hineinschauen - if (mpView->PickObj(aPnt, pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP)) + if (mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP)) bDefPointer = !SetPointer(pObj, aPnt); } } @@ -767,10 +767,10 @@ BOOL FuDraw::SetPointer(SdrObject* pObj, const Point& rPos) aHitPosB.Y() -= n2HitLog; if ( !pObj->IsClosedObj() || - ( pObj->IsHit(aHitPosR, nHitLog, pVisiLayer) && - pObj->IsHit(aHitPosL, nHitLog, pVisiLayer) && - pObj->IsHit(aHitPosT, nHitLog, pVisiLayer) && - pObj->IsHit(aHitPosB, nHitLog, pVisiLayer) ) ) + ( SdrObjectPrimitiveHit(*pObj, aHitPosR, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && + SdrObjectPrimitiveHit(*pObj, aHitPosL, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && + SdrObjectPrimitiveHit(*pObj, aHitPosT, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && + SdrObjectPrimitiveHit(*pObj, aHitPosB, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false))) { /********************************************************** * hit inside the object (without margin) or open object @@ -922,7 +922,7 @@ BOOL FuDraw::RequestHelp(const HelpEvent& rHEvt) Point aPos(mpWindow->PixelToLogic(mpWindow->ScreenToOutputPixel(aPosPixel))); - if (mpView->PickObj(aPos, pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP)) + if (mpView->PickObj(aPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP)) bReturn = SetHelpText(pObj, aPosPixel, aVEvt); } } diff --git a/sd/source/ui/func/fudspord.cxx b/sd/source/ui/func/fudspord.cxx index b8e2ae7b13af..c0103d58c475 100644 --- a/sd/source/ui/func/fudspord.cxx +++ b/sd/source/ui/func/fudspord.cxx @@ -116,7 +116,7 @@ BOOL FuDisplayOrder::MouseMove(const MouseEvent& rMEvt) SdrPageView* pPV; Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); - if ( mpView->PickObj(aPnt, pPickObj, pPV) ) + if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), pPickObj, pPV) ) { if (mpRefObj != pPickObj) { @@ -153,7 +153,7 @@ BOOL FuDisplayOrder::MouseButtonUp(const MouseEvent& rMEvt) SdrPageView* pPV = NULL; Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); - if ( mpView->PickObj(aPnt, mpRefObj, pPV) ) + if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), mpRefObj, pPV) ) { if (nSlotId == SID_BEFORE_OBJ) { diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx index 9f534ede7006..3517892700ed 100644 --- a/sd/source/ui/func/fusel.cxx +++ b/sd/source/ui/func/fusel.cxx @@ -91,6 +91,8 @@ #include <svx/svdundo.hxx> #include <avmedia/mediawindow.hxx> +#include <svx/sdrhittesthelper.hxx> + using namespace ::com::sun::star; namespace sd { @@ -264,7 +266,7 @@ BOOL FuSelection::MouseButtonDown(const MouseEvent& rMEvt) } else { - if (!rMEvt.IsMod2() && mpView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_PICKMACRO)) + if (!rMEvt.IsMod2() && mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO)) { mpView->BegMacroObj(aMDPos, nHitLog, pObj, pPV, mpWindow); bReturn = TRUE; @@ -320,7 +322,7 @@ BOOL FuSelection::MouseButtonDown(const MouseEvent& rMEvt) && mpViewShell->ISA(DrawViewShell) ) { - if(mpView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_ALSOONMASTER)) + if(mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER)) { // Animate object when not just selecting. if ( ! bSelectionOnly) @@ -331,7 +333,7 @@ BOOL FuSelection::MouseButtonDown(const MouseEvent& rMEvt) if(rMEvt.GetClicks() == 1) { // In die Gruppe hineinschauen - if (mpView->PickObj(aMDPos, pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP)) + if (mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP)) bReturn = AnimateObj(pObj, aMDPos); } else if( !bReadOnly && rMEvt.GetClicks() == 2) @@ -1212,10 +1214,10 @@ BOOL FuSelection::AnimateObj(SdrObject* pObj, const Point& rPos) if ( !bClosed || !bFilled || - (pObj->IsHit( aHitPosR, nHitLog, pVisiLayer ) && - pObj->IsHit( aHitPosL, nHitLog, pVisiLayer ) && - pObj->IsHit( aHitPosT, nHitLog, pVisiLayer ) && - pObj->IsHit( aHitPosB, nHitLog, pVisiLayer ) ) ) + (SdrObjectPrimitiveHit(*pObj, aHitPosR, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && + SdrObjectPrimitiveHit(*pObj, aHitPosL, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && + SdrObjectPrimitiveHit(*pObj, aHitPosT, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) && + SdrObjectPrimitiveHit(*pObj, aHitPosB, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) ) ) { if ( mpDoc->GetIMapInfo( pObj ) ) { diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index cb6b42dfc2fb..4f75012ebd3c 100644 --- a/sd/source/ui/func/futext.cxx +++ b/sd/source/ui/func/futext.cxx @@ -325,7 +325,7 @@ BOOL FuText::MouseButtonDown(const MouseEvent& rMEvt) { BOOL bMacro = FALSE; - if (bMacro && mpView->PickObj(aMDPos,pObj,pPV,SDRSEARCH_PICKMACRO)) + if (bMacro && mpView->PickObj(aMDPos,mpView->getHitTolLog(),pObj,pPV,SDRSEARCH_PICKMACRO)) { // Makro USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() ); @@ -1037,7 +1037,7 @@ void FuText::Activate() mpView->SetQuickTextEditMode(mpViewShell->GetFrameView()->IsQuickEdit()); // #i89661# it's no longer necessary to make it so big here, it's fine tuned - // for text objects in SdrMarkView::ImpCheckObjHit + // for text objects in SdrMarkView::CheckSingleSdrObjectHit mpView->SetHitTolerancePixel( 2 * HITPIX ); OutlinerView* pOLV = mpView->GetTextEditOutlinerView(); diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index 0c1cbd47f8e5..9b31cb17e5aa 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -431,7 +431,7 @@ bool SlideSorterController::Command ( // would take place. mrView.GetOverlay().GetInsertionIndicatorOverlay().SetPosition( pWindow->PixelToLogic(rEvent.GetMousePosPixel())); - mrView.GetOverlay().GetInsertionIndicatorOverlay().Show(); + mrView.GetOverlay().GetInsertionIndicatorOverlay().setVisible(true); } pWindow->ReleaseMouse(); @@ -477,7 +477,7 @@ bool SlideSorterController::Command ( // finds the right place to insert a new slide. GetSelectionManager()->SetInsertionPosition( mrView.GetOverlay().GetInsertionIndicatorOverlay().GetInsertionPageIndex()); - mrView.GetOverlay().GetInsertionIndicatorOverlay().Hide(); + mrView.GetOverlay().GetInsertionIndicatorOverlay().setVisible(false); } bEventHasBeenHandled = true; } diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index f157968d6c2d..805628396a35 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -235,7 +235,7 @@ sal_Int32 Clipboard::GetInsertionPosition (::Window* pWindow) view::InsertionIndicatorOverlay& rInsertionIndicatorOverlay ( mrSlideSorter.GetView().GetOverlay().GetInsertionIndicatorOverlay()); - if (rInsertionIndicatorOverlay.IsShowing()) + if (rInsertionIndicatorOverlay.isVisible()) { nInsertPosition = rInsertionIndicatorOverlay.GetInsertionPageIndex(); } @@ -441,8 +441,8 @@ void Clipboard::StartDrag ( void Clipboard::DragFinished (sal_Int8 nDropAction) { // Hide the substitution display and insertion indicator. - mrSlideSorter.GetView().GetOverlay().GetSubstitutionOverlay().Hide(); - mrSlideSorter.GetView().GetOverlay().GetInsertionIndicatorOverlay().Hide(); + mrSlideSorter.GetView().GetOverlay().GetSubstitutionOverlay().setVisible(false); + mrSlideSorter.GetView().GetOverlay().GetInsertionIndicatorOverlay().setVisible(false); SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; @@ -522,7 +522,7 @@ sal_Int8 Clipboard::AcceptDrop ( Point aPosition = pTargetWindow->PixelToLogic (rEvent.maPosPixel); view::ViewOverlay& rOverlay (mrSlideSorter.GetView().GetOverlay()); rOverlay.GetInsertionIndicatorOverlay().SetPosition (aPosition); - rOverlay.GetInsertionIndicatorOverlay().Show(); + rOverlay.GetInsertionIndicatorOverlay().setVisible(true); rOverlay.GetSubstitutionOverlay().SetPosition (aPosition); // Scroll the window when the mouse reaches the window border. @@ -581,7 +581,7 @@ sal_Int8 Clipboard::ExecuteDrop ( USHORT nIndex = DetermineInsertPosition (*pDragTransferable); OSL_TRACE ("Clipboard::AcceptDrop() called for index %d", nIndex); - rOverlay.GetInsertionIndicatorOverlay().Hide(); + rOverlay.GetInsertionIndicatorOverlay().setVisible(false); if (bContinue) { diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx index 366ddc51b2fb..9ed68156f701 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx @@ -243,9 +243,9 @@ BOOL SelectionFunction::MouseMove (const MouseEvent& rEvent) rOverlay.GetMouseOverIndicatorOverlay().SetSlideUnderMouse( rEvent.IsLeaveWindow() ? model::SharedPageDescriptor() : pHitDescriptor); if (pHitDescriptor.get() != NULL) - rOverlay.GetMouseOverIndicatorOverlay().Show(); + rOverlay.GetMouseOverIndicatorOverlay().setVisible(true); else - rOverlay.GetMouseOverIndicatorOverlay().Hide(); + rOverlay.GetMouseOverIndicatorOverlay().setVisible(false); // Allow one mouse move before the drag timer is disabled. if (aDragTimer.IsActive()) @@ -258,7 +258,7 @@ BOOL SelectionFunction::MouseMove (const MouseEvent& rEvent) Rectangle aRectangle (Point(0,0),mpWindow->GetOutputSizePixel()); if ( ! aRectangle.IsInside(aMousePosition) - && rOverlay.GetSubstitutionOverlay().IsShowing()) + && rOverlay.GetSubstitutionOverlay().isVisible()) { // Mouse left the window with pressed left button. Make it a drag. StartDrag(); @@ -598,11 +598,11 @@ void SelectionFunction::ProcessRectangleSelection (bool bToggleSelection) return; view::ViewOverlay& rOverlay (mrSlideSorter.GetView().GetOverlay()); - if (rOverlay.GetSelectionRectangleOverlay().IsShowing()) + if (rOverlay.GetSelectionRectangleOverlay().isVisible()) { PageSelector& rSelector (mrController.GetPageSelector()); - rOverlay.GetSelectionRectangleOverlay().Hide(); + rOverlay.GetSelectionRectangleOverlay().setVisible(false); // Select all pages whose page object lies completly inside the drag // rectangle. @@ -717,7 +717,7 @@ void SelectionFunction::ClearOverlays (void) { view::ViewOverlay& rOverlay (mrSlideSorter.GetView().GetOverlay()); - rOverlay.GetSubstitutionOverlay().Hide(); + rOverlay.GetSubstitutionOverlay().setVisible(false); rOverlay.GetSubstitutionOverlay().Clear(); mpInsertionIndicatorHandler->End(); @@ -795,9 +795,9 @@ sal_uInt32 SelectionFunction::EncodeMouseEvent ( // Detect whether we are dragging pages or dragging a selection rectangle. view::ViewOverlay& rOverlay (mrSlideSorter.GetView().GetOverlay()); - if (rOverlay.GetSubstitutionOverlay().IsShowing()) + if (rOverlay.GetSubstitutionOverlay().isVisible()) nEventCode |= SUBSTITUTION_VISIBLE; - if (rOverlay.GetSelectionRectangleOverlay().IsShowing()) + if (rOverlay.GetSelectionRectangleOverlay().isVisible()) nEventCode |= RECTANGLE_VISIBLE; return nEventCode; @@ -853,9 +853,9 @@ sal_uInt32 SelectionFunction::EncodeKeyEvent ( // Detect whether we are dragging pages or dragging a selection rectangle. view::ViewOverlay& rOverlay (mrSlideSorter.GetView().GetOverlay()); - if (rOverlay.GetSubstitutionOverlay().IsShowing()) + if (rOverlay.GetSubstitutionOverlay().isVisible()) nEventCode |= SUBSTITUTION_VISIBLE; - if (rOverlay.GetSelectionRectangleOverlay().IsShowing()) + if (rOverlay.GetSelectionRectangleOverlay().isVisible()) nEventCode |= RECTANGLE_VISIBLE; return nEventCode; @@ -1070,20 +1070,20 @@ void SelectionFunction::EventPostprocessing (const EventDescriptor& rDescriptor) // case that the context menu is visible. DBG_ASSERT( mrController.IsContextMenuOpen() - || !rOverlay.GetInsertionIndicatorOverlay().IsShowing(), + || !rOverlay.GetInsertionIndicatorOverlay().isVisible(), "slidesorter::SelectionFunction: insertion indicator still visible"); DBG_ASSERT( - !rOverlay.GetSubstitutionOverlay().IsShowing(), + !rOverlay.GetSubstitutionOverlay().isVisible(), "slidesorter::SelectionFunction: substitution still visible"); DBG_ASSERT( - !rOverlay.GetSelectionRectangleOverlay().IsShowing(), + !rOverlay.GetSelectionRectangleOverlay().isVisible(), "slidesorter::SelectionFunction: selection rectangle still visible"); // Now turn them off. if ( ! mrController.IsContextMenuOpen()) - rOverlay.GetInsertionIndicatorOverlay().Hide(); - rOverlay.GetSubstitutionOverlay().Hide(); - rOverlay.GetSelectionRectangleOverlay().Hide(); + rOverlay.GetInsertionIndicatorOverlay().setVisible(false); + rOverlay.GetSubstitutionOverlay().setVisible(false); + rOverlay.GetSelectionRectangleOverlay().setVisible(false); } } @@ -1193,7 +1193,7 @@ SelectionFunction::SubstitutionHandler::~SubstitutionHandler (void) if (mrSlideSorter.IsValid()) { view::ViewOverlay& rOverlay (mrSlideSorter.GetView().GetOverlay()); - rOverlay.GetSubstitutionOverlay().Hide(); + rOverlay.GetSubstitutionOverlay().setVisible(false); rOverlay.GetSubstitutionOverlay().Clear(); } } @@ -1212,14 +1212,14 @@ void SelectionFunction::SubstitutionHandler::Start (const Point& rMouseModelPosi view::ViewOverlay& rOverlay (mrSlideSorter.GetView().GetOverlay()); - if ( ! rOverlay.GetSubstitutionOverlay().IsShowing()) + if ( ! rOverlay.GetSubstitutionOverlay().isVisible()) { // Show a new substitution for the selected page objects. model::PageEnumeration aSelectedPages( model::PageEnumerationProvider::CreateSelectedPagesEnumeration( mrSlideSorter.GetModel())); rOverlay.GetSubstitutionOverlay().Create(aSelectedPages, rMouseModelPosition); - rOverlay.GetSubstitutionOverlay().Show(); + rOverlay.GetSubstitutionOverlay().setVisible(true); mbHasBeenMoved = false; } else @@ -1240,7 +1240,7 @@ void SelectionFunction::SubstitutionHandler::UpdatePosition (const Point& rMouse rOverlay.GetSubstitutionOverlay().SetPosition(rMouseModelPosition); rOverlay.GetInsertionIndicatorOverlay().SetPosition(rMouseModelPosition); - rOverlay.GetInsertionIndicatorOverlay().Show(); + rOverlay.GetInsertionIndicatorOverlay().setVisible(true); mbHasBeenMoved = true; } @@ -1279,9 +1279,9 @@ void SelectionFunction::SubstitutionHandler::Process (void) void SelectionFunction::SubstitutionHandler::End (void) { view::ViewOverlay& rOverlay (mrSlideSorter.GetView().GetOverlay()); - rOverlay.GetSubstitutionOverlay().Hide(); + rOverlay.GetSubstitutionOverlay().setVisible(false); rOverlay.GetSubstitutionOverlay().Clear(); - rOverlay.GetInsertionIndicatorOverlay().Hide(); + rOverlay.GetInsertionIndicatorOverlay().setVisible(false); } @@ -1304,9 +1304,9 @@ bool SelectionFunction::SubstitutionHandler::IsSubstitutionInsertionNonTrivial ( view::ViewOverlay& rOverlay (mrSlideSorter.GetView().GetOverlay()); // Make sure that the substitution and the insertion indicator are visible. - if ( ! rOverlay.GetSubstitutionOverlay().IsShowing()) + if ( ! rOverlay.GetSubstitutionOverlay().isVisible()) break; - if ( ! rOverlay.GetInsertionIndicatorOverlay().IsShowing()) + if ( ! rOverlay.GetInsertionIndicatorOverlay().isVisible()) break; // Iterate over all selected pages and check whether there are @@ -1381,7 +1381,7 @@ void SelectionFunction::InsertionIndicatorHandler::Start (const Point& rMouseMod view::ViewOverlay& rOverlay (mrSlideSorter.GetView().GetOverlay()); rOverlay.GetInsertionIndicatorOverlay().SetPosition(rMouseModelPosition); - rOverlay.GetInsertionIndicatorOverlay().Show(); + rOverlay.GetInsertionIndicatorOverlay().setVisible(true); } @@ -1401,7 +1401,7 @@ void SelectionFunction::InsertionIndicatorHandler::UpdatePosition (const Point& void SelectionFunction::InsertionIndicatorHandler::End (void) { - mrSlideSorter.GetView().GetOverlay().GetInsertionIndicatorOverlay().Hide(); + mrSlideSorter.GetView().GetOverlay().GetInsertionIndicatorOverlay().setVisible(false); } } } } // end of namespace ::sd::slidesorter::controller diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index 2fddf952e18e..a9a4d6b2d385 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -1076,7 +1076,7 @@ void SlotManager::InsertSlide (SfxRequest& rRequest) // No selection. Is there an insertion indicator? else if (mrSlideSorter.GetView().GetOverlay() - .GetInsertionIndicatorOverlay().IsShowing()) + .GetInsertionIndicatorOverlay().isVisible()) { // Select the page before the insertion indicator. nInsertionIndex = mrSlideSorter.GetView().GetOverlay() diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewObjectContact.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewObjectContact.hxx index 52fc96d449db..9351ab72dcd6 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewObjectContact.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectViewObjectContact.hxx @@ -105,13 +105,6 @@ public: */ model::SharedPageDescriptor GetPageDescriptor (void) const; - /** Return the device independent part of the page border. This border - is returned in pixel coordinates. Note that the device dependent - parts--for the page number and the page title--have to be added. - This is done by CalculatePageModelBorder(). - */ - static SvBorder GetPagePixelBorder (void); - /** Return the border widths in the screen coordinate system of the border arround the page object. The border contains frames for selection, focus, the page name and number, and the indicator for @@ -144,7 +137,7 @@ public: When bVisible is <FALSE/> then paint the area of the mouse over effect in the background color, i.e. erase it. */ - void PaintMouseOverEffect (OutputDevice& rDevice, bool bVisible) const; + drawinglayer::primitive2d::Primitive2DSequence createMouseOverEffectPrimitive2DSequence(); enum BoundingBoxType { // This is the outer bounding box that includes the preview, page @@ -189,33 +182,6 @@ public: // access to the current page content primitive vector which may be used for visualisation const drawinglayer::primitive2d::Primitive2DSequence& getCurrentPageContents() const { return mxCurrentPageContents; } - /** This convenience method paints a dotted or dashed rectangle. The - length of dots or dashes is indepent of zoom factor or map mode. - */ - enum DashType { Dotted, Dashed }; - static void PaintDottedRectangle ( - OutputDevice& rDevice, - const Rectangle& rRectangle, - const DashType eDashType = Dotted); - - - enum ColorSpec { CS_SELECTION, CS_BACKGROUND, CS_WINDOW, CS_TEXT }; - /** Return a color for one of the screen elements in ColorSpec. For - Background the background color is updated when - mbIsBackgroundColorUpdatePending is <TRUE/>. - @param rDevice - Base colors are taken from the device. - @param eSpec - The type of color to return. - @param nOpacity - This parameter controls the blending between the background and - the actual color. - */ - Color GetColor ( - const OutputDevice& rDevice, - const ColorSpec eSpec, - const double nOpacity = 1.0) const; - virtual void ActionChanged (void); private: @@ -239,11 +205,6 @@ private: */ bool mbInDestructor; - /** Set this flag to <TRUE/> to update the background color on the next - call to GetBackgroundColor(). - */ - mutable bool mbIsBackgroundColorUpdatePending; - /// The primitive sequence of the page contents, completely scaled /// and prepared for painiting drawinglayer::primitive2d::Primitive2DSequence mxCurrentPageContents; @@ -252,12 +213,6 @@ private: ::boost::shared_ptr<controller::Properties> mpProperties; - /** Do not use this member directly. Use GetColor(Background) instead. - That method determines the background color when - mbIsBackgroundColorUpdatePending is <TRUE/>. - */ - mutable Color maBackgroundColor; - BitmapEx GetPreview ( const sdr::contact::DisplayInfo& rDisplayInfo, const Rectangle& rNewSizePixel); @@ -266,46 +221,6 @@ private: is painted). */ Rectangle GetPageNumberArea (OutputDevice& rDevice) const; - - void PaintBackground (OutputDevice& rDevice) const; - - /** Paint the preview bitmap. - */ - void PaintPreview (OutputDevice& rDevice); - - /** Paint a border arround the page preview. - */ - void PaintBorder (OutputDevice& rDevice) const; - - /** Paint the focus indicator for the specified page. - */ - void PaintFocusIndicator ( - OutputDevice& rDevice, - bool bEraseBackground) const; - - /** Paint the selection indicator when the page is currently selected. - Otherwise the call is ignored. - */ - void PaintSelectionIndicator (OutputDevice& rDevice) const; - - /** Paint the fade effect indicator which indicates whether a fade - effect is currently associated with a page. - @param rDescriptor - The descriptor of the page for which to paint the fade effect - indicator. - */ - void PaintFadeEffectIndicator (OutputDevice& rDevice) const; - - /** Paint the name of the page to the bottom right of the page object. - */ - void PaintPageName (OutputDevice& rDevice) const; - - /** Paint the number of the page to the upper left of the page object. - */ - void PaintPageNumber ( - ::sdr::contact::DisplayInfo& rDisplayInfo); - - Color GetBackgroundColor (const OutputDevice& rDevice) const; }; } } } // end of namespace ::sd::slidesorter::view diff --git a/sd/source/ui/slidesorter/inc/view/SlsViewOverlay.hxx b/sd/source/ui/slidesorter/inc/view/SlsViewOverlay.hxx index a7652d87d35c..1d99584bec4b 100644 --- a/sd/source/ui/slidesorter/inc/view/SlsViewOverlay.hxx +++ b/sd/source/ui/slidesorter/inc/view/SlsViewOverlay.hxx @@ -74,28 +74,17 @@ class ViewOverlay; support for the display. */ class OverlayBase - : private ::boost::noncopyable, - public sdr::overlay::OverlayObject + : public sdr::overlay::OverlayObject { public: OverlayBase (ViewOverlay& rViewOverlay); virtual ~OverlayBase (void); - virtual void Paint (void); - - virtual void Show (void); - virtual void Hide (void); - void Toggle (void); - bool IsShowing (void); - ViewOverlay& GetViewOverlay (void); - protected: ::osl::Mutex maMutex; ViewOverlay& mrViewOverlay; - virtual void transform (const basegfx::B2DHomMatrix& rMatrix); - /** Make sure that the overlay object is registered at the OverlayManager. This registration is done on demand. */ @@ -134,15 +123,16 @@ public: void SetPosition (const Point& rPosition); Point GetPosition (void) const; + // react on stripe definition change + virtual void stripeDefinitionHasChanged(); + protected: - virtual void drawGeometry (OutputDevice& rOutputDevice); - virtual void createBaseRange (OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); private: Point maPosition; - Point maTranslation; - Rectangle maBoundingBox; - ::std::vector<Rectangle> maShapes; + basegfx::B2DPolyPolygon maShapes; }; @@ -163,9 +153,12 @@ public: Rectangle GetSelectionRectangle (void); + // react on stripe definition change + virtual void stripeDefinitionHasChanged(); + protected: - virtual void drawGeometry (OutputDevice& rOutputDevice); - virtual void createBaseRange (OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); private: Point maAnchor; @@ -193,8 +186,8 @@ public: sal_Int32 GetInsertionPageIndex (void) const; protected: - virtual void drawGeometry (OutputDevice& rOutputDevice); - virtual void createBaseRange (OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); private: sal_Int32 mnInsertionIndex; @@ -223,8 +216,8 @@ public: void SetSlideUnderMouse (const model::SharedPageDescriptor& rpDescriptor); protected: - virtual void drawGeometry (OutputDevice& rOutputDevice); - virtual void createBaseRange (OutputDevice& rOutputDevice); + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); private: /** The page under the mouse is stored as weak shared pointer so that diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx index fbea240c5a25..92a0abb72762 100644 --- a/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx +++ b/sd/source/ui/slidesorter/view/SlsPageObjectViewObjectContact.cxx @@ -90,11 +90,9 @@ PageObjectViewObjectContact::PageObjectViewObjectContact ( const ::boost::shared_ptr<controller::Properties>& rpProperties) : ViewObjectContactOfPageObj(rObjectContact, rViewContact), mbInDestructor(false), - mbIsBackgroundColorUpdatePending(true), mxCurrentPageContents(), mpCache(rpCache), - mpProperties(rpProperties), - maBackgroundColor() + mpProperties(rpProperties) { SharedPageDescriptor pDescriptor (GetPageDescriptor()); OSL_ASSERT(pDescriptor.get()!=NULL); @@ -1139,71 +1137,128 @@ void PageObjectViewObjectContact::ActionChanged (void) GetPage()); } - mbIsBackgroundColorUpdatePending = true; - // call parent ViewObjectContactOfPageObj::ActionChanged(); } +////////////////////////////////////////////////////////////////////////////// +// helper MouseOverEffectPrimitive +// +// Used to allow view-dependent primitive definition. For that purpose, the +// initially created primitive (here: in createMouseOverEffectPrimitive2DSequence()) +// always has to be view-independent, but the decomposition is made view-dependent. +// Very simple primitive which just remembers the discrete data and applies +// it at decomposition time. +class MouseOverEffectPrimitive : public drawinglayer::primitive2d::BasePrimitive2D +{ +private: + basegfx::B2DRange maLogicRange; + sal_uInt32 mnDiscreteOffset; + sal_uInt32 mnDiscreteWidth; + basegfx::BColor maRGBColor; +protected: + virtual drawinglayer::primitive2d::Primitive2DSequence createLocalDecomposition( + const drawinglayer::geometry::ViewInformation2D& rViewInformation) const; -void PageObjectViewObjectContact::PaintMouseOverEffect ( - OutputDevice& rDevice, - bool bVisible) const +public: + MouseOverEffectPrimitive( + const basegfx::B2DRange& rLogicRange, + sal_uInt32 nDiscreteOffset, + sal_uInt32 nDiscreteWidth, + const basegfx::BColor& rRGBColor) + : drawinglayer::primitive2d::BasePrimitive2D(), + maLogicRange(rLogicRange), + mnDiscreteOffset(nDiscreteOffset), + mnDiscreteWidth(nDiscreteWidth), + maRGBColor(rRGBColor) + {} + + // data access + const basegfx::B2DRange& getLogicRange() const { return maLogicRange; } + sal_uInt32 getDiscreteOffset() const { return mnDiscreteOffset; } + sal_uInt32 getDiscreteWidth() const { return mnDiscreteWidth; } + const basegfx::BColor& getRGBColor() const { return maRGBColor; } + + virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const; + + DeclPrimitrive2DIDBlock() +}; + +drawinglayer::primitive2d::Primitive2DSequence MouseOverEffectPrimitive::createLocalDecomposition( + const drawinglayer::geometry::ViewInformation2D& rViewInformation) const +{ + // get logic sizes in object coordinate system + const double fDiscreteWidth((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength()); + const double fOffset(fDiscreteWidth * getDiscreteOffset()); + const double fWidth(fDiscreteWidth * getDiscreteWidth()); + + // create range (one pixel less to get a good fitting) + basegfx::B2DRange aRange( + getLogicRange().getMinimum(), + getLogicRange().getMaximum() - basegfx::B2DTuple(fDiscreteWidth, fDiscreteWidth)); + + // grow range + aRange.grow(fOffset - (fWidth * 0.5)); + + // create fat line with parameters. The formerly hand-painted edge + // roundings will now be done using rounded edges of this fat line + const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aRange)); + const drawinglayer::attribute::LineAttribute aLineAttribute(getRGBColor(), fWidth); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::PolygonStrokePrimitive2D( + aPolygon, + aLineAttribute)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); +} + +bool MouseOverEffectPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const +{ + if(drawinglayer::primitive2d::BasePrimitive2D::operator==(rPrimitive)) + { + const MouseOverEffectPrimitive& rCompare = static_cast< const MouseOverEffectPrimitive& >(rPrimitive); + + return (getLogicRange() == rCompare.getLogicRange() + && getDiscreteOffset() == rCompare.getDiscreteOffset() + && getDiscreteWidth() == rCompare.getDiscreteWidth() + && getRGBColor() == rCompare.getRGBColor()); + } + + return false; +} + +ImplPrimitrive2DIDBlock(MouseOverEffectPrimitive, PRIMITIVE2D_ID_SDMOUSEOVEREFFECTPRIMITIVE) + +////////////////////////////////////////////////////////////////////////////// + +drawinglayer::primitive2d::Primitive2DSequence PageObjectViewObjectContact::createMouseOverEffectPrimitive2DSequence() { - // When the selection frame is painted the mouse over frame is not - // visible and does not have to be painted. - if (GetPageDescriptor()->IsSelected()) - if (mpProperties.get()!=NULL && mpProperties->IsShowSelection()) - return; - - ULONG nPreviousDrawMode = rDevice.GetDrawMode(); - rDevice.SetDrawMode (DRAWMODE_DEFAULT); - Rectangle aInner (GetBoundingBox(rDevice,PreviewBoundingBox,PixelCoordinateSystem)); - rDevice.EnableMapMode (FALSE); - - Color aSelectionColor (GetColor(rDevice, CS_SELECTION)); - Color aBackgroundColor (GetColor(rDevice, CS_BACKGROUND)); - Color aFrameColor (bVisible ? aSelectionColor : aBackgroundColor); - Color aCornerColor (aBackgroundColor); - - rDevice.SetFillColor (); - rDevice.SetLineColor (aFrameColor); - - // Paint the frame. - for (int nOffset=mnMouseOverEffectOffset; - nOffset<mnMouseOverEffectOffset+mnMouseOverEffectThickness; - nOffset++) + drawinglayer::primitive2d::Primitive2DSequence aRetval; + + if(GetPageDescriptor()->IsSelected() && mpProperties.get() && mpProperties->IsShowSelection()) { - Rectangle aFrame (aInner); - aFrame.Left() -= nOffset; - aFrame.Top() -= nOffset; - aFrame.Right() += nOffset; - aFrame.Bottom() += nOffset; - rDevice.DrawRect (rDevice.PixelToLogic(aFrame)); + // When the selection frame is visualized the mouse over frame is not + // visible and does not have to be created. + } + else + { + const PageObjectViewContact& rPaObVOC(static_cast<PageObjectViewContact&>(GetViewContact())); + const Rectangle aBoundingBox(rPaObVOC.GetPageObject().GetLastBoundRect()); + const basegfx::B2DRange aLogicRange(aBoundingBox.Left(), aBoundingBox.Top(), aBoundingBox.Right(), aBoundingBox.Bottom()); + const basegfx::BColor aSelectionColor(mpProperties->GetSelectionColor().getBColor()); + const drawinglayer::primitive2d::Primitive2DReference aReference( + new MouseOverEffectPrimitive( + aLogicRange, + mnMouseOverEffectOffset, + mnMouseOverEffectThickness, + aSelectionColor)); + + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); } - // Paint the four corner pixels in backround color for a rounded effect. - int nFrameWidth (mnMouseOverEffectOffset - + mnMouseOverEffectThickness - 1); - Rectangle aOuter (aInner); - aOuter.Left() -= nFrameWidth; - aOuter.Top() -= nFrameWidth; - aOuter.Right() += nFrameWidth; - aOuter.Bottom() += nFrameWidth; - Point aCorner (aOuter.TopLeft()); - - rDevice.DrawPixel (aCorner, aCornerColor); - aCorner = aOuter.TopRight(); - rDevice.DrawPixel (aCorner, aCornerColor); - aCorner = aOuter.BottomLeft(); - rDevice.DrawPixel (aCorner, aCornerColor); - aCorner = aOuter.BottomRight(); - rDevice.DrawPixel (aCorner, aCornerColor); - - rDevice.EnableMapMode (TRUE); - rDevice.SetDrawMode(nPreviousDrawMode); + return aRetval; } @@ -1297,52 +1352,4 @@ model::SharedPageDescriptor - - -Color PageObjectViewObjectContact::GetColor ( - const OutputDevice& rDevice, - const ColorSpec eSpec, - const double nOpacity) const -{ - (void)rDevice; - if (mbIsBackgroundColorUpdatePending) - { - mbIsBackgroundColorUpdatePending = false; - maBackgroundColor = mpProperties->GetBackgroundColor(); - } - - Color aColor; - - switch (eSpec) - { - case CS_SELECTION: - aColor = mpProperties->GetSelectionColor(); - break; - - case CS_BACKGROUND: - if (mpProperties.get()!=NULL - && mpProperties->IsHighlightCurrentSlide() - && GetPageDescriptor()->IsCurrentPage()) - { - aColor = mpProperties->GetHighlightColor(); - } - else - aColor = maBackgroundColor; - break; - - case CS_WINDOW: - aColor = maBackgroundColor; - break; - - case CS_TEXT: - default: - aColor = mpProperties->GetTextColor(); - break; - } - aColor.Merge(maBackgroundColor, BYTE(255*(nOpacity) + 0.5)); - return aColor; -} - - - } } } // end of namespace ::sd::slidesorter::view diff --git a/sd/source/ui/slidesorter/view/SlsViewOverlay.cxx b/sd/source/ui/slidesorter/view/SlsViewOverlay.cxx index c1f5c984d3bc..5e338480e236 100644 --- a/sd/source/ui/slidesorter/view/SlsViewOverlay.cxx +++ b/sd/source/ui/slidesorter/view/SlsViewOverlay.cxx @@ -60,6 +60,9 @@ #include <svx/sdrpagewindow.hxx> #include <vcl/svapp.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> + using namespace ::sdr::overlay; namespace { @@ -170,64 +173,6 @@ OverlayBase::~OverlayBase (void) -void OverlayBase::Paint (void) -{ -} - - - - -bool OverlayBase::IsShowing (void) -{ - return isVisible(); -} - - - - -void OverlayBase::Toggle (void) -{ - if (IsShowing()) - Hide(); - else - Show(); -} - - - - -void OverlayBase::Show (void) -{ - setVisible(true); -} - - - - -void OverlayBase::Hide (void) -{ - setVisible(false); -} - - - - -ViewOverlay& OverlayBase::GetViewOverlay (void) -{ - return mrViewOverlay; -} - - - - -void OverlayBase::transform (const basegfx::B2DHomMatrix& rMatrix) -{ - (void)rMatrix; -} - - - - void OverlayBase::EnsureRegistration (void) { if (getOverlayManager() == NULL) @@ -246,7 +191,6 @@ void OverlayBase::EnsureRegistration (void) SubstitutionOverlay::SubstitutionOverlay (ViewOverlay& rViewOverlay) : OverlayBase(rViewOverlay), maPosition(0,0), - maBoundingBox(), maShapes() { } @@ -268,17 +212,20 @@ void SubstitutionOverlay::Create ( EnsureRegistration(); maPosition = rPosition; - maTranslation = Point(0,0); maShapes.clear(); while (rSelection.HasMoreElements()) { const Rectangle aBox (rSelection.GetNextElement()->GetPageObject()->GetCurrentBoundRect()); - maShapes.push_back(aBox); - maBoundingBox.Union(aBox); + basegfx::B2DRectangle aB2DBox( + aBox.Left(), + aBox.Top(), + aBox.Right(), + aBox.Bottom()); + maShapes.append(basegfx::tools::createPolygonFromRect(aB2DBox), 4); } - setVisible(maShapes.size() > 0); + setVisible(maShapes.count() > 0); // The selection indicator may have been visible already so call // objectChange() to enforce an update. objectChange(); @@ -290,7 +237,6 @@ void SubstitutionOverlay::Create ( void SubstitutionOverlay::Clear (void) { maShapes.clear(); - maBoundingBox.SetEmpty(); setVisible(false); } @@ -299,9 +245,10 @@ void SubstitutionOverlay::Clear (void) void SubstitutionOverlay::Move (const Point& rOffset) { - maTranslation += rOffset; - maBoundingBox.Move(rOffset.X(), rOffset.Y()); + basegfx::B2DHomMatrix aTranslation; + aTranslation.translate(rOffset.X(), rOffset.Y()); + maShapes.transform(aTranslation); maPosition += rOffset; objectChange(); @@ -312,70 +259,52 @@ void SubstitutionOverlay::Move (const Point& rOffset) void SubstitutionOverlay::SetPosition (const Point& rPosition) { - Move(rPosition - maPosition); + Move(rPosition - GetPosition()); } -void SubstitutionOverlay::drawGeometry (OutputDevice& rOutputDevice) +Point SubstitutionOverlay::GetPosition (void) const { - if (getOverlayManager() != NULL) - { - const sal_uInt32 nSavedStripeLength (getOverlayManager()->getStripeLengthPixel()); - - for (::std::vector<Rectangle>::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(nSavedStripeLength); - } + return maPosition; } -void SubstitutionOverlay::createBaseRange (OutputDevice& rOutputDevice) +drawinglayer::primitive2d::Primitive2DSequence SubstitutionOverlay::createOverlayObjectPrimitive2DSequence() { - (void)rOutputDevice; - - maBaseRange = basegfx::B2DRange( - basegfx::B2IRange( - maBoundingBox.Left(), - maBoundingBox.Top(), - maBoundingBox.Right(), - maBoundingBox.Bottom())); -} + drawinglayer::primitive2d::Primitive2DSequence aRetval; + const sal_uInt32 nCount(maShapes.count()); + if(nCount && getOverlayManager()) + { + aRetval.realloc(nCount); + const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor()); + const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor()); + for(sal_uInt32 a(0); a < nCount; a++) + { + aRetval[a] = drawinglayer::primitive2d::Primitive2DReference( + new drawinglayer::primitive2d::PolygonMarkerPrimitive2D( + maShapes.getB2DPolygon(a), + aRGBColorA, + aRGBColorB, + gnSubstitutionStripeLength)); + } + } + return aRetval; +} -Point SubstitutionOverlay::GetPosition (void) const +void SubstitutionOverlay::stripeDefinitionHasChanged() { - return maPosition; + // react on OverlayManager's stripe definition change + objectChange(); } - - //===== SelectionRectangleOverlay =========================================== SelectionRectangleOverlay::SelectionRectangleOverlay (ViewOverlay& rViewOverlay) @@ -418,28 +347,33 @@ void SelectionRectangleOverlay::Update (const Point& rSecondCorner) -void SelectionRectangleOverlay::drawGeometry (OutputDevice& rOutputDevice) +drawinglayer::primitive2d::Primitive2DSequence SelectionRectangleOverlay::createOverlayObjectPrimitive2DSequence() { - ImpDrawRangeStriped( - rOutputDevice, - basegfx::B2DRange( - maAnchor.X(), - maAnchor.Y(), - maSecondCorner.X(), - maSecondCorner.Y())); -} - + drawinglayer::primitive2d::Primitive2DSequence aRetval; + const basegfx::B2DRange aRange(maAnchor.X(), maAnchor.Y(), maSecondCorner.X(), maSecondCorner.Y()); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aRange)); + if(aPolygon.count()) + { + const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor()); + const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor()); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::PolygonMarkerPrimitive2D( + aPolygon, + aRGBColorA, + aRGBColorB, + gnSubstitutionStripeLength)); + + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } + return aRetval; +} -void SelectionRectangleOverlay::createBaseRange (OutputDevice& rOutputDevice) +void SelectionRectangleOverlay::stripeDefinitionHasChanged() { - (void)rOutputDevice; - maBaseRange = basegfx::B2DRange( - maAnchor.X(), - maAnchor.Y(), - maSecondCorner.X(), - maSecondCorner.Y()); + // react on OverlayManager's stripe definition change + objectChange(); } @@ -540,40 +474,23 @@ sal_Int32 InsertionIndicatorOverlay::GetInsertionPageIndex (void) const -void InsertionIndicatorOverlay::drawGeometry (OutputDevice& rOutputDevice) +drawinglayer::primitive2d::Primitive2DSequence InsertionIndicatorOverlay::createOverlayObjectPrimitive2DSequence() { - const Color aFillColor (rOutputDevice.GetFillColor()); - const Color aLineColor (rOutputDevice.GetLineColor()); - - if (isVisible()) - { - const Color aColor (rOutputDevice.GetSettings().GetStyleSettings().GetFontColor()); - rOutputDevice.SetLineColor(aColor); - rOutputDevice.SetFillColor(aColor); - - // 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); - rOutputDevice.SetLineColor(aLineColor); -} - + drawinglayer::primitive2d::Primitive2DSequence aRetval(2); + const basegfx::B2DRange aRange(maBoundingBox.Left(), maBoundingBox.Top(), maBoundingBox.Right(), maBoundingBox.Bottom()); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aRange)); + const basegfx::BColor aRGBColor(Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetFontColor().getBColor()); + aRetval[0] = drawinglayer::primitive2d::Primitive2DReference( + new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( + basegfx::B2DPolyPolygon(aPolygon), + aRGBColor)); + aRetval[1] = drawinglayer::primitive2d::Primitive2DReference( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + aPolygon, + aRGBColor)); - -void InsertionIndicatorOverlay::createBaseRange (OutputDevice& rOutputDevice) -{ - (void)rOutputDevice; - const sal_Int32 nBorder (10); - maBaseRange = basegfx::B2DRange( - maBoundingBox.Left()-nBorder, - maBoundingBox.Top()-nBorder, - maBoundingBox.Right()-nBorder, - maBoundingBox.Bottom()-nBorder); + return aRetval; } @@ -634,34 +551,16 @@ void MouseOverIndicatorOverlay::SetSlideUnderMouse ( -void MouseOverIndicatorOverlay::drawGeometry (OutputDevice& rOutputDevice) +drawinglayer::primitive2d::Primitive2DSequence MouseOverIndicatorOverlay::createOverlayObjectPrimitive2DSequence() { - const Color aFillColor (rOutputDevice.GetFillColor()); - const Color aLineColor (rOutputDevice.GetLineColor()); - view::PageObjectViewObjectContact* pContact = GetViewObjectContact(); - if (pContact != NULL) - pContact->PaintMouseOverEffect(rOutputDevice, true); - - rOutputDevice.SetFillColor(aFillColor); - rOutputDevice.SetLineColor(aLineColor); -} - - - -void MouseOverIndicatorOverlay::createBaseRange (OutputDevice& rOutputDevice) -{ - (void)rOutputDevice; - view::PageObjectViewObjectContact* pContact = GetViewObjectContact(); - if (pContact != NULL) + if(pContact) { - Rectangle aBox (pContact->GetBoundingBox( - rOutputDevice, - view::PageObjectViewObjectContact::MouseOverIndicatorBoundingBox, - view::PageObjectViewObjectContact::ModelCoordinateSystem)); - maBaseRange = basegfx::B2DRange(aBox.Left(),aBox.Top(),aBox.Right(),aBox.Bottom()); + return pContact->createMouseOverEffectPrimitive2DSequence(); } + + return drawinglayer::primitive2d::Primitive2DSequence(); } diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index eb3665fa05f2..9a63afc03479 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -793,7 +793,7 @@ sal_Bool View::SdrBeginTextEdit( Color aBackground; if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_TABLE ) { - aBackground = ImpGetTextEditBackgroundColor(); + aBackground = GetTextEditBackgroundColor(*this); } else { diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index bcf84ec006cf..7f30660c6e4d 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -584,19 +584,8 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge { static_cast< SdrHdlColor* >( pIAOHandle )->SetSize( SDR_HANDLE_COLOR_SIZE_NORMAL ); } - - //OLMconst B2dIAOGroup& rIAOGroup = pIAOHandle->GetIAOGroup(); - //OLMif( rIAOGroup.IsHit( rEvt.maPosPixel ) ) - //OLM{ - //OLM nRet = nDropAction; - //OLM static_cast< SdrHdlColor* >( pIAOHandle )->SetSize( SDR_HANDLE_COLOR_SIZE_SELECTED ); - //OLM} - //OLMelse - //OLM static_cast< SdrHdlColor* >( pIAOHandle )->SetSize( SDR_HANDLE_COLOR_SIZE_NORMAL ); } } - - //OLMRefreshAllIAOManagers(); } // check object insert @@ -606,7 +595,7 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge SdrPageView* pPageView = NULL; ::sd::Window* pWindow = mpViewSh->GetActiveWindow(); Point aPos( pWindow->PixelToLogic( rEvt.maPosPixel ) ); - const BOOL bHasPickObj = PickObj( aPos, pPickObj, pPageView ); + const BOOL bHasPickObj = PickObj( aPos, getHitTolLog(), pPickObj, pPageView ); BOOL bIsPresTarget = FALSE; if( bHasPickObj && pPickObj && ( pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall() ) ) @@ -756,20 +745,6 @@ sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTar nRet = nDropAction; } } - - //OLMconst B2dIAOGroup& rIAOGroup = pIAOHandle->GetIAOGroup(); - //OLMif( rIAOGroup.IsHit( rEvt.maPosPixel ) ) - //OLM{ - //OLM SotStorageStreamRef xStm; - //OLM if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_XFA, xStm ) && xStm.Is() ) - //OLM { - //OLM XFillExchangeData aFillData( XFillAttrSetItem( &pDoc->GetPool() ) ); - //OLM *xStm >> aFillData; - //OLM const Color aColor( ( (XFillColorItem&) aFillData.GetXFillAttrSetItem()->GetItemSet().Get( XATTR_FILLCOLOR ) ).GetValue() ); - //OLM static_cast< SdrHdlColor* >( pIAOHandle )->SetColor( aColor, TRUE ); - //OLM nRet = nDropAction; - //OLM } - //OLM} } } } @@ -805,7 +780,7 @@ sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt, DropTargetHelper& rTar SdrObject* pPickObj = NULL; SdrPageView* pPageView = NULL; - if( PickObj( aPos, pPickObj, pPageView ) ) + if( PickObj( aPos, getHitTolLog(), pPickObj, pPageView ) ) { // insert as clip action => jump rtl::OUString aBookmark( aINetBookmark.GetURL() ); diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 04cebfbdd577..184949f4e683 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -94,6 +94,7 @@ #include <comphelper/processfactory.hxx> #include <tools/stream.hxx> #include <vcl/cvtgrf.hxx> +#include <svx/sdrhittesthelper.hxx> // -------------- // - Namespaces - @@ -327,7 +328,7 @@ BOOL View::InsertData( const TransferableDataHelper& rDataHelper, if( bDrag ) { SdrPageView* pPV = NULL; - PickObj( rPos, pPickObj, pPV ); + PickObj( rPos, getHitTolLog(), pPickObj, pPV ); } if( nPage != SDRPAGE_NOTFOUND ) @@ -721,7 +722,7 @@ BOOL View::InsertData( const TransferableDataHelper& rDataHelper, SdrObject* pObj = pModel->GetSdPage( 0, PK_STANDARD )->GetObj( 0 ); SdrObject* pPickObj2 = NULL; SdrPageView* pPV = NULL; - PickObj( rPos, pPickObj2, pPV ); + PickObj( rPos, getHitTolLog(), pPickObj2, pPV ); if( ( mnAction & DND_ACTION_MOVE ) && pPickObj2 && pObj ) { @@ -1311,11 +1312,11 @@ BOOL View::InsertData( const TransferableDataHelper& rDataHelper, aHitPosT.Y() += n2HitLog; aHitPosB.Y() -= n2HitLog; - if( bClosed && - pPickObj->IsHit( aHitPosR, nHitLog, pVisiLayer ) && - pPickObj->IsHit( aHitPosL, nHitLog, pVisiLayer ) && - pPickObj->IsHit( aHitPosT, nHitLog, pVisiLayer ) && - pPickObj->IsHit( aHitPosB, nHitLog, pVisiLayer ) ) + if( bClosed && + SdrObjectPrimitiveHit(*pPickObj, aHitPosR, nHitLog, *GetSdrPageView(), pVisiLayer, false) && + SdrObjectPrimitiveHit(*pPickObj, aHitPosL, nHitLog, *GetSdrPageView(), pVisiLayer, false) && + SdrObjectPrimitiveHit(*pPickObj, aHitPosT, nHitLog, *GetSdrPageView(), pVisiLayer, false) && + SdrObjectPrimitiveHit(*pPickObj, aHitPosB, nHitLog, *GetSdrPageView(), pVisiLayer, false) ) { // area fill if(eFill == XFILL_SOLID ) diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 1e6842408e67..72534b476a73 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -115,7 +115,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, if( !pPickObj && pPV ) { SdrPageView* pPageView = pPV; - PickObj(rPos, pPickObj, pPageView); + PickObj(rPos, getHitTolLog(), pPickObj, pPageView); } if( mnAction == DND_ACTION_LINK && pPickObj && pPV ) @@ -312,7 +312,7 @@ SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAc if( !pPickObj && pPV ) { SdrPageView* pPageView = pPV; - PickObj(rPos, pPickObj, pPageView); + PickObj(rPos, getHitTolLog(), pPickObj, pPageView); } if( mnAction == DND_ACTION_LINK && pPickObj && pPV && pPickObj->ISA( SdrMediaObj ) ) |