diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2008-11-19 14:05:59 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2008-11-19 14:05:59 +0000 |
commit | ddcf9b9ff2caaffcc59d250b2d7f50ca3ab20330 (patch) | |
tree | ad470e65da542ad344e126f1964ed2d7c248e3a2 /svx/source/dialog/dlgctrl.cxx | |
parent | CWS-TOOLING: integrate CWS fwk94_DEV300 (diff) | |
download | core-ddcf9b9ff2caaffcc59d250b2d7f50ca3ab20330.tar.gz core-ddcf9b9ff2caaffcc59d250b2d7f50ca3ab20330.zip |
CWS-TOOLING: integrate CWS aw058
2008-11-19 14:27:57 +0100 aw r263994 : #i95264# corrected line primitive range calculation for hairlines
2008-11-18 11:31:52 +0100 wg r263754 : i96156
2008-11-18 11:22:38 +0100 wg r263752 : i96156
2008-11-13 11:46:49 +0100 aw r263626 : #i93169# used flag the wrong way; true means that nothing was done yet
2008-11-12 15:33:41 +0100 wg r263601 : i96156
2008-11-12 13:22:38 +0100 wg r263592 : i95527
2008-11-12 13:18:51 +0100 wg r263591 : i95527
2008-10-29 13:22:02 +0100 aw r262794 : #i93485# identified reason and with PL's help changed problem accordingly with usage of an old fallback. This will need to be optimized again by HDU when he finds the time.
2008-10-28 18:23:04 +0100 aw r262763 : unxmacxi compiler warning fixed
2008-10-28 18:17:01 +0100 aw r262762 : unxmacxi compiler warning fixed
2008-10-28 17:55:18 +0100 aw r262761 : unxmacxi compiler warning fixed
2008-10-28 13:48:22 +0100 aw r262743 : #i93485# added UnifiedAlphaPrimitive2D to VclRenderer; corrected getB2DRange implementations for hairlines which are view-dependent
2008-10-28 12:40:55 +0100 aw r262735 : #i93485# had to move Pre/PostPaint to LocalPre/PostPaint since PrePaint is a virtual window method
2008-10-27 15:54:10 +0100 aw r262679 : #i19871# adapted the call order to parent implementations in some Nbc methods in SdrPathObj due to errors in SnapRect recalculation when GluePoints are involved
2008-10-24 18:31:48 +0200 aw r262661 : #i77187# disable all buttons in bezier toolbar when move and/or resize protected object is involved
2008-10-24 18:30:16 +0200 aw r262660 : #i77187# simplified and secured model changers, added toolbar update, disabled move drag start when polygon point is selected
2008-10-24 12:57:50 +0200 hdu r262635 : #i93485# use device transformation for SAL layer
2008-10-24 12:41:37 +0200 hdu r262634 : #i93485# use device transformation for SAL layer
2008-10-23 19:46:12 +0200 aw r262630 : mac compiler warning fixed
2008-10-23 18:15:02 +0200 aw r262628 : #i93485# modified dialog previews to use prerendering
2008-10-23 18:14:27 +0200 aw r262627 : #i93485# added assert when render helper uses Window as copy source
2008-10-22 18:07:30 +0200 aw r262610 : #i95264# fixes assertion
2008-10-22 14:31:51 +0200 aw r262606 : #i89661# also enabling DrawTransparent shortcut for VCL-Renderer
2008-10-22 14:10:31 +0200 aw r262604 : #i89661# new HitTest 2D primitive to support BoundRect and HitTest calculations/tests
2008-10-22 14:09:22 +0200 aw r262603 : #i89661# new HitTest tolerance, new TextFrame selection overlay, support for HitTest geometry
2008-10-22 14:08:16 +0200 aw r262602 : #i89661# correcting old HitTest tolerance expansion
2008-10-20 15:31:48 +0200 aw r262321 : #i89661# added patch to test it
2008-10-20 11:50:31 +0200 aw r262310 : #i87762# removed no longer used icons (aw053)
2008-10-17 15:41:48 +0200 aw r262288 : #i93169#, #i93180# FormControl corrections for Primitive handling
2008-10-17 15:40:54 +0200 aw r262287 : #i93169#, #i93180# FormControl corrections for Primitive handling
2008-10-16 11:12:44 +0200 aw r262253 : #i93595# removed superfluous grid interface
2008-10-16 11:11:20 +0200 aw r262252 : #i93595# changed grid display to sub-grid usage and new defaults
2008-10-15 15:09:40 +0200 aw r262234 : #i93597# moved flag for only vertical PageBorder, added reacting on it to primitive creation
2008-10-15 15:09:09 +0200 aw r262233 : #i93597# moved flag for only vertical PageBorder
2008-10-15 15:08:46 +0200 aw r262232 : #i93597# moved flag for only vertical PageBorder, added reacting on it to primitive creation
2008-10-14 16:27:07 +0200 aw r262207 : #i93648# (flushViewObjectContacts) and #i93318# (propertyChange)
2008-10-14 16:25:10 +0200 aw r262206 : #i93318# back to old state since detecting a change is not placed well at the primitive (which is a graphical information at the itme it was fetched). Instead i will add the needed check and flush at the FormControl's VOC
2008-10-14 13:47:38 +0200 aw r262201 : #i93318# added a change listener to the XControlModel and code to make the operator== at control primitive fail
Diffstat (limited to 'svx/source/dialog/dlgctrl.cxx')
-rw-r--r-- | svx/source/dialog/dlgctrl.cxx | 341 |
1 files changed, 154 insertions, 187 deletions
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index c48e74e1946a..beef4fe8ae48 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -56,6 +56,11 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <svx/svdorect.hxx> +#include <svx/svdmodel.hxx> +#include <svx/svdopath.hxx> +#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> +#include <svx/sdr/contact/displayinfo.hxx> + #define OUTPUT_DRAWMODE_COLOR (DRAWMODE_DEFAULT) #define OUTPUT_DRAWMODE_CONTRAST (DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT) @@ -1895,36 +1900,146 @@ void LineEndLB::Modify( XLineEndEntry* pEntry, USHORT nPos, Bitmap* pBmp, InsertEntry( pEntry->GetName(), nPos ); } +////////////////////////////////////////////////////////////////////////////// + +void SvxPreviewBase::InitSettings(bool bForeground, bool bBackground) +{ + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + + if(bForeground) + { + svtools::ColorConfig aColorConfig; + Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor); + + if(IsControlForeground()) + { + aTextColor = GetControlForeground(); + } + + getBufferDevice().SetTextColor(aTextColor); + } + + if(bBackground) + { + if(IsControlBackground()) + { + getBufferDevice().SetBackground(GetControlBackground()); + } + else + { + getBufferDevice().SetBackground(rStyleSettings.GetWindowColor()); + } + } + + // do not paint background self, it gets painted buffered + SetControlBackground(); + SetBackground(); + + Invalidate(); +} + +SvxPreviewBase::SvxPreviewBase( Window* pParent, const ResId& rResId ) +: Control( pParent, rResId ), + mpModel( new SdrModel() ), + mpBufferDevice( new VirtualDevice(*this) ) +{ + // Draw the control's border as a flat thin black line. + SetBorderStyle(WINDOW_BORDER_MONO); + SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + SetMapMode(MAP_100TH_MM); + + // init model + mpModel->GetItemPool().FreezeIdRanges(); +} + +SvxPreviewBase::~SvxPreviewBase() +{ + delete mpModel; + delete mpBufferDevice; +} + +void SvxPreviewBase::LocalPrePaint() +{ + // init BufferDevice + if(mpBufferDevice->GetOutputSizePixel() != GetOutputSizePixel()) + { + mpBufferDevice->SetDrawMode(GetDrawMode()); + mpBufferDevice->SetSettings(GetSettings()); + mpBufferDevice->SetAntialiasing(GetAntialiasing()); + mpBufferDevice->SetOutputSizePixel(GetOutputSizePixel()); + mpBufferDevice->SetMapMode(GetMapMode()); + } + + mpBufferDevice->Erase(); +} + +void SvxPreviewBase::LocalPostPaint() +{ + // copy to front (in pixel mode) + const bool bWasEnabledSrc(mpBufferDevice->IsMapModeEnabled()); + const bool bWasEnabledDst(IsMapModeEnabled()); + const Point aEmptyPoint; + + mpBufferDevice->EnableMapMode(false); + EnableMapMode(false); + + DrawOutDev( + aEmptyPoint, GetOutputSizePixel(), + aEmptyPoint, GetOutputSizePixel(), + *mpBufferDevice); + + mpBufferDevice->EnableMapMode(bWasEnabledSrc); + EnableMapMode(bWasEnabledDst); +} + +void SvxPreviewBase::StateChanged(StateChangedType nType) +{ + Control::StateChanged(nType); + + if(STATE_CHANGE_CONTROLFOREGROUND == nType) + { + InitSettings(true, false); + } + else if(STATE_CHANGE_CONTROLBACKGROUND == nType) + { + InitSettings(false, true); + } +} + +void SvxPreviewBase::DataChanged(const DataChangedEvent& rDCEvt) +{ + SetDrawMode(GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR); + + if((DATACHANGED_SETTINGS == rDCEvt.GetType()) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) + { + InitSettings(true, true); + } + else + { + Control::DataChanged(rDCEvt); + } +} + /************************************************************************* |* |* SvxXLinePreview::SvxXLinePreview() |* *************************************************************************/ -#include <svx/svdmodel.hxx> -#include <svx/svdopath.hxx> -#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> -#include <svx/sdr/contact/displayinfo.hxx> SvxXLinePreview::SvxXLinePreview( Window* pParent, const ResId& rResId ) -: Control( pParent, rResId ), +: SvxPreviewBase( pParent, rResId ), mpLineObjA( 0L ), mpLineObjB( 0L ), mpLineObjC( 0L ), - mpModel( 0L ), mpGraphic( 0L ), mbWithSymbol( sal_False ) { - SetMapMode( MAP_100TH_MM ); const Size aOutputSize(GetOutputSize()); InitSettings( TRUE, TRUE ); const sal_Int32 nDistance(500L); const sal_Int32 nAvailableLength(aOutputSize.Width() - (4 * nDistance)); - // create model - mpModel = new SdrModel(); - mpModel->GetItemPool().FreezeIdRanges(); - // create DrawObectA const sal_Int32 aYPosA(aOutputSize.Height() / 2); const basegfx::B2DPoint aPointA1( nDistance, aYPosA); @@ -1933,7 +2048,7 @@ SvxXLinePreview::SvxXLinePreview( Window* pParent, const ResId& rResId ) aPolygonA.append(aPointA1); aPolygonA.append(aPointA2); mpLineObjA = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygonA)); - mpLineObjA->SetModel(mpModel); + mpLineObjA->SetModel(&getModel()); // create DrawObectB const sal_Int32 aYPosB1((aOutputSize.Height() * 3) / 4); @@ -1946,7 +2061,7 @@ SvxXLinePreview::SvxXLinePreview( Window* pParent, const ResId& rResId ) aPolygonB.append(aPointB2); aPolygonB.append(aPointB3); mpLineObjB = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aPolygonB)); - mpLineObjB->SetModel(mpModel); + mpLineObjB->SetModel(&getModel()); // create DrawObectC const basegfx::B2DPoint aPointC1( aPointB3.getX() + nDistance, aYPosB1); @@ -1957,11 +2072,7 @@ SvxXLinePreview::SvxXLinePreview( Window* pParent, const ResId& rResId ) aPolygonC.append(aPointC2); aPolygonC.append(aPointC3); mpLineObjC = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aPolygonC)); - mpLineObjC->SetModel(mpModel); - - // Draw the control's border as a flat thin black line. - SetBorderStyle (WINDOW_BORDER_MONO); - SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + mpLineObjC->SetModel(&getModel()); } SvxXLinePreview::~SvxXLinePreview() @@ -1969,33 +2080,6 @@ SvxXLinePreview::~SvxXLinePreview() SdrObject::Free( mpLineObjA ); SdrObject::Free( mpLineObjB ); SdrObject::Free( mpLineObjC ); - delete mpModel; -} - -// ----------------------------------------------------------------------- - -void SvxXLinePreview::InitSettings( BOOL bForeground, BOOL bBackground ) -{ - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - if ( bForeground ) - { - svtools::ColorConfig aColorConfig; - Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); - - if ( IsControlForeground() ) - aTextColor = GetControlForeground(); - SetTextColor( aTextColor ); - } - - if ( bBackground ) - { - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( rStyleSettings.GetWindowColor() ); - } - Invalidate(); } // ----------------------------------------------------------------------- @@ -2037,15 +2121,15 @@ void SvxXLinePreview::SetLineAttributes(const SfxItemSet& rItemSet) void SvxXLinePreview::Paint( const Rectangle& ) { - const Size aOutputSize(GetOutputSize()); + LocalPrePaint(); - // paint objects + // paint objects to buffer device sdr::contact::SdrObjectVector aObjectVector; aObjectVector.push_back(mpLineObjA); aObjectVector.push_back(mpLineObjB); aObjectVector.push_back(mpLineObjC); - sdr::contact::ObjectContactOfObjListPainter aPainter(*this, aObjectVector, 0); + sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; // do processing @@ -2053,35 +2137,14 @@ void SvxXLinePreview::Paint( const Rectangle& ) if ( mbWithSymbol && mpGraphic ) { + const Size aOutputSize(GetOutputSize()); Point aPos = Point( aOutputSize.Width() / 3, aOutputSize.Height() / 2 ); aPos.X() -= maSymbolSize.Width() / 2; aPos.Y() -= maSymbolSize.Height() / 2; - mpGraphic->Draw( this, aPos, maSymbolSize ); + mpGraphic->Draw( &getBufferDevice(), aPos, maSymbolSize ); } -} - -// ----------------------------------------------------------------------- - -void SvxXLinePreview::StateChanged( StateChangedType nType ) -{ - if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) - InitSettings( TRUE, FALSE ); - else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) - InitSettings( FALSE, TRUE ); - - Control::StateChanged( nType ); -} - -// ----------------------------------------------------------------------- - -void SvxXLinePreview::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - InitSettings( TRUE, TRUE ); - else - Control::DataChanged( rDCEvt ); - SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + LocalPostPaint(); } /************************************************************************* @@ -2090,57 +2153,21 @@ void SvxXLinePreview::DataChanged( const DataChangedEvent& rDCEvt ) |* *************************************************************************/ -void SvxXRectPreview::InitSettings(bool bForeground, bool bBackground) -{ - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - if ( bForeground ) - { - svtools::ColorConfig aColorConfig; - Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); - - if ( IsControlForeground() ) - aTextColor = GetControlForeground(); - SetTextColor( aTextColor ); - } - - if ( bBackground ) - { - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( rStyleSettings.GetWindowColor() ); - } - Invalidate(); -} - SvxXRectPreview::SvxXRectPreview( Window* pParent, const ResId& rResId ) -: Control( pParent, rResId ), - mpRectangleObject(0), - mpModel(0) +: SvxPreviewBase( pParent, rResId ), + mpRectangleObject(0) { - SetBorderStyle(WINDOW_BORDER_MONO); - SetMapMode(MAP_100TH_MM); InitSettings(true, true); - // create model - mpModel = new SdrModel(); - mpModel->GetItemPool().FreezeIdRanges(); - // create RectangleObject const Rectangle aObjectSize(Point(), GetOutputSize()); mpRectangleObject = new SdrRectObj(aObjectSize); - mpRectangleObject->SetModel(mpModel); - - // Draw the control's border as a flat thin black line. - SetBorderStyle (WINDOW_BORDER_MONO); - SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + mpRectangleObject->SetModel(&getModel()); } SvxXRectPreview::~SvxXRectPreview() { SdrObject::Free(mpRectangleObject); - delete mpModel; } void SvxXRectPreview::SetAttributes(const SfxItemSet& rItemSet) @@ -2151,30 +2178,18 @@ void SvxXRectPreview::SetAttributes(const SfxItemSet& rItemSet) void SvxXRectPreview::Paint( const Rectangle& ) { + LocalPrePaint(); + sdr::contact::SdrObjectVector aObjectVector; + aObjectVector.push_back(mpRectangleObject); - sdr::contact::ObjectContactOfObjListPainter aPainter(*this, aObjectVector, 0); + + sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; aPainter.ProcessDisplay(aDisplayInfo); -} -void SvxXRectPreview::StateChanged( StateChangedType nType ) -{ - if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) - InitSettings(true, false); - else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) - InitSettings(false, true); - - Control::StateChanged( nType ); -} - -void SvxXRectPreview::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - InitSettings(true, true); - else - Control::DataChanged( rDCEvt ); + LocalPostPaint(); } /************************************************************************* @@ -2183,44 +2198,13 @@ void SvxXRectPreview::DataChanged( const DataChangedEvent& rDCEvt ) |* *************************************************************************/ -void SvxXShadowPreview::InitSettings(bool bForeground, bool bBackground) -{ - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - if ( bForeground ) - { - svtools::ColorConfig aColorConfig; - Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); - - if ( IsControlForeground() ) - aTextColor = GetControlForeground(); - SetTextColor( aTextColor ); - } - - if ( bBackground ) - { - if ( IsControlBackground() ) - SetBackground( GetControlBackground() ); - else - SetBackground( rStyleSettings.GetWindowColor() ); - } - Invalidate(); -} - SvxXShadowPreview::SvxXShadowPreview( Window* pParent, const ResId& rResId ) -: Control( pParent, rResId ), +: SvxPreviewBase( pParent, rResId ), mpRectangleObject(0), - mpRectangleShadow(0), - mpModel(0) + mpRectangleShadow(0) { - SetBorderStyle(WINDOW_BORDER_MONO); - SetMapMode(MAP_100TH_MM); InitSettings(true, true); - // create model - mpModel = new SdrModel(); - mpModel->GetItemPool().FreezeIdRanges(); - // prepare size Size aSize = GetOutputSize(); aSize.Width() = aSize.Width() / 3; @@ -2229,23 +2213,18 @@ SvxXShadowPreview::SvxXShadowPreview( Window* pParent, const ResId& rResId ) // create RectangleObject const Rectangle aObjectSize( Point( aSize.Width(), aSize.Height() ), aSize ); mpRectangleObject = new SdrRectObj(aObjectSize); - mpRectangleObject->SetModel(mpModel); + mpRectangleObject->SetModel(&getModel()); // create ShadowObject const Rectangle aShadowSize( Point( aSize.Width(), aSize.Height() ), aSize ); mpRectangleShadow = new SdrRectObj(aShadowSize); - mpRectangleShadow->SetModel(mpModel); - - // Draw the control's border as a flat thin black line. - SetBorderStyle (WINDOW_BORDER_MONO); - SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); + mpRectangleShadow->SetModel(&getModel()); } SvxXShadowPreview::~SvxXShadowPreview() { SdrObject::Free(mpRectangleObject); SdrObject::Free(mpRectangleShadow); - delete mpModel; } void SvxXShadowPreview::SetRectangleAttributes(const SfxItemSet& rItemSet) @@ -2269,31 +2248,19 @@ void SvxXShadowPreview::SetShadowPosition(const Point& rPos) void SvxXShadowPreview::Paint( const Rectangle& ) { + LocalPrePaint(); + sdr::contact::SdrObjectVector aObjectVector; + aObjectVector.push_back(mpRectangleShadow); aObjectVector.push_back(mpRectangleObject); - sdr::contact::ObjectContactOfObjListPainter aPainter(*this, aObjectVector, 0); + + sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0); sdr::contact::DisplayInfo aDisplayInfo; aPainter.ProcessDisplay(aDisplayInfo); -} - -void SvxXShadowPreview::StateChanged( StateChangedType nType ) -{ - if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) - InitSettings( TRUE, FALSE ); - else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) - InitSettings( FALSE, TRUE ); - Control::StateChanged( nType ); -} - -void SvxXShadowPreview::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - InitSettings( TRUE, TRUE ); - else - Control::DataChanged( rDCEvt ); + LocalPostPaint(); } // ----------------------------------------------------------------------- |