diff options
Diffstat (limited to 'svx/source/dialog/fontwork.cxx')
-rw-r--r-- | svx/source/dialog/fontwork.cxx | 305 |
1 files changed, 6 insertions, 299 deletions
diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx index 32aab9e8a89c..d3773ae587d0 100644 --- a/svx/source/dialog/fontwork.cxx +++ b/svx/source/dialog/fontwork.cxx @@ -101,14 +101,6 @@ void SvxFontWorkControllerItem::StateChanged( sal_uInt16 /*nSID*/, SfxItemState rFontWorkDlg.SetMirror_Impl(pStateItem); break; } - case SID_FORMTEXT_STDFORM: - { - const XFormTextStdFormItem* pStateItem = - PTR_CAST(XFormTextStdFormItem, pItem); - DBG_ASSERT(pStateItem || pItem == 0, "XFormTextStdFormItem expected"); - rFontWorkDlg.SetStdForm_Impl(pStateItem); - break; - } case SID_FORMTEXT_HIDEFORM: { const XFormTextHideFormItem* pStateItem = @@ -190,8 +182,6 @@ SvxFontWorkDialog::SvxFontWorkDialog( SfxBindings *pBindinx, const ResId& rResId ) : SfxDockingWindow( pBindinx, pCW, _pParent, rResId ), - aFormSet (this, ResId(VS_FORMS,*rResId.GetResMgr())), - aTbxStyle (this, ResId(TBX_STYLE,*rResId.GetResMgr())), aTbxAdjust (this, ResId(TBX_ADJUST,*rResId.GetResMgr())), @@ -229,16 +219,12 @@ SvxFontWorkDialog::SvxFontWorkDialog( SfxBindings *pBindinx, pCtrlItems[2] = new SvxFontWorkControllerItem(SID_FORMTEXT_DISTANCE, *this, rBindings); pCtrlItems[3] = new SvxFontWorkControllerItem(SID_FORMTEXT_START, *this, rBindings); pCtrlItems[4] = new SvxFontWorkControllerItem(SID_FORMTEXT_MIRROR, *this, rBindings); - pCtrlItems[5] = new SvxFontWorkControllerItem(SID_FORMTEXT_STDFORM, *this, rBindings); - pCtrlItems[6] = new SvxFontWorkControllerItem(SID_FORMTEXT_HIDEFORM, *this, rBindings); - pCtrlItems[7] = new SvxFontWorkControllerItem(SID_FORMTEXT_OUTLINE, *this, rBindings); - pCtrlItems[8] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHADOW, *this, rBindings); - pCtrlItems[9] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWCOLOR, *this, rBindings); - pCtrlItems[10] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWXVAL, *this, rBindings); - pCtrlItems[11] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWYVAL, *this, rBindings); - - WinBits aNewStyle = ( aFormSet.GetStyle() | WB_VSCROLL | WB_ITEMBORDER | WB_DOUBLEBORDER ); - aFormSet.SetStyle( aNewStyle ); + pCtrlItems[5] = new SvxFontWorkControllerItem(SID_FORMTEXT_HIDEFORM, *this, rBindings); + pCtrlItems[6] = new SvxFontWorkControllerItem(SID_FORMTEXT_OUTLINE, *this, rBindings); + pCtrlItems[7] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHADOW, *this, rBindings); + pCtrlItems[8] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWCOLOR, *this, rBindings); + pCtrlItems[9] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWXVAL, *this, rBindings); + pCtrlItems[10] = new SvxFontWorkControllerItem(SID_FORMTEXT_SHDWYVAL, *this, rBindings); Size aSize = aTbxStyle.CalcWindowSizePixel(); aTbxStyle.SetSizePixel(aSize); @@ -281,14 +267,6 @@ SvxFontWorkDialog::SvxFontWorkDialog( SfxBindings *pBindinx, aInputTimer.SetTimeout(500); aInputTimer.SetTimeoutHdl(LINK(this, SvxFontWorkDialog, InputTimoutHdl_Impl)); - - aFormSet.SetSelectHdl( LINK(this, SvxFontWorkDialog, FormSelectHdl_Impl) ); - aFormSet.SetColCount(4); - aFormSet.SetLineCount(2); - - Bitmap aBmp(SVX_RES(RID_SVXBMP_FONTWORK_FORM1)); - aSize.Height() = aFormSet.CalcWindowSizePixel(aBmp.GetSizePixel()).Height() + 2; - aFormSet.SetSizePixel(aSize); } SvxFontWorkDialog::~SvxFontWorkDialog() @@ -449,23 +427,6 @@ void SvxFontWorkDialog::SetMirror_Impl(const XFormTextMirrorItem* pItem) aTbxAdjust.CheckItem(TBI_ADJUST_MIRROR, pItem->GetValue()); } -// Standard form in ValueSet View - -void SvxFontWorkDialog::SetStdForm_Impl(const XFormTextStdFormItem* pItem) -{ - if ( pItem ) - { - aFormSet.Enable(); - aFormSet.SetNoSelection(); - - if ( pItem->GetValue() != XFTFORM_NONE ) - aFormSet.SelectItem( - sal::static_int_cast< sal_uInt16 >(pItem->GetValue())); - } - else - aFormSet.Disable(); -} - // Set button for contour display void SvxFontWorkDialog::SetShowForm_Impl(const XFormTextHideFormItem* pItem) @@ -807,19 +768,6 @@ IMPL_LINK_NOARG(SvxFontWorkDialog, InputTimoutHdl_Impl) return 0; } -IMPL_LINK_NOARG(SvxFontWorkDialog, FormSelectHdl_Impl) -{ - XFormTextStdFormItem aItem; - - if ( aFormSet.IsNoSelection() ) - aItem.SetValue(XFTFORM_NONE); - else - aItem.SetValue(aFormSet.GetSelectItemId()); - GetBindings().GetDispatcher()->Execute( SID_FORMTEXT_STDFORM, SFX_CALLMODE_RECORD, &aItem, 0L ); - aFormSet.SetNoSelection(); - return 0; -} - IMPL_LINK_NOARG(SvxFontWorkDialog, ColorSelectHdl_Impl) { XFormTextShadowColorItem aItem( (const String &) String(), @@ -842,226 +790,6 @@ void SvxFontWorkDialog::SetActive(bool /*bActivate*/) { } -// Create standard fontWork Object - -void SvxFontWorkDialog::CreateStdFormObj(SdrView& rView, SdrPageView& rPV, - const SfxItemSet& rAttr, - SdrObject& rOldObj, - XFormTextStdForm eForm) -{ - SfxItemSet aAttr(*rAttr.GetPool(), XATTR_FORMTXTSTYLE, - XATTR_FORMTXTHIDEFORM); - SdrObject* pNewObj = NULL; - Rectangle aRect; - XFormTextAdjust eAdjust = XFT_AUTOSIZE; - - aAttr.Put(rOldObj.GetMergedItemSet()); - - const XFormTextStdFormItem& rOldForm = (const XFormTextStdFormItem&) - aAttr.Get(XATTR_FORMTXTSTDFORM); - - aRect = rOldObj.GetSnapRect(); - - if ( !rOldObj.ISA(SdrPathObj) ) - { - Point aPos = aRect.TopLeft(); - aRect = rOldObj.GetLogicRect(); - aRect.SetPos(aPos); - } - - aAttr.Put(rAttr); - - if ( rOldForm.GetValue() == XFTFORM_NONE ) - { - long nW = aRect.GetWidth(); - aRect.SetSize(Size(nW, nW)); - aAttr.Put(XFormTextStyleItem(XFT_ROTATE)); - } - - Point aCenter = aRect.Center(); - - switch ( eForm ) - { - case XFTFORM_TOPCIRC: - case XFTFORM_BOTCIRC: - case XFTFORM_LFTCIRC: - case XFTFORM_RGTCIRC: - case XFTFORM_TOPARC: - case XFTFORM_BOTARC: - case XFTFORM_LFTARC: - case XFTFORM_RGTARC: - { - long nBeg, nEnd; - - switch ( eForm ) - { - default: ; //prevent warning - case XFTFORM_TOPCIRC: - nBeg = 0; - nEnd = 18000; - break; - case XFTFORM_BOTCIRC: - nBeg = 18000; - nEnd = 36000; - break; - case XFTFORM_LFTCIRC: - nBeg = 9000; - nEnd = 27000; - break; - case XFTFORM_RGTCIRC: - nBeg = 27000; - nEnd = 9000; - break; - case XFTFORM_TOPARC: - nBeg = 4500; - nEnd = 13500; - break; - case XFTFORM_BOTARC: - nBeg = 22500; - nEnd = 31500; - break; - case XFTFORM_LFTARC: - nBeg = 13500; - nEnd = 22500; - break; - case XFTFORM_RGTARC: - nBeg = 31500; - nEnd = 4500; - break; - } - pNewObj = new SdrCircObj(OBJ_CARC, aRect, nBeg, nEnd); - break; - } - case XFTFORM_BUTTON1: - { - basegfx::B2DPolyPolygon aPolyPolygon; - basegfx::B2DPolygon aLine; - long nR = aRect.GetWidth() / 2; - basegfx::B2DPolygon aTopArc(XPolygon(aCenter, -nR, nR, 50, 1750, sal_False).getB2DPolygon()); - basegfx::B2DPolygon aBottomArc(XPolygon(aCenter, -nR, nR, 1850, 3550, sal_False).getB2DPolygon()); - - // Close Polygon - aTopArc.setClosed(true); - aBottomArc.setClosed(true); - aPolyPolygon.append(aTopArc); - - aLine.append(aBottomArc.getB2DPoint(aBottomArc.count() - 1L)); - aLine.append(aBottomArc.getB2DPoint(0L)); - aLine.setClosed(true); - - aPolyPolygon.append(aLine); - aPolyPolygon.append(aBottomArc); - - pNewObj = new SdrPathObj(OBJ_PATHFILL, aPolyPolygon); - eAdjust = XFT_CENTER; - break; - } - case XFTFORM_BUTTON2: - case XFTFORM_BUTTON3: - case XFTFORM_BUTTON4: - { - basegfx::B2DPolyPolygon aPolyPolygon; - basegfx::B2DPolygon aLine; - long nR = aRect.GetWidth() / 2; - long nWDiff = nR / 5; - long nHDiff; - - if ( eForm == XFTFORM_BUTTON4 ) - { - basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 950, 2650, sal_False).getB2DPolygon()); - aNewArc.setClosed(true); - aPolyPolygon.append(aNewArc); - eAdjust = XFT_CENTER; - } - else - { - basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 2700, 2700).getB2DPolygon()); - aPolyPolygon.append(aNewArc); - } - - if ( eForm == XFTFORM_BUTTON3 ) - nHDiff = -aRect.GetHeight() / 10; - else - nHDiff = aRect.GetHeight() / 20; - - aLine.append(basegfx::B2DPoint(aRect.Left() + nWDiff, aRect.Center().Y() + nHDiff)); - aLine.append(basegfx::B2DPoint(aRect.Right() - nWDiff, aRect.Center().Y() + nHDiff)); - aLine.setClosed(true); - aPolyPolygon.append(aLine); - - if ( eForm == XFTFORM_BUTTON4 ) - { - basegfx::B2DPolygon aNewArc(XPolygon(aCenter, -nR, nR, 2750, 850, sal_False).getB2DPolygon()); - aNewArc.setClosed(true); - aPolyPolygon.append(aNewArc); - } - - if ( eForm == XFTFORM_BUTTON3 ) - { - nHDiff += nHDiff; - aLine.setB2DPoint(0L, basegfx::B2DPoint(aLine.getB2DPoint(0L).getX(), aLine.getB2DPoint(0L).getY() - nHDiff)); - aLine.setB2DPoint(1L, basegfx::B2DPoint(aLine.getB2DPoint(1L).getX(), aLine.getB2DPoint(1L).getY() - nHDiff)); - aPolyPolygon.append(aLine); - } - - pNewObj = new SdrPathObj(OBJ_PATHFILL, aPolyPolygon); - break; - } - default: ; //prevent warning - } - if ( pNewObj ) - { - // due to DLs changes in Outliner the object needs - // a model to get an outliner for later calls to - // pNewObj->SetOutlinerParaObject(pPara) (see below). - pNewObj->SetModel(rOldObj.GetModel()); - - Size aSize; - Rectangle aSnap = pNewObj->GetSnapRect(); - - aSize.Width() = aRect.Left() - aSnap.Left(); - aSize.Height() = aRect.Top() - aSnap.Top(); - pNewObj->NbcMove(aSize); - - rView.BegUndo( SVX_RESSTR( RID_SVXSTR_FONTWORK_UNDOCREATE ) ); - OutlinerParaObject* pPara = rOldObj.GetOutlinerParaObject(); - sal_Bool bHide = sal_True; - - if ( pPara != NULL ) - { - pPara = new OutlinerParaObject(*pPara); - pNewObj->SetOutlinerParaObject(pPara); - } - else - bHide = sal_False; - - rView.ReplaceObjectAtView(&rOldObj, rPV, pNewObj, sal_True); - pNewObj->SetLayer(rOldObj.GetLayer()); - aAttr.Put(XFormTextHideFormItem(bHide)); - aAttr.Put(XFormTextAdjustItem(eAdjust)); - - XFormTextShadow eShadow = XFTSHADOW_NONE; - - if ( nLastShadowTbxId == TBI_SHADOW_NORMAL ) - { - eShadow = XFTSHADOW_NORMAL; - aAttr.Put(XFormTextShadowXValItem(nSaveShadowX)); - aAttr.Put(XFormTextShadowYValItem(nSaveShadowY)); - } - else if ( nLastShadowTbxId == TBI_SHADOW_SLANT ) - { - eShadow = XFTSHADOW_SLANT; - aAttr.Put(XFormTextShadowXValItem(nSaveShadowAngle)); - aAttr.Put(XFormTextShadowYValItem(nSaveShadowSize)); - } - - aAttr.Put(XFormTextShadowItem(eShadow)); - - rView.SetAttributes(aAttr); - rView.EndUndo(); - } -} - void SvxFontWorkDialog::DataChanged( const DataChangedEvent& rDCEvt ) { if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) @@ -1072,27 +800,6 @@ void SvxFontWorkDialog::DataChanged( const DataChangedEvent& rDCEvt ) void SvxFontWorkDialog::ApplyImageList() { - ResMgr* _pMgr = &DIALOG_MGR(); - - sal_uInt16 nBitmapResId = RID_SVXBMP_FONTWORK_FORM1; - sal_uInt16 nTextResId = RID_SVXSTR_FONTWORK_FORM1; - - bool bInit = aFormSet.GetItemCount() == 0; - - sal_uInt16 i; - for( i = 1; i < 13; i++, nTextResId++, nBitmapResId++ ) - { - if( bInit ) - { - aFormSet.InsertItem( i, Bitmap(ResId(nBitmapResId,*_pMgr)), - String(ResId(nTextResId,*_pMgr))); - } - else - { - aFormSet.SetItemImage( i, Bitmap(ResId(nBitmapResId,*_pMgr)) ); - } - } - ImageList& rImgLst = maImageList; aTbxStyle.SetImageList( rImgLst ); |