1*facb16e7SArmin Le Grand /************************************************************** 2*facb16e7SArmin Le Grand * 3*facb16e7SArmin Le Grand * Licensed to the Apache Software Foundation (ASF) under one 4*facb16e7SArmin Le Grand * or more contributor license agreements. See the NOTICE file 5*facb16e7SArmin Le Grand * distributed with this work for additional information 6*facb16e7SArmin Le Grand * regarding copyright ownership. The ASF licenses this file 7*facb16e7SArmin Le Grand * to you under the Apache License, Version 2.0 (the 8*facb16e7SArmin Le Grand * "License"); you may not use this file except in compliance 9*facb16e7SArmin Le Grand * with the License. You may obtain a copy of the License at 10*facb16e7SArmin Le Grand * 11*facb16e7SArmin Le Grand * http://www.apache.org/licenses/LICENSE-2.0 12*facb16e7SArmin Le Grand * 13*facb16e7SArmin Le Grand * Unless required by applicable law or agreed to in writing, 14*facb16e7SArmin Le Grand * software distributed under the License is distributed on an 15*facb16e7SArmin Le Grand * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*facb16e7SArmin Le Grand * KIND, either express or implied. See the License for the 17*facb16e7SArmin Le Grand * specific language governing permissions and limitations 18*facb16e7SArmin Le Grand * under the License. 19*facb16e7SArmin Le Grand * 20*facb16e7SArmin Le Grand *************************************************************/ 21*facb16e7SArmin Le Grand 22*facb16e7SArmin Le Grand #include "precompiled_sc.hxx" 23*facb16e7SArmin Le Grand 24*facb16e7SArmin Le Grand #include <CellBorderStyleControl.hxx> 25*facb16e7SArmin Le Grand #include "sc.hrc" 26*facb16e7SArmin Le Grand #include "scresid.hxx" 27*facb16e7SArmin Le Grand #include <CellAppearancePropertyPanel.hrc> 28*facb16e7SArmin Le Grand #include <editeng/boxitem.hxx> 29*facb16e7SArmin Le Grand #include <editeng/bolnitem.hxx> 30*facb16e7SArmin Le Grand #include <CellAppearancePropertyPanel.hxx> 31*facb16e7SArmin Le Grand #include <sfx2/bindings.hxx> 32*facb16e7SArmin Le Grand #include <sfx2/dispatch.hxx> 33*facb16e7SArmin Le Grand #include <vcl/svapp.hxx> 34*facb16e7SArmin Le Grand 35*facb16e7SArmin Le Grand namespace sc { namespace sidebar { 36*facb16e7SArmin Le Grand 37*facb16e7SArmin Le Grand #define FRM_VALID_LEFT 0x01 38*facb16e7SArmin Le Grand #define FRM_VALID_RIGHT 0x02 39*facb16e7SArmin Le Grand #define FRM_VALID_TOP 0x04 40*facb16e7SArmin Le Grand #define FRM_VALID_BOTTOM 0x08 41*facb16e7SArmin Le Grand #define FRM_VALID_HINNER 0x10 42*facb16e7SArmin Le Grand #define FRM_VALID_VINNER 0x20 43*facb16e7SArmin Le Grand #define FRM_VALID_OUTER 0x0f 44*facb16e7SArmin Le Grand #define FRM_VALID_ALL 0xff 45*facb16e7SArmin Le Grand 46*facb16e7SArmin Le Grand CellBorderStyleControl::CellBorderStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel) 47*facb16e7SArmin Le Grand : svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE)), 48*facb16e7SArmin Le Grand mrCellAppearancePropertyPanel(rPanel), 49*facb16e7SArmin Le Grand maTBBorder1(this, ScResId(TB_BORDER1)), 50*facb16e7SArmin Le Grand maTBBorder2(this, ScResId(TB_BORDER2)), 51*facb16e7SArmin Le Grand maTBBorder3(this, ScResId(TB_BORDER3)), 52*facb16e7SArmin Le Grand maFL1(this, ScResId(FL_1)), 53*facb16e7SArmin Le Grand maFL2(this, ScResId(FL_2)), 54*facb16e7SArmin Le Grand mpImageList(0), 55*facb16e7SArmin Le Grand mpImageListH(0) 56*facb16e7SArmin Le Grand { 57*facb16e7SArmin Le Grand Initialize(); 58*facb16e7SArmin Le Grand FreeResource(); 59*facb16e7SArmin Le Grand } 60*facb16e7SArmin Le Grand 61*facb16e7SArmin Le Grand CellBorderStyleControl::~CellBorderStyleControl(void) 62*facb16e7SArmin Le Grand { 63*facb16e7SArmin Le Grand delete[] mpImageList; 64*facb16e7SArmin Le Grand delete[] mpImageListH; 65*facb16e7SArmin Le Grand } 66*facb16e7SArmin Le Grand 67*facb16e7SArmin Le Grand void CellBorderStyleControl::Initialize() 68*facb16e7SArmin Le Grand { 69*facb16e7SArmin Le Grand mpImageList = new Image[16]; 70*facb16e7SArmin Le Grand mpImageList[0] = Image(ScResId(IMG_BORDER1)); 71*facb16e7SArmin Le Grand mpImageList[1] = Image(ScResId(IMG_BORDER2)); 72*facb16e7SArmin Le Grand mpImageList[2] = Image(ScResId(IMG_BORDER3)); 73*facb16e7SArmin Le Grand mpImageList[3] = Image(ScResId(IMG_BORDER4)); 74*facb16e7SArmin Le Grand mpImageList[4] = Image(ScResId(IMG_BORDER5)); 75*facb16e7SArmin Le Grand mpImageList[5] = Image(ScResId(IMG_BORDER6)); 76*facb16e7SArmin Le Grand mpImageList[6] = Image(ScResId(IMG_BORDER7)); 77*facb16e7SArmin Le Grand mpImageList[7] = Image(ScResId(IMG_BORDER8)); 78*facb16e7SArmin Le Grand mpImageList[8] = Image(ScResId(IMG_BORDER9)); 79*facb16e7SArmin Le Grand mpImageList[9] = Image(ScResId(IMG_BORDER10)); 80*facb16e7SArmin Le Grand mpImageList[10] = Image(ScResId(IMG_BORDER11)); 81*facb16e7SArmin Le Grand mpImageList[11] = Image(ScResId(IMG_BORDER12)); 82*facb16e7SArmin Le Grand mpImageList[12] = Image(ScResId(IMG_BORDER13)); 83*facb16e7SArmin Le Grand mpImageList[13] = Image(ScResId(IMG_BORDER14)); 84*facb16e7SArmin Le Grand mpImageList[14] = Image(ScResId(IMG_BORDER15)); 85*facb16e7SArmin Le Grand mpImageList[15] = Image(ScResId(IMG_BORDER16)); 86*facb16e7SArmin Le Grand 87*facb16e7SArmin Le Grand //high contrast 88*facb16e7SArmin Le Grand mpImageListH = new Image[16]; 89*facb16e7SArmin Le Grand mpImageListH[0] = Image(ScResId(IMG_BORDER1_H)); 90*facb16e7SArmin Le Grand mpImageListH[1] = Image(ScResId(IMG_BORDER2_H)); 91*facb16e7SArmin Le Grand mpImageListH[2] = Image(ScResId(IMG_BORDER3_H)); 92*facb16e7SArmin Le Grand mpImageListH[3] = Image(ScResId(IMG_BORDER4_H)); 93*facb16e7SArmin Le Grand mpImageListH[4] = Image(ScResId(IMG_BORDER5_H)); 94*facb16e7SArmin Le Grand mpImageListH[5] = Image(ScResId(IMG_BORDER6_H)); 95*facb16e7SArmin Le Grand mpImageListH[6] = Image(ScResId(IMG_BORDER7_H)); 96*facb16e7SArmin Le Grand mpImageListH[7] = Image(ScResId(IMG_BORDER8_H)); 97*facb16e7SArmin Le Grand mpImageListH[8] = Image(ScResId(IMG_BORDER9_H)); 98*facb16e7SArmin Le Grand mpImageListH[9] = Image(ScResId(IMG_BORDER10_H)); 99*facb16e7SArmin Le Grand mpImageListH[10] = Image(ScResId(IMG_BORDER11_H)); 100*facb16e7SArmin Le Grand mpImageListH[11] = Image(ScResId(IMG_BORDER12_H)); 101*facb16e7SArmin Le Grand mpImageListH[12] = Image(ScResId(IMG_BORDER13_H)); 102*facb16e7SArmin Le Grand mpImageListH[13] = Image(ScResId(IMG_BORDER14_H)); 103*facb16e7SArmin Le Grand mpImageListH[14] = Image(ScResId(IMG_BORDER15_H)); 104*facb16e7SArmin Le Grand mpImageListH[15] = Image(ScResId(IMG_BORDER16_H)); 105*facb16e7SArmin Le Grand 106*facb16e7SArmin Le Grand maTBBorder1.SetItemImage(TBI_BORDER1_NONE, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[0] : mpImageList[0]); 107*facb16e7SArmin Le Grand maTBBorder1.SetItemImage(TBI_BORDER1_ALL, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[1] : mpImageList[1]); 108*facb16e7SArmin Le Grand maTBBorder1.SetItemImage(TBI_BORDER1_OUTER, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[2] : mpImageList[2]); 109*facb16e7SArmin Le Grand maTBBorder1.SetItemImage(TBI_BORDER1_OUTERBOLD, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[3] : mpImageList[3]); 110*facb16e7SArmin Le Grand maTBBorder1.SetBackground(Wallpaper()); 111*facb16e7SArmin Le Grand maTBBorder1.SetPaintTransparent(true); 112*facb16e7SArmin Le Grand Size aTbxSize( maTBBorder1.CalcWindowSizePixel() ); 113*facb16e7SArmin Le Grand maTBBorder1.SetOutputSizePixel( aTbxSize ); 114*facb16e7SArmin Le Grand Link aLink = LINK(this, CellBorderStyleControl, TB1SelectHdl); 115*facb16e7SArmin Le Grand maTBBorder1.SetSelectHdl ( aLink ); 116*facb16e7SArmin Le Grand 117*facb16e7SArmin Le Grand maTBBorder2.SetLineCount(2); 118*facb16e7SArmin Le Grand maTBBorder2.InsertItem(TBI_BORDER2_LEFT, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[4] : mpImageList[4]); 119*facb16e7SArmin Le Grand maTBBorder2.InsertItem(TBI_BORDER2_RIGHT, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[5] : mpImageList[5]); 120*facb16e7SArmin Le Grand maTBBorder2.InsertItem(TBI_BORDER2_TOP, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[6] : mpImageList[6]); 121*facb16e7SArmin Le Grand maTBBorder2.InsertItem(TBI_BORDER2_BOT, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[7] : mpImageList[7]); 122*facb16e7SArmin Le Grand maTBBorder2.InsertBreak(); 123*facb16e7SArmin Le Grand maTBBorder2.InsertItem(TBI_BORDER2_BLTR, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[8] : mpImageList[8]); 124*facb16e7SArmin Le Grand maTBBorder2.InsertItem(TBI_BORDER2_TLBR, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[9] : mpImageList[9]); 125*facb16e7SArmin Le Grand maTBBorder2.InsertItem(TBI_BORDER2_TOPBOT, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[10] : mpImageList[10]); 126*facb16e7SArmin Le Grand maTBBorder2.InsertItem(TBI_BORDER2_LEFTRIGHT, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[11] : mpImageList[11]); 127*facb16e7SArmin Le Grand maTBBorder2.SetBackground(Wallpaper()); 128*facb16e7SArmin Le Grand maTBBorder2.SetPaintTransparent(true); 129*facb16e7SArmin Le Grand aTbxSize = maTBBorder2.CalcWindowSizePixel() ; 130*facb16e7SArmin Le Grand maTBBorder2.SetOutputSizePixel( aTbxSize ); 131*facb16e7SArmin Le Grand maTBBorder2.SetHelpId(TBI_BORDER2_LEFT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT); 132*facb16e7SArmin Le Grand maTBBorder2.SetHelpId(TBI_BORDER2_RIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT); 133*facb16e7SArmin Le Grand maTBBorder2.SetHelpId(TBI_BORDER2_TOP, HID_PROPERTYPANEL_SC_BORDER_TBI_TOP); 134*facb16e7SArmin Le Grand maTBBorder2.SetHelpId(TBI_BORDER2_BOT, HID_PROPERTYPANEL_SC_BORDER_TBI_BOT); 135*facb16e7SArmin Le Grand maTBBorder2.SetHelpId(TBI_BORDER2_BLTR, HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR); 136*facb16e7SArmin Le Grand maTBBorder2.SetHelpId(TBI_BORDER2_TLBR, HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR); 137*facb16e7SArmin Le Grand maTBBorder2.SetHelpId(TBI_BORDER2_TOPBOT, HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT); 138*facb16e7SArmin Le Grand maTBBorder2.SetHelpId(TBI_BORDER2_LEFTRIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT); 139*facb16e7SArmin Le Grand maTBBorder2.SetItemText(TBI_BORDER2_LEFT, ScResId(STR_BORDER_1)); 140*facb16e7SArmin Le Grand maTBBorder2.SetItemText(TBI_BORDER2_RIGHT, ScResId(STR_BORDER_2)); 141*facb16e7SArmin Le Grand maTBBorder2.SetItemText(TBI_BORDER2_TOP, ScResId(STR_BORDER_3)); 142*facb16e7SArmin Le Grand maTBBorder2.SetItemText(TBI_BORDER2_BOT, ScResId(STR_BORDER_4)); 143*facb16e7SArmin Le Grand maTBBorder2.SetItemText(TBI_BORDER2_BLTR, ScResId(STR_BORDER_5)); 144*facb16e7SArmin Le Grand maTBBorder2.SetItemText(TBI_BORDER2_TLBR, ScResId(STR_BORDER_6)); 145*facb16e7SArmin Le Grand maTBBorder2.SetItemText(TBI_BORDER2_TOPBOT, ScResId(STR_BORDER_7)); 146*facb16e7SArmin Le Grand maTBBorder2.SetItemText(TBI_BORDER2_LEFTRIGHT, ScResId(STR_BORDER_8)); 147*facb16e7SArmin Le Grand aLink = LINK(this, CellBorderStyleControl, TB2SelectHdl); 148*facb16e7SArmin Le Grand maTBBorder2.SetSelectHdl ( aLink ); 149*facb16e7SArmin Le Grand 150*facb16e7SArmin Le Grand maTBBorder3.SetItemImage(TBI_BORDER3_S1, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[12] : mpImageList[12]); 151*facb16e7SArmin Le Grand maTBBorder3.SetItemImage(TBI_BORDER3_S2, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[13] : mpImageList[13]); 152*facb16e7SArmin Le Grand maTBBorder3.SetItemImage(TBI_BORDER3_S3, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[14] : mpImageList[14]); 153*facb16e7SArmin Le Grand maTBBorder3.SetItemImage(TBI_BORDER3_S4, GetDisplayBackground().GetColor().IsDark() ? mpImageListH[15] : mpImageList[15]); 154*facb16e7SArmin Le Grand maTBBorder3.SetBackground(Wallpaper()); 155*facb16e7SArmin Le Grand maTBBorder3.SetPaintTransparent(true); 156*facb16e7SArmin Le Grand aTbxSize = maTBBorder3.CalcWindowSizePixel() ; 157*facb16e7SArmin Le Grand maTBBorder3.SetOutputSizePixel( aTbxSize ); 158*facb16e7SArmin Le Grand aLink = LINK(this, CellBorderStyleControl, TB3SelectHdl); 159*facb16e7SArmin Le Grand maTBBorder3.SetSelectHdl ( aLink ); 160*facb16e7SArmin Le Grand } 161*facb16e7SArmin Le Grand 162*facb16e7SArmin Le Grand IMPL_LINK(CellBorderStyleControl, TB1SelectHdl, ToolBox*, pToolBox) 163*facb16e7SArmin Le Grand { 164*facb16e7SArmin Le Grand sal_uInt16 nId = pToolBox->GetCurItemId(); 165*facb16e7SArmin Le Grand ::Color aColBlack( COL_BLACK ); 166*facb16e7SArmin Le Grand SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); 167*facb16e7SArmin Le Grand SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); 168*facb16e7SArmin Le Grand SvxBorderLine theDefLine(NULL,1, 0, 0); 169*facb16e7SArmin Le Grand SvxBorderLine *pLeft = 0, *pRight = 0, *pTop = 0, *pBottom = 0; 170*facb16e7SArmin Le Grand sal_uInt8 nValidFlags = 0; 171*facb16e7SArmin Le Grand switch ( nId ) 172*facb16e7SArmin Le Grand { 173*facb16e7SArmin Le Grand case TBI_BORDER1_NONE: 174*facb16e7SArmin Le Grand { 175*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_ALL; 176*facb16e7SArmin Le Grand SvxLineItem aLineItem1( SID_ATTR_BORDER_DIAG_BLTR ); 177*facb16e7SArmin Le Grand SvxLineItem aLineItem2( SID_ATTR_BORDER_DIAG_TLBR ); 178*facb16e7SArmin Le Grand aLineItem1.SetLine( NULL ); //modify 179*facb16e7SArmin Le Grand aLineItem2.SetLine( NULL ); //modify 180*facb16e7SArmin Le Grand mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_BLTR, SFX_CALLMODE_RECORD, &aLineItem1, 0L); 181*facb16e7SArmin Le Grand mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_TLBR, SFX_CALLMODE_RECORD, &aLineItem2, 0L); 182*facb16e7SArmin Le Grand } 183*facb16e7SArmin Le Grand break; 184*facb16e7SArmin Le Grand case TBI_BORDER1_ALL: 185*facb16e7SArmin Le Grand pLeft = pRight = pTop = pBottom = &theDefLine; 186*facb16e7SArmin Le Grand aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI ); 187*facb16e7SArmin Le Grand aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT ); 188*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_ALL; 189*facb16e7SArmin Le Grand break; 190*facb16e7SArmin Le Grand case TBI_BORDER1_OUTER: 191*facb16e7SArmin Le Grand pLeft = pRight = pTop = pBottom = &theDefLine; 192*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_OUTER; 193*facb16e7SArmin Le Grand break; 194*facb16e7SArmin Le Grand case TBI_BORDER1_OUTERBOLD: 195*facb16e7SArmin Le Grand theDefLine.SetOutWidth(DEF_LINE_WIDTH_2); 196*facb16e7SArmin Le Grand pLeft = pRight = pTop = pBottom = &theDefLine; 197*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_OUTER; 198*facb16e7SArmin Le Grand break; 199*facb16e7SArmin Le Grand } 200*facb16e7SArmin Le Grand 201*facb16e7SArmin Le Grand aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT ); 202*facb16e7SArmin Le Grand aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT ); 203*facb16e7SArmin Le Grand aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); 204*facb16e7SArmin Le Grand aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); 205*facb16e7SArmin Le Grand 206*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); 207*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); 208*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT)); 209*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); 210*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); 211*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); 212*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_DISTANCE, true ); 213*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_DISABLE, false ); 214*facb16e7SArmin Le Grand 215*facb16e7SArmin Le Grand mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L); 216*facb16e7SArmin Le Grand mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode(); 217*facb16e7SArmin Le Grand return 0; 218*facb16e7SArmin Le Grand } 219*facb16e7SArmin Le Grand 220*facb16e7SArmin Le Grand IMPL_LINK(CellBorderStyleControl, TB2SelectHdl, ToolBox *, pToolBox) 221*facb16e7SArmin Le Grand { 222*facb16e7SArmin Le Grand sal_uInt16 nId = pToolBox->GetCurItemId(); 223*facb16e7SArmin Le Grand 224*facb16e7SArmin Le Grand if( nId != TBI_BORDER2_BLTR && nId != TBI_BORDER2_TLBR ) 225*facb16e7SArmin Le Grand { 226*facb16e7SArmin Le Grand ::Color aColBlack( COL_BLACK ); 227*facb16e7SArmin Le Grand SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); 228*facb16e7SArmin Le Grand SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); 229*facb16e7SArmin Le Grand SvxBorderLine theDefLine(NULL, 1, 0, 0); 230*facb16e7SArmin Le Grand SvxBorderLine *pLeft = 0, 231*facb16e7SArmin Le Grand *pRight = 0, 232*facb16e7SArmin Le Grand *pTop = 0, 233*facb16e7SArmin Le Grand *pBottom = 0; 234*facb16e7SArmin Le Grand sal_uInt8 nValidFlags = 0; 235*facb16e7SArmin Le Grand switch ( nId ) 236*facb16e7SArmin Le Grand { 237*facb16e7SArmin Le Grand case TBI_BORDER2_LEFT: 238*facb16e7SArmin Le Grand pLeft = &theDefLine; 239*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_LEFT; 240*facb16e7SArmin Le Grand break; 241*facb16e7SArmin Le Grand case TBI_BORDER2_RIGHT: 242*facb16e7SArmin Le Grand // 243*facb16e7SArmin Le Grand if(!Application::GetSettings().GetLayoutRTL()) 244*facb16e7SArmin Le Grand { 245*facb16e7SArmin Le Grand pRight = &theDefLine; 246*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_RIGHT; 247*facb16e7SArmin Le Grand } 248*facb16e7SArmin Le Grand else 249*facb16e7SArmin Le Grand { 250*facb16e7SArmin Le Grand pLeft = &theDefLine; 251*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_LEFT; 252*facb16e7SArmin Le Grand } 253*facb16e7SArmin Le Grand break; 254*facb16e7SArmin Le Grand case TBI_BORDER2_TOP: 255*facb16e7SArmin Le Grand pTop = &theDefLine; 256*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_TOP; 257*facb16e7SArmin Le Grand break; 258*facb16e7SArmin Le Grand case TBI_BORDER2_BOT: 259*facb16e7SArmin Le Grand pBottom = &theDefLine; 260*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_BOTTOM; 261*facb16e7SArmin Le Grand break; 262*facb16e7SArmin Le Grand case TBI_BORDER2_TOPBOT: 263*facb16e7SArmin Le Grand pTop = pBottom = &theDefLine; 264*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; 265*facb16e7SArmin Le Grand break; 266*facb16e7SArmin Le Grand case TBI_BORDER2_LEFTRIGHT: 267*facb16e7SArmin Le Grand pLeft = pRight = &theDefLine; 268*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT; 269*facb16e7SArmin Le Grand break; 270*facb16e7SArmin Le Grand } 271*facb16e7SArmin Le Grand aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT ); 272*facb16e7SArmin Le Grand aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT ); 273*facb16e7SArmin Le Grand aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); 274*facb16e7SArmin Le Grand aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); 275*facb16e7SArmin Le Grand 276*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); 277*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); 278*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT)); 279*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); 280*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); 281*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); 282*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_DISTANCE, true ); 283*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_DISABLE, false ); 284*facb16e7SArmin Le Grand 285*facb16e7SArmin Le Grand mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L); 286*facb16e7SArmin Le Grand } 287*facb16e7SArmin Le Grand else if(nId == TBI_BORDER2_BLTR) 288*facb16e7SArmin Le Grand { 289*facb16e7SArmin Le Grand SvxBorderLine aTmp( NULL, 1, 0, 0 ); 290*facb16e7SArmin Le Grand SvxLineItem aLineItem( SID_ATTR_BORDER_DIAG_BLTR ); 291*facb16e7SArmin Le Grand aLineItem.SetLine( &aTmp ); 292*facb16e7SArmin Le Grand mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_BLTR, SFX_CALLMODE_RECORD, &aLineItem, 0L); 293*facb16e7SArmin Le Grand } 294*facb16e7SArmin Le Grand else if(nId == TBI_BORDER2_TLBR) 295*facb16e7SArmin Le Grand { 296*facb16e7SArmin Le Grand SvxBorderLine aTmp( NULL, 1, 0, 0 ); 297*facb16e7SArmin Le Grand SvxLineItem aLineItem( SID_ATTR_BORDER_DIAG_TLBR ); 298*facb16e7SArmin Le Grand aLineItem.SetLine( &aTmp ); 299*facb16e7SArmin Le Grand mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_TLBR, SFX_CALLMODE_RECORD, &aLineItem, 0L); 300*facb16e7SArmin Le Grand } 301*facb16e7SArmin Le Grand 302*facb16e7SArmin Le Grand mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode(); 303*facb16e7SArmin Le Grand return 0; 304*facb16e7SArmin Le Grand } 305*facb16e7SArmin Le Grand 306*facb16e7SArmin Le Grand IMPL_LINK(CellBorderStyleControl, TB3SelectHdl, ToolBox *, pToolBox) 307*facb16e7SArmin Le Grand { 308*facb16e7SArmin Le Grand sal_uInt16 nId = pToolBox->GetCurItemId(); 309*facb16e7SArmin Le Grand 310*facb16e7SArmin Le Grand ::Color aColBlack( COL_BLACK ); 311*facb16e7SArmin Le Grand SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); 312*facb16e7SArmin Le Grand SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); 313*facb16e7SArmin Le Grand SvxBorderLine *pTop = 0 , 314*facb16e7SArmin Le Grand *pBottom = 0 ; 315*facb16e7SArmin Le Grand sal_uInt8 nValidFlags = 0; 316*facb16e7SArmin Le Grand 317*facb16e7SArmin Le Grand switch ( nId ) 318*facb16e7SArmin Le Grand { 319*facb16e7SArmin Le Grand case TBI_BORDER3_S1: 320*facb16e7SArmin Le Grand pBottom = new SvxBorderLine(NULL, DEF_LINE_WIDTH_2, 0, 0); 321*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_BOTTOM; 322*facb16e7SArmin Le Grand break; 323*facb16e7SArmin Le Grand case TBI_BORDER3_S2: 324*facb16e7SArmin Le Grand pBottom = new SvxBorderLine(NULL, DEF_DOUBLE_LINE0_OUT, DEF_DOUBLE_LINE0_IN, DEF_DOUBLE_LINE0_DIST); 325*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_BOTTOM; 326*facb16e7SArmin Le Grand break; 327*facb16e7SArmin Le Grand case TBI_BORDER3_S3: 328*facb16e7SArmin Le Grand pBottom = new SvxBorderLine(NULL, DEF_LINE_WIDTH_2, 0, 0); 329*facb16e7SArmin Le Grand pTop = new SvxBorderLine(NULL, 1, 0, 0); 330*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; 331*facb16e7SArmin Le Grand break; 332*facb16e7SArmin Le Grand case TBI_BORDER3_S4: 333*facb16e7SArmin Le Grand pBottom = new SvxBorderLine(NULL, DEF_DOUBLE_LINE0_OUT, DEF_DOUBLE_LINE0_IN, DEF_DOUBLE_LINE0_DIST); 334*facb16e7SArmin Le Grand pTop = new SvxBorderLine(NULL, 1, 0, 0); 335*facb16e7SArmin Le Grand nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; 336*facb16e7SArmin Le Grand break; 337*facb16e7SArmin Le Grand } 338*facb16e7SArmin Le Grand 339*facb16e7SArmin Le Grand aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); 340*facb16e7SArmin Le Grand aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); 341*facb16e7SArmin Le Grand aBorderOuter.SetLine( NULL, BOX_LINE_LEFT ); 342*facb16e7SArmin Le Grand aBorderOuter.SetLine( NULL, BOX_LINE_RIGHT ); 343*facb16e7SArmin Le Grand 344*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); 345*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); 346*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT )); 347*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); 348*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); 349*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); 350*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_DISTANCE, true ); 351*facb16e7SArmin Le Grand aBorderInner.SetValid( VALID_DISABLE, false ); 352*facb16e7SArmin Le Grand 353*facb16e7SArmin Le Grand mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L); 354*facb16e7SArmin Le Grand 355*facb16e7SArmin Le Grand delete pTop; 356*facb16e7SArmin Le Grand delete pBottom; 357*facb16e7SArmin Le Grand 358*facb16e7SArmin Le Grand mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode(); 359*facb16e7SArmin Le Grand return 0; 360*facb16e7SArmin Le Grand } 361*facb16e7SArmin Le Grand 362*facb16e7SArmin Le Grand } } // end of namespace svx::sidebar 363*facb16e7SArmin Le Grand 364*facb16e7SArmin Le Grand // eof 365