diff options
author | Armin Le Grand <alg@apache.org> | 2014-07-14 19:09:11 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2014-07-14 19:09:11 +0000 |
commit | 3c1d4742e649fe9c8aed8c2817fe3e1f3364f298 (patch) | |
tree | e0c6e02c89aa9227726c9469da1001b3e29c41df /svx/source | |
parent | c5c31e2aeaedbdf76e1f38d3c385e34f5ed875ca (diff) |
Resync to trunk, windows non-pro build
aoo/aw080
Diffstat (limited to 'svx/source')
63 files changed, 1979 insertions, 942 deletions
diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx index 62fdf9e09d33..61eb91bfed41 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.cxx +++ b/svx/source/accessibility/ChildrenManagerImpl.cxx @@ -306,7 +306,7 @@ void ChildrenManagerImpl::CreateListOfVisibleShapes ( Rectangle aVisibleArea = maShapeTreeInfo.GetViewForwarder()->GetVisibleArea(); - // Add the visible shapes for wich the accessible objects already exist. + // Add the visible shapes for which the accessible objects already exist. AccessibleShapeList::iterator I,aEnd = maAccessibleShapes.end(); for (I=maAccessibleShapes.begin(); I != aEnd; ++I) { @@ -875,7 +875,7 @@ sal_Bool ChildrenManagerImpl::ReplaceChild ( uno::Any(), uno::makeAny (I->mxAccessibleShape)); - // Replace with replacement and send an event about existance + // Replace with replacement and send an event about existence // of the new child. I->mxAccessibleShape = pNewChild; mrContext.CommitChange ( diff --git a/svx/source/accessibility/ChildrenManagerImpl.hxx b/svx/source/accessibility/ChildrenManagerImpl.hxx index 396263ad34c2..64f8725cf9c1 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.hxx +++ b/svx/source/accessibility/ChildrenManagerImpl.hxx @@ -89,7 +89,7 @@ public: /** Create a children manager, which manages the children of the given parent. The parent is used for creating accessible objects. The list of shapes for which to create those objects is not derived from - the parent and has to be provided seperately by calling one of the + the parent and has to be provided separately by calling one of the update methods. @param rxParent The parent of the accessible objects which will be created @@ -184,7 +184,7 @@ public: /** Update the child manager. Take care of a modified set of children and modified visible area. This method can optimize the update - process with respect seperate updates of a modified children list + process with respect separate updates of a modified children list and visible area. @param bCreateNewObjectsOnDemand If </true> then accessible objects associated with the visible @@ -274,10 +274,10 @@ public: (or more) aspect of the view forwarder. @param aChangeType A change type of <const>VISIBLE_AREA</const> leads to a call to - the <member>Update</memeber> which creates accessible objects of + the <member>Update</member> which creates accessible objects of new shapes immediately. Other change types are passed to the visible accessible children without calling - <member>Update</memeber>. + <member>Update</member>. @param pViewForwarder The modified view forwarder. Use this one from now on. */ @@ -521,7 +521,7 @@ public: /** This flag is set during the visibility calculation and indicates that at one time in this process an event is sent that informs the - listners of the creation of a new accessible object. This flags is + listeners of the creation of a new accessible object. This flags is not reset afterwards. Don't use it unless you know exactly what you are doing. */ diff --git a/svx/source/accessibility/DGColorNameLookUp.cxx b/svx/source/accessibility/DGColorNameLookUp.cxx index 97455cb9d489..be75185df418 100644 --- a/svx/source/accessibility/DGColorNameLookUp.cxx +++ b/svx/source/accessibility/DGColorNameLookUp.cxx @@ -109,7 +109,7 @@ DGColorNameLookUp::DGColorNameLookUp (void) } catch (uno::RuntimeException e) { - // When an excpetion occured then whe have an empty name sequence + // When an excpetion occurred then whe have an empty name sequence // and the loop below is not entered. } diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx index ed68c386eba1..e016b7065b7a 100644 --- a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx +++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx @@ -1256,7 +1256,7 @@ Rectangle SvxPixelCtlAccessibleChild::GetBoundingBoxOnScreen( void ) throw( Runt Rectangle SvxPixelCtlAccessibleChild::GetBoundingBox( void ) throw( RuntimeException ) { - // no guard neccessary, because no one changes mpBoundingBox after creating it + // no guard necessary, because no one changes mpBoundingBox after creating it ThrowExceptionIfNotAlive(); return *mpBoundingBox; diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx index 6a053ba5d9ec..3f2c753acc01 100644 --- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx +++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx @@ -595,7 +595,7 @@ void SAL_CALL SvxRectCtlAccessibleContext::selectAccessibleChild( sal_Int32 nInd DBG_ASSERT( pData, "SvxRectCtlAccessibleContext::selectAccessibleChild(): this is an impossible state! Or at least should be..." ); - // this does all wich is needed, including the change of the child's state! + // this does all which is needed, including the change of the child's state! mpRepr->SetActualRP( pData->ePoint ); } @@ -1286,7 +1286,7 @@ Rectangle SvxRectCtlChildAccessibleContext::GetBoundingBoxOnScreen( void ) throw Rectangle SvxRectCtlChildAccessibleContext::GetBoundingBox( void ) throw( RuntimeException ) { - // no guard neccessary, because no one changes mpBoundingBox after creating it + // no guard necessary, because no one changes mpBoundingBox after creating it ThrowExceptionIfNotAlive(); return *mpBoundingBox; diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 72101ed2acaa..f4f8d65f86bd 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1099,7 +1099,7 @@ Rectangle SvxPixelCtl::implCalFocusRect( const Point& aPosition ) return Rectangle(nLeft,nTop,nRight,nBottom); } -//Solution:Keyboard fucntion +//Solution:Keyboard function void SvxPixelCtl::KeyInput( const KeyEvent& rKEvt ) { KeyCode aKeyCode = rKEvt.GetKeyCode(); diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index aec7768ba8b9..fec655dbb057 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -448,7 +448,7 @@ ERecoveryState RecoveryCore::mapDocState2RecoverState(sal_Int32 eDocState) ERecoveryState eRecState = E_NOT_RECOVERED_YET; /* Attention: - Some of the following states can occure at the + Some of the following states can occur at the same time. So we have to check for the "worst case" first! DAMAGED -> INCOMPLETE -> HANDLED @@ -596,7 +596,7 @@ void RecoveryCore::impl_startListening() //=============================================== void RecoveryCore::impl_stopListening() { - // Ignore it, if this instance doesnt listen currently + // Ignore it, if this instance doesn't listen currently if (!m_xRealCore.is()) return; @@ -757,7 +757,7 @@ SaveDialog::SaveDialog(Window* pParent, FreeResource(); // Prepare the office for the following crash save step. - // E.g. hide all open widows so the user cant influence our + // E.g. hide all open widows so the user can't influence our // operation .-) m_pCore->doEmergencySavePrepare(); @@ -1323,7 +1323,7 @@ short RecoveryDialog::execute() Application::Yield(); // TODO: show BrokenRecoveryDialog again, ift he user - // doesnt accepted it last time. + // doesn't accepted it last time. if (m_bUserDecideNext) return DLG_RET_OK; diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx index 4eb9ca73712b..70bae5fa376b 100644 --- a/svx/source/dialog/hdft.cxx +++ b/svx/source/dialog/hdft.cxx @@ -19,12 +19,9 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" -// include --------------------------------------------------------------- #include <tools/shl.hxx> #include <svl/itemiter.hxx> #include <sfx2/app.hxx> @@ -32,31 +29,33 @@ #include <sfx2/module.hxx> #include <vcl/msgbox.hxx> #include <vcl/graph.hxx> - #include <sfx2/sfxsids.hrc> #include <svx/svxids.hrc> #include <svx/dialogs.hrc> #include "hdft.hrc" #include <svl/intitem.hxx> - #define _SVX_HDFT_CXX - #include <svx/hdft.hxx> #include <svx/pageitem.hxx> -//CHINA001 #include "bbdlg.hxx" #include "svx/dlgutil.hxx" #include <svx/dialmgr.hxx> #include "svx/htmlmode.hxx" - #include <editeng/brshitem.hxx> #include <editeng/lrspitem.hxx> #include <editeng/ulspitem.hxx> #include <editeng/shaditem.hxx> #include <editeng/sizeitem.hxx> #include <editeng/boxitem.hxx> - #include <svx/svxdlg.hxx> //CHINA001 #include <svx/dialogs.hrc> //CHINA001 + +//UUUU +#include <svx/xdef.hxx> +#include <svx/xenum.hxx> +#include <svx/xfillit0.hxx> +#include <svx/unobrushitemhelper.hxx> +#include <sfx2/request.hxx> + // static ---------------------------------------------------------------- // --> OD 2004-06-18 #i19922# @@ -70,6 +69,11 @@ static const long DEF_DIST_CALC = 250; // 2,5mm (Calc) static sal_uInt16 pRanges[] = { SID_ATTR_BRUSH, SID_ATTR_BRUSH, + + //UUUU Support DrawingLayer FillStyles (no real call to below GetRanges() + // detected, still do the complete transition) + XATTR_FILL_FIRST, XATTR_FILL_LAST, + SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW, @@ -138,9 +142,8 @@ SvxFooterPage::SvxFooterPage( Window* pParent, const SfxItemSet& rAttr ) : // ----------------------------------------------------------------------- -SvxHFPage::SvxHFPage( Window* pParent, sal_uInt16 nResId, const SfxItemSet& rAttr, sal_uInt16 nSetId ) : - - SfxTabPage( pParent, SVX_RES( nResId ), rAttr ), +SvxHFPage::SvxHFPage( Window* pParent, sal_uInt16 nResId, const SfxItemSet& rAttr, sal_uInt16 nSetId ) +: SfxTabPage( pParent, SVX_RES( nResId ), rAttr ), aFrm ( this, SVX_RES( FL_FRAME ) ), aTurnOnBox ( this, SVX_RES( CB_TURNON ) ), @@ -158,11 +161,13 @@ SvxHFPage::SvxHFPage( Window* pParent, sal_uInt16 nResId, const SfxItemSet& rAtt aBspWin ( this, SVX_RES( WN_BSP ) ), aBackgroundBtn ( this, SVX_RES( BTN_EXTRAS ) ), - nId ( nSetId ), - pBBSet ( NULL ), - bDisableQueryBox ( sal_False ), - bEnableBackgroundSelector ( sal_True ) + nId ( nSetId ), + pBBSet ( NULL ), + // bitfield + mbDisableQueryBox(false), + mbEnableBackgroundSelector(true), + mbEnableDrawingLayerFillStyles(false) { InitHandler(); aBspWin.EnableRTL( sal_False ); @@ -205,34 +210,49 @@ SvxHFPage::~SvxHFPage() sal_Bool SvxHFPage::FillItemSet( SfxItemSet& rSet ) { - const sal_uInt16 nWSize = GetWhich( SID_ATTR_PAGE_SIZE ); - const sal_uInt16 nWLRSpace = GetWhich( SID_ATTR_LRSPACE ); - const sal_uInt16 nWULSpace = GetWhich( SID_ATTR_ULSPACE ); - const sal_uInt16 nWOn = GetWhich( SID_ATTR_PAGE_ON ); - const sal_uInt16 nWDynamic = GetWhich( SID_ATTR_PAGE_DYNAMIC ); - const sal_uInt16 nWDynSpacing = GetWhich( SID_ATTR_HDFT_DYNAMIC_SPACING ); - const sal_uInt16 nWShared = GetWhich( SID_ATTR_PAGE_SHARED ); - const sal_uInt16 nWBrush = GetWhich( SID_ATTR_BRUSH ); - const sal_uInt16 nWBox = GetWhich( SID_ATTR_BORDER_OUTER ); - const sal_uInt16 nWBoxInfo = GetWhich( SID_ATTR_BORDER_INNER ); - const sal_uInt16 nWShadow = GetWhich( SID_ATTR_BORDER_SHADOW ); - const sal_uInt16 aWhichTab[] = { nWSize, nWSize, - nWLRSpace, nWLRSpace, - nWULSpace, nWULSpace, - nWOn, nWOn, - nWDynamic, nWDynamic, - nWShared, nWShared, - nWBrush, nWBrush, - nWBoxInfo, nWBoxInfo, - nWBox, nWBox, - nWShadow, nWShadow, - nWDynSpacing, nWDynSpacing, - 0 }; - const SfxItemSet& rOldSet = GetItemSet(); - SfxItemPool* pPool = rOldSet.GetPool(); - DBG_ASSERT( pPool, "no pool :-(" ); - SfxMapUnit eUnit = pPool->GetMetric( nWSize ); - SfxItemSet aSet ( *pPool, aWhichTab ); + const sal_uInt16 nWSize = GetWhich(SID_ATTR_PAGE_SIZE); + const sal_uInt16 nWLRSpace = GetWhich(SID_ATTR_LRSPACE); + const sal_uInt16 nWULSpace = GetWhich(SID_ATTR_ULSPACE); + const sal_uInt16 nWOn = GetWhich(SID_ATTR_PAGE_ON); + const sal_uInt16 nWDynamic = GetWhich(SID_ATTR_PAGE_DYNAMIC); + const sal_uInt16 nWDynSpacing = GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING); + const sal_uInt16 nWShared = GetWhich(SID_ATTR_PAGE_SHARED); + const sal_uInt16 nWBrush = GetWhich(SID_ATTR_BRUSH); + const sal_uInt16 nWBox = GetWhich(SID_ATTR_BORDER_OUTER); + const sal_uInt16 nWBoxInfo = GetWhich(SID_ATTR_BORDER_INNER); + const sal_uInt16 nWShadow = GetWhich(SID_ATTR_BORDER_SHADOW); + + const sal_uInt16 aWhichTab[] = { + nWSize, nWSize, + nWLRSpace, nWLRSpace, + nWULSpace, nWULSpace, + nWOn, nWOn, + nWDynamic, nWDynamic, + nWShared, nWShared, + nWBrush, nWBrush, + nWBoxInfo, nWBoxInfo, + nWBox, nWBox, + nWShadow, nWShadow, + nWDynSpacing, nWDynSpacing, + + //UUUU take over DrawingLayer FillStyles + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [1014 + + 0, 0}; + + const SfxItemSet& rOldSet = GetItemSet(); + SfxItemPool* pPool = rOldSet.GetPool(); + DBG_ASSERT(pPool,"no pool :-("); + SfxMapUnit eUnit = pPool->GetMetric(nWSize); + SfxItemSet aSet(*pPool,aWhichTab); + + if(mbEnableDrawingLayerFillStyles) + { + //UUUU When using the XATTR_FILLSTYLE DrawingLayer FillStyle definition + // extra action has to be done here since the pool default is XFILL_SOLID + // instead of XFILL_NONE (to have the default blue fill color at start). + aSet.Put(XFillStyleItem(XFILL_NONE)); + } //-------------------------------------------------------------------- @@ -274,26 +294,47 @@ sal_Bool SvxHFPage::FillItemSet( SfxItemSet& rSet ) aSet.Put( aUL ); // Hintergrund und Umrandung? - if ( pBBSet ) - aSet.Put( *pBBSet ); + if(pBBSet) + { + aSet.Put(*pBBSet); + } else { const SfxItemSet* _pSet; const SfxPoolItem* pItem; - if ( SFX_ITEM_SET == - GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) ) + if(SFX_ITEM_SET == GetItemSet().GetItemState(GetWhich(nId), sal_False, &pItem)) { - _pSet = &( (SvxSetItem*)pItem )->GetItemSet(); - - if ( _pSet->GetItemState( nWBrush ) == SFX_ITEM_SET ) - aSet.Put( (const SvxBrushItem&)_pSet->Get( nWBrush ) ); - if ( _pSet->GetItemState( nWBoxInfo ) == SFX_ITEM_SET ) - aSet.Put( (const SvxBoxInfoItem&)_pSet->Get( nWBoxInfo ) ); - if ( _pSet->GetItemState( nWBox ) == SFX_ITEM_SET ) - aSet.Put( (const SvxBoxItem&)_pSet->Get( nWBox ) ); - if ( _pSet->GetItemState( nWShadow ) == SFX_ITEM_SET ) - aSet.Put( (const SvxShadowItem&)_pSet->Get( nWShadow ) ); + _pSet = &(static_cast< const SvxSetItem* >(pItem)->GetItemSet()); + + if(_pSet->GetItemState(nWBrush) == SFX_ITEM_SET) + { + aSet.Put(_pSet->Get(nWBrush)); + } + + if(_pSet->GetItemState(nWBoxInfo) == SFX_ITEM_SET) + { + aSet.Put(_pSet->Get(nWBoxInfo)); + } + + if(_pSet->GetItemState(nWBox) == SFX_ITEM_SET) + { + aSet.Put(_pSet->Get(nWBox)); + } + + if(_pSet->GetItemState(nWShadow) == SFX_ITEM_SET) + { + aSet.Put(_pSet->Get(nWShadow)); + } + + //UUUU take care of [XATTR_XATTR_FILL_FIRST .. XATTR_FILL_LAST] + for(sal_uInt16 nFillStyleId(XATTR_FILL_FIRST); nFillStyleId <= XATTR_FILL_LAST; nFillStyleId++) + { + if(_pSet->GetItemState(nFillStyleId) == SFX_ITEM_SET) + { + aSet.Put(_pSet->Get(nFillStyleId)); + } + } } } @@ -466,7 +507,7 @@ IMPL_LINK( SvxHFPage, TurnOnHdl, CheckBox *, pBox ) { sal_Bool bDelete = sal_True; - if ( !bDisableQueryBox && pBox && aTurnOnBox.GetSavedValue() == sal_True ) + if ( !mbDisableQueryBox && pBox && aTurnOnBox.GetSavedValue() == sal_True ) bDelete = ( QueryBox( this, SVX_RES( RID_SVXQBX_DELETE_HEADFOOT ) ).Execute() == RET_YES ); if ( bDelete ) @@ -529,80 +570,169 @@ IMPL_LINK_INLINE_END( SvxHFPage, BorderModify, MetricField *, EMPTYARG ) IMPL_LINK( SvxHFPage, BackgroundHdl, Button *, EMPTYARG ) { - if ( !pBBSet ) + if(!pBBSet) { // nur die n"otigen Items f"uer Umrandung und Hintergrund benutzen - sal_uInt16 nBrush = GetWhich( SID_ATTR_BRUSH ); - sal_uInt16 nOuter = GetWhich( SID_ATTR_BORDER_OUTER ); - sal_uInt16 nInner = GetWhich( SID_ATTR_BORDER_INNER, sal_False ); - sal_uInt16 nShadow = GetWhich( SID_ATTR_BORDER_SHADOW ); - - // einen leeren Set erzeugenc - pBBSet = new SfxItemSet( *GetItemSet().GetPool(), nBrush, nBrush, - nOuter, nOuter, nInner, nInner, - nShadow, nShadow, 0 ); + const sal_uInt16 nOuter(GetWhich(SID_ATTR_BORDER_OUTER)); + const sal_uInt16 nInner(GetWhich(SID_ATTR_BORDER_INNER, sal_False)); + const sal_uInt16 nShadow(GetWhich(SID_ATTR_BORDER_SHADOW)); + + if(mbEnableDrawingLayerFillStyles) + { + pBBSet = new SfxItemSet( + *GetItemSet().GetPool(), + XATTR_FILL_FIRST, XATTR_FILL_LAST, // DrawingLayer FillStyle definitions + SID_COLOR_TABLE, SID_BITMAP_LIST, // XPropertyLists for Color, Gradient, Hatch and Graphic fills + nOuter, nOuter, + nInner, nInner, + nShadow, nShadow, + 0, 0); + + //UUUU copy items for XPropertyList entries from the DrawModel so that + // the Area TabPage can access them + static const sal_uInt16 nCopyFlags[] = { + SID_COLOR_TABLE, + SID_GRADIENT_LIST, + SID_HATCH_LIST, + SID_BITMAP_LIST, + 0 + }; + + for(sal_uInt16 a(0); nCopyFlags[a]; a++) + { + const SfxPoolItem* pItem = GetItemSet().GetItem(nCopyFlags[a]); + + if(pItem) + { + pBBSet->Put(*pItem); + } + else + { + OSL_ENSURE(false, "XPropertyList missing (!)"); + } + } + } + else + { + const sal_uInt16 nBrush(GetWhich(SID_ATTR_BRUSH)); + + pBBSet = new SfxItemSet( + *GetItemSet().GetPool(), + nBrush, nBrush, + nOuter, nOuter, + nInner, nInner, + nShadow, nShadow, + 0, 0); + } + const SfxPoolItem* pItem; - if ( SFX_ITEM_SET == - GetItemSet().GetItemState( GetWhich( nId ), sal_False, &pItem ) ) - // wenn es schon einen gesetzen Set gibt, dann diesen benutzen - pBBSet->Put( ( (SvxSetItem*)pItem)->GetItemSet() ); + if(SFX_ITEM_SET == GetItemSet().GetItemState(GetWhich(nId), sal_False, &pItem)) + { + // If a SfxItemSet from the SetItem for SID_ATTR_PAGE_HEADERSET or + // SID_ATTR_PAGE_FOOTERSET exists, use it's content + pBBSet->Put(((SvxSetItem*)pItem)->GetItemSet()); + } + else + { + if(mbEnableDrawingLayerFillStyles) + { + //UUUU The style for header/footer is not yet created, need to reset + // XFillStyleItem to XFILL_NONE which is the same as in the style + // initialization. This needs to be done since the pool default for + // XFillStyleItem is XFILL_SOLID + pBBSet->Put(XFillStyleItem(XFILL_NONE)); + } + } - if ( SFX_ITEM_SET == - GetItemSet().GetItemState( nInner, sal_False, &pItem ) ) + if(SFX_ITEM_SET == GetItemSet().GetItemState(nInner, sal_False, &pItem)) + { // das gesetze InfoItem wird immer ben"otigt - pBBSet->Put( *pItem ); + pBBSet->Put(*pItem); + } } - //CHINA001 SvxBorderBackgroundDlg* pDlg = -//CHINA001 new SvxBorderBackgroundDlg( this, *pBBSet, bEnableBackgroundSelector ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + if(pFact) { - SfxAbstractTabDialog* pDlg = pFact->CreateSvxBorderBackgroundDlg( this, *pBBSet, bEnableBackgroundSelector ); - DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 - if ( pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet() ) + //UUUU + SfxAbstractTabDialog* pDlg = pFact->CreateSvxBorderBackgroundDlg( + this, + *pBBSet, + mbEnableBackgroundSelector, + mbEnableDrawingLayerFillStyles); + + DBG_ASSERT(pDlg,"Dialogdiet fail!");//CHINA001 + if(RET_OK == pDlg->Execute() && pDlg->GetOutputItemSet()) { - SfxItemIter aIter( *pDlg->GetOutputItemSet() ); + SfxItemIter aIter(*pDlg->GetOutputItemSet()); const SfxPoolItem* pItem = aIter.FirstItem(); - while ( pItem ) + while(pItem) { - if ( !IsInvalidItem( pItem ) ) - pBBSet->Put( *pItem ); + if(!IsInvalidItem(pItem)) + { + pBBSet->Put(*pItem); + } + pItem = aIter.NextItem(); } //---------------------------------------------------------------- - - sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH ); - - if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET ) { - const SvxBrushItem& rItem = (const SvxBrushItem&)pBBSet->Get( nWhich ); - if ( nId == SID_ATTR_PAGE_HEADERSET ) - aBspWin.SetHdColor( rItem.GetColor() ); + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; + + if(mbEnableDrawingLayerFillStyles) + { + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pBBSet)); + } else - aBspWin.SetFtColor( rItem.GetColor() ); + { + const sal_uInt16 nWhich = GetWhich(SID_ATTR_BRUSH); + + if(pBBSet->GetItemState(nWhich) == SFX_ITEM_SET) + { + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(pBBSet->Get(nWhich)); + SfxItemSet aTempSet(*pBBSet->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); + } + } + + if(SID_ATTR_PAGE_HEADERSET == nId) + { + //aBspWin.SetHdColor(rItem.GetColor()); + aBspWin.setHeaderFillAttributes(aFillAttributes); + } + else + { + //aBspWin.SetFtColor(rItem.GetColor()); + aBspWin.setFooterFillAttributes(aFillAttributes); + } } //---------------------------------------------------------------- - - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); - - if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET ) { - const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get( nWhich ); + const sal_uInt16 nWhich = GetWhich(SID_ATTR_BORDER_OUTER); - if ( nId == SID_ATTR_PAGE_HEADERSET ) - aBspWin.SetHdBorder( rItem ); - else - aBspWin.SetFtBorder( rItem ); + if(pBBSet->GetItemState(nWhich) == SFX_ITEM_SET) + { + const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get(nWhich); + + if(nId == SID_ATTR_PAGE_HEADERSET) + aBspWin.SetHdBorder(rItem); + else + aBspWin.SetFtBorder(rItem); + } } UpdateExample(); } - delete pDlg; + delete pDlg; } return 0; } @@ -638,87 +768,122 @@ void SvxHFPage::UpdateExample() void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet ) { - sal_uInt16 nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET ); + sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET)); - if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) + if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False)) { - const SvxSetItem& rSetItem = - (const SvxSetItem&)rSet.Get( nWhich, sal_False ); + const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, sal_False)); const SfxItemSet& rTmpSet = rSetItem.GetItemSet(); - const SfxBoolItem& rOn = - (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ); + const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON))); - if ( rOn.GetValue() ) + if(rOn.GetValue()) { - nWhich = GetWhich( SID_ATTR_BRUSH ); + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes; - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + if(mbEnableDrawingLayerFillStyles) { - const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich ); - aBspWin.SetHdColor( rItem.GetColor() ); + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet)); } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + else + { + nWhich = GetWhich(SID_ATTR_BRUSH); + + if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich)) + { + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich)); + SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); + } + } + + aBspWin.setHeaderFillAttributes(aHeaderFillAttributes); + nWhich = GetWhich(SID_ATTR_BORDER_OUTER); - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET) { const SvxBoxItem& rItem = - (const SvxBoxItem&)rTmpSet.Get( nWhich ); - aBspWin.SetHdBorder( rItem ); + (const SvxBoxItem&)rTmpSet.Get(nWhich); + aBspWin.SetHdBorder(rItem); } } } - nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET ); + nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET); - if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) + if(SFX_ITEM_SET == rSet.GetItemState(nWhich, sal_False)) { - const SvxSetItem& rSetItem = - (const SvxSetItem&)rSet.Get( nWhich, sal_False ); + const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, sal_False)); const SfxItemSet& rTmpSet = rSetItem.GetItemSet(); - const SfxBoolItem& rOn = - (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ); + const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON))); - if ( rOn.GetValue() ) + if(rOn.GetValue()) { - nWhich = GetWhich( SID_ATTR_BRUSH ); + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes; - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + if(mbEnableDrawingLayerFillStyles) { - const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich ); - aBspWin.SetFtColor( rItem.GetColor() ); + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet)); } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + else + { + nWhich = GetWhich(SID_ATTR_BRUSH); + + if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich)) + { + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich)); + SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); + } + } + + aBspWin.setFooterFillAttributes(aFooterFillAttributes); + nWhich = GetWhich(SID_ATTR_BORDER_OUTER); - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET) { - const SvxBoxItem& rItem = - (const SvxBoxItem&)rTmpSet.Get( nWhich ); - aBspWin.SetFtBorder( rItem ); + const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rTmpSet.Get(nWhich)); + aBspWin.SetFtBorder(rItem); } } } - nWhich = GetWhich( SID_ATTR_BRUSH ); - if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aPageFillAttributes; + + if(mbEnableDrawingLayerFillStyles) + { + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rSet)); + } + else { - const SvxBrushItem& rItem = (const SvxBrushItem&)rSet.Get( nWhich ); - aBspWin.SetColor( rItem.GetColor() ); - const Graphic* pGrf = rItem.GetGraphic(); + nWhich = GetWhich(SID_ATTR_BRUSH); - if ( pGrf ) + if(rSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE) { - Bitmap aBitmap = pGrf->GetBitmap(); - aBspWin.SetBitmap( &aBitmap ); + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rSet.Get(nWhich)); + SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); } - else - aBspWin.SetBitmap( NULL ); } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); - if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + aBspWin.setPageFillAttributes(aPageFillAttributes); + nWhich = GetWhich(SID_ATTR_BORDER_OUTER); + + if(rSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE) { - const SvxBoxItem& rItem = (const SvxBoxItem&)rSet.Get( nWhich ); - aBspWin.SetBorder( rItem ); + const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rSet.Get(nWhich)); + aBspWin.SetBorder(rItem); } } @@ -973,6 +1138,7 @@ void lcl_Move(Window& rWin, sal_Int32 nDiff) aPos.Y() -= nDiff; rWin.SetPosPixel(aPos); } + void SvxHFPage::EnableDynamicSpacing() { aDynSpacingCB.Show(); @@ -991,3 +1157,17 @@ void SvxHFPage::EnableDynamicSpacing() lcl_Move(*aMoveWindows[nIdx++], nOffset); } +void SvxHFPage::PageCreated(SfxAllItemSet aSet) +{ + //UUUU + SFX_ITEMSET_ARG (&aSet, pSupportDrawingLayerFillStyleItem, SfxBoolItem, SID_DRAWINGLAYER_FILLSTYLES); + + if(pSupportDrawingLayerFillStyleItem) + { + const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue()); + + EnableDrawingLayerFillStyles(bNew); + } +} + +//eof diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx index 9a6be7a907a9..745d05c5412a 100644 --- a/svx/source/dialog/pagectrl.cxx +++ b/svx/source/dialog/pagectrl.cxx @@ -19,45 +19,20 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" -// include --------------------------------------------------------------- - - #include <vcl/bitmap.hxx> #include <editeng/frmdiritem.hxx> #include <svx/pageitem.hxx> #include <svx/pagectrl.hxx> #include <editeng/boxitem.hxx> - #include <algorithm> - -// struct PageWindow_Impl ------------------------------------------------ - -struct PageWindow_Impl -{ - SvxBoxItem* pBorder; - Bitmap aBitmap; - bool bBitmap; - sal_Bool bResetBackground; - sal_Bool bFrameDirection; - sal_Int32 nFrameDirection; - - - PageWindow_Impl() : - pBorder(0), - bBitmap(sal_False), - bResetBackground(sal_False), - bFrameDirection(sal_False), - nFrameDirection(0) {} - - void EnableFrameDirection(sal_Bool bEnable){bFrameDirection = bEnable;} - void SetFrameDirection(sal_Int32 nDirection){nFrameDirection = nDirection;} - -}; +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <drawinglayer/geometry/viewinformation2d.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> // STATIC DATA ----------------------------------------------------------- @@ -66,44 +41,57 @@ struct PageWindow_Impl // class SvxPageWindow --------------------------------------------------- -SvxPageWindow::SvxPageWindow( Window* pParent, const ResId& rId ) : - - Window( pParent, rId ), - - nTop ( 0 ), - nBottom ( 0 ), - nLeft ( 0 ), - nRight ( 0 ), - aColor ( COL_TRANSPARENT ), - nHdLeft ( 0 ), - nHdRight ( 0 ), - nHdDist ( 0 ), - nHdHeight ( 0 ), - aHdColor ( COL_TRANSPARENT ), - pHdBorder ( 0 ), - nFtLeft ( 0 ), - nFtRight ( 0 ), - nFtDist ( 0 ), - nFtHeight ( 0 ), - aFtColor ( COL_TRANSPARENT ), - pFtBorder ( 0 ), - bFooter ( sal_False ), - bHeader ( sal_False ), - bTable ( sal_False ), - bHorz ( sal_False ), - bVert ( sal_False ), - eUsage ( SVX_PAGE_ALL ) +SvxPageWindow::SvxPageWindow(Window* pParent,const ResId& rId) +: Window(pParent,rId), + aWinSize(), + aSize(), + + nTop(0), + nBottom(0), + nLeft(0), + nRight(0), + + //UUUU + pBorder(0), + bResetBackground(sal_False), + bFrameDirection(sal_False), + nFrameDirection(0), + + nHdLeft(0), + nHdRight(0), + nHdDist(0), + nHdHeight(0), + + pHdBorder(0), + nFtLeft(0), + nFtRight(0), + nFtDist(0), + nFtHeight(0), + + pFtBorder(0), + + maHeaderFillAttributes(), + maFooterFillAttributes(), + maPageFillAttributes(), + + bFooter(sal_False), + bHeader(sal_False), + bTable(sal_False), + bHorz(sal_False), + bVert(sal_False), + eUsage(SVX_PAGE_ALL), + + aLeftText(), + aRightText() { - pImpl = new PageWindow_Impl; - // defaultmaessing in Twips rechnen - SetMapMode( MapMode( MAP_TWIP ) ); + SetMapMode(MapMode(MAP_TWIP)); aWinSize = GetOutputSizePixel(); aWinSize.Height() -= 4; aWinSize.Width() -= 4; - aWinSize = PixelToLogic( aWinSize ); + aWinSize = PixelToLogic(aWinSize); SetBackground(); } @@ -111,67 +99,66 @@ SvxPageWindow::SvxPageWindow( Window* pParent, const ResId& rId ) : SvxPageWindow::~SvxPageWindow() { - delete pImpl; delete pHdBorder; delete pFtBorder; } // ----------------------------------------------------------------------- -void __EXPORT SvxPageWindow::Paint( const Rectangle& ) +void __EXPORT SvxPageWindow::Paint(const Rectangle&) { - Fraction aXScale( aWinSize.Width(), std::max( (long) (aSize.Width() * 2 + aSize.Width() / 8), 1L ) ); - Fraction aYScale( aWinSize.Height(), std::max( aSize.Height(), 1L ) ); - MapMode aMapMode( GetMapMode() ); + Fraction aXScale(aWinSize.Width(),std::max((long)(aSize.Width() * 2 + aSize.Width() / 8),1L)); + Fraction aYScale(aWinSize.Height(),std::max(aSize.Height(),1L)); + MapMode aMapMode(GetMapMode()); - if ( aYScale < aXScale ) + if(aYScale < aXScale) { - aMapMode.SetScaleX( aYScale ); - aMapMode.SetScaleY( aYScale ); + aMapMode.SetScaleX(aYScale); + aMapMode.SetScaleY(aYScale); } else { - aMapMode.SetScaleX( aXScale ); - aMapMode.SetScaleY( aXScale ); + aMapMode.SetScaleX(aXScale); + aMapMode.SetScaleY(aXScale); } - SetMapMode( aMapMode ); - Size aSz( PixelToLogic( GetSizePixel() ) ); - long nYPos = ( aSz.Height() - aSize.Height() ) / 2; + SetMapMode(aMapMode); + Size aSz(PixelToLogic(GetSizePixel())); + long nYPos = (aSz.Height() - aSize.Height()) / 2; - if ( eUsage == SVX_PAGE_ALL ) + if(eUsage == SVX_PAGE_ALL) { // alle Seiten gleich -> eine Seite malen - if ( aSize.Width() > aSize.Height() ) + if(aSize.Width() > aSize.Height()) { // Querformat in gleicher Gr"osse zeichnen Fraction aX = aMapMode.GetScaleX(); Fraction aY = aMapMode.GetScaleY(); - Fraction a2( 1.5 ); + Fraction a2(1.5); aX *= a2; aY *= a2; - aMapMode.SetScaleX( aX ); - aMapMode.SetScaleY( aY ); - SetMapMode( aMapMode ); - aSz = PixelToLogic( GetSizePixel() ); - nYPos = ( aSz.Height() - aSize.Height() ) / 2; - long nXPos = ( aSz.Width() - aSize.Width() ) / 2; - DrawPage( Point( nXPos, nYPos ), sal_True, sal_True ); + aMapMode.SetScaleX(aX); + aMapMode.SetScaleY(aY); + SetMapMode(aMapMode); + aSz = PixelToLogic(GetSizePixel()); + nYPos = (aSz.Height() - aSize.Height()) / 2; + long nXPos = (aSz.Width() - aSize.Width()) / 2; + DrawPage(Point(nXPos,nYPos),sal_True,sal_True); } else // Hochformat - DrawPage( Point( ( aSz.Width() - aSize.Width() ) / 2, nYPos ), sal_True, sal_True ); + DrawPage(Point((aSz.Width() - aSize.Width()) / 2,nYPos),sal_True,sal_True); } else { // Linke und rechte Seite unterschiedlich -> ggf. zwei Seiten malen - DrawPage( Point( 0, nYPos ), sal_False, (sal_Bool)( eUsage & SVX_PAGE_LEFT ) ); - DrawPage( Point( aSize.Width() + aSize.Width() / 8, nYPos ), sal_True, - (sal_Bool)( eUsage & SVX_PAGE_RIGHT ) ); + DrawPage(Point(0,nYPos),sal_False,(sal_Bool)(eUsage & SVX_PAGE_LEFT)); + DrawPage(Point(aSize.Width() + aSize.Width() / 8,nYPos),sal_True, + (sal_Bool)(eUsage & SVX_PAGE_RIGHT)); } } // ----------------------------------------------------------------------- -void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const sal_Bool bEnabled ) +void SvxPageWindow::DrawPage(const Point& rOrg,const sal_Bool bSecond,const sal_Bool bEnabled) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); const Color& rFieldColor = rStyleSettings.GetFieldColor(); @@ -180,37 +167,37 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const s const Color& rDlgColor = rStyleSettings.GetDialogColor(); // background - if(!bSecond || pImpl->bResetBackground) + if(!bSecond || bResetBackground) { - SetLineColor( Color(COL_TRANSPARENT) ); - SetFillColor( rDlgColor ); + SetLineColor(Color(COL_TRANSPARENT)); + SetFillColor(rDlgColor); Size winSize(GetOutputSize()); - DrawRect( Rectangle( Point(0,0), winSize ) ); + DrawRect(Rectangle(Point(0,0),winSize)); - if ( pImpl->bResetBackground ) - pImpl->bResetBackground = sal_False; + if(bResetBackground) + bResetBackground = sal_False; } - SetLineColor( rFieldTextColor ); + SetLineColor(rFieldTextColor); // Schatten Size aTempSize = aSize; // Seite - if ( !bEnabled ) + if(!bEnabled) { - SetFillColor( rDisableColor ); - DrawRect( Rectangle( rOrg, aTempSize ) ); + SetFillColor(rDisableColor); + DrawRect(Rectangle(rOrg,aTempSize)); return; } - SetFillColor( rFieldColor ); - DrawRect( Rectangle( rOrg, aTempSize ) ); + SetFillColor(rFieldColor); + DrawRect(Rectangle(rOrg,aTempSize)); // Border Top Bottom Left Right - Point aBegin( rOrg ); - Point aEnd( rOrg ); + Point aBegin(rOrg); + Point aEnd(rOrg); long nL = nLeft; long nR = nRight; - if ( eUsage == SVX_PAGE_MIRROR && !bSecond ) + if(eUsage == SVX_PAGE_MIRROR && !bSecond) { // f"ur gespiegelt drehen nL = nRight; @@ -219,91 +206,94 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const s Rectangle aRect; - aRect.Left() = rOrg.X() + nL; + aRect.Left() = rOrg.X() + nL; aRect.Right() = rOrg.X() + aTempSize.Width() - nR; - aRect.Top() = rOrg.Y() + nTop; - aRect.Bottom()= rOrg.Y() + aTempSize.Height() - nBottom; + aRect.Top() = rOrg.Y() + nTop; + aRect.Bottom() = rOrg.Y() + aTempSize.Height() - nBottom; - Rectangle aHdRect( aRect ); - Rectangle aFtRect( aRect ); + Rectangle aHdRect(aRect); + Rectangle aFtRect(aRect); - if ( bHeader ) + if(bHeader || bFooter) { - // ggf. Header anzeigen - aHdRect.Left() += nHdLeft; - aHdRect.Right() -= nHdRight; - aHdRect.Bottom() = aRect.Top() + nHdHeight; - aRect.Top() += nHdHeight + nHdDist; - SetFillColor( aHdColor ); - DrawRect( aHdRect ); - } + //UUUU Header and/or footer used + const Color aLineColor(GetLineColor()); - if ( bFooter ) - { - // ggf. Footer anzeigen - aFtRect.Left() += nFtLeft; - aFtRect.Right() -= nFtRight; - aFtRect.Top() = aRect.Bottom() - nFtHeight; - aRect.Bottom() -= nFtHeight + nFtDist; - SetFillColor( aFtColor ); - DrawRect( aFtRect ); - } + //UUUU draw PageFill first and on the whole page, no outline + SetLineColor(); + drawFillAttributes(maPageFillAttributes, aRect, aRect); + SetLineColor(aLineColor); - // Body malen - SetFillColor( aColor ); - if ( pImpl->bBitmap ) - { - DrawRect( aRect ); - Point aBmpPnt = aRect.TopLeft(); - Size aBmpSiz = aRect.GetSize(); - long nDeltaX = aBmpSiz.Width() / 15; - long nDeltaY = aBmpSiz.Height() / 15; - aBmpPnt.X() += nDeltaX; - aBmpPnt.Y() += nDeltaY; - aBmpSiz.Width() -= nDeltaX * 2; - aBmpSiz.Height() -= nDeltaY * 2; - DrawBitmap( aBmpPnt, aBmpSiz, pImpl->aBitmap ); + if(bHeader) + { + // ggf. Header anzeigen + aHdRect.Left() += nHdLeft; + aHdRect.Right() -= nHdRight; + aHdRect.Bottom() = aRect.Top() + nHdHeight; + aRect.Top() += nHdHeight + nHdDist; + + // draw header over PageFill, plus outline + drawFillAttributes(maHeaderFillAttributes, aHdRect, aHdRect); + } + + if(bFooter) + { + // ggf. Footer anzeigen + aFtRect.Left() += nFtLeft; + aFtRect.Right() -= nFtRight; + aFtRect.Top() = aRect.Bottom() - nFtHeight; + aRect.Bottom() -= nFtHeight + nFtDist; + + // draw footer over PageFill, plus outline + drawFillAttributes(maFooterFillAttributes, aFtRect, aFtRect); + } + + // draw page's reduced outline, only outline + drawFillAttributes(drawinglayer::attribute::SdrAllFillAttributesHelperPtr(), aRect, aRect); } else - DrawRect( aRect ); + { + //UUUU draw PageFill and outline + drawFillAttributes(maPageFillAttributes, aRect, aRect); + } - if(pImpl->bFrameDirection && !bTable) + if(bFrameDirection && !bTable) { - //pImpl->nFrameDirection + //pImpl->nFrameDirection Point aPos; Font aFont(GetFont()); const Size aSaveSize = aFont.GetSize(); - Size aDrawSize( 0, aRect.GetHeight() / 6); + Size aDrawSize(0,aRect.GetHeight() / 6); aFont.SetSize(aDrawSize); SetFont(aFont); String sText(String::CreateFromAscii("ABC")); - Point aMove(1, GetTextHeight()); + Point aMove(1,GetTextHeight()); sal_Unicode cArrow = 0x2193; long nAWidth = GetTextWidth(String(sText.GetChar(0))); - switch(pImpl->nFrameDirection) + switch(nFrameDirection) { - case FRMDIR_HORI_LEFT_TOP: - aPos = aRect.TopLeft(); - aPos.X() += PixelToLogic(Point(1,1)).X(); - aMove.Y() = 0; - cArrow = 0x2192; + case FRMDIR_HORI_LEFT_TOP: + aPos = aRect.TopLeft(); + aPos.X() += PixelToLogic(Point(1,1)).X(); + aMove.Y() = 0; + cArrow = 0x2192; break; - case FRMDIR_HORI_RIGHT_TOP: - aPos = aRect.TopRight(); - aPos.X() -= nAWidth; - aMove.Y() = 0; - aMove.X() *= -1; - cArrow = 0x2190; + case FRMDIR_HORI_RIGHT_TOP: + aPos = aRect.TopRight(); + aPos.X() -= nAWidth; + aMove.Y() = 0; + aMove.X() *= -1; + cArrow = 0x2190; break; - case FRMDIR_VERT_TOP_LEFT: - aPos = aRect.TopLeft(); - aPos.X() += PixelToLogic(Point(1,1)).X(); - aMove.X() = 0; + case FRMDIR_VERT_TOP_LEFT: + aPos = aRect.TopLeft(); + aPos.X() += PixelToLogic(Point(1,1)).X(); + aMove.X() = 0; break; - case FRMDIR_VERT_TOP_RIGHT: - aPos = aRect.TopRight(); - aPos.X() -= nAWidth; - aMove.X() = 0; + case FRMDIR_VERT_TOP_RIGHT: + aPos = aRect.TopRight(); + aPos.X() -= nAWidth; + aMove.X() = 0; break; } sText.Append(cArrow); @@ -315,13 +305,13 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const s sal_Bool bHorizontal = 0 == aMove.Y(); if(!bHorizontal) { - nHDiff = (nAWidth - nCharWidth)/2; + nHDiff = (nAWidth - nCharWidth) / 2; aPos.X() += nHDiff; } - DrawText(aPos, sDraw); + DrawText(aPos,sDraw); if(bHorizontal) { - aPos.X() += aMove.X() < 0 ? - nCharWidth : nCharWidth; + aPos.X() += aMove.X() < 0 ? -nCharWidth : nCharWidth; } else { @@ -333,85 +323,140 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const sal_Bool bSecond, const s SetFont(aFont); } - if ( bTable ) + if(bTable) { // Tabelle malen, ggf. zentrieren - SetLineColor( Color(COL_LIGHTGRAY) ); + SetLineColor(Color(COL_LIGHTGRAY)); - long nW = aRect.GetWidth(), nH = aRect.GetHeight(); - long nTW = CELL_WIDTH * 3, nTH = CELL_HEIGHT * 3; + long nW = aRect.GetWidth(),nH = aRect.GetHeight(); + long nTW = CELL_WIDTH * 3,nTH = CELL_HEIGHT * 3; long _nLeft = bHorz ? aRect.Left() + ((nW - nTW) / 2) : aRect.Left(); long _nTop = bVert ? aRect.Top() + ((nH - nTH) / 2) : aRect.Top(); - Rectangle aCellRect( Point( _nLeft, _nTop ), Size( CELL_WIDTH, CELL_HEIGHT ) ); + Rectangle aCellRect(Point(_nLeft,_nTop),Size(CELL_WIDTH,CELL_HEIGHT)); - for ( sal_uInt16 i = 0; i < 3; ++i ) + for(sal_uInt16 i = 0; i < 3; ++i) { aCellRect.Left() = _nLeft; aCellRect.Right() = _nLeft + CELL_WIDTH; - if ( i > 0 ) - aCellRect.Move( 0, CELL_HEIGHT ); + if(i > 0) + aCellRect.Move(0,CELL_HEIGHT); - for ( sal_uInt16 j = 0; j < 3; ++j ) + for(sal_uInt16 j = 0; j < 3; ++j) { - if ( j > 0 ) - aCellRect.Move( CELL_WIDTH, 0 ); - DrawRect( aCellRect ); + if(j > 0) + aCellRect.Move(CELL_WIDTH,0); + DrawRect(aCellRect); } } } } -// ----------------------------------------------------------------------- - -void SvxPageWindow::SetBorder( const SvxBoxItem& rNew ) +//UUUU +void SvxPageWindow::drawFillAttributes( + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, + const Rectangle& rPaintRange, + const Rectangle& rDefineRange) { - delete pImpl->pBorder; - pImpl->pBorder = new SvxBoxItem( rNew ); + const basegfx::B2DRange aPaintRange( + rPaintRange.Left(), + rPaintRange.Top(), + rPaintRange.Right(), + rPaintRange.Bottom()); + + if(!aPaintRange.isEmpty() && + !basegfx::fTools::equalZero(aPaintRange.getWidth()) && + !basegfx::fTools::equalZero(aPaintRange.getHeight())) + { + const basegfx::B2DRange aDefineRange( + rDefineRange.Left(), + rDefineRange.Top(), + rDefineRange.Right(), + rDefineRange.Bottom()); + + // prepare primitive sequence + drawinglayer::primitive2d::Primitive2DSequence aSequence; + + // create fill geometry if there is something to fill + if(rFillAttributes.get() && rFillAttributes->isUsed()) + { + aSequence = rFillAttributes->getPrimitive2DSequence( + aPaintRange, + aDefineRange); + } + + // create line geometry if a LineColor is set at the target device + if(IsLineColor()) + { + const drawinglayer::primitive2d::Primitive2DReference xOutline( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + basegfx::tools::createPolygonFromRect(aPaintRange), + GetLineColor().getBColor())); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( + aSequence, + xOutline); + } + + // draw that if we have something to draw + if(aSequence.getLength()) + { + const drawinglayer::geometry::ViewInformation2D aViewInformation2D( + basegfx::B2DHomMatrix(), + GetViewTransformation(), + aPaintRange, + 0, + 0.0, + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >()); + drawinglayer::processor2d::BaseProcessor2D* pProcessor = drawinglayer::processor2d::createProcessor2DFromOutputDevice( + *this, + aViewInformation2D); + + if(pProcessor) + { + pProcessor->process(aSequence); + + delete pProcessor; + } + } + } } // ----------------------------------------------------------------------- -void SvxPageWindow::SetBitmap( Bitmap* pBmp ) +void SvxPageWindow::SetBorder(const SvxBoxItem& rNew) { - if ( pBmp ) - { - pImpl->aBitmap = *pBmp; - pImpl->bBitmap = sal_True; - } - else - pImpl->bBitmap = sal_False; + delete pBorder; + pBorder = new SvxBoxItem(rNew); } // ----------------------------------------------------------------------- -void SvxPageWindow::SetHdBorder( const SvxBoxItem& rNew ) +void SvxPageWindow::SetHdBorder(const SvxBoxItem& rNew) { delete pHdBorder; - pHdBorder = new SvxBoxItem( rNew ); + pHdBorder = new SvxBoxItem(rNew); } // ----------------------------------------------------------------------- -void SvxPageWindow::SetFtBorder( const SvxBoxItem& rNew ) +void SvxPageWindow::SetFtBorder(const SvxBoxItem& rNew) { delete pFtBorder; - pFtBorder = new SvxBoxItem( rNew ); + pFtBorder = new SvxBoxItem(rNew); } -/* -----------------------------13.06.2002 16:16------------------------------ - ---------------------------------------------------------------------------*/ -void SvxPageWindow::EnableFrameDirection(sal_Bool bEnable) +void SvxPageWindow::EnableFrameDirection(sal_Bool bEnable) { - pImpl->EnableFrameDirection(bEnable); + bFrameDirection = bEnable; } -/* -----------------------------13.06.2002 16:16------------------------------ - ---------------------------------------------------------------------------*/ -void SvxPageWindow::SetFrameDirection(sal_Int32 nFrameDirection) +void SvxPageWindow::SetFrameDirection(sal_Int32 nDirection) { - pImpl->SetFrameDirection(nFrameDirection); + nFrameDirection = nDirection; } void SvxPageWindow::ResetBackground() { - pImpl->bResetBackground = sal_True; + bResetBackground = sal_True; } + +//eof diff --git a/svx/source/dialog/pfiledlg.cxx b/svx/source/dialog/pfiledlg.cxx index b41a590a7e26..4b6ddd1d386a 100644 --- a/svx/source/dialog/pfiledlg.cxx +++ b/svx/source/dialog/pfiledlg.cxx @@ -204,7 +204,7 @@ SvxPluginFileDlg::~SvxPluginFileDlg() /************************************************************************* |* |* Plugins available for the the MIME-Typ in nKind -|* (whith nKind = SID_INSERT_SOUND for MIME-Type audio +|* (with nKind = SID_INSERT_SOUND for MIME-Type audio |* SID_INSERT_VIDEO for MIME-Type video |* \************************************************************************/ diff --git a/svx/source/engine3d/helperminimaldepth3d.cxx b/svx/source/engine3d/helperminimaldepth3d.cxx index fa53e514f3d6..3687ea612db0 100644 --- a/svx/source/engine3d/helperminimaldepth3d.cxx +++ b/svx/source/engine3d/helperminimaldepth3d.cxx @@ -194,7 +194,7 @@ double getMinimalDepthInViewCoordinates(const E3dCompoundObject& rObject) aViewInfo3D.getViewTime(), aViewInfo3D.getExtendedInformationSequence()); - // create extractor helper, proccess geometry and get return value + // create extractor helper, process geometry and get return value drawinglayer::processor3d::MinimalDephInViewExtractor aExtractor(aNewViewInformation3D); aExtractor.process(aPrimitives); fRetval = aExtractor.getMinimalDepth(); diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index e651eebc1d52..557c9479f2c7 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -502,7 +502,7 @@ IMPL_LINK( FmGridHeader, OnAsyncExecuteDrop, void*, /*NOTINTERESTEDIN*/ ) } catch(Exception&) { - DBG_ERROR("FmGridHeader::ExecuteDrop: Exception occured!"); + DBG_ERROR("FmGridHeader::ExecuteDrop: Exception occurred!"); } sal_Int32 nPreferedType = -1; @@ -1896,7 +1896,7 @@ Sequence< Any> FmGridControl::getSelectionBookmarks() // The next problem caused by the same behaviuor (SeekCursor causes a propertyChanged) : when adjusting rows we implicitly // change our selection. So a "FirstSelected(); SeekCursor(); NextSelected();" may produce unpredictable results. - // That's why we _first_ collect the indicies of the selected rows and _then_ their bookmarks. + // That's why we _first_ collect the indices of the selected rows and _then_ their bookmarks. long nIdx = FirstSelectedRow(); while (nIdx >= 0) { @@ -1904,7 +1904,7 @@ Sequence< Any> FmGridControl::getSelectionBookmarks() pBookmarks[i++] <<= (sal_Int32)nIdx; nIdx = NextSelectedRow(); } - DBG_ASSERT(i == nSelectedRows, "FmGridControl::DeleteSelectedRows : could not collect the row indicies !"); + DBG_ASSERT(i == nSelectedRows, "FmGridControl::DeleteSelectedRows : could not collect the row indices !"); for (i=0; i<nSelectedRows; ++i) { @@ -2124,7 +2124,7 @@ void FmGridControl::KeyInput( const KeyEvent& rKEvt ) } catch(const Exception&) { - OSL_ENSURE(0,"exception occured while deleting a column"); + OSL_ENSURE(0,"exception occurred while deleting a column"); } } } diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 2943fdbeea51..c1d3da92b479 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1506,7 +1506,7 @@ void FmXGridPeer::propertyChange(const PropertyChangeEvent& evt) throw( RuntimeE sal_Int32 nWidth = 0; if (evt.NewValue.getValueType().getTypeClass() == TypeClass_VOID) nWidth = pGrid->GetDefaultColumnWidth(pGrid->GetColumnTitle(nId)); - // GetDefaultColumnWidth already considerd the zoom factor + // GetDefaultColumnWidth already considered the zoom factor else { sal_Int32 nTest = 0; @@ -2551,7 +2551,7 @@ Reference< ::com::sun::star::frame::XDispatch > FmXGridPeer::queryDispatch(cons { m_bInterceptingDispatch = sal_True; // safety against recursion : as we are master of the first chain element and slave of the last one we would - // have an infinite loop without this if no dispatcher can fullfill the rewuest) + // have an infinite loop without this if no dispatcher can fulfill the rewuest) xResult = m_xFirstDispatchInterceptor->queryDispatch(aURL, aTargetFrameName, nSearchFlags); m_bInterceptingDispatch = sal_False; } diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 69a125e827c5..7a364e1b00c2 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -1598,7 +1598,7 @@ void DbFormattedField::updateFromModel( Reference< XPropertySet > _rxModel ) ::rtl::OUString sText; Any aValue = _rxModel->getPropertyValue( FM_PROP_EFFECTIVE_VALUE ); if ( aValue >>= sText ) - { // our effective value is transfered as string + { // our effective value is transferred as string pFormattedWindow->SetTextFormatted( sText ); pFormattedWindow->SetSelection( Selection( SELECTION_MAX, SELECTION_MIN ) ); } @@ -1837,7 +1837,7 @@ String DbPatternField::GetFormatText(const Reference< ::com::sun::star::sdb::XCo } else OSL_ENSURE( rpFormatter->getColumn() == _rxField, "DbPatternField::GetFormatText: my value formatter is working for another field ...!" ); - // re-creating the value formatter here everytime would be quite expensive ... + // re-creating the value formatter here every time would be quite expensive ... String sText; if ( rpFormatter.get() ) diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 0a07f987496d..72ce80fa3778 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -359,7 +359,7 @@ void DbGridControl::NavigationBar::PositionDataSource(sal_Int32 nRecord) { if (m_bPositioning) return; - // the MoveToPosition may cause a LoseFocus which would lead to a second MoveToPosition, so protect agains this + // the MoveToPosition may cause a LoseFocus which would lead to a second MoveToPosition, so protect against this // recursion // 68167 - 13.08.99 - FS m_bPositioning = sal_True; @@ -1304,7 +1304,7 @@ sal_uInt16 DbGridControl::SetOptions(sal_uInt16 nOpt) } else nNewMode &= ~BROWSER_HIDECURSOR; - // should not be neccessary if EnablePermanentCursor is used to change the cursor behaviour, but to be sure ... + // should not be necessary if EnablePermanentCursor is used to change the cursor behaviour, but to be sure ... if (nNewMode != m_nMode) { @@ -1630,7 +1630,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt // there are rows so go to the selected current column if (nRecordCount) GoToRowColumnId(0, GetColumnId(nCurPos)); - // else stop the editing if neccessary + // else stop the editing if necessary else if (IsEditing()) DeactivateCell(); @@ -1796,7 +1796,7 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId) // +---+---+---+---+---+---+ // // Now, all is consistent again. - // (except of the hidden column : The cycling of the cols occured on the model, not on the view. maybe + // (except of the hidden column : The cycling of the cols occurred on the model, not on the view. maybe // the user expected the latter but there really is no good argument against our method ;) ...) // // And no, this large explanation isn't just because I wanted to play a board game or something like @@ -2275,7 +2275,7 @@ void DbGridControl::AdjustDataSource(sal_Bool bFull) if (bFull) m_xCurrentRow = NULL; // if we are on the same row only repaint - // but this is only possible for rows which are not inserted, in that case the comparision result + // but this is only possible for rows which are not inserted, in that case the comparison result // may not be correct else if ( m_xCurrentRow.Is() @@ -3363,7 +3363,7 @@ sal_Bool DbGridControl::SaveRow() // if we are appending we still sit on the insert row // we don't move just clear the flags not to move on the current row m_xCurrentRow->SetState(m_pDataCursor, sal_False); - TRACE_RANGE_MESSAGE1("explicit SetState after a successfull update, new state : %s", ROWSTATUS(m_xCurrentRow)); + TRACE_RANGE_MESSAGE1("explicit SetState after a successful update, new state : %s", ROWSTATUS(m_xCurrentRow)); m_xCurrentRow->SetNew(sal_False); // adjust the seekcursor if it is on the same position as the datacursor diff --git a/svx/source/form/dbtoolsclient.cxx b/svx/source/form/dbtoolsclient.cxx index aac45b06fdc2..8815689dc85e 100644 --- a/svx/source/form/dbtoolsclient.cxx +++ b/svx/source/form/dbtoolsclient.cxx @@ -76,7 +76,7 @@ namespace svxform if ( pDBTFactory ) { m_xDataAccessFactory = pDBTFactory; - // by definition, the factory was aquired once + // by definition, the factory was acquired once m_xDataAccessFactory->release(); } } diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx index 26d69d399598..55a3f8abba5a 100644 --- a/svx/source/form/filtnav.cxx +++ b/svx/source/form/filtnav.cxx @@ -1349,7 +1349,7 @@ sal_Int8 FmFilterNavigator::AcceptDrop( const AcceptDropEvent& rEvt ) bNeedTrigger = sal_True; } else - { // is it an entry whith children, and not yet expanded? + { // is it an entry with children, and not yet expanded? SvLBoxEntry* pDropppedOn = GetEntry(aDropPos); if (pDropppedOn && (GetChildCount(pDropppedOn) > 0) && !IsExpanded(pDropppedOn)) { diff --git a/svx/source/form/fmPropBrw.cxx b/svx/source/form/fmPropBrw.cxx index 5eb81acff6a1..26097275ba2d 100644 --- a/svx/source/form/fmPropBrw.cxx +++ b/svx/source/form/fmPropBrw.cxx @@ -226,7 +226,7 @@ FmPropBrw::FmPropBrw( const Reference< XMultiServiceFactory >& _xORB, SfxBinding { // create an intermediate window, which is to be the container window of the frame // Do *not* use |this| as container window for the frame, this would result in undefined - // responsiblity for this window (as soon as we initialize a frame with a window, the frame + // responsibility for this window (as soon as we initialize a frame with a window, the frame // is responsible for it's life time, but |this| is controlled by the belonging SfxChildWindow) // #i34249# - 2004-09-27 - fs@openoffice.org Window* pContainerWindow = new Window( this ); @@ -241,7 +241,7 @@ FmPropBrw::FmPropBrw( const Reference< XMultiServiceFactory >& _xORB, SfxBinding xSupp ( _pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); // if ( xSupp.is() ) // xSupp->getFrames()->append( m_xMeAsFrame ); - // Don't append frame to frame hierachy to prevent UI_DEACTIVATE messages + // Don't append frame to frame hierarchy to prevent UI_DEACTIVATE messages // #i31834# - 2004-07-27 - cd@openoffice.org } } @@ -708,7 +708,7 @@ void FmPropBrw::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPool } catch (Exception&) { - DBG_ERROR("FmPropBrw::StateChanged: Exception occured!"); + DBG_ERROR("FmPropBrw::StateChanged: Exception occurred!"); } m_bInStateChange = false; } diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index c87abc14c0ba..1aab6abf3c05 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -678,7 +678,7 @@ bool FmFormObj::EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd ) Reference< XIndexContainer > xFormToInsertInto; if ( !xParentForm.is() ) - { // model is not yet part of a form component hierachy + { // model is not yet part of a form component hierarchy xParentForm.set( rPage.GetImpl().findPlaceInFormComponentHierarchy( xContent ), UNO_SET_THROW ); xFormToInsertInto.set( xParentForm, UNO_QUERY_THROW ); } diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index f72806ba27e5..bbb3e62ed7b4 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -1719,7 +1719,7 @@ void FmXFormShell::SetY2KState(sal_uInt16 n) } catch(Exception&) { - DBG_ERROR("FmXFormShell::SetY2KState: Exception occured!"); + DBG_ERROR("FmXFormShell::SetY2KState: Exception occurred!"); } } @@ -1760,7 +1760,7 @@ void FmXFormShell::SetY2KState(sal_uInt16 n) } catch(Exception&) { - DBG_ERROR("FmXFormShell::SetY2KState: Exception occured!"); + DBG_ERROR("FmXFormShell::SetY2KState: Exception occurred!"); } } @@ -3014,7 +3014,7 @@ void FmXFormShell::startFiltering() Reference< XControlContainer> xContainer; if (getActiveController() == m_xExternalViewController) { - DBG_ASSERT(m_xExtViewTriggerController.is(), "FmXFormShell::startFiltering : inconsistent : active external controller, but noone triggered this !"); + DBG_ASSERT(m_xExtViewTriggerController.is(), "FmXFormShell::startFiltering : inconsistent : active external controller, but no one triggered this !"); xContainer = m_xExtViewTriggerController->getContainer(); } else @@ -3091,7 +3091,7 @@ void FmXFormShell::stopFiltering(sal_Bool bSave) Reference< XControlContainer> xContainer; if (getActiveController() == m_xExternalViewController) { - DBG_ASSERT(m_xExtViewTriggerController.is(), "FmXFormShell::stopFiltering : inconsistent : active external controller, but noone triggered this !"); + DBG_ASSERT(m_xExtViewTriggerController.is(), "FmXFormShell::stopFiltering : inconsistent : active external controller, but no one triggered this !"); xContainer = m_xExtViewTriggerController->getContainer(); } else @@ -3156,7 +3156,7 @@ void FmXFormShell::stopFiltering(sal_Bool bSave) } catch(Exception&) { - DBG_ERROR("FmXFormShell::stopFiltering: Exception occured!"); + DBG_ERROR("FmXFormShell::stopFiltering: Exception occurred!"); } if (!isRowSetAlive(xFormSet)) @@ -3227,7 +3227,7 @@ void FmXFormShell::clearFilter() Reference< XControlContainer> xContainer; if (getActiveController() == m_xExternalViewController) { - DBG_ASSERT(m_xExtViewTriggerController.is(), "FmXFormShell::clearFilter : inconsistent : active external controller, but noone triggered this !"); + DBG_ASSERT(m_xExtViewTriggerController.is(), "FmXFormShell::clearFilter : inconsistent : active external controller, but no one triggered this !"); xContainer = m_xExtViewTriggerController->getContainer(); } else diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx index 0c5b2b060bdf..49ade47330f4 100644 --- a/svx/source/form/fmsrcimp.cxx +++ b/svx/source/form/fmsrcimp.cxx @@ -896,7 +896,7 @@ void FmSearchEngine::Init(const ::rtl::OUString& sVisibleFields) } catch(Exception&) { - DBG_ERROR("Exception occured!"); + DBG_ERROR("Exception occurred!"); } } diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 67d0a06465ff..f886000dda14 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -1507,7 +1507,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice& _rOutDev, sal_Int32 _nXO ) return false; - // insert the control model(s) into the form component hierachy + // insert the control model(s) into the form component hierarchy if ( _rpLabel ) lcl_insertIntoFormComponentHierarchy_throw( *m_pView, *_rpLabel, _rxDataSource, _rDataSourceName, _rCommand, _nCommandType ); lcl_insertIntoFormComponentHierarchy_throw( *m_pView, *_rpControl, _rxDataSource, _rDataSourceName, _rCommand, _nCommandType ); diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index c3e7029bcf2e..177cfc57cd97 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -1057,7 +1057,7 @@ void SAL_CALL FormController::removeDisjunctiveTerm( ::sal_Int32 _Term ) throw ( FmFilterRows::iterator pos = m_aFilterRows.begin() + _Term; m_aFilterRows.erase( pos ); - // adjust m_nCurrentFilterPosition if the removed row preceeded it + // adjust m_nCurrentFilterPosition if the removed row preceded it if ( _Term < m_nCurrentFilterPosition ) --m_nCurrentFilterPosition; @@ -3133,7 +3133,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos) Sequence < PropertyValue> aLevel; Sequence< Sequence < PropertyValue > > aFilterRows = m_xComposer->getStructuredFilter(); - // ok, we recieve the list of filters as sequence of fieldnames, value + // ok, we receive the list of filters as sequence of fieldnames, value // now we have to transform the fieldname into UI names, that could be a label of the field or // a aliasname or the fieldname itself diff --git a/svx/source/form/formdispatchinterceptor.cxx b/svx/source/form/formdispatchinterceptor.cxx index 38be635b3c53..e8623c07dc3a 100644 --- a/svx/source/form/formdispatchinterceptor.cxx +++ b/svx/source/form/formdispatchinterceptor.cxx @@ -78,7 +78,7 @@ namespace svxform { _rxToIntercept->registerDispatchProviderInterceptor((XDispatchProviderInterceptor*)this); // this should make us the top-level dispatch-provider for the component, via a call to our - // setDispatchProvider we should have got an fallback for requests we (i.e. our master) cannot fullfill + // setDispatchProvider we should have got an fallback for requests we (i.e. our master) cannot fulfill Reference< XComponent> xInterceptedComponent(_rxToIntercept, UNO_QUERY); if (xInterceptedComponent.is()) { diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 720bbfe4207f..7269e9c2b6ea 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1898,7 +1898,7 @@ namespace svxform m_arrCurrentSelection.Remove( i - 1, 1 ); } // In case there is no shape for the current entry, we keep the entry in m_arrCurrentSelection, - // since then we can definately remove it. + // since then we can definitely remove it. // #103597# } } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 5d3a5c30443a..cc0a3447cb5e 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -435,7 +435,7 @@ sal_Bool GalleryTheme::InsertObject( const SgaObject& rObj, sal_uIntPtr nInsertP { GalleryObject aNewEntry; - // update title of new object if neccessary + // update title of new object if necessary if( !rObj.GetTitle().Len() ) { SgaObject* pOldObj = ImplReadSgaObject( pFoundEntry ); diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx index 3125f9e1090a..3bf8ca7b5c8e 100644 --- a/svx/source/inc/docrecovery.hxx +++ b/svx/source/inc/docrecovery.hxx @@ -127,9 +127,9 @@ enum EDocStates /* FINAL STATES */ - /// the Auto/Emergency saved document isnt useable any longer + /// the Auto/Emergency saved document isn't useable any longer E_DAMAGED = 64, - /// the Auto/Emergency saved document isnt realy up-to-date (some changes can be missing) + /// the Auto/Emergency saved document isn't really up-to-date (some changes can be missing) E_INCOMPLETE = 128, /// the Auto/Emergency saved document was processed successfully E_SUCCEDED = 512 @@ -487,13 +487,13 @@ class SaveDialog : public IExtendedTabPage //--------------------------------------- /** @short create all child controls of this dialog. - @descr The dialog isnt shown nor it starts any + @descr The dialog isn't shown nor it starts any action by itself! @param pParent can point to a parent window. If its set to 0, the defmodal-dialog-parent - is used automaticly. + is used automatically. @param pCore provides access to the recovery core service @@ -544,13 +544,13 @@ class SaveProgressDialog : public ModalDialog //--------------------------------------- /** @short create all child controls of this dialog. - @descr The dialog isnt shown nor it starts any + @descr The dialog isn't shown nor it starts any action by itself! @param pParent can point to a parent window. If its set to 0, the defmodal-dialog-parent - is used automaticly. + is used automatically. @param pCore used to start emegrency save. diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx index 9f2d487d9852..391915da3ed4 100644 --- a/svx/source/inc/fmshimp.hxx +++ b/svx/source/inc/fmshimp.hxx @@ -477,7 +477,7 @@ public: // if the form belongs to the controller (extern) displaying a grid, the according internal form will // be displayed, _xForm else - // check if the current control of the active controler has the focus + // check if the current control of the active controller has the focus bool HasControlFocus() const; private: diff --git a/svx/source/inc/fmtextcontrolshell.hxx b/svx/source/inc/fmtextcontrolshell.hxx index 5d5cd7b58ca0..4ee43867350c 100644 --- a/svx/source/inc/fmtextcontrolshell.hxx +++ b/svx/source/inc/fmtextcontrolshell.hxx @@ -93,7 +93,7 @@ namespace svx // without this define, m_xActiveControl remembers the *last* active control, even // if it, in the meantime, already lost the focus bool m_bActiveControl; - // so we need an additional boolean flag telling whether the active cotrol + // so we need an additional boolean flag telling whether the active control // is really focused #endif bool m_bActiveControlIsReadOnly; diff --git a/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx b/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx new file mode 100755 index 000000000000..1814b3eeb4db --- /dev/null +++ b/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx @@ -0,0 +1,275 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> +#include <svx/sdr/primitive2d/sdrattributecreator.hxx> +#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <drawinglayer/attribute/fillhatchattribute.hxx> +#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx> +#include <svx/xfillit0.hxx> +#include <vcl/graph.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + void SdrAllFillAttributesHelper::createPrimitive2DSequence( + const basegfx::B2DRange& rPaintRange, + const basegfx::B2DRange& rDefineRange) + { + // reset and remember new target range for object geometry + maLastPaintRange = rPaintRange; + maLastDefineRange = rDefineRange; + + if(isUsed()) + { + maPrimitives.realloc(1); + maPrimitives[0] = drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon( + basegfx::tools::createPolygonFromRect( + maLastPaintRange)), + maLastDefineRange, + maFillAttribute.get() ? *maFillAttribute.get() : drawinglayer::attribute::SdrFillAttribute(), + maFillGradientAttribute.get() ? *maFillGradientAttribute.get() : drawinglayer::attribute::FillGradientAttribute()); + } + } + + SdrAllFillAttributesHelper::SdrAllFillAttributesHelper() + : maLastPaintRange(), + maLastDefineRange(), + maFillAttribute(), + maFillGradientAttribute(), + maPrimitives() + { + } + + SdrAllFillAttributesHelper::SdrAllFillAttributesHelper(const Color& rColor) + : maLastPaintRange(), + maLastDefineRange(), + maFillAttribute(), + maFillGradientAttribute(), + maPrimitives() + { + maFillAttribute.reset( + new drawinglayer::attribute::SdrFillAttribute( + 0.0, + Color(rColor.GetRGBColor()).getBColor(), + drawinglayer::attribute::FillGradientAttribute(), + drawinglayer::attribute::FillHatchAttribute(), + drawinglayer::attribute::SdrFillGraphicAttribute())); + } + + SdrAllFillAttributesHelper::SdrAllFillAttributesHelper(const SfxItemSet& rSet) + : maLastPaintRange(), + maLastDefineRange(), + maFillAttribute( + new drawinglayer::attribute::SdrFillAttribute( + drawinglayer::primitive2d::createNewSdrFillAttribute(rSet))), + maFillGradientAttribute( + new drawinglayer::attribute::FillGradientAttribute( + drawinglayer::primitive2d::createNewTransparenceGradientAttribute(rSet))), + maPrimitives() + { + } + + SdrAllFillAttributesHelper::~SdrAllFillAttributesHelper() + { + } + + bool SdrAllFillAttributesHelper::isUsed() const + { + // only depends on fill, FillGradientAttribute alone defines no fill + return maFillAttribute.get() && !maFillAttribute->isDefault(); + } + + bool SdrAllFillAttributesHelper::isTransparent() const + { + if(hasSdrFillAttribute() && 0.0 != maFillAttribute->getTransparence()) + { + return true; + } + + if(hasFillGradientAttribute() && !maFillGradientAttribute->isDefault()) + { + return true; + } + + if(hasSdrFillAttribute()) + { + const Graphic& rGraphic = getFillAttribute().getFillGraphic().getFillGraphic(); + + return rGraphic.IsSupportedGraphic() && rGraphic.IsTransparent(); + } + + return false; + } + + const drawinglayer::attribute::SdrFillAttribute& SdrAllFillAttributesHelper::getFillAttribute() const + { + if(!maFillAttribute.get()) + { + const_cast< SdrAllFillAttributesHelper* >(this)->maFillAttribute.reset(new drawinglayer::attribute::SdrFillAttribute()); + } + + return *maFillAttribute.get(); + } + + const drawinglayer::attribute::FillGradientAttribute& SdrAllFillAttributesHelper::getFillGradientAttribute() const + { + if(!maFillGradientAttribute.get()) + { + const_cast< SdrAllFillAttributesHelper* >(this)->maFillGradientAttribute.reset(new drawinglayer::attribute::FillGradientAttribute()); + } + + return *maFillGradientAttribute.get(); + } + + const drawinglayer::primitive2d::Primitive2DSequence& SdrAllFillAttributesHelper::getPrimitive2DSequence( + const basegfx::B2DRange& rPaintRange, + const basegfx::B2DRange& rDefineRange) const + { + if(maPrimitives.getLength() && (maLastPaintRange != rPaintRange || maLastDefineRange != rDefineRange)) + { + const_cast< SdrAllFillAttributesHelper* >(this)->maPrimitives.realloc(0); + } + + if(!maPrimitives.getLength()) + { + const_cast< SdrAllFillAttributesHelper* >(this)->createPrimitive2DSequence(rPaintRange, rDefineRange); + } + + return maPrimitives; + } + + basegfx::BColor SdrAllFillAttributesHelper::getAverageColor(const basegfx::BColor& rFallback) const + { + basegfx::BColor aRetval(rFallback); + + if(maFillAttribute.get() && !maFillAttribute->isDefault()) + { + const drawinglayer::attribute::FillGradientAttribute& rFillGradientAttribute = maFillAttribute->getGradient(); + const drawinglayer::attribute::FillHatchAttribute& rFillHatchAttribute = maFillAttribute->getHatch(); + const drawinglayer::attribute::SdrFillGraphicAttribute& rSdrFillGraphicAttribute = maFillAttribute->getFillGraphic(); + const drawinglayer::attribute::FillGradientAttribute& rFillTransparenceGradientAttribute = getFillGradientAttribute(); + double fTransparence(maFillAttribute->getTransparence()); + + if(!rFillTransparenceGradientAttribute.isDefault()) + { + const double fTransA = rFillTransparenceGradientAttribute.getStartColor().luminance(); + const double fTransB = rFillTransparenceGradientAttribute.getEndColor().luminance(); + + fTransparence = (fTransA + fTransB) * 0.5; + } + + if(!rFillGradientAttribute.isDefault()) + { + // gradient fill + const basegfx::BColor& rStart = rFillGradientAttribute.getStartColor(); + const basegfx::BColor& rEnd = rFillGradientAttribute.getEndColor(); + + aRetval = basegfx::interpolate(rStart, rEnd, 0.5); + } + else if(!rFillHatchAttribute.isDefault()) + { + // hatch fill + const basegfx::BColor& rColor = rFillHatchAttribute.getColor(); + + if(rFillHatchAttribute.isFillBackground()) + { + const basegfx::BColor& rBackgroundColor = maFillAttribute->getColor(); + + // mix colors 50%/50% + aRetval = basegfx::interpolate(rColor, rBackgroundColor, 0.5); + } + else + { + // mix color with fallback color + aRetval = basegfx::interpolate(rColor, rFallback, 0.5); + } + } + else if(!rSdrFillGraphicAttribute.isDefault()) + { + // graphic fill + + // not used yet by purpose (see SwPageFrm::GetDrawBackgrdColor()), + // use fallback (already set) + } + else + { + // color fill + aRetval = maFillAttribute->getColor(); + } + + if(!basegfx::fTools::equalZero(fTransparence)) + { + // blend into transparency + aRetval = basegfx::interpolate(aRetval, rFallback, fTransparence); + } + } + + return aRetval.clamp(); + } + + bool SdrAllFillAttributesHelper::needCompleteRepaint() const + { + if(!isUsed() || !hasSdrFillAttribute()) + { + // not used or no fill + return false; + } + + const drawinglayer::attribute::SdrFillAttribute& rSdrFillAttribute = getFillAttribute(); + + if(!rSdrFillAttribute.getHatch().isDefault()) + { + // hatch is always top-left aligned, needs no full refreshes + return false; + } + + if(!rSdrFillAttribute.getGradient().isDefault()) + { + // gradients always scale with the object + return true; + } + + if(!rSdrFillAttribute.getFillGraphic().isDefault()) + { + // some graphic constellations may not need this, but since most do + // (stretch to fill, all but top-left aligned, ...) claim to do by default + return true; + } + + // color fill + return false; + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/sdr/contact/displayinfo.cxx b/svx/source/sdr/contact/displayinfo.cxx index fdd2a6cb0be2..51289719680d 100644 --- a/svx/source/sdr/contact/displayinfo.cxx +++ b/svx/source/sdr/contact/displayinfo.cxx @@ -53,7 +53,7 @@ namespace sdr { } - // Access to LayerInfos (which layers to proccess) + // Access to LayerInfos (which layers to process) void DisplayInfo::SetProcessLayers(const SetOfByte& rSet) { maProcessLayers = rSet; diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index 2705fa80c8f4..38b2e286f696 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -265,7 +265,7 @@ namespace sdr // set recursion flag bInCreatePrimitive2D = true; - // init extractor, guarantee existance, set page there + // init extractor, guarantee existence, set page there mpExtractor->SetStartPage(pPage); // #i105548# also need to copy the VOCRedirector for sub-content creation diff --git a/svx/source/sdr/event/eventhandler.cxx b/svx/source/sdr/event/eventhandler.cxx index f4cc5af898db..030e113be963 100644 --- a/svx/source/sdr/event/eventhandler.cxx +++ b/svx/source/sdr/event/eventhandler.cxx @@ -25,7 +25,7 @@ #include "precompiled_svx.hxx" #include <svx/sdr/event/eventhandler.hxx> -// for SOLARIS compiler include of algorithm part of _STL is necesary to +// for SOLARIS compiler include of algorithm part of _STL is necessary to // get access to basic algos like ::std::find #include <algorithm> #include <tools/debug.hxx> diff --git a/svx/source/sdr/overlay/overlayobjectlist.cxx b/svx/source/sdr/overlay/overlayobjectlist.cxx index 1f8dcca670f2..0f5d4d947707 100644 --- a/svx/source/sdr/overlay/overlayobjectlist.cxx +++ b/svx/source/sdr/overlay/overlayobjectlist.cxx @@ -29,7 +29,7 @@ #include <vcl/outdev.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -// for SOLARIS compiler include of algorithm part of _STL is necesary to +// for SOLARIS compiler include of algorithm part of _STL is necessary to // get access to basic algos like ::std::find #include <algorithm> diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index dfc53f1cd253..af1c03d97d75 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -135,7 +135,11 @@ namespace drawinglayer // create FillGradientPrimitive2D for transparence and add to new sequence // fillGradientPrimitive is enough here (compared to PolyPolygonGradientPrimitive2D) since float transparence will be masked anyways const basegfx::B2DRange aRange(basegfx::tools::getRange(rPolyPolygon)); - const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, rFillGradient)); + const Primitive2DReference xRefB( + new FillGradientPrimitive2D( + aRange, + rDefinitionRange, + rFillGradient)); const Primitive2DSequence aAlpha(&xRefB, 1L); // create TransparencePrimitive2D using alpha and content diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx index ec60ed0cbf31..97cbac3bd999 100644 --- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx @@ -55,7 +55,7 @@ namespace drawinglayer // to take care of getSdrLFSTAttribute() later, the same as in SdrGrafPrimitive2D::create2DDecomposition // should happen. For the moment we only need the OLE itself // Added complete primitive preparation using getSdrLFSTAttribute() now. To not do stuff which is not needed now, it - // may be supressed by using a static bool. The paint version only supported text. + // may be suppressed by using a static bool. The paint version only supported text. static bool bBehaveCompatibleToPaintVersion(false); Primitive2DSequence aRetval; @@ -131,7 +131,7 @@ namespace drawinglayer // add graphic content appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, getOLEContent()); - // add text, no need to supress to stay compatible since text was + // add text, no need to suppress to stay compatible since text was // always supported by the old paints, too if(!getSdrLFSTAttribute().getText().isDefault()) { diff --git a/svx/source/sidebar/line/LineWidthControl.cxx b/svx/source/sidebar/line/LineWidthControl.cxx index 77e582b1aea1..b2a6e2281ad6 100644 --- a/svx/source/sidebar/line/LineWidthControl.cxx +++ b/svx/source/sidebar/line/LineWidthControl.cxx @@ -52,8 +52,8 @@ LineWidthControl::LineWidthControl ( mstrPT(SVX_RES(STR_PT)), mnCustomWidth(0), mbCustom(false), - mbColseByEdit(false), - mnTmpCusomWidth(0), + mbCloseByEdit(false), + mnTmpCustomWidth(0), mbVSFocus(true), maIMGCus(SVX_RES(IMG_WIDTH_CUSTOM)), maIMGCusGray(SVX_RES(IMG_WIDTH_CUSTOM_GRAY)) @@ -208,7 +208,7 @@ void LineWidthControl::SetWidthSelect( long lValue, bool bValuable, SfxMapUnit e { mbVSFocus = true; maVSWidth.SetSelItem(0); - mbColseByEdit = false; + mbCloseByEdit = false; meMapUnit = eMapUnit; SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE ); if ( aWinOpt.Exists() ) @@ -287,8 +287,8 @@ IMPL_LINK(LineWidthControl, VSSelectHdl, void *, pControl) mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aWidthItem, 0L); mrLinePropertyPanel.SetWidthIcon(iPos); mrLinePropertyPanel.SetWidth(nVal); - mbColseByEdit = false; - mnTmpCusomWidth = 0; + mbCloseByEdit = false; + mnTmpCustomWidth = 0; } else if(iPos == 9) {//last custom @@ -300,8 +300,8 @@ IMPL_LINK(LineWidthControl, VSSelectHdl, void *, pControl) XLineWidthItem aWidthItem( nVal ); mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aWidthItem, 0L); mrLinePropertyPanel.SetWidth(nVal); - mbColseByEdit = false; - mnTmpCusomWidth = 0; + mbCloseByEdit = false; + mnTmpCustomWidth = 0; } else { @@ -338,13 +338,13 @@ IMPL_LINK(LineWidthControl, MFModifyHdl, void *, pControl) XLineWidthItem aWidthItem(nNewWidth); mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aWidthItem, 0L); - mbColseByEdit = true; - mnTmpCusomWidth = nTmp; + mbCloseByEdit = true; + mnTmpCustomWidth = nTmp; /*for(sal_uInt16 i = 0; i < 8; i++) { if(nTmp == (sal_Int32)maVSWidth.GetItemData(i)) { - mbColseByEdit = false; + mbCloseByEdit = false; break; } }*/ @@ -358,7 +358,7 @@ IMPL_LINK(LineWidthControl, MFModifyHdl, void *, pControl) bool LineWidthControl::IsCloseByEdit() { - return mbColseByEdit; + return mbCloseByEdit; } @@ -366,7 +366,7 @@ bool LineWidthControl::IsCloseByEdit() long LineWidthControl::GetTmpCustomWidth() { - return mnTmpCusomWidth; + return mnTmpCustomWidth; } diff --git a/svx/source/sidebar/line/LineWidthControl.hxx b/svx/source/sidebar/line/LineWidthControl.hxx index 88b614714c0a..9e43b8748be8 100644 --- a/svx/source/sidebar/line/LineWidthControl.hxx +++ b/svx/source/sidebar/line/LineWidthControl.hxx @@ -58,8 +58,8 @@ private: XubString mstrPT; // long mnCustomWidth; bool mbCustom; - bool mbColseByEdit; - long mnTmpCusomWidth; + bool mbCloseByEdit; + long mnTmpCustomWidth; bool mbVSFocus; Image maIMGCus; diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx index f581909e55a9..4ffa6bf9abb4 100755 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx @@ -178,7 +178,7 @@ private: SfxMapUnit m_eULSpaceUnit; /**************************************************************** ** - ** Controll Items + ** Control Items ** *****************************************************************/ diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index e6901e2a9c61..9f22f2dd2978 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -90,7 +90,10 @@ PosSizePropertyPanel::PosSizePropertyPanel( mlRotY(0), maUIScale(), mePoolUnit(), - meDlgUnit(), + + // #124409# init with fallback default + meDlgUnit(FUNIT_INCH), + maTransfPosXControl(SID_ATTR_TRANSFORM_POS_X, *pBindings, *this), maTransfPosYControl(SID_ATTR_TRANSFORM_POS_Y, *pBindings, *this), maTransfWidthControl(SID_ATTR_TRANSFORM_WIDTH, *pBindings, *this), @@ -309,11 +312,15 @@ void PosSizePropertyPanel::Initialize() } mePoolUnit = maTransfWidthControl.GetCoreMetric(); - meDlgUnit = GetModuleFieldUnit(); - SetFieldUnit( *mpMtrPosX, meDlgUnit, true ); - SetFieldUnit( *mpMtrPosY, meDlgUnit, true ); - SetFieldUnit( *mpMtrWidth, meDlgUnit, true ); - SetFieldUnit( *mpMtrHeight, meDlgUnit, true ); + + // #124409# no need to do this, the mpBindings->Update( SID_ATTR_METRIC ) + // call in the constructor will trigger MetricState and will get the correct unit + // + // meDlgUnit = GetModuleFieldUnit(); + // SetFieldUnit( *mpMtrPosX, meDlgUnit, true ); + // SetFieldUnit( *mpMtrPosY, meDlgUnit, true ); + // SetFieldUnit( *mpMtrWidth, meDlgUnit, true ); + // SetFieldUnit( *mpMtrHeight, meDlgUnit, true ); } @@ -784,7 +791,13 @@ void PosSizePropertyPanel::NotifyItemUpdate( // Pool unit and dialog unit may have changed, make sure that we // have the current values. mePoolUnit = maTransfWidthControl.GetCoreMetric(); - meDlgUnit = GetModuleFieldUnit(); + + // #124409# do not change; GetModuleFieldUnit uses SfxModule::GetCurrentFieldUnit() + // which uses GetActiveModule() and if no items are set there (which is the case e.g. + // for writer), will just return the system fallback of FUNIT_INCH which is wrong. + // Anyways, with multiple open views the static call GetActiveModule is ambigious + // + // meDlgUnit = GetModuleFieldUnit(); switch (nSID) { @@ -1185,6 +1198,9 @@ void PosSizePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem* bool bWidthBlank = false; bool bHeightBlank = false; String sNull = String::CreateFromAscii(""); + + // #124409# use the given Item to get the correct UI unit and initialize it + // and the Fields using it meDlgUnit = GetCurrentUnit(eState,pState); if( mpMtrPosX->GetText() == sNull ) diff --git a/svx/source/sidebar/tools/ColorControl.cxx b/svx/source/sidebar/tools/ColorControl.cxx index 6dc193ce0f70..359b34356d8e 100644 --- a/svx/source/sidebar/tools/ColorControl.cxx +++ b/svx/source/sidebar/tools/ColorControl.cxx @@ -167,18 +167,20 @@ void ColorControl::GetFocus (void) -void ColorControl::SetCurColorSelect (Color aCol, bool bAvailable) +void ColorControl::SetCurColorSelect(Color aCol,bool bAvailable) { -// FillColors(); - short nCol = GetItemId_Imp( maVSColor, aCol ); - if(! bAvailable) + //UUUU When transparent use transparent entry (entry 0) + const bool bIsTransparent(0xff == aCol.GetTransparency()); + short nCol = bIsTransparent ? 0 : GetItemId_Imp(maVSColor,aCol); + + if(!bAvailable) { maVSColor.SetNoSelection(); return; } //if not found - if( nCol == -1) + if(nCol == -1) { maVSColor.SetNoSelection(); } diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 8d51eba6bfa7..2cdbdc3671cc 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -1243,7 +1243,7 @@ void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode) nInsPos = pObj->GetNavigationPosition() + 1; pInsOL = pObj->getParentOfSdrObject(); - // #i76891# use single iter from SJ here whcih works on SdrObjects and takes + // #i76891# use single iter from SJ here which works on SdrObjects and takes // groups into account by itself SdrObjListIter aIter(*pObj, IM_DEEPWITHGROUPS); diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 68f94acadbcf..38ee709c7155 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -322,7 +322,7 @@ void SdrObjEditView::LazyReactOnObjectChanges() // which makes the Handles visible. Changes at TakeTextRange() // seem to have resulted in a case where no refresh is executed. // Before that, a refresh must have been always executed - // (else this error would have happend earlier), thus i + // (else this error would have happened earlier), thus i // even think here a refresh should be done always. // Since follow-up problems cannot even be guessed I only // add this one more case to the if below. diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 4382077d7e6c..c35d075a9e15 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -178,7 +178,10 @@ void ImpSdrGDIMetaFileImport::DoLoopActions(GDIMetaFile& rMtf, SvdProgressInfo* case META_PUSH_ACTION : DoAction((MetaPushAction &)*pAct); break; case META_POP_ACTION : DoAction((MetaPopAction &)*pAct); break; case META_HATCH_ACTION : DoAction((MetaHatchAction &)*pAct); break; - case META_COMMENT_ACTION : DoAction((MetaCommentAction &)*pAct, &rMtf); break; + + // #i125211# MetaCommentAction may change index, thus hand it over + case META_COMMENT_ACTION : DoAction((MetaCommentAction&)*pAct, rMtf, a); + break; // missing actions added case META_TEXTRECT_ACTION : DoAction((MetaTextRectAction&)*pAct); break; @@ -1280,9 +1283,8 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaHatchAction& rAct ) SdrPathObj* pPath = new SdrPathObj( mrModel, aSource); - SfxItemSet aHatchAttr(pPath->GetObjectItemPool(), - XATTR_FILLSTYLE, XATTR_FILLSTYLE, - XATTR_FILLHATCH, XATTR_FILLHATCH, 0, 0 ); + // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet + SfxItemSet aHatchAttr(pPath->GetObjectItemPool(), pPath->GetMergedItemSet().GetRanges()); XHatchStyle eStyle; switch(rHatch.GetStyle()) @@ -1332,13 +1334,14 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaMapModeAction& rAct) //////////////////////////////////////////////////////////////////////////////////////////////////// -void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pMtf ) +void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile& rMtf, sal_uLong& a) // GDIMetaFile* pMtf ) { ByteString aSkipComment; - if( rAct.GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL ) + if( a < rMtf.GetActionCount() && rAct.GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL ) { - MetaGradientExAction* pAct = (MetaGradientExAction*) pMtf->NextAction(); + // #i125211# Check if next action is a MetaGradientExAction + MetaGradientExAction* pAct = dynamic_cast< MetaGradientExAction* >(rMtf.GetAction(a + 1)); if( pAct && pAct->GetType() == META_GRADIENTEX_ACTION ) { @@ -1354,9 +1357,8 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM SdrPathObj* pPath = new SdrPathObj( mrModel, aSource); - SfxItemSet aGradAttr(pPath->GetObjectItemPool(), - XATTR_FILLSTYLE, XATTR_FILLSTYLE, - XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0 ); + // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet + SfxItemSet aGradAttr(pPath->GetObjectItemPool(), pPath->GetMergedItemSet().GetRanges()); XGradient aXGradient; aXGradient.SetGradientStyle((XGradientStyle)rGrad.GetStyle()); @@ -1394,13 +1396,14 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM if(aSkipComment.Len()) { - MetaAction* pSkipAct = pMtf->NextAction(); + // #i125211# forward until closing MetaCommentAction + MetaAction* pSkipAct = rMtf.GetAction(++a); while( pSkipAct && ((pSkipAct->GetType() != META_COMMENT_ACTION ) || (((MetaCommentAction*)pSkipAct)->GetComment().CompareIgnoreCaseToAscii(aSkipComment.GetBuffer()) != COMPARE_EQUAL))) { - pSkipAct = pMtf->NextAction(); + pSkipAct = rMtf.GetAction(++a); } } } @@ -1574,7 +1577,8 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction& rAct) mrModel, maCurrent * aObjectTransform); - SfxItemSet aGradientAttr(mrModel.GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0); + // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet + SfxItemSet aGradientAttr(mrModel.GetItemPool(), pRect->GetMergedItemSet().GetRanges()); const Gradient& rGradient = rAct.GetGradient(); const XGradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle())); const XFillGradientItem aXFillGradientItem( @@ -1592,7 +1596,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction& rAct) rGradient.GetSteps())); SetAttributes(pRect); - aGradientAttr.Put(XFillStyleItem(XFILL_HATCH)); + aGradientAttr.Put(XFillStyleItem(XFILL_GRADIENT)); // #i125211# aGradientAttr.Put(aXFillGradientItem); pRect->SetMergedItemSet(aGradientAttr); @@ -1654,10 +1658,11 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaGradientExAction& rAct) if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource)) { + // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet SdrPathObj* pPath = new SdrPathObj( mrModel, aSource); - SfxItemSet aGradientAttr(mrModel.GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLSTYLE, XATTR_FILLGRADIENT, XATTR_FILLGRADIENT, 0, 0); + SfxItemSet aGradientAttr(mrModel.GetItemPool(), pPath->GetMergedItemSet().GetRanges()); const Gradient& rGradient = rAct.GetGradient(); const XGradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle())); const XFillGradientItem aXFillGradientItem( @@ -1675,7 +1680,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaGradientExAction& rAct) rGradient.GetSteps())); SetAttributes(pPath); - aGradientAttr.Put(XFillStyleItem(XFILL_HATCH)); + aGradientAttr.Put(XFillStyleItem(XFILL_GRADIENT)); // #i125211# aGradientAttr.Put(aXFillGradientItem); pPath->SetMergedItemSet(aGradientAttr); diff --git a/svx/source/svdraw/svdfmtf.hxx b/svx/source/svdraw/svdfmtf.hxx index 2999b3c26b1a..e67230f84c3d 100644 --- a/svx/source/svdraw/svdfmtf.hxx +++ b/svx/source/svdraw/svdfmtf.hxx @@ -116,7 +116,10 @@ protected: void DoAction(MetaMoveClipRegionAction & rAct) { rAct.Execute(&maVD); checkClip(); } void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&maVD); checkClip(); } void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&maVD); checkClip(); } - void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf); + + // #i125211# The MetaCommentAction needs to advance (if used), thus + // give current metafile and index which may be changed + void DoAction(MetaCommentAction& rAct, GDIMetaFile& rMtf, sal_uLong& a); // missing actions added void DoAction(MetaTextRectAction& rAct); diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index e78c841c941c..0ff2f3638574 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -261,7 +261,7 @@ const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal } } - // cannot happen since all pathes return something; return Rect_7x7 as default (see switch) + // cannot happen since all paths return something; return Rect_7x7 as default (see switch) return maRealMarkers[0]; } @@ -2402,7 +2402,7 @@ void SdrCropViewHdl::CreateB2dIAObject(::sdr::overlay::OverlayManager& rOverlayM aCropped.getMinY()); aCroppedTransform = maObjectTransform * aCroppedTransform; - // prepare graphic primitive (tranformed) + // prepare graphic primitive (transformed) const drawinglayer::primitive2d::Primitive2DReference aGraphic( new drawinglayer::primitive2d::GraphicPrimitive2D( aCroppedTransform, diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 62c9988fc832..b3a43d3aed2a 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -150,7 +150,7 @@ const Graphic ImpLoadLinkedGraphic( const String aFileName, const String aFilter // handing it over means that any GraphicFormat that internallv needs a path as base // to interpret included links may fail. // Alternatively the path may be set at the result after this call when it is known - // that it is a SVG graphic, but only because noone yet tried to interpret it. + // that it is a SVG graphic, but only because no one yet tried to interpret it. pGF->ImportGraphic( aGraphic, aFileName, *pInStrm, nFilter, NULL, 0, &aFilterData ); } return aGraphic; @@ -1391,9 +1391,11 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) { pFilterData = new com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >( 3 ); - com::sun::star::awt::Size aPreviewSizeHint( 64, 64 ); - sal_Bool bAllowPartialStreamRead = sal_True; - sal_Bool bCreateNativeLink = sal_False; + const com::sun::star::awt::Size aPreviewSizeHint( 64, 64 ); + const sal_Bool bAllowPartialStreamRead = sal_True; + // create <GfxLink> instance also for previews in order to avoid that its corresponding + // data is cleared in the graphic cache entry in case that the preview data equals the complete graphic data + const sal_Bool bCreateNativeLink = sal_True; (*pFilterData)[ 0 ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "PreviewSizeHint" ) ); (*pFilterData)[ 0 ].Value <<= aPreviewSizeHint; (*pFilterData)[ 1 ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "AllowPartialStreamRead" ) ); diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index f83ae05ac683..a76db4d6c229 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -309,7 +309,7 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::saveObject() if ( !mpObj ) throw embed::ObjectSaveVetoException(); - // the common persistance is supported by objects and links + // the common persistence is supported by objects and links xPersist = uno::Reference< embed::XCommonEmbedPersist >( mpObj->GetObjRef(), uno::UNO_QUERY_THROW ); xModifiable = uno::Reference< util::XModifiable >( mpObj->GetParentXModel(), uno::UNO_QUERY ); } @@ -1311,7 +1311,7 @@ void SdrOle2Obj::Disconnect_Impl() // TODO/LATER: here we must assume that the destruction of the model is enough to make clear that we will not // remove the object from the container, even if the DrawingObject itself is not destroyed (unfortunately this // There is no real need to do the following removing of the object from the container - // in case the model has correct persistance, but in case of problems such a removing + // in case the model has correct persistence, but in case of problems such a removing // would make the behaviour of the office more stable comphelper::EmbeddedObjectContainer* pContainer = xObjRef.GetContainer(); diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 74ef8940068b..c8c6bc13cd4e 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -613,7 +613,7 @@ void SdrObjList::InsertObjectIntoContainer(SdrObject& rObject, const sal_uInt32 else { maList.insert(maList.begin()+nInsertPosition, &rObject); - EnsureValidNavigationPositions(); + EnsureValidNavigationPositions(nInsertPosition); } } diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src index f920bdc39e0f..e66d8d3dca6f 100644 --- a/svx/source/svdraw/svdstr.src +++ b/svx/source/svdraw/svdstr.src @@ -957,7 +957,7 @@ String STR_DragMethDistort }; String STR_DragMethCrop { - Text [ en-US ] = "Crop %O" ; + Text [ en-US ] = "Crop %1" ; }; String STR_DragRectEckRad diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index c311c9795a42..bbd7ae1c7555 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -47,6 +47,9 @@ #include <svx/svdograf.hxx> #include <svx/sdr/contact/viewcontactofgraphic.hxx> +// #124389# +#include <svx/svdotable.hxx> + //////////////////////////////////////////////////////////////////////////////////////////////////// sal_Bool SdrUndoAction::CanRepeat(SfxRepeatTarget& rView) const @@ -469,7 +472,7 @@ void SdrUndoAttrObj::Undo() // #105122# Since ClearItem sets back everything to normal // it also sets fit-to-size text to non-fit-to-size text and // switches on autogrowheight (the default). That may lead to - // loosing the geometry size info for the object when it is + // losing the geometry size info for the object when it is // re-layouted from AdjustTextFrameWidthAndHeight(). This makes // rescuing the size of the object necessary. const basegfx::B2DRange aSnapRange(sdr::legacy::GetSnapRange(mrSdrObject)); @@ -1207,11 +1210,20 @@ void SdrUndoObjSetText::AfterSetText() void SdrUndoObjSetText::Undo() { + // only works with SdrTextObj + SdrTextObj* pTarget = dynamic_cast< SdrTextObj* >(&mrSdrObject); + + if(!pTarget) + { + OSL_ENSURE(false, "SdrUndoObjSetText::Undo with SdrObject not based on SdrTextObj (!)"); + return; + } + // #94278# Trigger PageChangeCall ImpShowPageOfThisObject(); // alten Text sichern fuer Redo - if (!mbNewTextAvailable) + if(!mbNewTextAvailable) { AfterSetText(); } @@ -1224,15 +1236,21 @@ void SdrUndoObjSetText::Undo() pText1 = new OutlinerParaObject(*pText1); } - SdrText* pText = static_cast< SdrTextObj*>( &mrSdrObject )->getText(mnText); + SdrText* pText = pTarget->getText(mnText); - if( pText ) + if(pText) { - pText->SetOutlinerParaObject(pText1); + pTarget->SetOutlinerParaObjectForText(pText1, pText); } - mrSdrObject.SetEmptyPresObj( mbEmptyPresObj ); - mrSdrObject.ActionChanged(); + pTarget->SetEmptyPresObj(mbEmptyPresObj); + pTarget->ActionChanged(); + + // #124389# if it's a table, als oneed to relayout TextFrame + if(0 != dynamic_cast< sdr::table::SdrTableObj* >(pTarget)) + { + pTarget->AdjustTextFrameWidthAndHeight(); + } // #122410# SetOutlinerParaObject at SdrText does not trigger a // BroadcastObjectChange, but it is needed to make evtl. SlideSorters @@ -1242,6 +1260,15 @@ void SdrUndoObjSetText::Undo() void SdrUndoObjSetText::Redo() { + // only works with SdrTextObj + SdrTextObj* pTarget = dynamic_cast< SdrTextObj* >(&mrSdrObject); + + if(!pTarget) + { + OSL_ENSURE(false, "SdrUndoObjSetText::Redo with SdrObject not based on SdrTextObj (!)"); + return; + } + // Text fuer Undo kopieren, denn SetOutlinerParaObject() ist Eigentumsuebereignung OutlinerParaObject* pText1 = mpNewText; @@ -1250,16 +1277,22 @@ void SdrUndoObjSetText::Redo() pText1 = new OutlinerParaObject(*pText1); } - SdrText* pText = static_cast< SdrTextObj*>( &mrSdrObject )->getText(mnText); + SdrText* pText = pTarget->getText(mnText); - if( pText ) + if(pText) { - static_cast< SdrTextObj* >( &mrSdrObject )->SetOutlinerParaObjectForText( pText1, pText ); + pTarget->SetOutlinerParaObjectForText(pText1, pText); } - mrSdrObject.ActionChanged(); + pTarget->ActionChanged(); + + // #124389# if it's a table, als oneed to relayout TextFrame + if(0 != dynamic_cast< sdr::table::SdrTableObj* >(pTarget)) + { + pTarget->AdjustTextFrameWidthAndHeight(); + } - // #122410# NbcSetOutlinerParaObjectForText at SdrTextObj does not trigger a + // #122410# SetOutlinerParaObjectForText at SdrTextObj does not trigger a // BroadcastObjectChange, but it is needed to make evtl. SlideSorters // update their preview. const SdrObjectChangeBroadcaster aSdrObjectChangeBroadcaster(mrSdrObject); diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 21aad6536980..4519590cc5f1 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -635,7 +635,7 @@ BitmapEx SdrExchangeView::GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked) const if(pSdrGrafObj) { - // #122753# To ensure existance of graphic content, force swap in + // #122753# To ensure existence of graphic content, force swap in pSdrGrafObj->ForceSwapIn(); } @@ -717,7 +717,7 @@ GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked) co aMtf.SetPrefMapMode( aMap ); // removed PrefSize extension. It is principially wrong to set a reduced size at - // the created MetaFile. The mentioned errors occurr at output time since the integer + // the created MetaFile. The mentioned errors occur at output time since the integer // MapModes from VCL lead to errors. It is now corrected in the VCLRenderer for // primitives (and may later be done in breaking up a MetaFile to primitives) aMtf.SetPrefSize(aBoundSize); diff --git a/svx/source/table/celltypes.hxx b/svx/source/table/celltypes.hxx index 8361d33084c0..3daeea3759d1 100644 --- a/svx/source/table/celltypes.hxx +++ b/svx/source/table/celltypes.hxx @@ -80,7 +80,7 @@ public: } /* iterates in the configured direction and returns true if rValue - now contains a valid positon in the range of this iterator */ + now contains a valid position in the range of this iterator */ bool next( T& rValue ) { if( maIter == maEnd ) diff --git a/svx/source/table/tablelayouter.hxx b/svx/source/table/tablelayouter.hxx index 6f432a822de4..b103d8974b91 100644 --- a/svx/source/table/tablelayouter.hxx +++ b/svx/source/table/tablelayouter.hxx @@ -72,7 +72,7 @@ public: if bFitWidth or bFitHeight is set, the layouter tries to scale the rows and/or columns to the given area. The result my be bigger - to fullfill constrains. + to fulfill constrains. if bFitWidth or bFitHeight is set, the model is changed. */ diff --git a/svx/source/table/tableundo.cxx b/svx/source/table/tableundo.cxx index 42aebdf24666..cca0a7bf8e4e 100644 --- a/svx/source/table/tableundo.cxx +++ b/svx/source/table/tableundo.cxx @@ -145,8 +145,13 @@ void CellUndo::setDataToCell( const Data& rData ) mxCell->mnRowSpan = rData.mnRowSpan; mxCell->mnColSpan = rData.mnColSpan; - if( mxObjRef.is() ) + if(mxObjRef.is()) + { + // #120201# ActionChanged is not enough, we need to trigger TableLayouter::UpdateBorderLayout() + // and this is done best using ReformatText() for table objects mxObjRef->ActionChanged(); + mxObjRef->ReformatText(); + } } void CellUndo::getDataFromCell( Data& rData ) diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx index e90836c79d26..73d9f4b8e628 100755 --- a/svx/source/tbxctrls/SvxColorValueSet.cxx +++ b/svx/source/tbxctrls/SvxColorValueSet.cxx @@ -118,7 +118,7 @@ Size SvxColorValueSet::layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntry const Size aItemSize(getEntryEdgeLength(), getEntryEdgeLength()); const WinBits aWinBits(GetStyle() & ~WB_VSCROLL); - // get size whith all fields disabled + // get size with all fields disabled const WinBits aWinBitsNoScrollNoFields(GetStyle() & ~(WB_VSCROLL|WB_NAMEFIELD|WB_NONEFIELD)); SetStyle(aWinBitsNoScrollNoFields); const Size aSizeNoScrollNoFields(CalcWindowSizePixel(aItemSize, static_cast< sal_uInt16 >(getColumnCount()))); diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index 354797036a79..5c98d3835d1a 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -19,24 +19,17 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" -// include --------------------------------------------------------------- - #include <string> // HACK: prevent conflict between STLPORT and Workshop headers #include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/objsh.hxx> #include <sfx2/viewsh.hxx> #include <rtl/ustring.hxx> - #include <svx/dialogs.hrc> -#define DELAY_TIMEOUT 300 - #define TMP_STR_BEGIN '[' #define TMP_STR_END ']' @@ -62,19 +55,21 @@ SFX_IMPL_TOOLBOX_CONTROL( SvxFillToolBoxControl, XFillStyleItem ); |* \************************************************************************/ -SvxFillToolBoxControl::SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : - SfxToolBoxControl( nSlotId, nId, rTbx ), - - pStyleItem ( NULL ), - pColorItem ( NULL ), - pGradientItem ( NULL ), - pHatchItem ( NULL ), - pBitmapItem ( NULL ), - pFillControl ( NULL ), - pFillTypeLB ( NULL ), - pFillAttrLB ( NULL ), - bUpdate ( sal_False ), - eLastXFS ( XFILL_NONE ) +SvxFillToolBoxControl::SvxFillToolBoxControl( + sal_uInt16 nSlotId, + sal_uInt16 nId, + ToolBox& rTbx ) +: SfxToolBoxControl( nSlotId, nId, rTbx ), + mpStyleItem(0), + mpColorItem(0), + mpGradientItem(0), + mpHatchItem(0), + mpBitmapItem(0), + mpFillControl(0), + mpFillTypeLB(0), + mpFillAttrLB(0), + meLastXFS(XFILL_NONE), + mbUpdate(false) { addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillColor" ))); addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillGradient" ))); @@ -90,134 +85,146 @@ SvxFillToolBoxControl::SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId SvxFillToolBoxControl::~SvxFillToolBoxControl() { - delete pStyleItem; - delete pColorItem; - delete pGradientItem; - delete pHatchItem; - delete pBitmapItem; + delete mpStyleItem; + delete mpColorItem; + delete mpGradientItem; + delete mpHatchItem; + delete mpBitmapItem; } //======================================================================== void SvxFillToolBoxControl::StateChanged( - - sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) - + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) { - bool bEnableControls = sal_False; + bool bEnableControls(false); - if( eState == SFX_ITEM_DISABLED ) + if(eState == SFX_ITEM_DISABLED) { - if( nSID == SID_ATTR_FILL_STYLE ) + // slot disable state + if(nSID == SID_ATTR_FILL_STYLE) { - pFillTypeLB->Disable(); - pFillTypeLB->SetNoSelection(); + mpFillTypeLB->Disable(); + mpFillTypeLB->SetNoSelection(); } - pFillAttrLB->Disable(); - pFillAttrLB->SetNoSelection(); + + mpFillAttrLB->Disable(); + mpFillAttrLB->SetNoSelection(); } - else + else if(SFX_ITEM_AVAILABLE == eState) { - if ( SFX_ITEM_AVAILABLE == eState ) + // slot available state + if(nSID == SID_ATTR_FILL_STYLE) { - if( nSID == SID_ATTR_FILL_STYLE ) - { - delete pStyleItem; - pStyleItem = (XFillStyleItem*) pState->Clone(); - pFillTypeLB->Enable(); - } - else if( pStyleItem ) + delete mpStyleItem; + mpStyleItem = static_cast< XFillStyleItem* >(pState->Clone()); + mpFillTypeLB->Enable(); + } + else if(mpStyleItem) + { + const XFillStyle eXFS(static_cast< XFillStyle >(mpStyleItem->GetValue())); + + if(nSID == SID_ATTR_FILL_COLOR) { - XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); + delete mpColorItem; + mpColorItem = static_cast< XFillColorItem* >(pState->Clone()); - if( nSID == SID_ATTR_FILL_COLOR ) + if(eXFS == XFILL_SOLID) { - delete pColorItem; - pColorItem = (XFillColorItem*) pState->Clone(); - - if( eXFS == XFILL_SOLID ) - bEnableControls = sal_True; + bEnableControls = true; } - else if( nSID == SID_ATTR_FILL_GRADIENT ) - { - delete pGradientItem; - pGradientItem = (XFillGradientItem*) pState->Clone(); + } + else if(nSID == SID_ATTR_FILL_GRADIENT) + { + delete mpGradientItem; + mpGradientItem = static_cast< XFillGradientItem* >(pState->Clone()); - if( eXFS == XFILL_GRADIENT ) - bEnableControls = sal_True; - } - else if( nSID == SID_ATTR_FILL_HATCH ) + if(eXFS == XFILL_GRADIENT) { - delete pHatchItem; - pHatchItem = (XFillHatchItem*) pState->Clone(); - - if( eXFS == XFILL_HATCH ) - bEnableControls = sal_True; + bEnableControls = true; } - else if( nSID == SID_ATTR_FILL_BITMAP ) - { - delete pBitmapItem; - pBitmapItem = (XFillBitmapItem*) pState->Clone(); + } + else if(nSID == SID_ATTR_FILL_HATCH) + { + delete mpHatchItem; + mpHatchItem = static_cast< XFillHatchItem* >(pState->Clone()); - if( eXFS == XFILL_BITMAP ) - bEnableControls = sal_True; + if(eXFS == XFILL_HATCH) + { + bEnableControls = true; } } - - if( pStyleItem ) + else if(nSID == SID_ATTR_FILL_BITMAP) { - // ensure that the correct entry is selected in pFillTypeLB. It - // might have been changed by nSID == SID_ATTR_FILL_STYLE, but - // it might also be in an in-between state when user had started to - // change fillstyle, but not yet changed fillvalue for new style - // and when nSID == SID_ATTR_FILL_COLOR/SID_ATTR_FILL_GRADIENT/ - // SID_ATTR_FILL_HATCH/SID_ATTR_FILL_BITMAP value change is triggered - eLastXFS = pFillTypeLB->GetSelectEntryPos(); - XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); - - if(eLastXFS != eXFS) + delete mpBitmapItem; + mpBitmapItem = static_cast< XFillBitmapItem* >(pState->Clone()); + + if(eXFS == XFILL_BITMAP) { - bUpdate = sal_True; - pFillTypeLB->SelectEntryPos( sal::static_int_cast< sal_uInt16 >( eXFS ) ); + bEnableControls = true; } - - pFillAttrLB->Enable(); } + } + + if(mpStyleItem) + { + // ensure that the correct entry is selected in mpFillTypeLB + XFillStyle eXFS(static_cast< XFillStyle >(mpStyleItem->GetValue())); + const bool bFillTypeChangedByUser(mpFillControl->mbFillTypeChanged); - if( bEnableControls ) + if(bFillTypeChangedByUser) { - //pFillTypeLB->Enable(); - pFillAttrLB->Enable(); + meLastXFS = static_cast< XFillStyle >(mpFillControl->mnLastFillTypeControlSelectEntryPos); + mpFillControl->mbFillTypeChanged = false; + } - bUpdate = sal_True; + if(meLastXFS != eXFS) + { + mbUpdate = true; + mpFillTypeLB->SelectEntryPos(sal::static_int_cast<sal_uInt16>(eXFS)); } - Update( pState ); + mpFillAttrLB->Enable(); + } + + if(bEnableControls) + { + mpFillAttrLB->Enable(); + mbUpdate = true; + } + + Update(pState); + } + else + { + // slot empty or ambigous + if(nSID == SID_ATTR_FILL_STYLE) + { + mpFillTypeLB->SetNoSelection(); + mpFillAttrLB->Disable(); + mpFillAttrLB->SetNoSelection(); + delete mpStyleItem; + mpStyleItem = 0; + mbUpdate = false; } else { - // leerer oder uneindeutiger Status - if( nSID == SID_ATTR_FILL_STYLE ) + XFillStyle eXFS(XFILL_NONE); + + if(mpStyleItem) { - pFillTypeLB->SetNoSelection(); - pFillAttrLB->Disable(); - pFillAttrLB->SetNoSelection(); - bUpdate = sal_False; + eXFS = static_cast< XFillStyle >(mpStyleItem->GetValue()); } - else + + if(!mpStyleItem || + (nSID == SID_ATTR_FILL_COLOR && eXFS == XFILL_SOLID) || + (nSID == SID_ATTR_FILL_GRADIENT && eXFS == XFILL_GRADIENT) || + (nSID == SID_ATTR_FILL_HATCH && eXFS == XFILL_HATCH) || + (nSID == SID_ATTR_FILL_BITMAP && eXFS == XFILL_BITMAP)) { - XFillStyle eXFS = XFILL_NONE; - if( pStyleItem ) - eXFS = (XFillStyle)pStyleItem->GetValue(); - if( !pStyleItem || - ( nSID == SID_ATTR_FILL_COLOR && eXFS == XFILL_SOLID ) || - ( nSID == SID_ATTR_FILL_GRADIENT && eXFS == XFILL_GRADIENT ) || - ( nSID == SID_ATTR_FILL_HATCH && eXFS == XFILL_HATCH ) || - ( nSID == SID_ATTR_FILL_BITMAP && eXFS == XFILL_BITMAP ) ) - { - pFillAttrLB->SetNoSelection(); - //bUpdate = sal_False; - } + mpFillAttrLB->SetNoSelection(); } } } @@ -225,271 +232,321 @@ void SvxFillToolBoxControl::StateChanged( //======================================================================== -void SvxFillToolBoxControl::Update( const SfxPoolItem* pState ) +void SvxFillToolBoxControl::Update(const SfxPoolItem* pState) { - if ( pStyleItem && pState && bUpdate ) + if(mpStyleItem && pState && mbUpdate) { - bUpdate = sal_False; - - XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue(); + mbUpdate = false; + const XFillStyle eXFS(static_cast< XFillStyle >(mpStyleItem->GetValue())); // Pruefen, ob Fuellstil schon vorher aktiv war - //if( eTmpXFS != eXFS ) - if( (XFillStyle) eLastXFS != eXFS ) - pFillControl->SelectFillTypeHdl( NULL ); - //eLastXFS = eXFS; + if(meLastXFS != eXFS) + { + // update mnLastFillTypeControlSelectEntryPos and fill style list + mpFillControl->updateLastFillTypeControlSelectEntryPos(); + mpFillControl->InitializeFillStyleAccordingToGivenFillType(eXFS); + meLastXFS = eXFS; + } - switch( eXFS ) + switch(eXFS) { case XFILL_NONE: - break; + { + break; + } case XFILL_SOLID: { - if ( pColorItem ) + if(mpColorItem) { - String aString( pColorItem->GetName() ); - ::Color aColor = pColorItem->GetColorValue(); + String aString(mpColorItem->GetName()); + ::Color aColor = mpColorItem->GetColorValue(); - pFillAttrLB->SelectEntry( aString ); + mpFillAttrLB->SelectEntry(aString); - if ( pFillAttrLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND || - pFillAttrLB->GetSelectEntryColor() != aColor ) - pFillAttrLB->SelectEntry( aColor ); + if(mpFillAttrLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND || mpFillAttrLB->GetSelectEntryColor() != aColor) + { + mpFillAttrLB->SelectEntry(aColor); + } - // NEU // Pruefen, ob Eintrag nicht in der Liste ist - if( pFillAttrLB->GetSelectEntryPos() == - LISTBOX_ENTRY_NOTFOUND || - pFillAttrLB->GetSelectEntryColor() != aColor ) + if(mpFillAttrLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND || mpFillAttrLB->GetSelectEntryColor() != aColor) { - sal_uInt16 nCount = pFillAttrLB->GetEntryCount(); + sal_uInt16 nCount = mpFillAttrLB->GetEntryCount(); String aTmpStr; - if( nCount > 0 ) + if(nCount > 0) { //Letzter Eintrag wird auf temporaere Farbe geprueft - aTmpStr = pFillAttrLB->GetEntry( nCount - 1 ); - if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && - aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) + aTmpStr = mpFillAttrLB->GetEntry(nCount - 1); + + if(aTmpStr.GetChar(0) == TMP_STR_BEGIN && aTmpStr.GetChar(aTmpStr.Len() - 1) == TMP_STR_END) { - pFillAttrLB->RemoveEntry( nCount - 1 ); + mpFillAttrLB->RemoveEntry(nCount - 1); } } + aTmpStr = TMP_STR_BEGIN; aTmpStr += aString; aTmpStr += TMP_STR_END; - //pFillAttrLB->SetUpdateMode( sal_False ); - sal_uInt16 nPos = pFillAttrLB->InsertEntry( aColor, aTmpStr ); - //pFillAttrLB->SetUpdateMode( sal_True ); - pFillAttrLB->SelectEntryPos( nPos ); + sal_uInt16 nPos = mpFillAttrLB->InsertEntry(aColor,aTmpStr); + mpFillAttrLB->SelectEntryPos(nPos); } - // NEU } else - pFillAttrLB->SetNoSelection(); + { + mpFillAttrLB->SetNoSelection(); + } + break; } - break; case XFILL_GRADIENT: { - if ( pGradientItem ) + if(mpGradientItem) { - String aString( pGradientItem->GetName() ); - pFillAttrLB->SelectEntry( aString ); - // NEU + String aString(mpGradientItem->GetName()); + mpFillAttrLB->SelectEntry(aString); + // Pruefen, ob Eintrag nicht in der Liste ist - if( pFillAttrLB->GetSelectEntry() != aString ) + if(mpFillAttrLB->GetSelectEntry() != aString) { - sal_uInt16 nCount = pFillAttrLB->GetEntryCount(); + sal_uInt16 nCount = mpFillAttrLB->GetEntryCount(); String aTmpStr; - if( nCount > 0 ) + + if(nCount > 0) { //Letzter Eintrag wird auf temporaeren Eintrag geprueft - aTmpStr = pFillAttrLB->GetEntry( nCount - 1 ); - if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && - aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) + aTmpStr = mpFillAttrLB->GetEntry(nCount - 1); + + if(aTmpStr.GetChar(0) == TMP_STR_BEGIN && aTmpStr.GetChar(aTmpStr.Len() - 1) == TMP_STR_END) { - pFillAttrLB->RemoveEntry( nCount - 1 ); + mpFillAttrLB->RemoveEntry(nCount - 1); } } + aTmpStr = TMP_STR_BEGIN; aTmpStr += aString; aTmpStr += TMP_STR_END; - XGradientEntry* pEntry = new XGradientEntry( pGradientItem->GetGradientValue(), aTmpStr ); + XGradientEntry* pEntry = new XGradientEntry(mpGradientItem->GetGradientValue(),aTmpStr); XGradientListSharedPtr aGradientList(XPropertyListFactory::CreateSharedXGradientList(String::CreateFromAscii("TmpList"))); aGradientList->Insert(pEntry); aGradientList->SetDirty(false); - const Bitmap aBmp = aGradientList->GetUiBitmap( 0 ); + const Bitmap aBmp = aGradientList->GetUiBitmap(0); - if( !aBmp.IsEmpty() ) + if(!aBmp.IsEmpty()) { - ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), aBmp ); - pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); + ((ListBox*)mpFillAttrLB)->InsertEntry(pEntry->GetName(),aBmp); + mpFillAttrLB->SelectEntryPos(mpFillAttrLB->GetEntryCount() - 1); } } - // NEU } else - pFillAttrLB->SetNoSelection(); + { + mpFillAttrLB->SetNoSelection(); + } + break; } - break; case XFILL_HATCH: { - if ( pHatchItem ) + if(mpHatchItem) { - String aString( pHatchItem->GetName() ); - pFillAttrLB->SelectEntry( aString ); - // NEU + String aString(mpHatchItem->GetName()); + mpFillAttrLB->SelectEntry(aString); + // Pruefen, ob Eintrag nicht in der Liste ist - if( pFillAttrLB->GetSelectEntry() != aString ) + if(mpFillAttrLB->GetSelectEntry() != aString) { - sal_uInt16 nCount = pFillAttrLB->GetEntryCount(); + sal_uInt16 nCount = mpFillAttrLB->GetEntryCount(); String aTmpStr; - if( nCount > 0 ) + if(nCount > 0) { //Letzter Eintrag wird auf temporaeren Eintrag geprueft - aTmpStr = pFillAttrLB->GetEntry( nCount - 1 ); - if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && - aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) + aTmpStr = mpFillAttrLB->GetEntry(nCount - 1); + if(aTmpStr.GetChar(0) == TMP_STR_BEGIN && + aTmpStr.GetChar(aTmpStr.Len() - 1) == TMP_STR_END) { - pFillAttrLB->RemoveEntry( nCount - 1 ); + mpFillAttrLB->RemoveEntry(nCount - 1); } } + aTmpStr = TMP_STR_BEGIN; aTmpStr += aString; aTmpStr += TMP_STR_END; - XHatchEntry* pEntry = new XHatchEntry( pHatchItem->GetHatchValue(), aTmpStr ); + XHatchEntry* pEntry = new XHatchEntry(mpHatchItem->GetHatchValue(),aTmpStr); XHatchListSharedPtr aHatchList(XPropertyListFactory::CreateSharedXHatchList(String::CreateFromAscii("TmpList"))); - aHatchList->Insert( pEntry ); - aHatchList->SetDirty( sal_False ); - const Bitmap aBmp = aHatchList->GetUiBitmap( 0 ); + aHatchList->Insert(pEntry); + aHatchList->SetDirty(sal_False); + const Bitmap aBmp = aHatchList->GetUiBitmap(0); - if( !aBmp.IsEmpty() ) + if(!aBmp.IsEmpty()) { - ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), aBmp ); - pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); + ((ListBox*)mpFillAttrLB)->InsertEntry(pEntry->GetName(),aBmp); + mpFillAttrLB->SelectEntryPos(mpFillAttrLB->GetEntryCount() - 1); } } - // NEU } else - pFillAttrLB->SetNoSelection(); + { + mpFillAttrLB->SetNoSelection(); + } + break; } - break; case XFILL_BITMAP: { - if ( pBitmapItem ) - // && - // SfxObjectShell::Current() && - // SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) ) + if(mpBitmapItem) { - String aString( pBitmapItem->GetName() ); - // Bitmap aBitmap( pBitmapItem->GetValue() ); + String aString(mpBitmapItem->GetName()); + mpFillAttrLB->SelectEntry(aString); - // SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( - // SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) ) ); - pFillAttrLB->SelectEntry( aString ); - // NEU // Pruefen, ob Eintrag nicht in der Liste ist - if( pFillAttrLB->GetSelectEntry() != aString ) + if(mpFillAttrLB->GetSelectEntry() != aString) { - sal_uInt16 nCount = pFillAttrLB->GetEntryCount(); + sal_uInt16 nCount = mpFillAttrLB->GetEntryCount(); String aTmpStr; - if( nCount > 0 ) + + if(nCount > 0) { //Letzter Eintrag wird auf temporaeren Eintrag geprueft - aTmpStr = pFillAttrLB->GetEntry( nCount - 1 ); - if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && - aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) + aTmpStr = mpFillAttrLB->GetEntry(nCount - 1); + + if(aTmpStr.GetChar(0) == TMP_STR_BEGIN && aTmpStr.GetChar(aTmpStr.Len() - 1) == TMP_STR_END) { - pFillAttrLB->RemoveEntry( nCount - 1 ); + mpFillAttrLB->RemoveEntry(nCount - 1); } } + aTmpStr = TMP_STR_BEGIN; aTmpStr += aString; aTmpStr += TMP_STR_END; XBitmapListSharedPtr aNew(XPropertyListFactory::CreateSharedXBitmapList(String::CreateFromAscii("TmpList"))); - aNew->Insert(new XBitmapEntry(pBitmapItem->GetGraphicObject(), aTmpStr)); + aNew->Insert(new XBitmapEntry(mpBitmapItem->GetGraphicObject(),aTmpStr)); aNew->SetDirty(false); - pFillAttrLB->Fill( aNew ); - pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 ); + mpFillAttrLB->Fill(aNew); + mpFillAttrLB->SelectEntryPos(mpFillAttrLB->GetEntryCount() - 1); } - // NEU } else - pFillAttrLB->SetNoSelection(); + { + mpFillAttrLB->SetNoSelection(); + } + break; } - break; default: - DBG_ERROR( "Nicht unterstuetzter Flaechentyp" ); - break; + { + DBG_ERROR("Nicht unterstuetzter Flaechentyp"); + break; + } } + + // update mnLastFillAttrControlSelectEntryPos + mpFillControl->updateLastFillAttrControlSelectEntryPos(); } - if( pState && pStyleItem ) + if(pState && mpStyleItem) { - XFillStyle eXFS = (XFillStyle) pStyleItem->GetValue(); + XFillStyle eXFS = static_cast< XFillStyle >(mpStyleItem->GetValue()); // Die Listen haben sich geaendert ? - if( dynamic_cast< const SvxColorTableItem* >(pState) && eXFS == XFILL_SOLID ) - { - ::Color aTmpColor( pFillAttrLB->GetSelectEntryColor() ); - pFillAttrLB->Clear(); - pFillAttrLB->Fill( ( (SvxColorTableItem*)pState )->GetColorTable() ); - pFillAttrLB->SelectEntry( aTmpColor ); - } - if( dynamic_cast< const SvxGradientListItem* >(pState) && eXFS == XFILL_GRADIENT ) - { - String aString( pFillAttrLB->GetSelectEntry() ); - pFillAttrLB->Clear(); - pFillAttrLB->Fill( ( (SvxGradientListItem*)pState )->GetGradientList() ); - pFillAttrLB->SelectEntry( aString ); - } - if( dynamic_cast< const SvxHatchListItem* >(pState) && eXFS == XFILL_HATCH ) + switch(eXFS) { - String aString( pFillAttrLB->GetSelectEntry() ); - pFillAttrLB->Clear(); - pFillAttrLB->Fill( ( (SvxHatchListItem*)pState )->GetHatchList() ); - pFillAttrLB->SelectEntry( aString ); - } - if( dynamic_cast< const SvxBitmapListItem* >(pState) && eXFS == XFILL_BITMAP ) - { - String aString( pFillAttrLB->GetSelectEntry() ); - pFillAttrLB->Clear(); - pFillAttrLB->Fill( ( (SvxBitmapListItem*)pState )->GetBitmapList() ); - pFillAttrLB->SelectEntry( aString ); + case XFILL_SOLID: + { + const SvxColorTableItem* pItem = dynamic_cast< const SvxColorTableItem* >(pState); + + if(pItem) + { + ::Color aTmpColor(mpFillAttrLB->GetSelectEntryColor()); + mpFillAttrLB->Clear(); + mpFillAttrLB->Fill(pItem->GetColorTable()); + mpFillAttrLB->SelectEntry(aTmpColor); + } + break; + } + case XFILL_GRADIENT: + { + const SvxGradientListItem* pItem = dynamic_cast< const SvxGradientListItem* >(pState); + + if(pItem) + { + String aString(mpFillAttrLB->GetSelectEntry()); + mpFillAttrLB->Clear(); + mpFillAttrLB->Fill(pItem->GetGradientList()); + mpFillAttrLB->SelectEntry(aString); + } + break; + } + case XFILL_HATCH: + { + const SvxHatchListItem* pItem = dynamic_cast< const SvxHatchListItem* >(pState); + + if(pItem) + { + String aString(mpFillAttrLB->GetSelectEntry()); + mpFillAttrLB->Clear(); + mpFillAttrLB->Fill(pItem->GetHatchList()); + mpFillAttrLB->SelectEntry(aString); + } + break; + } + case XFILL_BITMAP: + { + const SvxBitmapListItem* pItem = dynamic_cast< const SvxBitmapListItem* >(pState); + + if(pItem) + { + String aString(mpFillAttrLB->GetSelectEntry()); + mpFillAttrLB->Clear(); + mpFillAttrLB->Fill(pItem->GetBitmapList()); + mpFillAttrLB->SelectEntry(aString); + } + break; + } + default: // XFILL_NONE + { + break; + } } } } //======================================================================== -Window* SvxFillToolBoxControl::CreateItemWindow( Window *pParent ) +Window* SvxFillToolBoxControl::CreateItemWindow(Window *pParent) { - if ( GetSlotId() == SID_ATTR_FILL_STYLE ) + if(GetSlotId() == SID_ATTR_FILL_STYLE) { - pFillControl = new FillControl( pParent ); + mpFillControl = new FillControl(pParent); // Damit dem FillControl das SvxFillToolBoxControl bekannt ist // (und um kompatibel zu bleiben) - pFillControl->SetData( this ); + mpFillControl->SetData(this); + + mpFillAttrLB = (SvxFillAttrBox*)mpFillControl->mpLbFillAttr; + mpFillTypeLB = (SvxFillTypeBox*)mpFillControl->mpLbFillType; - pFillAttrLB = (SvxFillAttrBox*)pFillControl->pLbFillAttr; - pFillTypeLB = (SvxFillTypeBox*)pFillControl->pLbFillType; + mpFillAttrLB->SetUniqueId(HID_FILL_ATTR_LISTBOX); + mpFillTypeLB->SetUniqueId(HID_FILL_TYPE_LISTBOX); - pFillAttrLB->SetUniqueId( HID_FILL_ATTR_LISTBOX ); - pFillTypeLB->SetUniqueId( HID_FILL_TYPE_LISTBOX ); + if(!mpStyleItem) + { + // for Writer and Calc it's not the same instance of + // SvxFillToolBoxControl which gets used after deselecting + // and selecting a DrawObject, thhus a useful initialization is + // needed to get the FillType and the FillStyle List inited + // correctly. This in combination with meLastXFS inited to + // XFILL_NONE do the trick + mpStyleItem = new XFillStyleItem(XFILL_SOLID); + } - return pFillControl; + return mpFillControl; } return NULL; } @@ -500,283 +557,337 @@ Window* SvxFillToolBoxControl::CreateItemWindow( Window *pParent ) |* \************************************************************************/ -FillControl::FillControl( Window* pParent, WinBits nStyle ) : - Window( pParent, nStyle | WB_DIALOGCONTROL ), - pLbFillType(new SvxFillTypeBox( this )), - aLogicalFillSize(40,80), - aLogicalAttrSize(50,80) +FillControl::FillControl(Window* pParent,WinBits nStyle) +: Window(pParent,nStyle | WB_DIALOGCONTROL), + mpLbFillType(new SvxFillTypeBox(this)), + mpLbFillAttr(new SvxFillAttrBox(this)), + maLogicalFillSize(40,80), + maLogicalAttrSize(50,80), + mnLastFillTypeControlSelectEntryPos(mpLbFillType->GetSelectEntryPos()), + mnLastFillAttrControlSelectEntryPos(mpLbFillAttr->GetSelectEntryPos()), + mbFillTypeChanged(false) { - pLbFillAttr = new SvxFillAttrBox( this ); - Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT)); - Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT)); - pLbFillType->SetSizePixel(aTypeSize); - pLbFillAttr->SetSizePixel(aAttrSize); + Size aTypeSize(LogicToPixel(maLogicalFillSize,MAP_APPFONT)); + Size aAttrSize(LogicToPixel(maLogicalAttrSize,MAP_APPFONT)); + mpLbFillType->SetSizePixel(aTypeSize); + mpLbFillAttr->SetSizePixel(aAttrSize); + //to get the base height - aTypeSize = pLbFillType->GetSizePixel(); - aAttrSize = pLbFillAttr->GetSizePixel(); - Point aAttrPnt = pLbFillAttr->GetPosPixel(); + aTypeSize = mpLbFillType->GetSizePixel(); + aAttrSize = mpLbFillAttr->GetSizePixel(); + Point aAttrPnt = mpLbFillAttr->GetPosPixel(); SetSizePixel( - Size( aAttrPnt.X() + aAttrSize.Width(), - Max( aAttrSize.Height(), aTypeSize.Height() ) ) ); + Size(aAttrPnt.X() + aAttrSize.Width(), + Max(aAttrSize.Height(),aTypeSize.Height()))); - pLbFillType->SetSelectHdl( LINK( this, FillControl, SelectFillTypeHdl ) ); - pLbFillAttr->SetSelectHdl( LINK( this, FillControl, SelectFillAttrHdl ) ); - - aDelayTimer.SetTimeout( DELAY_TIMEOUT ); - aDelayTimer.SetTimeoutHdl( LINK( this, FillControl, DelayHdl ) ); - aDelayTimer.Start(); + mpLbFillType->SetSelectHdl(LINK(this,FillControl,SelectFillTypeHdl)); + mpLbFillAttr->SetSelectHdl(LINK(this,FillControl,SelectFillAttrHdl)); } //------------------------------------------------------------------------ FillControl::~FillControl() { - delete pLbFillType; - delete pLbFillAttr; -} - -//------------------------------------------------------------------------ - -IMPL_LINK_INLINE_START( FillControl, DelayHdl, Timer *, EMPTYARG ) -{ - SelectFillTypeHdl( NULL ); - ( (SvxFillToolBoxControl*)GetData() )->updateStatus( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" ))); -// ( (SvxFillToolBoxControl*)GetData() )->GetBindings().Invalidate( SID_ATTR_FILL_STYLE ); - return 0; + delete mpLbFillType; + delete mpLbFillAttr; } -IMPL_LINK_INLINE_END( FillControl, DelayHdl, Timer *, pTimer ) //------------------------------------------------------------------------ -IMPL_LINK( FillControl, SelectFillTypeHdl, ListBox *, pBox ) +void FillControl::InitializeFillStyleAccordingToGivenFillType(XFillStyle aFillStyle) { - XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos(); - - // Spaeter sollte eine Optimierung derart erfolgen, dass die - // Listen, bzw. Tables nur dann geloescht und wieder aufgebaut - // werden, wenn sich die Listen, bzw. Tables tatsaechlich geaendert - // haben (in den LBs natuerlich). + SfxObjectShell* pSh = SfxObjectShell::Current(); + bool bDone(false); - if ( ( pBox && !pBox->IsTravelSelect() ) || !pBox ) + if(pSh) { - // Damit wir in folgendem Fall einen Status anzeigen koennen: - // Ein Typ wurde ausgewaehlt aber kein Attribut. - // Die Selektion hat genau die gleichen Attribute wie die vorherige. -// SvxFillToolBoxControl* pControlerItem = (SvxFillToolBoxControl*)GetData(); -// if( pControlerItem ) -// pControlerItem->ClearCache(); - - pLbFillAttr->Clear(); - SfxObjectShell* pSh = SfxObjectShell::Current(); + // clear in all cases, else we would risk a mix of FillStyles in the Style list + mpLbFillAttr->Clear(); - switch( eXFS ) + switch(aFillStyle) { - case XFILL_NONE: - { - pLbFillType->Selected(); - SelectFillAttrHdl( pBox ); - pLbFillAttr->Disable(); - } - break; - case XFILL_SOLID: { - if ( pSh && pSh->GetItem( SID_COLOR_TABLE ) ) + if(pSh->GetItem(SID_COLOR_TABLE)) { - SvxColorTableItem aItem( *(const SvxColorTableItem*)( - pSh->GetItem( SID_COLOR_TABLE ) ) ); - pLbFillAttr->Enable(); - pLbFillAttr->Fill( aItem.GetColorTable() ); + const SvxColorTableItem* pItem = static_cast< const SvxColorTableItem* >(pSh->GetItem(SID_COLOR_TABLE)); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill(pItem->GetColorTable()); + bDone = true; } - else - pLbFillAttr->Disable(); + break; } - break; case XFILL_GRADIENT: { - if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) + if(pSh->GetItem(SID_GRADIENT_LIST)) { - SvxGradientListItem aItem( *(const SvxGradientListItem*)( - pSh->GetItem( SID_GRADIENT_LIST ) ) ); - pLbFillAttr->Enable(); - pLbFillAttr->Fill( aItem.GetGradientList() ); + const SvxGradientListItem* pItem = static_cast< const SvxGradientListItem* >(pSh->GetItem(SID_GRADIENT_LIST)); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill(pItem->GetGradientList()); + bDone = true; } - else - pLbFillAttr->Disable(); + break; } - break; case XFILL_HATCH: { - if ( pSh && pSh->GetItem( SID_HATCH_LIST ) ) + if(pSh->GetItem(SID_HATCH_LIST)) { - SvxHatchListItem aItem( *(const SvxHatchListItem*)( - pSh->GetItem( SID_HATCH_LIST ) ) ); - pLbFillAttr->Enable(); - pLbFillAttr->Fill( aItem.GetHatchList() ); + const SvxHatchListItem* pItem = static_cast< const SvxHatchListItem* >(pSh->GetItem(SID_HATCH_LIST)); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill(pItem->GetHatchList()); + bDone = true; } - else - pLbFillAttr->Disable(); + break; } - break; case XFILL_BITMAP: { - if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) ) + if(pSh->GetItem(SID_BITMAP_LIST)) { - SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( - pSh->GetItem( SID_BITMAP_LIST ) ) ); - pLbFillAttr->Enable(); - pLbFillAttr->Fill( aItem.GetBitmapList() ); + const SvxBitmapListItem* pItem = static_cast< const SvxBitmapListItem* >(pSh->GetItem(SID_BITMAP_LIST)); + mpLbFillAttr->Enable(); + mpLbFillAttr->Fill(pItem->GetBitmapList()); + bDone = true; } - else - pLbFillAttr->Disable(); + break; + } + default: // XFILL_NONE + { + // accept disable (no styles for XFILL_NONE) + break; } - break; } + } - if( eXFS != XFILL_NONE ) // Wurde schon erledigt - { - if ( pBox ) - pLbFillType->Selected(); + if(!bDone) + { + mpLbFillAttr->Disable(); + } +} - // release focus - if ( pBox && pLbFillType->IsRelease() ) - { - SfxViewShell* pViewShell = SfxViewShell::Current(); - if( pViewShell && pViewShell->GetWindow() ) - pViewShell->GetWindow()->GrabFocus(); - } +void FillControl::updateLastFillTypeControlSelectEntryPos() +{ + mnLastFillTypeControlSelectEntryPos = mpLbFillType->GetSelectEntryPos(); +} + +IMPL_LINK(FillControl,SelectFillTypeHdl,ListBox *,pBox) +{ + if(!pBox) // only work with real calls from ListBox, do not accept direct calls with zeros here + { + return 0; + } + + const bool bAction( + !mpLbFillType->IsTravelSelect() // keep TravelSelect, this means keyboard up/down in the list + && mpLbFillType->GetSelectEntryCount() + && mpLbFillType->GetSelectEntryPos() != mnLastFillTypeControlSelectEntryPos); + + updateLastFillTypeControlSelectEntryPos(); + XFillStyle eXFS = static_cast< XFillStyle >(mpLbFillType->GetSelectEntryPos()); + + if(bAction && XFILL_NONE != eXFS) + { + mbFillTypeChanged = true; + } + + // update list of FillStyles in any case + InitializeFillStyleAccordingToGivenFillType(eXFS); + + // for XFILL_NONE do no longer call SelectFillAttrHdl (as done before), + // trigger needed actions directly. This is the only action this handler + // can trigger directly as the user action is finished in this case + if(XFILL_NONE == eXFS && bAction) + { + // for XFILL_NONE do no longer call SelectFillAttrHdl, + // trigger needed actions directly + Any a; + Sequence< PropertyValue > aArgsFillStyle(1); + XFillStyleItem aXFillStyleItem(eXFS); + + aArgsFillStyle[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")); + aXFillStyleItem.QueryValue(a); + aArgsFillStyle[0].Value = a; + ((SvxFillToolBoxControl*)GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillStyle")), aArgsFillStyle); + } + + mpLbFillType->Selected(); + + // release focus. Needed to get focus automatically back to EditView + if(mpLbFillType->IsRelease()) + { + SfxViewShell* pViewShell = SfxViewShell::Current(); + + if(pViewShell && pViewShell->GetWindow()) + { + pViewShell->GetWindow()->GrabFocus(); } } + return 0; } //------------------------------------------------------------------------ -IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox ) +void FillControl::updateLastFillAttrControlSelectEntryPos() +{ + mnLastFillAttrControlSelectEntryPos = mpLbFillAttr->GetSelectEntryPos(); +} + +IMPL_LINK(FillControl, SelectFillAttrHdl, ListBox *, pBox) { - XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos(); - XFillStyleItem aXFillStyleItem( eXFS ); - sal_Bool bAction = pBox && !pLbFillAttr->IsTravelSelect(); + if(!pBox) // only work with real calls from ListBox, do not accept direct calls with zeros here + { + return 0; + } - SfxObjectShell* pSh = SfxObjectShell::Current(); - if ( bAction ) + const bool bAction( + !mpLbFillAttr->IsTravelSelect() // keep TravelSelect, this means keyboard up/down in the list + && mpLbFillAttr->GetSelectEntryCount() + && mpLbFillAttr->GetSelectEntryPos() != mnLastFillAttrControlSelectEntryPos); + + updateLastFillAttrControlSelectEntryPos(); + + if(bAction) { - Any a; - Sequence< PropertyValue > aArgs( 1 ); + SfxObjectShell* pSh = SfxObjectShell::Current(); - // First set the style - aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" )); - aXFillStyleItem.QueryValue( a ); - aArgs[0].Value = a; - ((SvxFillToolBoxControl*)GetData())->Dispatch( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" )), aArgs ); + // Need to prepare the PropertyValue for the FillStyle dispatch action early, + // else the call for FillType to Dispatch(".uno:FillStyle") will already destroy the current state + // of selection in mpLbFillAttr again by calls to StateChanged which *will* set to no + // selection again (e.g. when two objects, same fill style, but different fill attributes) + Any a; + Sequence< PropertyValue > aArgsFillAttr(1); + ::rtl::OUString aFillAttrCommand; + XFillStyle eXFS(static_cast< XFillStyle >(mpLbFillType->GetSelectEntryPos())); - switch( eXFS ) + switch(eXFS) { case XFILL_NONE: { + // handled in SelectFillTypeHdl, nothing to do here + break; } - break; case XFILL_SOLID: { - // NEU //Eintrag wird auf temporaere Farbe geprueft - String aTmpStr = pLbFillAttr->GetSelectEntry(); - if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END ) + String aTmpStr = mpLbFillAttr->GetSelectEntry(); + + if(aTmpStr.GetChar(0) == TMP_STR_BEGIN && aTmpStr.GetChar(aTmpStr.Len() - 1) == TMP_STR_END) { - aTmpStr.Erase( aTmpStr.Len()-1, 1 ); - aTmpStr.Erase( 0, 1 ); + aTmpStr.Erase(aTmpStr.Len() - 1,1); + aTmpStr.Erase(0,1); } - XFillColorItem aXFillColorItem( aTmpStr, pLbFillAttr->GetSelectEntryColor() ); - - aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillColor" )); - aXFillColorItem.QueryValue( a ); - aArgs[0].Value = a; - ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillColor" )), - aArgs ); + XFillColorItem aXFillColorItem(aTmpStr,mpLbFillAttr->GetSelectEntryColor()); + aArgsFillAttr[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")); + aXFillColorItem.QueryValue(a); + aArgsFillAttr[0].Value = a; + aFillAttrCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillColor")); + break; } - break; case XFILL_GRADIENT: { - sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos(); + sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) + if(nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem(SID_GRADIENT_LIST)) { - SvxGradientListItem aItem( - *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) ); + const SvxGradientListItem* pItem = static_cast< const SvxGradientListItem* >(pSh->GetItem(SID_GRADIENT_LIST)); - if ( nPos < aItem.GetGradientList()->Count() ) // kein temp. Eintrag ? + if(nPos < pItem->GetGradientList()->Count()) // kein temp. Eintrag ? { - XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient(); - XFillGradientItem aXFillGradientItem( pLbFillAttr->GetSelectEntry(), aGradient ); - - aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" )); - aXFillGradientItem.QueryValue( a ); - aArgs[0].Value = a; - ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillGradient" )), - aArgs ); + XGradient aGradient = pItem->GetGradientList()->GetGradient(nPos)->GetGradient(); + XFillGradientItem aXFillGradientItem(mpLbFillAttr->GetSelectEntry(),aGradient); + aArgsFillAttr[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillGradient")); + aXFillGradientItem.QueryValue(a); + aArgsFillAttr[0].Value = a; + aFillAttrCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillGradient")); } } + break; } - break; case XFILL_HATCH: { - sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos(); + sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) ) + if(nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem(SID_HATCH_LIST)) { - SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) ); + const SvxHatchListItem* pItem = static_cast< const SvxHatchListItem* >(pSh->GetItem(SID_HATCH_LIST)); - if ( nPos < aItem.GetHatchList()->Count() ) // kein temp. Eintrag ? + if(nPos < pItem->GetHatchList()->Count()) // kein temp. Eintrag ? { - XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch(); - XFillHatchItem aXFillHatchItem( pLbFillAttr->GetSelectEntry(), aHatch ); - - aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" )); - aXFillHatchItem.QueryValue( a ); - aArgs[0].Value = a; - ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillHatch" )), - aArgs ); + XHatch aHatch = pItem->GetHatchList()->GetHatch(nPos)->GetHatch(); + XFillHatchItem aXFillHatchItem(mpLbFillAttr->GetSelectEntry(),aHatch); + + aArgsFillAttr[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillHatch")); + aXFillHatchItem.QueryValue(a); + aArgsFillAttr[0].Value = a; + aFillAttrCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillHatch")); } } + break; } - break; case XFILL_BITMAP: { - sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos(); + sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) ) + if(nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem(SID_BITMAP_LIST)) { - SvxBitmapListItem aItem( - *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) ); + const SvxBitmapListItem* pItem = static_cast< const SvxBitmapListItem* >(pSh->GetItem(SID_BITMAP_LIST)); - if ( nPos < aItem.GetBitmapList()->Count() ) // kein temp. Eintrag ? + if(nPos < pItem->GetBitmapList()->Count()) // kein temp. Eintrag ? { - const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos); - const XFillBitmapItem aXFillBitmapItem(pLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject()); + const XBitmapEntry* pXBitmapEntry = pItem->GetBitmapList()->GetBitmap(nPos); + const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->GetSelectEntry(),pXBitmapEntry->GetGraphicObject()); - aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillBitmap" )); - aXFillBitmapItem.QueryValue( a ); - aArgs[0].Value = a; - ((SvxFillToolBoxControl*)GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillBitmap")), aArgs); + aArgsFillAttr[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillBitmap")); + aXFillBitmapItem.QueryValue(a); + aArgsFillAttr[0].Value = a; + aFillAttrCommand = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillBitmap")); } } + break; } - break; } - // release focus - if ( pLbFillAttr->IsRelease() && pBox ) + // this is the place where evtl. a new slot action may be introduced to avoid the + // two undo entries. Reason for this is that indeed two actions are executed, the fill style + // and the fill attribute change. The sidebar already handles both separately, so + // changing the fill style already changes the object and adds a default fill attribute for + // the newly choosen fill style. + // This control uses the older user's two-step action to select a fill style and a fill attribute. In + // this case a lot of things may go wrong (e.g. the user stops that action and does something + // different), thus the solution of the sidebar should be preferred from my POV in the future + + // first set the fill style if changed + if(mbFillTypeChanged) + { + Sequence< PropertyValue > aArgsFillStyle(1); + XFillStyleItem aXFillStyleItem(eXFS); + + aArgsFillStyle[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")); + aXFillStyleItem.QueryValue(a); + aArgsFillStyle[0].Value = a; + ((SvxFillToolBoxControl*)GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillStyle")), aArgsFillStyle); + mbFillTypeChanged = false; + } + + // second set fill attribute when a change was detected and prepared + if(aFillAttrCommand.getLength()) + { + ((SvxFillToolBoxControl*)GetData())->Dispatch(aFillAttrCommand, aArgsFillAttr); + } + + // release focus. Needed to get focus automatically back to EditView + if(mpLbFillAttr->IsRelease() && pBox) { SfxViewShell* pViewShell = SfxViewShell::Current(); - if( pViewShell && pViewShell->GetWindow() ) + + if(pViewShell && pViewShell->GetWindow()) { pViewShell->GetWindow()->GrabFocus(); } @@ -795,31 +906,33 @@ void FillControl::Resize() long nH = 180; long nSep = 0; // war vorher 4 - pLbFillType->SetSizePixel( Size( nW * 2 - nSep, nH ) ); - pLbFillAttr->SetPosSizePixel( Point( nW * 2 + nSep, 0 ), Size( nW * 3 - nSep, nH ) ); + mpLbFillType->SetSizePixel(Size(nW * 2 - nSep,nH)); + mpLbFillAttr->SetPosSizePixel(Point(nW * 2 + nSep,0),Size(nW * 3 - nSep,nH)); } -/* -----------------------------08.03.2002 15:04------------------------------ - ---------------------------------------------------------------------------*/ +//------------------------------------------------------------------------ -void FillControl::DataChanged( const DataChangedEvent& rDCEvt ) +void FillControl::DataChanged(const DataChangedEvent& rDCEvt) { - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + if((rDCEvt.GetType() == DATACHANGED_SETTINGS) && + (rDCEvt.GetFlags() & SETTINGS_STYLE)) { - Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT)); - Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT)); - pLbFillType->SetSizePixel(aTypeSize); - pLbFillAttr->SetSizePixel(aAttrSize); + Size aTypeSize(LogicToPixel(maLogicalFillSize,MAP_APPFONT)); + Size aAttrSize(LogicToPixel(maLogicalAttrSize,MAP_APPFONT)); + mpLbFillType->SetSizePixel(aTypeSize); + mpLbFillAttr->SetSizePixel(aAttrSize); + //to get the base height - aTypeSize = pLbFillType->GetSizePixel(); - aAttrSize = pLbFillAttr->GetSizePixel(); - Point aAttrPnt = pLbFillAttr->GetPosPixel(); + aTypeSize = mpLbFillType->GetSizePixel(); + aAttrSize = mpLbFillAttr->GetSizePixel(); + Point aAttrPnt = mpLbFillAttr->GetPosPixel(); SetSizePixel( - Size( aAttrPnt.X() + aAttrSize.Width(), - Max( aAttrSize.Height(), aTypeSize.Height() ) ) ); + Size(aAttrPnt.X() + aAttrSize.Width(), + Max(aAttrSize.Height(),aTypeSize.Height()))); } - Window::DataChanged( rDCEvt ); + Window::DataChanged(rDCEvt); } +//------------------------------------------------------------------------ +//eof diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index d909b4387485..21257d9956b2 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -109,7 +109,19 @@ namespace svx else pBmpAcc->SetLineColor( Color( COL_BLACK ) ); - pBmpAcc->SetFillColor( maCurColor = aColor ); + // use not only COL_TRANSPARENT for detection of transparence, + // but the method/way which is designed to do that + const bool bIsTransparent(0xff == aColor.GetTransparency()); + maCurColor = aColor; + + if(bIsTransparent) + { + pBmpAcc->SetFillColor(); + } + else + { + pBmpAcc->SetFillColor(maCurColor); + } if( TBX_UPDATER_MODE_CHAR_COLOR_NEW == mnDrawMode || TBX_UPDATER_MODE_NONE == mnDrawMode ) { @@ -146,7 +158,7 @@ namespace svx if( pMskAcc ) { - if( COL_TRANSPARENT == aColor.GetColor() ) + if( bIsTransparent ) { pMskAcc->SetLineColor( COL_BLACK ); pMskAcc->SetFillColor( COL_WHITE ); diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx index 20a12ae41efd..a5982bfbfc50 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.cxx @@ -85,7 +85,7 @@ ChineseTranslationDialog::ChineseTranslationDialog( Window* pParent ) if( aAny >>= bValue ) m_aCB_Use_Variants.Check( bValue ); - // #117820# (search for other occurences!) + // #117820# (search for other occurrences!) // disable and hide that checkbox until it is decided if it is needed or not. // If it is to be removed later the respective code needs to be removed as // well, otherwise we just have to remove the next lines again. @@ -127,7 +127,7 @@ void ChineseTranslationDialog::getSettings( sal_Bool& rbDirectionToSimplified void ChineseTranslationDialog::impl_UpdateVariantsCheckBox() { -// #117820# (search for other occurences!) +// #117820# (search for other occurrences!) // m_aCB_Use_Variants.Enable( m_aRB_To_Traditional.IsChecked() ); } @@ -139,7 +139,7 @@ IMPL_LINK( ChineseTranslationDialog, DirectionHdl, void*, EMPTYARG ) IMPL_LINK( ChineseTranslationDialog, CommonTermsHdl, void*, EMPTYARG ) { -// #117820# (search for other occurences!) +// #117820# (search for other occurrences!) // if( m_aCB_Translate_Commonterms.IsChecked() && m_aRB_To_Traditional.IsChecked() ) // m_aCB_Use_Variants.Check( true ); return 0; diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx new file mode 100644 index 000000000000..ff83649a4078 --- /dev/null +++ b/svx/source/unodraw/unobrushitemhelper.cxx @@ -0,0 +1,342 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include <svx/unobrushitemhelper.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xbtmpit.hxx> +#include <svx/xgrscit.hxx> +#include <svx/xflbmtit.hxx> +#include <svx/xflbmpit.hxx> +#include <svx/xflbmsxy.hxx> +#include <svx/xflbmsxy.hxx> +#include <svx/xflftrit.hxx> +#include <svx/xsflclit.hxx> +#include <svx/xflbmsli.hxx> +#include <svx/xflbtoxy.hxx> +#include <svx/xflbstit.hxx> +#include <svx/xflboxy.hxx> +#include <svx/xflbckit.hxx> +#include <svx/xflclit.hxx> +#include <svx/xfltrit.hxx> +#include <svx/xflhtit.hxx> +#include <svx/unoshape.hxx> + +//UUUU +void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxItemSet& rToSet) +{ + // Clear all items from the DrawingLayer FillStyle range (if we have any). All + // items that need to be set will be set as hard attributes + for(sal_uInt16 a(XATTR_FILL_FIRST); rToSet.Count() && a < XATTR_FILL_LAST; a++) + { + rToSet.ClearItem(a); + } + + const sal_uInt8 nTransparency(rBrush.GetColor().GetTransparency()); + + if(0xff != nTransparency) + { + // we have a color fill + const Color aColor(rBrush.GetColor().GetRGBColor()); + + rToSet.Put(XFillStyleItem(XFILL_SOLID)); + rToSet.Put(XFillColorItem(String(), aColor)); + + // #125189# nTransparency is in range [0..254], convert to [0..100] which is used in + // XFillTransparenceItem (caution with the range which is in an *item-specific* range) + rToSet.Put(XFillTransparenceItem((((sal_Int32)nTransparency * 100) + 127) / 254)); + } + else if(GPOS_NONE != rBrush.GetGraphicPos()) + { + // we have a graphic fill, set fill style + rToSet.Put(XFillStyleItem(XFILL_BITMAP)); + + // set graphic (if available) + const Graphic* pGraphic = rBrush.GetGraphic(); + + if(pGraphic) + { + rToSet.Put(XFillBitmapItem(String(), *pGraphic)); + } + else + { + OSL_ENSURE(false, "Could not get Graphic from SvxBrushItem (!)"); + } + + if(GPOS_AREA == rBrush.GetGraphicPos()) + { + // stretch, also means no tile (both items are defaulted to true) + rToSet.Put(XFillBmpStretchItem(true)); + rToSet.Put(XFillBmpTileItem(false)); + + // default for strech is also top-left, but this will not be visible + rToSet.Put(XFillBmpPosItem(RP_LT)); + } + else if(GPOS_TILED == rBrush.GetGraphicPos()) + { + // tiled, also means no stretch (both items are defaulted to true) + rToSet.Put(XFillBmpStretchItem(false)); + rToSet.Put(XFillBmpTileItem(true)); + + // default for tiled is top-left + rToSet.Put(XFillBmpPosItem(RP_LT)); + } + else + { + // everything else means no tile and no stretch + rToSet.Put(XFillBmpStretchItem(false)); + rToSet.Put(XFillBmpTileItem(false)); + + RECT_POINT aRectPoint(RP_MM); + + switch(rBrush.GetGraphicPos()) + { + case GPOS_LT: aRectPoint = RP_LT; break; + case GPOS_MT: aRectPoint = RP_MT; break; + case GPOS_RT: aRectPoint = RP_RT; break; + case GPOS_LM: aRectPoint = RP_LM; break; + case GPOS_MM: aRectPoint = RP_MM; break; + case GPOS_RM: aRectPoint = RP_RM; break; + case GPOS_LB: aRectPoint = RP_LB; break; + case GPOS_MB: aRectPoint = RP_MB; break; + case GPOS_RB: aRectPoint = RP_RB; break; + default: break; // GPOS_NONE, GPOS_AREA and GPOS_TILED already handled + } + + rToSet.Put(XFillBmpPosItem(aRectPoint)); + } + + // check for graphic's transparency + const sal_Int8 nGraphicTransparency(rBrush.getGraphicTransparency()); + + if(0 != nGraphicTransparency) + { + // nGraphicTransparency is in range [0..100] + rToSet.Put(XFillTransparenceItem(nGraphicTransparency)); + } + } + else + { + // GPOS_NONE == rBrush.GetGraphicPos() && 0xff == rBrush.GetColor().GetTransparency(), + // still need to rescue the color used. There are sequences used on the UNO API at + // import time (OLE. e.g. chart) which first set RGB color (MID_BACK_COLOR_R_G_B, + // color stays transparent) and then set transparency (MID_BACK_COLOR_TRANSPARENCY) + // to zero later. When not saving the color, it will be lost. + // Also need to set the FillStyle to NONE to express the 0xff transparency flag; this + // is needed when e.g. first transparency is set to 0xff and then a Graphic gets set. + // When not changing the FillStyle, the next getSvxBrushItemFromSourceSet *will* return + // to XFILL_SOLID with the rescued color. + const Color aColor(rBrush.GetColor().GetRGBColor()); + + rToSet.Put(XFillStyleItem(XFILL_NONE)); + rToSet.Put(XFillColorItem(String(), aColor)); + } +} + +//UUUU +sal_uInt16 getTransparenceForSvxBrushItem(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents) +{ + sal_uInt16 nFillTransparence(static_cast< const XFillTransparenceItem& >(rSourceSet.Get(XATTR_FILLTRANSPARENCE, bSearchInParents)).GetValue()); + const SfxPoolItem* pGradientItem = 0; + + if(SFX_ITEM_SET == rSourceSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, bSearchInParents, &pGradientItem) + && static_cast< const XFillFloatTransparenceItem* >(pGradientItem)->IsEnabled()) + { + const XGradient& rGradient = static_cast< const XFillFloatTransparenceItem* >(pGradientItem)->GetGradientValue(); + const sal_uInt16 nStartLuminance(rGradient.GetStartColor().GetLuminance()); + const sal_uInt16 nEndLuminance(rGradient.GetEndColor().GetLuminance()); + + // luminance is [0..255], transparence needs to be in [0..100].Maximum is 51200, thus sal_uInt16 is okay to use + nFillTransparence = static_cast< sal_uInt16 >(((nStartLuminance + nEndLuminance) * 100) / 512); + } + + return nFillTransparence; +} + +//UUUU +SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, sal_Bool bSearchInParents, sal_uInt16 nBackgroundID) +{ + Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue()); + + // get evtl. mixed transparence + const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); + + if(0 != nFillTransparence) + { + // #i125189# nFillTransparence is in range [0..100] and needs to be in [0..254] unsigned + // It is necessary to use the maximum of 0xfe for transparence for the SvxBrushItem + // since the oxff value is used for special purposes (like no fill and derive from parent) + const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100))); + + aFillColor.SetTransparency(aTargetTrans); + } + + return SvxBrushItem(aFillColor, nBackgroundID); +} + +//UUUU +SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, sal_Bool bSearchInParents) +{ + const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem* >(rSourceSet.GetItem(XATTR_FILLSTYLE, bSearchInParents))); + + if(!pXFillStyleItem || XFILL_NONE == pXFillStyleItem->GetValue()) + { + // no fill, still need to rescue the evtl. set RGB color, but use as transparent color (we have XFILL_NONE) + Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue()); + aFillColor.SetTransparency(0xff); + + return SvxBrushItem(aFillColor, nBackgroundID); + } + + SvxBrushItem aRetval(nBackgroundID); + + switch(pXFillStyleItem->GetValue()) + { + case XFILL_NONE: + { + // already handled above, can not happen again + break; + } + case XFILL_SOLID: + { + // create SvxBrushItem with fill color + aRetval = getSvxBrushItemForSolid(rSourceSet, bSearchInParents, nBackgroundID); + break; + } + case XFILL_GRADIENT: + { + // cannot be directly supported, but do the best possible + const XGradient aXGradient(static_cast< const XFillGradientItem& >(rSourceSet.Get(XATTR_FILLGRADIENT)).GetGradientValue()); + const basegfx::BColor aStartColor(aXGradient.GetStartColor().getBColor() * (aXGradient.GetStartIntens() * 0.01)); + const basegfx::BColor aEndColor(aXGradient.GetEndColor().getBColor() * (aXGradient.GetEndIntens() * 0.01)); + + // use half/half mixed color from gradient start and end + Color aMixedColor((aStartColor + aEndColor) * 0.5); + + // get evtl. mixed transparence + const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); + + if(0 != nFillTransparence) + { + // #i125189# nFillTransparence is in range [0..100] and needs to be in [0..254] unsigned + // It is necessary to use the maximum of 0xfe for transparence for the SvxBrushItem + // since the oxff value is used for special purposes (like no fill and derive from parent) + const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100))); + + aMixedColor.SetTransparency(aTargetTrans); + } + + aRetval = SvxBrushItem(aMixedColor, nBackgroundID); + break; + } + case XFILL_HATCH: + { + // cannot be directly supported, but do the best possible + const XHatch& rHatch(static_cast< const XFillHatchItem& >(rSourceSet.Get(XATTR_FILLHATCH)).GetHatchValue()); + const bool bFillBackground(static_cast< const XFillBackgroundItem& >(rSourceSet.Get(XATTR_FILLBACKGROUND)).GetValue()); + + if(bFillBackground) + { + // hatch is background-filled, use FillColor as if XFILL_SOLID + aRetval = getSvxBrushItemForSolid(rSourceSet, bSearchInParents, nBackgroundID); + } + else + { + // hatch is not background-filled and using hatch color would be too dark; compensate + // somewhat by making it more transparent + Color aHatchColor(rHatch.GetColor()); + + // get evtl. mixed transparence + sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); + + // take half orig transparence, add half transparent, clamp result + nFillTransparence = basegfx::clamp((sal_uInt16)((nFillTransparence / 2) + 50), (sal_uInt16)0, (sal_uInt16)255); + + // #i125189# nFillTransparence is in range [0..100] and needs to be in [0..254] unsigned + // It is necessary to use the maximum of 0xfe for transparence for the SvxBrushItem + // since the oxff value is used for special purposes (like no fill and derive from parent) + const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100))); + + aHatchColor.SetTransparency(aTargetTrans); + aRetval = SvxBrushItem(aHatchColor, nBackgroundID); + } + + break; + } + case XFILL_BITMAP: + { + // create SvxBrushItem with bitmap info and flags + const XFillBitmapItem& rBmpItm = static_cast< const XFillBitmapItem& >(rSourceSet.Get(XATTR_FILLBITMAP, bSearchInParents)); + const Graphic aGraphic(rBmpItm.GetGraphicObject().GetGraphic()); + + // continue idependent of evtl. GRAPHIC_NONE as aGraphic.GetType(), we still need to rescue positions + SvxGraphicPosition aSvxGraphicPosition(GPOS_NONE); + const XFillBmpStretchItem& rStretchItem = static_cast< const XFillBmpStretchItem& >(rSourceSet.Get(XATTR_FILLBMP_STRETCH, bSearchInParents)); + const XFillBmpTileItem& rTileItem = static_cast< const XFillBmpTileItem& >(rSourceSet.Get(XATTR_FILLBMP_TILE, bSearchInParents)); + + if(rTileItem.GetValue()) + { + aSvxGraphicPosition = GPOS_TILED; + } + else if(rStretchItem.GetValue()) + { + aSvxGraphicPosition = GPOS_AREA; + } + else + { + const XFillBmpPosItem& rPosItem = static_cast< const XFillBmpPosItem& >(rSourceSet.Get(XATTR_FILLBMP_POS, bSearchInParents)); + + switch(rPosItem.GetValue()) + { + case RP_LT: aSvxGraphicPosition = GPOS_LT; break; + case RP_MT: aSvxGraphicPosition = GPOS_MT; break; + case RP_RT: aSvxGraphicPosition = GPOS_RT; break; + case RP_LM: aSvxGraphicPosition = GPOS_LM; break; + case RP_MM: aSvxGraphicPosition = GPOS_MM; break; + case RP_RM: aSvxGraphicPosition = GPOS_RM; break; + case RP_LB: aSvxGraphicPosition = GPOS_LB; break; + case RP_MB: aSvxGraphicPosition = GPOS_MB; break; + case RP_RB: aSvxGraphicPosition = GPOS_RB; break; + } + } + + // create with given graphic and position + aRetval = SvxBrushItem(aGraphic, aSvxGraphicPosition, nBackgroundID); + + // get evtl. mixed transparence + const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); + + if(0 != nFillTransparence) + { + // #i125189# nFillTransparence is in range [0..100] and needs to be in [0..100] signed + aRetval.setGraphicTransparency(static_cast< sal_Int8 >(nFillTransparence)); + } + + break; + } + } + + return aRetval; +} + +//eof diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index 03e4801f5be2..51ebdb715207 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -222,7 +222,7 @@ void SvxDrawPage::dispose() ::com::sun::star::document::EventObject aEvt; aEvt.Source = xSource; // inform all listeners to release this object - // The listener container are automaticly cleared + // The listener container are automatically cleared mrBHelper.aLC.disposeAndClear( aEvt ); // notify subclasses to do their dispose disposing(); diff --git a/svx/source/unodraw/unoshcol.cxx b/svx/source/unodraw/unoshcol.cxx index 3378c78c0e89..0bfaa64c2a07 100644 --- a/svx/source/unodraw/unoshcol.cxx +++ b/svx/source/unodraw/unoshcol.cxx @@ -129,7 +129,7 @@ void SvxShapeCollection::dispose() document::EventObject aEvt; aEvt.Source = xSource; // inform all listeners to release this object - // The listener container are automaticly cleared + // The listener container are automatically cleared mrBHelper.aLC.disposeAndClear( aEvt ); // notify subclasses to do their dispose disposing(); diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx index b16249e5d51f..98d253fb28a6 100644 --- a/svx/source/xml/xmleohlp.cxx +++ b/svx/source/xml/xmleohlp.cxx @@ -415,7 +415,7 @@ sal_Bool SvXMLEmbeddedObjectHelper::ImplReadObject( if( xDocStor != xCntnrStor || pTemp || bDuplicate ) { - // TODO/LATER: make this alltogether a method in the EmbeddedObjectContainer + // TODO/LATER: make this altogether a method in the EmbeddedObjectContainer // create a unique name for the duplicate object if( bDuplicate ) |