diff options
-rw-r--r-- | sw/inc/crsrsh.hxx | 9 | ||||
-rw-r--r-- | sw/inc/dcontact.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 28 | ||||
-rw-r--r-- | sw/source/core/crsr/viscrs.cxx | 330 | ||||
-rw-r--r-- | sw/source/core/draw/dcontact.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/draw/dflyobj.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/inc/dflyobj.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 3 |
8 files changed, 169 insertions, 234 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 1f945cf6fdff..2a66b9a63ca0 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -152,6 +152,9 @@ const int CRSR_POSOLD = 0x01, // Cursor bleibt an alter Doc-Position String *ReplaceBackReferences( const com::sun::star::util::SearchOptions& rSearchOpt, SwPaM* pPam ); +// #i75172# +enum SwOverlayType { SW_OVERLAY_INVERT, SW_OVERLAY_TRANSPARENT }; + // die Cursor - Shell class SW_DLLPUBLIC SwCrsrShell : public ViewShell, public SwModify { @@ -251,6 +254,9 @@ private: // OD 11.02.2003 #100556# - flag to allow/avoid execution of marcos (default: true) bool mbMacroExecAllowed : 1; + // #i88893# the overlay type to use for cursor + SwOverlayType maSwOverlayType; + SW_DLLPRIVATE void UpdateCrsr( USHORT eFlags =SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE, BOOL bIdleEnd = FALSE ); @@ -348,6 +354,9 @@ public: // only for usage in special cases allowed! void ExtendedSelectAll(); + // #i88893# the overlay type to use for cursor + SwOverlayType getSwOverlayType() const { return maSwOverlayType; } + SwPaM* GetCrsr( BOOL bMakeTblCrsr = TRUE ) const; inline SwCursor* GetSwCrsr( BOOL bMakeTblCrsr = TRUE ) const; // nur den akt. Cursor returnen diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index 146f3f41225c..2c905275ac84 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -379,6 +379,10 @@ class SwDrawVirtObj : public SdrVirtObj virtual SdrLayerID GetLayer() const; virtual void NbcSetLayer(SdrLayerID nLayer); virtual void SetLayer(SdrLayerID nLayer); + + // FullDrag support + virtual bool supportsFullDrag() const; + virtual SdrObject* getFullDragClone() const; }; // OD 26.06.2003 #108784# diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 72056be6a3ef..8b54e9647be3 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2567,6 +2567,22 @@ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx ) * Alle Ansichten eines Dokumentes stehen im Ring der Shells. */ +SwOverlayType impGetOverlayType(OutputDevice* pOut) +{ + if(!pOut) + { + pOut = Application::GetDefaultDevice(); + } + + if(pOut->GetSettings().GetStyleSettings().GetHighContrastMode() + || !pOut->supportsOperation( OutDevSupport_TransparentRect )) + { + return SW_OVERLAY_INVERT; + } + + return SW_OVERLAY_TRANSPARENT; +} + SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin ) : ViewShell( rShell, pInitWin ), SwModify( 0 ), pCrsrStk( 0 ), pBlockCrsr( 0 ), pTblCrsr( 0 ), @@ -2574,8 +2590,9 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin ) eMvState( MV_NONE ), // --> OD 2008-04-02 #refactorlists# sMarkedListId(), - nMarkedListLevel( 0 ) + nMarkedListLevel( 0 ), // <-- + maSwOverlayType(SW_OVERLAY_INVERT) { SET_CURR_SHELL( this ); // Nur die Position vom aktuellen Cursor aus der Copy-Shell uebernehmen @@ -2591,6 +2608,9 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& rShell, Window *pInitWin ) // UpdateCrsr( 0 ); // OD 11.02.2003 #100556# mbMacroExecAllowed = rShell.IsMacroExecAllowed(); + + // #i88893# init cursor selection type + maSwOverlayType = impGetOverlayType(pInitWin); } @@ -2606,8 +2626,9 @@ SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin, eMvState( MV_NONE ), // state for crsr-travelling - GetCrsrOfst // --> OD 2008-04-02 #refactorlists# sMarkedListId(), - nMarkedListLevel( 0 ) + nMarkedListLevel( 0 ), // <-- + maSwOverlayType(SW_OVERLAY_INVERT) { SET_CURR_SHELL( this ); /* @@ -2635,6 +2656,9 @@ SwCrsrShell::SwCrsrShell( SwDoc& rDoc, Window *pInitWin, // UpdateCrsr( 0 ); // OD 11.02.2003 #100556# mbMacroExecAllowed = true; + + // #i88893# init cursor selection type + maSwOverlayType = impGetOverlayType(pInitWin); } diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 6ba832e45075..dd6d1e24fdc4 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -65,6 +65,15 @@ #include <comcore.hrc> // ResId fuer Abfrage wenn zu Search & Replaces #endif +// #i75172# +#include <svx/sdr/overlay/overlaymanager.hxx> +#include <svx/sdrpaintwindow.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <vcl/hatch.hxx> + extern void SwCalcPixStatics( OutputDevice *pOut ); //Damit beim ShowCrsr nicht immer wieder die gleiche Size teuer ermittelt @@ -515,24 +524,9 @@ void SwVisCrsr::_SetPosAndShow() } } - -/* */ -// ------ Ab hier Klassen / Methoden fuer die Selectionen ------- - -// #i75172# -#include <svx/sdr/overlay/overlaymanager.hxx> -#include <svx/sdrpaintwindow.hxx> -#include <basegfx/polygon/b2dpolygontools.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/polygon/b2dpolypolygontools.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <vcl/hatch.hxx> - ////////////////////////////////////////////////////////////////////////////// // #i75172# -enum SwOverlayType { SW_OVERLAY_INVERT, SW_OVERLAY_HATCH, SW_OVERLAY_TRANSPARENT, SW_OVERLAY_LIGHT_TRANSPARENT }; - namespace sdr { namespace overlay @@ -567,6 +561,10 @@ namespace sdr void OverlaySwSelPaintRects::drawGeometry(OutputDevice& rOutputDevice) { + // safe original AA and switch off for selection + const sal_uInt16 nOriginalAA(rOutputDevice.GetAntialiasing()); + rOutputDevice.SetAntialiasing(0); + rOutputDevice.SetLineColor(); rOutputDevice.SetFillColor(getBaseColor()); @@ -580,30 +578,54 @@ namespace sdr for(sal_uInt32 a(0); a < maRanges.size(); a++) { const basegfx::B2DRange& rRange(maRanges[a]); - const Rectangle aRectangle( - basegfx::fround(rRange.getMinX()), basegfx::fround(rRange.getMinY()), - basegfx::fround(rRange.getMaxX()), basegfx::fround(rRange.getMaxY())); switch(mePaintType) { default: // SW_OVERLAY_INVERT { - rOutputDevice.DrawRect( aRectangle ); - break; - } - case SW_OVERLAY_HATCH : - { - rOutputDevice.DrawHatch(PolyPolygon(Polygon(aRectangle)), Hatch(HATCH_SINGLE, getBaseColor(), 2, 450)); + const Rectangle aRectangle( + basegfx::fround(rRange.getMinX()), basegfx::fround(rRange.getMinY()), + basegfx::fround(rRange.getMaxX()) - 1, basegfx::fround(rRange.getMaxY()) - 1); + Rectangle aPntRect(aRectangle); + + // avoid single-pixel overlaps + Rectangle aCalcRect( aPntRect ); + bool bChange(false); + + ++aCalcRect.Bottom(); + ++aCalcRect.Right(); + + aPntRect = rOutputDevice.LogicToPixel( aPntRect ); + aCalcRect = rOutputDevice.LogicToPixel( aCalcRect ); + + if(aPntRect.Bottom() == aCalcRect.Bottom()) + { + --aPntRect.Bottom(); + bChange = true; + } + + if(aPntRect.Right() == aCalcRect.Right()) + { + --aPntRect.Right(); + bChange = true; + } + + if(bChange) + { + aPntRect = rOutputDevice.PixelToLogic(aPntRect); + } + else + { + aPntRect = aRectangle; + } + + rOutputDevice.DrawRect(aPntRect); break; } case SW_OVERLAY_TRANSPARENT : { - rOutputDevice.DrawTransparent(PolyPolygon(Polygon(aRectangle)), 50); - break; - } - case SW_OVERLAY_LIGHT_TRANSPARENT : - { - rOutputDevice.DrawTransparent(PolyPolygon(Polygon(aRectangle)), 80); + const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange)); + rOutputDevice.DrawTransparent(basegfx::B2DPolyPolygon(aPolygon), 0.5); break; } } @@ -613,6 +635,9 @@ namespace sdr { rOutputDevice.Pop(); } + + // restore original AA + rOutputDevice.SetAntialiasing(nOriginalAA); } void OverlaySwSelPaintRects::createBaseRange(OutputDevice& /*rOutputDevice*/) @@ -631,17 +656,6 @@ namespace sdr maRanges(rRanges), mePaintType(eType) { -#ifdef DBG_UTIL - // Here is a debugger test method for checking the new cursor modes. - // Default is SW_OVERLAY_INVERT, of course... - static sal_uInt16 nChangeForTest(0); - switch(nChangeForTest) { - default: mePaintType=SW_OVERLAY_INVERT; break; - case 1: mePaintType=SW_OVERLAY_HATCH; break; - case 2: mePaintType=SW_OVERLAY_TRANSPARENT; break; - case 3: mePaintType=SW_OVERLAY_LIGHT_TRANSPARENT; break; - } -#endif } OverlaySwSelPaintRects::~OverlaySwSelPaintRects() @@ -697,13 +711,6 @@ namespace sdr } // end of namespace sdr ////////////////////////////////////////////////////////////////////////////// -// #i75172# -// Following this flag, a lot of SwSelPaintRects may be removed in the future. -// This includes ::Invalidate, all ::Paint and the derivated implementations. -// I leave them for now to be able to follow old behaviour for some time. -static bool bTestOverlay(true); - -////////////////////////////////////////////////////////////////////////////// SwSelPaintRects::SwSelPaintRects( const SwCrsrShell& rCSh ) : SwRects( 0 ), @@ -729,12 +736,9 @@ void SwSelPaintRects::swapContent(SwSelPaintRects& rSwap) rSwap.Insert(&aTempRects, 0); // #i75172# also swap mpCursorOverlay - if(bTestOverlay) - { - sdr::overlay::OverlayObject* pTempOverlay = getCursorOverlay(); - setCursorOverlay(rSwap.getCursorOverlay()); - rSwap.setCursorOverlay(pTempOverlay); - } + sdr::overlay::OverlayObject* pTempOverlay = getCursorOverlay(); + setCursorOverlay(rSwap.getCursorOverlay()); + rSwap.setCursorOverlay(pTempOverlay); } void SwSelPaintRects::Hide() @@ -745,140 +749,63 @@ void SwSelPaintRects::Hide() mpCursorOverlay = 0; } - for( USHORT n = 0; n < Count(); ++n ) - Paint( (*this)[n] ); SwRects::Remove( 0, Count() ); } void SwSelPaintRects::Show() { - if(bTestOverlay) + SdrView* pView = (SdrView*)pCShell->GetDrawView(); + + if(pView && pView->PaintWindowCount()) { - SdrView* pView = (SdrView*)pCShell->GetDrawView(); + SwRects::Remove( 0, SwRects::Count() ); + FillRects(); + std::vector< basegfx::B2DRange > aNewRanges; - if(pView && pView->PaintWindowCount()) + for(sal_uInt16 a(0); a < Count(); a++) { - SwRects::Remove( 0, SwRects::Count() ); - FillRects(); - std::vector< basegfx::B2DRange > aNewRanges; - Window* pWin = GetShell()->GetWin(); - - for(sal_uInt16 a(0); a < Count(); a++) - { - const SwRect aNextRect((*this)[a]); - Rectangle aPntRect(aNextRect.SVRect()); - - if(pWin) - { - // avoid single-pixel overlaps - Rectangle aCalcRect( aPntRect ); - bool bChange(false); - - ++aCalcRect.Bottom(); - ++aCalcRect.Right(); - - aPntRect = pWin->LogicToPixel( aPntRect ); - aCalcRect = pWin->LogicToPixel( aCalcRect ); - - if(aPntRect.Bottom() == aCalcRect.Bottom()) - { - --aPntRect.Bottom(); - bChange = true; - } - - if(aPntRect.Right() == aCalcRect.Right()) - { - --aPntRect.Right(); - bChange = true; - } - - if(bChange) - { - aPntRect = pWin->PixelToLogic(aPntRect); - } - else - { - aPntRect = aNextRect.SVRect(); - } - } + const SwRect aNextRect((*this)[a]); + const Rectangle aPntRect(aNextRect.SVRect()); - aNewRanges.push_back(basegfx::B2DRange(aPntRect.Left(), aPntRect.Top(), aPntRect.Right(), aPntRect.Bottom())); - } + aNewRanges.push_back(basegfx::B2DRange( + aPntRect.Left(), aPntRect.Top(), + aPntRect.Right() + 1, aPntRect.Bottom() + 1)); + } - if(mpCursorOverlay) + if(mpCursorOverlay) + { + if(aNewRanges.size()) { - if(aNewRanges.size()) - { - static_cast< sdr::overlay::OverlaySwSelPaintRects* >(mpCursorOverlay)->setB2DRanges(aNewRanges); - } - else - { - delete mpCursorOverlay; - mpCursorOverlay = 0; - } + static_cast< sdr::overlay::OverlaySwSelPaintRects* >(mpCursorOverlay)->setB2DRanges(aNewRanges); } - else if(Count()) + else { - SdrPaintWindow* pCandidate = pView->GetPaintWindow(0); - sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager(); - - if(pTargetOverlay) - { - Color aHighlight(COL_BLACK); - const OutputDevice *pOut = GetShell()->GetOut(); - - if(pOut) - { - aHighlight = pOut->GetSettings().GetStyleSettings().GetHighlightColor(); - } - - mpCursorOverlay = new sdr::overlay::OverlaySwSelPaintRects(aHighlight, aNewRanges, SW_OVERLAY_INVERT); - pTargetOverlay->add(*mpCursorOverlay); - } + delete mpCursorOverlay; + mpCursorOverlay = 0; } } - } - else - { - if( pCShell->GetDrawView() ) - { - SdrView* pView = (SdrView*)pCShell->GetDrawView(); - pView->SetAnimationEnabled( !pCShell->IsSelection() ); - } - - SwRects aTmp; - aTmp.Insert( this, 0 ); // Kopie vom Array - - SwRects::Remove( 0, SwRects::Count() ); - FillRects(); - - if( Count() || aTmp.Count() ) + else if(Count()) { - SwRegionRects aReg( pCShell->VisArea() ); - USHORT n; - - // suche die neu selektierten Rechtecke heraus - aReg.Remove( 0, aReg.Count() ); - aReg.Insert( this, 0 ); + SdrPaintWindow* pCandidate = pView->GetPaintWindow(0); + sdr::overlay::OverlayManager* pTargetOverlay = pCandidate->GetOverlayManager(); - for( n = 0; n < aTmp.Count(); ++n ) - aReg -= aTmp[n]; + if(pTargetOverlay) + { + Color aHighlight(COL_BLACK); + const OutputDevice *pOut = GetShell()->GetOut(); - // jetzt sollten in aReg nur noch die neuen Rechtecke vorliegen - for( n = 0; n < aReg.Count(); ++n ) - Paint( aReg[n] ); + if(pOut) + { + aHighlight = pOut->GetSettings().GetStyleSettings().GetHighlightColor(); + } - // suche die nicht mehr selektierten Rechtecke heraus - if( aTmp.Count() ) - { - aReg.Remove( 0, aReg.Count() ); - aReg.Insert( &aTmp, 0 ); - - for( n = 0; n < Count(); ++n ) - aReg -= (*this)[n]; - // jetzt sollten in aReg nur noch die alten Rechtecke vorliegen - for( n = 0; n < aReg.Count(); ++n ) - Paint( aReg[n] ); + SwOverlayType aType(GetShell()->getSwOverlayType()); +#ifdef DBG_UTIL + static bool bChange(false); + if(bChange) aType = (SW_OVERLAY_INVERT == aType) ? SW_OVERLAY_TRANSPARENT : SW_OVERLAY_INVERT; +#endif + mpCursorOverlay = new sdr::overlay::OverlaySwSelPaintRects(aHighlight, aNewRanges, aType); + pTargetOverlay->add(*mpCursorOverlay); } } } @@ -916,15 +843,9 @@ void SwSelPaintRects::Invalidate( const SwRect& rRect ) } } -void SwSelPaintRects::Paint( const Rectangle& rRect ) +void SwSelPaintRects::Paint( const Rectangle& /*rRect*/ ) { - if(bTestOverlay) - { - } - else - { - GetShell()->GetWin()->Invert( rRect ); - } + // nothing to do with overlays } /* @@ -933,60 +854,9 @@ void SwSelPaintRects::Paint( const Rectangle& rRect ) * == 0 -> nur testen, ob es gemalt werden kann */ -void SwSelPaintRects::Paint( const SwRect& rRect ) +void SwSelPaintRects::Paint( const SwRect& /*rRect*/ ) { - if(bTestOverlay) - { - } - else - { - Window* pWin = GetShell()->GetWin(); - const SwRect& rVisArea = GetShell()->VisArea(); - - if( !pWin || rRect.IsEmpty() || !rVisArea.IsOver( rRect ) ) - return; - - Rectangle aPntRect( rRect.SVRect() ); - Rectangle aCalcRect( aPntRect ); - - aPntRect = pWin->LogicToPixel( aPntRect ); - - // falls nach der "Normalisierung" kein Rectangle besteht -> Ende - if( aPntRect.Left() == aPntRect.Right() || - aPntRect.Top() == aPntRect.Bottom() ) - return; - - // damit Linien nicht doppelt invertiert werden, muss jeweis von - // der rechten und unteren Seite ein PIXEL abgezogen werden ! - // Pixel heisst, gleichgueltig, welcher MapMode heute zaehlt ! - - BOOL bChg = FALSE; - BOOL bTstRight = rRect.Right() < rVisArea.Right(); - BOOL bTstBottom = rRect.Bottom() < rVisArea.Bottom(); - - if( bTstBottom || bTstRight ) - { - ++aCalcRect.Bottom(); - ++aCalcRect.Right(); - aCalcRect = pWin->LogicToPixel( aCalcRect ); - - if( bTstBottom && aPntRect.Bottom() == aCalcRect.Bottom() ) - { - --aPntRect.Bottom(); - bChg = TRUE; - } - if( bTstRight && aPntRect.Right() == aCalcRect.Right() ) - { - --aPntRect.Right(); - bChg = TRUE; - } - } - - if( bChg ) - Paint( pWin->PixelToLogic( aPntRect )); - else - Paint( rRect.SVRect() ); - } + // nothing to do with overlays } // check current MapMode of the shell and set possibly the static members. diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index cecab8acca79..05f384156500 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -2758,5 +2758,18 @@ void SwDrawVirtObj::SetLayer(SdrLayerID nLayer) ReferencedObj().SetLayer( nLayer ); SdrVirtObj::NbcSetLayer( ReferencedObj().GetLayer() ); } + +bool SwDrawVirtObj::supportsFullDrag() const +{ + // call parent + return SdrVirtObj::supportsFullDrag(); +} + +SdrObject* SwDrawVirtObj::getFullDragClone() const +{ + // call parent + return SdrVirtObj::getFullDragClone(); +} + // eof diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index a9be7f621d93..d98d5cea0b8e 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -922,4 +922,16 @@ SdrObject* SwVirtFlyDrawObj::CheckMacroHit( const SdrObjMacroHitRec& rRec ) cons return SdrObject::CheckMacroHit( rRec ); } +bool SwVirtFlyDrawObj::supportsFullDrag() const +{ + // call parent + return SdrVirtObj::supportsFullDrag(); +} + +SdrObject* SwVirtFlyDrawObj::getFullDragClone() const +{ + // call parent + return SdrVirtObj::getFullDragClone(); +} +// eof diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx index ea1aae14b62d..3a3be7a60412 100644 --- a/sw/source/core/inc/dflyobj.hxx +++ b/sw/source/core/inc/dflyobj.hxx @@ -126,6 +126,10 @@ public: virtual FASTBOOL HasMacro() const; virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const; virtual Pointer GetMacroPointer (const SdrObjMacroHitRec& rRec) const; + + // FullDrag support + virtual bool supportsFullDrag() const; + virtual SdrObject* getFullDragClone() const; }; diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index b73935b97f35..a88f2ca4db22 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2716,8 +2716,7 @@ void SwEscherEx::WriteOCXControl( const SwFrmFmt& rFmt, UINT32 nShapeId ) // SdrExchangeView aExchange(pModel, pDevice); SdrView aExchange(pModel, pDevice); - Graphic aGraphic(aExchange.GetObjGraphic(pModel, - const_cast<SdrObject*>(pSdrObj))); + Graphic aGraphic(aExchange.GetObjGraphic(pModel, pSdrObj)); EscherPropertyContainer aPropOpt; WriteOLEPicture(aPropOpt, 0xa00 | SHAPEFLAG_OLESHAPE, aGraphic, |