1b3f79822SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3b3f79822SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4b3f79822SAndrew Rist * or more contributor license agreements. See the NOTICE file 5b3f79822SAndrew Rist * distributed with this work for additional information 6b3f79822SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7b3f79822SAndrew Rist * to you under the Apache License, Version 2.0 (the 8b3f79822SAndrew Rist * "License"); you may not use this file except in compliance 9b3f79822SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13b3f79822SAndrew Rist * Unless required by applicable law or agreed to in writing, 14b3f79822SAndrew Rist * software distributed under the License is distributed on an 15b3f79822SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16b3f79822SAndrew Rist * KIND, either express or implied. See the License for the 17b3f79822SAndrew Rist * specific language governing permissions and limitations 18b3f79822SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20b3f79822SAndrew Rist *************************************************************/ 21b3f79822SAndrew Rist 22b3f79822SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sc.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> 29cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 30cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 31cdf0e10cSrcweir 32cdf0e10cSrcweir //------------------------------------------------------------------ 33cdf0e10cSrcweir 34cdf0e10cSrcweir //svdraw.hxx 35cdf0e10cSrcweir #define _SDR_NOITEMS 36cdf0e10cSrcweir #define _SDR_NOTOUCH 37cdf0e10cSrcweir #define _SDR_NOTRANSFORM 38cdf0e10cSrcweir #define _SI_NOSBXCONTROLS 39cdf0e10cSrcweir #define _VCONT_HXX 40cdf0e10cSrcweir #define _SI_NOOTHERFORMS 41cdf0e10cSrcweir #define _VCTRLS_HXX 42cdf0e10cSrcweir #define _SI_NOCONTROL 43cdf0e10cSrcweir #define _SETBRW_HXX 44cdf0e10cSrcweir #define _VCBRW_HXX 45cdf0e10cSrcweir #define _SI_NOSBXCONTROLS 46cdf0e10cSrcweir 47cdf0e10cSrcweir //------------------------------------------------------------------ 48cdf0e10cSrcweir 49cdf0e10cSrcweir #include "scitems.hxx" 50cdf0e10cSrcweir #include <editeng/eeitem.hxx> 51cdf0e10cSrcweir 52cdf0e10cSrcweir #include <sfx2/app.hxx> 53cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 54cdf0e10cSrcweir #include <sfx2/objface.hxx> 55cdf0e10cSrcweir #include <sfx2/request.hxx> 56cdf0e10cSrcweir #include <svl/whiter.hxx> 57cdf0e10cSrcweir #include <vcl/msgbox.hxx> 58cdf0e10cSrcweir 59cdf0e10cSrcweir #define _ZFORLIST_DECLARE_TABLE 60cdf0e10cSrcweir #include <svl/stritem.hxx> 61cdf0e10cSrcweir #include <svl/zformat.hxx> 62cdf0e10cSrcweir #include <svl/languageoptions.hxx> 63cdf0e10cSrcweir #include <editeng/boxitem.hxx> 64cdf0e10cSrcweir #include <editeng/langitem.hxx> 65cdf0e10cSrcweir #include <svx/numinf.hxx> 66cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 67cdf0e10cSrcweir #include <sfx2/templdlg.hxx> 68cdf0e10cSrcweir #include <sfx2/tplpitem.hxx> 69cdf0e10cSrcweir #include <editeng/svxenum.hxx> 70cdf0e10cSrcweir #include <svx/algitem.hxx> 71cdf0e10cSrcweir #include <editeng/wghtitem.hxx> 72cdf0e10cSrcweir #include <editeng/postitem.hxx> 73cdf0e10cSrcweir #include <editeng/udlnitem.hxx> 74cdf0e10cSrcweir #include <editeng/bolnitem.hxx> 75cdf0e10cSrcweir #include <editeng/colritem.hxx> 76cdf0e10cSrcweir #include <editeng/brshitem.hxx> 77cdf0e10cSrcweir #include <editeng/frmdiritem.hxx> 78cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx> 79cdf0e10cSrcweir #include <svtools/colorcfg.hxx> 80cdf0e10cSrcweir #include <editeng/shaditem.hxx> 81cdf0e10cSrcweir 82cdf0e10cSrcweir #include "formatsh.hxx" 83cdf0e10cSrcweir #include "sc.hrc" 84cdf0e10cSrcweir #include "globstr.hrc" 85cdf0e10cSrcweir #include "docsh.hxx" 86cdf0e10cSrcweir #include "patattr.hxx" 87cdf0e10cSrcweir #include "scmod.hxx" 88cdf0e10cSrcweir //CHINA001 #include "styledlg.hxx" 89cdf0e10cSrcweir #include "attrdlg.hrc" 90cdf0e10cSrcweir #include "stlpool.hxx" 91cdf0e10cSrcweir #include "stlsheet.hxx" 92cdf0e10cSrcweir #include "printfun.hxx" 93cdf0e10cSrcweir #include "docpool.hxx" 94cdf0e10cSrcweir #include "scresid.hxx" 95cdf0e10cSrcweir #include "tabvwsh.hxx" 96cdf0e10cSrcweir #include "undostyl.hxx" 97cdf0e10cSrcweir 98cdf0e10cSrcweir 99cdf0e10cSrcweir #define ScFormatShell 100cdf0e10cSrcweir #define TableFont 101cdf0e10cSrcweir #define FormatForSelection 102cdf0e10cSrcweir #include "scslots.hxx" 103cdf0e10cSrcweir 104cdf0e10cSrcweir #include "scabstdlg.hxx" //CHINA001 105cdf0e10cSrcweir 106cdf0e10cSrcweir namespace { 107cdf0e10cSrcweir 108cdf0e10cSrcweir SvxCellHorJustify lclConvertSlotToHAlign( sal_uInt16 nSlot ) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir SvxCellHorJustify eHJustify = SVX_HOR_JUSTIFY_STANDARD; 111cdf0e10cSrcweir switch( nSlot ) 112cdf0e10cSrcweir { 113cdf0e10cSrcweir case SID_ALIGN_ANY_HDEFAULT: eHJustify = SVX_HOR_JUSTIFY_STANDARD; break; 114cdf0e10cSrcweir case SID_ALIGN_ANY_LEFT: eHJustify = SVX_HOR_JUSTIFY_LEFT; break; 115cdf0e10cSrcweir case SID_ALIGN_ANY_HCENTER: eHJustify = SVX_HOR_JUSTIFY_CENTER; break; 116cdf0e10cSrcweir case SID_ALIGN_ANY_RIGHT: eHJustify = SVX_HOR_JUSTIFY_RIGHT; break; 117cdf0e10cSrcweir case SID_ALIGN_ANY_JUSTIFIED: eHJustify = SVX_HOR_JUSTIFY_BLOCK; break; 118cdf0e10cSrcweir default: DBG_ERRORFILE( "lclConvertSlotToHAlign - invalid slot" ); 119cdf0e10cSrcweir } 120cdf0e10cSrcweir return eHJustify; 121cdf0e10cSrcweir } 122cdf0e10cSrcweir 123cdf0e10cSrcweir SvxCellVerJustify lclConvertSlotToVAlign( sal_uInt16 nSlot ) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir SvxCellVerJustify eVJustify = SVX_VER_JUSTIFY_STANDARD; 126cdf0e10cSrcweir switch( nSlot ) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir case SID_ALIGN_ANY_VDEFAULT: eVJustify = SVX_VER_JUSTIFY_STANDARD; break; 129cdf0e10cSrcweir case SID_ALIGN_ANY_TOP: eVJustify = SVX_VER_JUSTIFY_TOP; break; 130cdf0e10cSrcweir case SID_ALIGN_ANY_VCENTER: eVJustify = SVX_VER_JUSTIFY_CENTER; break; 131cdf0e10cSrcweir case SID_ALIGN_ANY_BOTTOM: eVJustify = SVX_VER_JUSTIFY_BOTTOM; break; 132cdf0e10cSrcweir default: DBG_ERRORFILE( "lclConvertSlotToVAlign - invalid slot" ); 133cdf0e10cSrcweir } 134cdf0e10cSrcweir return eVJustify; 135cdf0e10cSrcweir } 136cdf0e10cSrcweir 137cdf0e10cSrcweir } // namespace 138cdf0e10cSrcweir 139cdf0e10cSrcweir TYPEINIT1( ScFormatShell, SfxShell ); 140cdf0e10cSrcweir 141cdf0e10cSrcweir SFX_IMPL_INTERFACE(ScFormatShell, SfxShell, ScResId(SCSTR_FORMATSHELL) ) 142cdf0e10cSrcweir { 143cdf0e10cSrcweir SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD | 144cdf0e10cSrcweir SFX_VISIBILITY_SERVER, 145cdf0e10cSrcweir ScResId(RID_OBJECTBAR_FORMAT)); 146cdf0e10cSrcweir 147cdf0e10cSrcweir } 148cdf0e10cSrcweir 149cdf0e10cSrcweir 150cdf0e10cSrcweir ScFormatShell::ScFormatShell(ScViewData* pData) : 151cdf0e10cSrcweir SfxShell(pData->GetViewShell()), 152cdf0e10cSrcweir pViewData(pData) 153cdf0e10cSrcweir { 154cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 155cdf0e10cSrcweir 156cdf0e10cSrcweir SetPool( &pTabViewShell->GetPool() ); 157cdf0e10cSrcweir ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); 158cdf0e10cSrcweir SetUndoManager( pMgr ); 159cdf0e10cSrcweir if ( !pViewData->GetDocument()->IsUndoEnabled() ) 160cdf0e10cSrcweir { 161cdf0e10cSrcweir pMgr->SetMaxUndoActionCount( 0 ); 162cdf0e10cSrcweir } 163cdf0e10cSrcweir SetHelpId(HID_SCSHELL_FORMATSH); 164cdf0e10cSrcweir SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Format"))); 165cdf0e10cSrcweir } 166cdf0e10cSrcweir 167cdf0e10cSrcweir ScFormatShell::~ScFormatShell() 168cdf0e10cSrcweir { 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir //------------------------------------------------------------------ 172cdf0e10cSrcweir 173cdf0e10cSrcweir void __EXPORT ScFormatShell::GetStyleState( SfxItemSet& rSet ) 174cdf0e10cSrcweir { 175cdf0e10cSrcweir ScDocument* pDoc = GetViewData()->GetDocument(); 176cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 177cdf0e10cSrcweir SfxStyleSheetBasePool* pStylePool = pDoc->GetStyleSheetPool(); 178cdf0e10cSrcweir 179cdf0e10cSrcweir sal_Bool bProtected = sal_False; 180cdf0e10cSrcweir SCTAB nTabCount = pDoc->GetTableCount(); 181cdf0e10cSrcweir for (SCTAB i=0; i<nTabCount; i++) 182cdf0e10cSrcweir if (pDoc->IsTabProtected(i)) // ueberhaupt eine Tabelle geschuetzt? 183cdf0e10cSrcweir bProtected = sal_True; 184cdf0e10cSrcweir 185cdf0e10cSrcweir SfxWhichIter aIter(rSet); 186cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 187cdf0e10cSrcweir sal_uInt16 nSlotId = 0; 188cdf0e10cSrcweir 189cdf0e10cSrcweir while ( nWhich ) 190cdf0e10cSrcweir { 191cdf0e10cSrcweir nSlotId = SfxItemPool::IsWhich( nWhich ) 192cdf0e10cSrcweir ? GetPool().GetSlotId( nWhich ) 193cdf0e10cSrcweir : nWhich; 194cdf0e10cSrcweir 195cdf0e10cSrcweir switch ( nSlotId ) 196cdf0e10cSrcweir { 197cdf0e10cSrcweir case SID_STYLE_APPLY: 198cdf0e10cSrcweir if ( !pStylePool ) 199cdf0e10cSrcweir rSet.DisableItem( nSlotId ); 200cdf0e10cSrcweir break; 201cdf0e10cSrcweir 202cdf0e10cSrcweir case SID_STYLE_FAMILY2: // Zellvorlagen 203cdf0e10cSrcweir { 204cdf0e10cSrcweir SfxStyleSheet* pStyleSheet = (SfxStyleSheet*) 205cdf0e10cSrcweir pTabViewShell->GetStyleSheetFromMarked(); 206cdf0e10cSrcweir 207cdf0e10cSrcweir if ( pStyleSheet ) 208cdf0e10cSrcweir rSet.Put( SfxTemplateItem( nSlotId, pStyleSheet->GetName() ) ); 209cdf0e10cSrcweir else 210cdf0e10cSrcweir rSet.Put( SfxTemplateItem( nSlotId, String() ) ); 211cdf0e10cSrcweir } 212cdf0e10cSrcweir break; 213cdf0e10cSrcweir 214cdf0e10cSrcweir case SID_STYLE_FAMILY4: // Seitenvorlagen 215cdf0e10cSrcweir { 216cdf0e10cSrcweir SCTAB nCurTab = GetViewData()->GetTabNo(); 217cdf0e10cSrcweir String aPageStyle = pDoc->GetPageStyle( nCurTab ); 218cdf0e10cSrcweir SfxStyleSheet* pStyleSheet = (SfxStyleSheet*)pStylePool-> 219cdf0e10cSrcweir Find( aPageStyle, SFX_STYLE_FAMILY_PAGE ); 220cdf0e10cSrcweir 221cdf0e10cSrcweir if ( pStyleSheet ) 222cdf0e10cSrcweir rSet.Put( SfxTemplateItem( nSlotId, aPageStyle ) ); 223cdf0e10cSrcweir else 224cdf0e10cSrcweir rSet.Put( SfxTemplateItem( nSlotId, String() ) ); 225cdf0e10cSrcweir } 226cdf0e10cSrcweir break; 227cdf0e10cSrcweir 228cdf0e10cSrcweir case SID_STYLE_WATERCAN: 229cdf0e10cSrcweir { 230cdf0e10cSrcweir rSet.Put( SfxBoolItem( nSlotId, SC_MOD()->GetIsWaterCan() ) ); 231cdf0e10cSrcweir } 232cdf0e10cSrcweir break; 233cdf0e10cSrcweir 234cdf0e10cSrcweir case SID_STYLE_UPDATE_BY_EXAMPLE: 235cdf0e10cSrcweir { 236cdf0e10cSrcweir ISfxTemplateCommon* pDesigner = SFX_APP()-> 237cdf0e10cSrcweir GetCurrentTemplateCommon(pTabViewShell->GetViewFrame()->GetBindings()); 238cdf0e10cSrcweir sal_Bool bPage = pDesigner && SFX_STYLE_FAMILY_PAGE == pDesigner->GetActualFamily(); 239cdf0e10cSrcweir 240cdf0e10cSrcweir if ( bProtected || bPage ) 241cdf0e10cSrcweir rSet.DisableItem( nSlotId ); 242cdf0e10cSrcweir } 243cdf0e10cSrcweir break; 244cdf0e10cSrcweir 245cdf0e10cSrcweir case SID_STYLE_EDIT: 246cdf0e10cSrcweir case SID_STYLE_DELETE: 247cdf0e10cSrcweir { 248cdf0e10cSrcweir ISfxTemplateCommon* pDesigner = SFX_APP()-> 249cdf0e10cSrcweir GetCurrentTemplateCommon(pTabViewShell->GetViewFrame()->GetBindings()); 250cdf0e10cSrcweir sal_Bool bPage = pDesigner && SFX_STYLE_FAMILY_PAGE == pDesigner->GetActualFamily(); 251cdf0e10cSrcweir 252cdf0e10cSrcweir if ( bProtected && !bPage ) 253cdf0e10cSrcweir rSet.DisableItem( nSlotId ); 254cdf0e10cSrcweir } 255cdf0e10cSrcweir break; 256cdf0e10cSrcweir 257cdf0e10cSrcweir default: 258cdf0e10cSrcweir break; 259cdf0e10cSrcweir } 260cdf0e10cSrcweir 261cdf0e10cSrcweir nWhich = aIter.NextWhich(); 262cdf0e10cSrcweir } 263cdf0e10cSrcweir } 264cdf0e10cSrcweir 265cdf0e10cSrcweir //------------------------------------------------------------------ 266cdf0e10cSrcweir 267cdf0e10cSrcweir void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq ) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir // Wenn ToolBar vertikal : 270cdf0e10cSrcweir if ( !rReq.GetArgs() ) 271cdf0e10cSrcweir { 272cdf0e10cSrcweir pViewData->GetDispatcher().Execute( SID_STYLE_DESIGNER, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD ); 273cdf0e10cSrcweir return; 274cdf0e10cSrcweir } 275cdf0e10cSrcweir 276cdf0e10cSrcweir //-------------------------------------------------------------------- 277cdf0e10cSrcweir SfxBindings& rBindings = pViewData->GetBindings(); 278cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 279cdf0e10cSrcweir const sal_uInt16 nSlotId = rReq.GetSlot(); 280cdf0e10cSrcweir const SCTAB nCurTab = GetViewData()->GetTabNo(); 281cdf0e10cSrcweir ScDocShell* pDocSh = GetViewData()->GetDocShell(); 282cdf0e10cSrcweir ScTabViewShell* pTabViewShell= GetViewData()->GetViewShell(); 283cdf0e10cSrcweir ScDocument* pDoc = pDocSh->GetDocument(); 284cdf0e10cSrcweir ScMarkData& rMark = GetViewData()->GetMarkData(); 285cdf0e10cSrcweir ScModule* pScMod = SC_MOD(); 286cdf0e10cSrcweir String aRefName; 287cdf0e10cSrcweir sal_Bool bUndo = pDoc->IsUndoEnabled(); 288cdf0e10cSrcweir 289cdf0e10cSrcweir if ( (nSlotId == SID_STYLE_NEW) 290cdf0e10cSrcweir || (nSlotId == SID_STYLE_EDIT) 291cdf0e10cSrcweir || (nSlotId == SID_STYLE_DELETE) 292cdf0e10cSrcweir || (nSlotId == SID_STYLE_APPLY) 293cdf0e10cSrcweir || (nSlotId == SID_STYLE_WATERCAN) 294cdf0e10cSrcweir || (nSlotId == SID_STYLE_FAMILY) 295cdf0e10cSrcweir || (nSlotId == SID_STYLE_NEW_BY_EXAMPLE) 296cdf0e10cSrcweir || (nSlotId == SID_STYLE_UPDATE_BY_EXAMPLE) ) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir SfxStyleSheetBasePool* pStylePool = pDoc->GetStyleSheetPool(); 299cdf0e10cSrcweir SfxStyleSheetBase* pStyleSheet = NULL; 300cdf0e10cSrcweir 301cdf0e10cSrcweir sal_Bool bStyleToMarked = sal_False; 302cdf0e10cSrcweir sal_Bool bListAction = sal_False; 303cdf0e10cSrcweir sal_Bool bAddUndo = sal_False; // add ScUndoModifyStyle (style modified) 304cdf0e10cSrcweir ScStyleSaveData aOldData; // for undo/redo 305cdf0e10cSrcweir ScStyleSaveData aNewData; 306cdf0e10cSrcweir 307cdf0e10cSrcweir SfxStyleFamily eFamily = SFX_STYLE_FAMILY_PARA; 308cdf0e10cSrcweir const SfxPoolItem* pFamItem; 309cdf0e10cSrcweir if ( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY, sal_True, &pFamItem ) ) 310cdf0e10cSrcweir eFamily = (SfxStyleFamily)((const SfxUInt16Item*)pFamItem)->GetValue(); 311cdf0e10cSrcweir else 312cdf0e10cSrcweir if ( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILYNAME, sal_True, &pFamItem ) ) 313cdf0e10cSrcweir { 314cdf0e10cSrcweir String sFamily = ((const SfxStringItem*)pFamItem)->GetValue(); 315cdf0e10cSrcweir if (sFamily.CompareToAscii("CellStyles") == COMPARE_EQUAL) 316cdf0e10cSrcweir eFamily = SFX_STYLE_FAMILY_PARA; 317cdf0e10cSrcweir else 318cdf0e10cSrcweir if (sFamily.CompareToAscii("PageStyles") == COMPARE_EQUAL) 319cdf0e10cSrcweir eFamily = SFX_STYLE_FAMILY_PAGE; 320cdf0e10cSrcweir } 321cdf0e10cSrcweir 322cdf0e10cSrcweir String aStyleName; 323cdf0e10cSrcweir sal_uInt16 nRetMask = 0xffff; 324cdf0e10cSrcweir // #96983# only stylist sends focus to sheet 325cdf0e10cSrcweir // sal_Bool bGrabFocus = ( SID_STYLE_APPLY == nSlotId ); 326cdf0e10cSrcweir 327cdf0e10cSrcweir pStylePool->SetSearchMask( eFamily, SFXSTYLEBIT_ALL ); 328cdf0e10cSrcweir 329cdf0e10cSrcweir switch ( nSlotId ) 330cdf0e10cSrcweir { 331cdf0e10cSrcweir case SID_STYLE_NEW: 332cdf0e10cSrcweir { 333cdf0e10cSrcweir const SfxPoolItem* pNameItem; 334cdf0e10cSrcweir if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( nSlotId, sal_True, &pNameItem )) 335cdf0e10cSrcweir aStyleName = ((const SfxStringItem*)pNameItem)->GetValue(); 336cdf0e10cSrcweir 337cdf0e10cSrcweir const SfxPoolItem* pRefItem=NULL; 338cdf0e10cSrcweir if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_REFERENCE, sal_True, &pRefItem )) 339cdf0e10cSrcweir { 340cdf0e10cSrcweir if(pRefItem!=NULL) 341cdf0e10cSrcweir aRefName = ((const SfxStringItem*)pRefItem)->GetValue(); 342cdf0e10cSrcweir } 343cdf0e10cSrcweir 344cdf0e10cSrcweir pStyleSheet = &(pStylePool->Make( aStyleName, eFamily, 345cdf0e10cSrcweir SFXSTYLEBIT_USERDEF ) ); 346cdf0e10cSrcweir 347cdf0e10cSrcweir if ( pStyleSheet && pStyleSheet->HasParentSupport() ) 348cdf0e10cSrcweir pStyleSheet->SetParent(aRefName); 349cdf0e10cSrcweir } 350cdf0e10cSrcweir break; 351cdf0e10cSrcweir 352cdf0e10cSrcweir case SID_STYLE_APPLY: 353cdf0e10cSrcweir { 354cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_APPLY_STYLE, sal_False ); 355cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pFamilyItem, SfxStringItem, SID_STYLE_FAMILYNAME, sal_False ); 356cdf0e10cSrcweir if ( pFamilyItem && pNameItem ) 357cdf0e10cSrcweir { 358cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::style::XStyleFamiliesSupplier > xModel(pDocSh->GetModel(), com::sun::star::uno::UNO_QUERY); 359cdf0e10cSrcweir try 360cdf0e10cSrcweir { 361cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xStyles; 362cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xCont = xModel->getStyleFamilies(); 363cdf0e10cSrcweir xCont->getByName(pFamilyItem->GetValue()) >>= xStyles; 364cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xInfo; 365cdf0e10cSrcweir xStyles->getByName( pNameItem->GetValue() ) >>= xInfo; 366cdf0e10cSrcweir ::rtl::OUString aUIName; 367cdf0e10cSrcweir xInfo->getPropertyValue( ::rtl::OUString::createFromAscii("DisplayName") ) >>= aUIName; 368cdf0e10cSrcweir if ( aUIName.getLength() ) 369cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aUIName ) ); 370cdf0e10cSrcweir } 371cdf0e10cSrcweir catch( com::sun::star::uno::Exception& ) 372cdf0e10cSrcweir { 373cdf0e10cSrcweir } 374cdf0e10cSrcweir } 375cdf0e10cSrcweir } 376cdf0e10cSrcweir case SID_STYLE_EDIT: 377cdf0e10cSrcweir case SID_STYLE_DELETE: 378cdf0e10cSrcweir case SID_STYLE_NEW_BY_EXAMPLE: 379cdf0e10cSrcweir { 380cdf0e10cSrcweir const SfxPoolItem* pNameItem; 381cdf0e10cSrcweir if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( nSlotId, sal_True, &pNameItem )) 382cdf0e10cSrcweir aStyleName = ((const SfxStringItem*)pNameItem)->GetValue(); 383cdf0e10cSrcweir pStyleSheet = pStylePool->Find( aStyleName, eFamily ); 384cdf0e10cSrcweir 385cdf0e10cSrcweir aOldData.InitFromStyle( pStyleSheet ); 386cdf0e10cSrcweir } 387cdf0e10cSrcweir break; 388cdf0e10cSrcweir 389cdf0e10cSrcweir case SID_STYLE_WATERCAN: 390cdf0e10cSrcweir { 391cdf0e10cSrcweir sal_Bool bWaterCan = pScMod->GetIsWaterCan(); 392cdf0e10cSrcweir 393cdf0e10cSrcweir if( !bWaterCan ) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir const SfxPoolItem* pItem; 396cdf0e10cSrcweir 397cdf0e10cSrcweir if ( SFX_ITEM_SET == 398cdf0e10cSrcweir pArgs->GetItemState( nSlotId, sal_True, &pItem ) ) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir const SfxStringItem* pStrItem = PTR_CAST(SfxStringItem,pItem); 401cdf0e10cSrcweir if ( pStrItem ) 402cdf0e10cSrcweir { 403cdf0e10cSrcweir aStyleName = pStrItem->GetValue(); 404cdf0e10cSrcweir pStyleSheet = pStylePool->Find( aStyleName, eFamily ); 405cdf0e10cSrcweir 406cdf0e10cSrcweir if ( pStyleSheet ) 407cdf0e10cSrcweir { 408cdf0e10cSrcweir ((ScStyleSheetPool*)pStylePool)-> 409cdf0e10cSrcweir SetActualStyleSheet( pStyleSheet ); 410cdf0e10cSrcweir rReq.Done(); 411cdf0e10cSrcweir } 412cdf0e10cSrcweir } 413cdf0e10cSrcweir } 414cdf0e10cSrcweir } 415cdf0e10cSrcweir 416cdf0e10cSrcweir if ( !bWaterCan && pStyleSheet ) 417cdf0e10cSrcweir { 418cdf0e10cSrcweir pScMod->SetWaterCan( sal_True ); 419cdf0e10cSrcweir pTabViewShell->SetActivePointer( Pointer(POINTER_FILL) ); 420cdf0e10cSrcweir rReq.Done(); 421cdf0e10cSrcweir } 422cdf0e10cSrcweir else 423cdf0e10cSrcweir { 424cdf0e10cSrcweir pScMod->SetWaterCan( sal_False ); 425cdf0e10cSrcweir pTabViewShell->SetActivePointer( Pointer(POINTER_ARROW) ); 426cdf0e10cSrcweir rReq.Done(); 427cdf0e10cSrcweir } 428cdf0e10cSrcweir } 429cdf0e10cSrcweir break; 430cdf0e10cSrcweir 431cdf0e10cSrcweir default: 432cdf0e10cSrcweir break; 433cdf0e10cSrcweir } 434cdf0e10cSrcweir 435cdf0e10cSrcweir // Neuen Style fuer WaterCan-Mode setzen 436cdf0e10cSrcweir if ( nSlotId == SID_STYLE_APPLY && pScMod->GetIsWaterCan() && pStyleSheet ) 437cdf0e10cSrcweir ((ScStyleSheetPool*)pStylePool)->SetActualStyleSheet( pStyleSheet ); 438cdf0e10cSrcweir 439cdf0e10cSrcweir switch ( eFamily ) 440cdf0e10cSrcweir { 441cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA: 442cdf0e10cSrcweir { 443cdf0e10cSrcweir switch ( nSlotId ) 444cdf0e10cSrcweir { 445cdf0e10cSrcweir case SID_STYLE_DELETE: 446cdf0e10cSrcweir { 447cdf0e10cSrcweir if ( pStyleSheet ) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir pTabViewShell->RemoveStyleSheetInUse( pStyleSheet ); 450cdf0e10cSrcweir pStylePool->Remove( pStyleSheet ); 451cdf0e10cSrcweir pTabViewShell->InvalidateAttribs(); 452cdf0e10cSrcweir nRetMask = sal_True; 453cdf0e10cSrcweir bAddUndo = sal_True; 454cdf0e10cSrcweir rReq.Done(); 455cdf0e10cSrcweir } 456cdf0e10cSrcweir else 457cdf0e10cSrcweir nRetMask = sal_False; 458cdf0e10cSrcweir } 459cdf0e10cSrcweir break; 460cdf0e10cSrcweir 461cdf0e10cSrcweir case SID_STYLE_APPLY: 462cdf0e10cSrcweir { 463cdf0e10cSrcweir if ( pStyleSheet && !pScMod->GetIsWaterCan() ) 464cdf0e10cSrcweir { 465cdf0e10cSrcweir // Anwenden der Vorlage auf das Dokument 466cdf0e10cSrcweir pTabViewShell->SetStyleSheetToMarked( (SfxStyleSheet*)pStyleSheet ); 467cdf0e10cSrcweir pTabViewShell->InvalidateAttribs(); 468cdf0e10cSrcweir rReq.Done(); 469cdf0e10cSrcweir } 470cdf0e10cSrcweir } 471cdf0e10cSrcweir break; 472cdf0e10cSrcweir 473cdf0e10cSrcweir case SID_STYLE_NEW_BY_EXAMPLE: 474cdf0e10cSrcweir case SID_STYLE_UPDATE_BY_EXAMPLE: 475cdf0e10cSrcweir { 476cdf0e10cSrcweir // Vorlage erzeugen/ersetzen durch Attribute 477cdf0e10cSrcweir // an der Cursor-Position: 478cdf0e10cSrcweir 479cdf0e10cSrcweir const ScPatternAttr* pAttrItem = NULL; 480cdf0e10cSrcweir 481cdf0e10cSrcweir // Die Abfrage, ob markiert ist, war hier immer falsch, 482cdf0e10cSrcweir // darum jetzt gar nicht mehr, und einfach vom Cursor. 483cdf0e10cSrcweir // Wenn Attribute aus der Selektion genommen werden sollen, 484cdf0e10cSrcweir // muss noch darauf geachtet werden, Items aus Vorlagen nicht 485cdf0e10cSrcweir // zu uebernehmen (GetSelectionPattern sammelt auch Items aus 486cdf0e10cSrcweir // Vorlagen zusammen) (#44748#) 487cdf0e10cSrcweir // pAttrItem = GetSelectionPattern(); 488cdf0e10cSrcweir 489cdf0e10cSrcweir // ScViewData* pViewData = GetViewData(); 490cdf0e10cSrcweir SCCOL nCol = pViewData->GetCurX(); 491cdf0e10cSrcweir SCROW nRow = pViewData->GetCurY(); 492cdf0e10cSrcweir pAttrItem = pDoc->GetPattern( nCol, nRow, nCurTab ); 493cdf0e10cSrcweir 494cdf0e10cSrcweir SfxItemSet aAttrSet = pAttrItem->GetItemSet(); 495cdf0e10cSrcweir aAttrSet.ClearItem( ATTR_MERGE ); 496cdf0e10cSrcweir aAttrSet.ClearItem( ATTR_MERGE_FLAG ); 497cdf0e10cSrcweir // bedingte Formatierung und Gueltigkeit nicht uebernehmen, 498cdf0e10cSrcweir // weil sie in der Vorlage nicht editiert werden koennen 499cdf0e10cSrcweir aAttrSet.ClearItem( ATTR_VALIDDATA ); 500cdf0e10cSrcweir aAttrSet.ClearItem( ATTR_CONDITIONAL ); 501cdf0e10cSrcweir 502cdf0e10cSrcweir if ( SID_STYLE_NEW_BY_EXAMPLE == nSlotId ) 503cdf0e10cSrcweir { 504cdf0e10cSrcweir if ( bUndo ) 505cdf0e10cSrcweir { 506cdf0e10cSrcweir String aUndo = ScGlobal::GetRscString( STR_UNDO_EDITCELLSTYLE ); 507cdf0e10cSrcweir pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo ); 508cdf0e10cSrcweir bListAction = sal_True; 509cdf0e10cSrcweir } 510cdf0e10cSrcweir 511cdf0e10cSrcweir sal_Bool bConvertBack = sal_False; 512cdf0e10cSrcweir SfxStyleSheet* pSheetInUse = (SfxStyleSheet*) 513cdf0e10cSrcweir pTabViewShell->GetStyleSheetFromMarked(); 514cdf0e10cSrcweir 515cdf0e10cSrcweir // wenn neuer Style vorhanden und in der Selektion 516cdf0e10cSrcweir // verwendet wird, so darf der Parent nicht uebernommen 517cdf0e10cSrcweir // werden: 518cdf0e10cSrcweir 519cdf0e10cSrcweir if ( pStyleSheet && pSheetInUse && pStyleSheet == pSheetInUse ) 520cdf0e10cSrcweir pSheetInUse = NULL; 521cdf0e10cSrcweir 522cdf0e10cSrcweir // wenn bereits vorhanden, erstmal entfernen... 523cdf0e10cSrcweir if ( pStyleSheet ) 524cdf0e10cSrcweir { 525cdf0e10cSrcweir // Style-Pointer zu Namen vor Erase, 526cdf0e10cSrcweir // weil Zellen sonst ungueltige Pointer 527cdf0e10cSrcweir // enthalten. 528cdf0e10cSrcweir //!!! bei Gelenheit mal eine Methode, die 529cdf0e10cSrcweir // das fuer einen bestimmten Style macht 530cdf0e10cSrcweir pDoc->StylesToNames(); 531cdf0e10cSrcweir bConvertBack = sal_True; 532cdf0e10cSrcweir pStylePool->Remove(pStyleSheet); 533cdf0e10cSrcweir } 534cdf0e10cSrcweir 535cdf0e10cSrcweir // ...und neu anlegen 536cdf0e10cSrcweir pStyleSheet = &pStylePool->Make( aStyleName, eFamily, 537cdf0e10cSrcweir SFXSTYLEBIT_USERDEF ); 538cdf0e10cSrcweir 539cdf0e10cSrcweir // wenn ein Style vorhanden ist, so wird dieser 540cdf0e10cSrcweir // Parent der neuen Vorlage: 541cdf0e10cSrcweir if ( pSheetInUse && pStyleSheet->HasParentSupport() ) 542cdf0e10cSrcweir pStyleSheet->SetParent( pSheetInUse->GetName() ); 543cdf0e10cSrcweir 544cdf0e10cSrcweir if ( bConvertBack ) 545cdf0e10cSrcweir // Namen zu Style-Pointer 546cdf0e10cSrcweir pDoc->UpdStlShtPtrsFrmNms(); 547cdf0e10cSrcweir else 548cdf0e10cSrcweir pDoc->GetPool()->CellStyleCreated( aStyleName ); 549cdf0e10cSrcweir 550cdf0e10cSrcweir // Attribute uebernehmen und Style anwenden 551cdf0e10cSrcweir pStyleSheet->GetItemSet().Put( aAttrSet ); 552cdf0e10cSrcweir pTabViewShell->UpdateStyleSheetInUse( pStyleSheet ); 553cdf0e10cSrcweir 554cdf0e10cSrcweir // call SetStyleSheetToMarked after adding the ScUndoModifyStyle 555cdf0e10cSrcweir // (pStyleSheet pointer is used!) 556cdf0e10cSrcweir bStyleToMarked = sal_True; 557cdf0e10cSrcweir } 558cdf0e10cSrcweir else // ( nSlotId == SID_STYLE_UPDATE_BY_EXAMPLE ) 559cdf0e10cSrcweir { 560cdf0e10cSrcweir pStyleSheet = (SfxStyleSheet*)pTabViewShell->GetStyleSheetFromMarked(); 561cdf0e10cSrcweir 562cdf0e10cSrcweir if ( pStyleSheet ) 563cdf0e10cSrcweir { 564cdf0e10cSrcweir aOldData.InitFromStyle( pStyleSheet ); 565cdf0e10cSrcweir 566cdf0e10cSrcweir if ( bUndo ) 567cdf0e10cSrcweir { 568cdf0e10cSrcweir String aUndo = ScGlobal::GetRscString( STR_UNDO_EDITCELLSTYLE ); 569cdf0e10cSrcweir pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo ); 570cdf0e10cSrcweir bListAction = sal_True; 571cdf0e10cSrcweir } 572cdf0e10cSrcweir 573cdf0e10cSrcweir pStyleSheet->GetItemSet().Put( aAttrSet ); 574cdf0e10cSrcweir pTabViewShell->UpdateStyleSheetInUse( pStyleSheet ); 575cdf0e10cSrcweir 576cdf0e10cSrcweir // call SetStyleSheetToMarked after adding the ScUndoModifyStyle 577cdf0e10cSrcweir // (pStyleSheet pointer is used!) 578cdf0e10cSrcweir bStyleToMarked = sal_True; 579cdf0e10cSrcweir } 580cdf0e10cSrcweir } 581cdf0e10cSrcweir 582cdf0e10cSrcweir aNewData.InitFromStyle( pStyleSheet ); 583cdf0e10cSrcweir bAddUndo = sal_True; 584cdf0e10cSrcweir rReq.Done(); 585cdf0e10cSrcweir } 586cdf0e10cSrcweir break; 587cdf0e10cSrcweir 588cdf0e10cSrcweir default: 589cdf0e10cSrcweir break; 590cdf0e10cSrcweir } 591cdf0e10cSrcweir } // case SFX_STYLE_FAMILY_PARA: 592cdf0e10cSrcweir break; 593cdf0e10cSrcweir 594cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE: 595cdf0e10cSrcweir { 596cdf0e10cSrcweir switch ( nSlotId ) 597cdf0e10cSrcweir { 598cdf0e10cSrcweir case SID_STYLE_DELETE: 599cdf0e10cSrcweir { 600cdf0e10cSrcweir nRetMask = ( NULL != pStyleSheet ); 601cdf0e10cSrcweir if ( pStyleSheet ) 602cdf0e10cSrcweir { 603cdf0e10cSrcweir if ( pDoc->RemovePageStyleInUse( pStyleSheet->GetName() ) ) 604cdf0e10cSrcweir { 605cdf0e10cSrcweir ScPrintFunc( pDocSh, pTabViewShell->GetPrinter(sal_True), nCurTab ).UpdatePages(); 606cdf0e10cSrcweir rBindings.Invalidate( SID_STATUS_PAGESTYLE ); 607cdf0e10cSrcweir rBindings.Invalidate( FID_RESET_PRINTZOOM ); 608cdf0e10cSrcweir } 609cdf0e10cSrcweir pStylePool->Remove( pStyleSheet ); 610cdf0e10cSrcweir rBindings.Invalidate( SID_STYLE_FAMILY4 ); 611cdf0e10cSrcweir pDocSh->SetDocumentModified(); 612cdf0e10cSrcweir bAddUndo = sal_True; 613cdf0e10cSrcweir rReq.Done(); 614cdf0e10cSrcweir } 615cdf0e10cSrcweir } 616cdf0e10cSrcweir break; 617cdf0e10cSrcweir 618cdf0e10cSrcweir case SID_STYLE_APPLY: 619cdf0e10cSrcweir { 620cdf0e10cSrcweir nRetMask = ( NULL != pStyleSheet ); 621cdf0e10cSrcweir if ( pStyleSheet && !pScMod->GetIsWaterCan() ) 622cdf0e10cSrcweir { 623cdf0e10cSrcweir ScUndoApplyPageStyle* pUndoAction = 0; 624cdf0e10cSrcweir for( SCTAB nTab = 0, nTabCount = pDoc->GetTableCount(); nTab < nTabCount; ++nTab ) 625cdf0e10cSrcweir { 626cdf0e10cSrcweir if( rMark.GetTableSelect( nTab ) ) 627cdf0e10cSrcweir { 628cdf0e10cSrcweir String aOldName = pDoc->GetPageStyle( nTab ); 629cdf0e10cSrcweir if ( aOldName != aStyleName ) 630cdf0e10cSrcweir { 631cdf0e10cSrcweir pDoc->SetPageStyle( nTab, aStyleName ); 632cdf0e10cSrcweir ScPrintFunc( pDocSh, pTabViewShell->GetPrinter(sal_True), nTab ).UpdatePages(); 633cdf0e10cSrcweir if( !pUndoAction ) 634cdf0e10cSrcweir pUndoAction = new ScUndoApplyPageStyle( pDocSh, aStyleName ); 635cdf0e10cSrcweir pUndoAction->AddSheetAction( nTab, aOldName ); 636cdf0e10cSrcweir } 637cdf0e10cSrcweir } 638cdf0e10cSrcweir } 639cdf0e10cSrcweir if( pUndoAction ) 640cdf0e10cSrcweir { 641cdf0e10cSrcweir pDocSh->GetUndoManager()->AddUndoAction( pUndoAction ); 642cdf0e10cSrcweir pDocSh->SetDocumentModified(); 643cdf0e10cSrcweir rBindings.Invalidate( SID_STYLE_FAMILY4 ); 644cdf0e10cSrcweir rBindings.Invalidate( SID_STATUS_PAGESTYLE ); 645cdf0e10cSrcweir rBindings.Invalidate( FID_RESET_PRINTZOOM ); 646cdf0e10cSrcweir } 647cdf0e10cSrcweir rReq.Done(); 648cdf0e10cSrcweir } 649cdf0e10cSrcweir } 650cdf0e10cSrcweir break; 651cdf0e10cSrcweir 652cdf0e10cSrcweir case SID_STYLE_NEW_BY_EXAMPLE: 653cdf0e10cSrcweir { 654cdf0e10cSrcweir const String& rStrCurStyle = pDoc->GetPageStyle( nCurTab ); 655cdf0e10cSrcweir 656cdf0e10cSrcweir if ( rStrCurStyle != aStyleName ) 657cdf0e10cSrcweir { 658cdf0e10cSrcweir SfxStyleSheetBase* pCurStyle = pStylePool->Find( rStrCurStyle, eFamily ); 659cdf0e10cSrcweir SfxItemSet aAttrSet = pCurStyle->GetItemSet(); 660cdf0e10cSrcweir SCTAB nInTab; 661cdf0e10cSrcweir sal_Bool bUsed = pDoc->IsPageStyleInUse( aStyleName, &nInTab ); 662cdf0e10cSrcweir 663cdf0e10cSrcweir // wenn bereits vorhanden, erstmal entfernen... 664cdf0e10cSrcweir if ( pStyleSheet ) 665cdf0e10cSrcweir pStylePool->Remove( pStyleSheet ); 666cdf0e10cSrcweir 667cdf0e10cSrcweir // ...und neu anlegen 668cdf0e10cSrcweir pStyleSheet = &pStylePool->Make( aStyleName, eFamily, 669cdf0e10cSrcweir SFXSTYLEBIT_USERDEF ); 670cdf0e10cSrcweir 671cdf0e10cSrcweir // Attribute uebernehmen 672cdf0e10cSrcweir pStyleSheet->GetItemSet().Put( aAttrSet ); 673cdf0e10cSrcweir pDocSh->SetDocumentModified(); 674cdf0e10cSrcweir 675cdf0e10cSrcweir // wenn in Verwendung -> Update 676cdf0e10cSrcweir if ( bUsed ) 677cdf0e10cSrcweir ScPrintFunc( pDocSh, pTabViewShell->GetPrinter(sal_True), nInTab ).UpdatePages(); 678cdf0e10cSrcweir 679cdf0e10cSrcweir aNewData.InitFromStyle( pStyleSheet ); 680cdf0e10cSrcweir bAddUndo = sal_True; 681cdf0e10cSrcweir rReq.Done(); 682cdf0e10cSrcweir nRetMask = sal_True; 683cdf0e10cSrcweir } 684cdf0e10cSrcweir } 685cdf0e10cSrcweir break; 686cdf0e10cSrcweir 687cdf0e10cSrcweir default: 688cdf0e10cSrcweir break; 689cdf0e10cSrcweir } // switch ( nSlotId ) 690cdf0e10cSrcweir } // case SFX_STYLE_FAMILY_PAGE: 691cdf0e10cSrcweir break; 692cdf0e10cSrcweir 693cdf0e10cSrcweir default: 694cdf0e10cSrcweir break; 695cdf0e10cSrcweir } // switch ( eFamily ) 696cdf0e10cSrcweir 697cdf0e10cSrcweir // Neu anlegen oder bearbeiten ueber Dialog: 698cdf0e10cSrcweir if ( nSlotId == SID_STYLE_NEW || nSlotId == SID_STYLE_EDIT ) 699cdf0e10cSrcweir { 700cdf0e10cSrcweir if ( pStyleSheet ) 701cdf0e10cSrcweir { 702cdf0e10cSrcweir SvxNumberInfoItem* pNumberInfoItem = NULL; 703cdf0e10cSrcweir 704cdf0e10cSrcweir SfxStyleFamily eFam = pStyleSheet->GetFamily(); 705cdf0e10cSrcweir // ScDocument* pDoc = GetViewData()->GetDocument(); 706cdf0e10cSrcweir // ScDocShell* pDocSh = GetViewData()->GetDocShell(); 707cdf0e10cSrcweir //CHINA001 ScStyleDlg* pDlg = NULL; 708cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = NULL; //CHINA001 709cdf0e10cSrcweir sal_uInt16 nRsc = 0; 710cdf0e10cSrcweir 711cdf0e10cSrcweir // #37034#/#37245# alte Items aus der Vorlage merken 712cdf0e10cSrcweir SfxItemSet aOldSet = pStyleSheet->GetItemSet(); 713cdf0e10cSrcweir String aOldName = pStyleSheet->GetName(); 714cdf0e10cSrcweir 715cdf0e10cSrcweir switch ( eFam ) 716cdf0e10cSrcweir { 717cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE: 718cdf0e10cSrcweir nRsc = RID_SCDLG_STYLES_PAGE; 719cdf0e10cSrcweir break; 720cdf0e10cSrcweir 721cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA: 722cdf0e10cSrcweir default: 723cdf0e10cSrcweir { 724cdf0e10cSrcweir SfxItemSet& rSet = pStyleSheet->GetItemSet(); 725cdf0e10cSrcweir 726cdf0e10cSrcweir const SfxPoolItem* pItem; 727cdf0e10cSrcweir if ( rSet.GetItemState( ATTR_VALUE_FORMAT, 728cdf0e10cSrcweir sal_False, &pItem ) == SFX_ITEM_SET ) 729cdf0e10cSrcweir { 730cdf0e10cSrcweir // NumberFormat Value aus Value und Language 731cdf0e10cSrcweir // erzeugen und eintueten 732cdf0e10cSrcweir sal_uLong nFormat = 733cdf0e10cSrcweir ((SfxUInt32Item*)pItem)->GetValue(); 734cdf0e10cSrcweir LanguageType eLang = 735cdf0e10cSrcweir ((SvxLanguageItem*)&rSet.Get( 736cdf0e10cSrcweir ATTR_LANGUAGE_FORMAT ))->GetLanguage(); 737cdf0e10cSrcweir sal_uLong nLangFormat = pDoc->GetFormatTable()-> 738cdf0e10cSrcweir GetFormatForLanguageIfBuiltIn( nFormat, eLang ); 739cdf0e10cSrcweir if ( nLangFormat != nFormat ) 740cdf0e10cSrcweir { 741cdf0e10cSrcweir SfxUInt32Item aNewItem( ATTR_VALUE_FORMAT, nLangFormat ); 742cdf0e10cSrcweir rSet.Put( aNewItem ); 743cdf0e10cSrcweir aOldSet.Put( aNewItem ); 744cdf0e10cSrcweir // auch in aOldSet fuer Vergleich nach dem Dialog, 745cdf0e10cSrcweir // sonst geht evtl. eine Aenderung der Sprache verloren 746cdf0e10cSrcweir } 747cdf0e10cSrcweir } 748cdf0e10cSrcweir 749cdf0e10cSrcweir pTabViewShell->MakeNumberInfoItem( pDoc, GetViewData(), &pNumberInfoItem ); 750cdf0e10cSrcweir pDocSh->PutItem( *pNumberInfoItem ); 751cdf0e10cSrcweir nRsc = RID_SCDLG_STYLES_PAR; 752cdf0e10cSrcweir 753cdf0e10cSrcweir // auf jeden Fall ein SvxBoxInfoItem mit Table = sal_False im Set: 754cdf0e10cSrcweir // (wenn gar kein Item da ist, loescht der Dialog auch das 755cdf0e10cSrcweir // BORDER_OUTER SvxBoxItem aus dem Vorlagen-Set) 756cdf0e10cSrcweir 757cdf0e10cSrcweir if ( rSet.GetItemState( ATTR_BORDER_INNER, sal_False ) != SFX_ITEM_SET ) 758cdf0e10cSrcweir { 759cdf0e10cSrcweir SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER ); 760cdf0e10cSrcweir aBoxInfoItem.SetTable(sal_False); // keine inneren Linien 761cdf0e10cSrcweir aBoxInfoItem.SetDist(sal_True); 762cdf0e10cSrcweir aBoxInfoItem.SetMinDist(sal_False); 763cdf0e10cSrcweir rSet.Put( aBoxInfoItem ); 764cdf0e10cSrcweir } 765cdf0e10cSrcweir } 766cdf0e10cSrcweir break; 767cdf0e10cSrcweir } 768cdf0e10cSrcweir 769cdf0e10cSrcweir // If GetDefDialogParent is a dialog, it must be used 770cdf0e10cSrcweir // (style catalog) 771cdf0e10cSrcweir 772cdf0e10cSrcweir Window* pParent = Application::GetDefDialogParent(); 773cdf0e10cSrcweir if ( !pParent || !pParent->IsDialog() ) 774cdf0e10cSrcweir { 775cdf0e10cSrcweir // #107256# GetDefDialogParent currently doesn't return the window 776cdf0e10cSrcweir // that was set with SetDefDialogParent (but dynamically finds the 777cdf0e10cSrcweir // topmost parent of the focus window), so IsDialog above is FALSE 778cdf0e10cSrcweir // even if called from the style catalog. 779cdf0e10cSrcweir // -> Use NULL if a modal dialog is open, to enable the Dialog's 780cdf0e10cSrcweir // default parent handling. 781cdf0e10cSrcweir if ( Application::IsInModalMode() ) 782cdf0e10cSrcweir pParent = NULL; 783cdf0e10cSrcweir else 784cdf0e10cSrcweir pParent = pTabViewShell->GetDialogParent(); 785cdf0e10cSrcweir } 786cdf0e10cSrcweir 787cdf0e10cSrcweir pTabViewShell->SetInFormatDialog(sal_True); 788cdf0e10cSrcweir 789cdf0e10cSrcweir //CHINA001 pDlg = new ScStyleDlg( pParent, *pStyleSheet, nRsc ); 790cdf0e10cSrcweir ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); 791cdf0e10cSrcweir DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 792cdf0e10cSrcweir 793cdf0e10cSrcweir pDlg = pFact->CreateScStyleDlg( pParent, *pStyleSheet, nRsc, nRsc ); 794cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 795cdf0e10cSrcweir short nResult = pDlg->Execute(); 796cdf0e10cSrcweir pTabViewShell->SetInFormatDialog(sal_False); 797cdf0e10cSrcweir 798cdf0e10cSrcweir if ( nResult == RET_OK ) 799cdf0e10cSrcweir { 800cdf0e10cSrcweir const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); 801cdf0e10cSrcweir 802cdf0e10cSrcweir if ( pOutSet ) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir nRetMask = pStyleSheet->GetMask(); 805cdf0e10cSrcweir 806cdf0e10cSrcweir // #37034#/#37245# Attribut-Vergleiche (frueher in ModifyStyleSheet) 807cdf0e10cSrcweir // jetzt hier mit den alten Werten (Style ist schon veraendert) 808cdf0e10cSrcweir 809cdf0e10cSrcweir if ( SFX_STYLE_FAMILY_PARA == eFam ) 810cdf0e10cSrcweir { 811cdf0e10cSrcweir // pDoc->CellStyleChanged( *pStyleSheet, aOldSet ); 812cdf0e10cSrcweir 813cdf0e10cSrcweir SfxItemSet& rNewSet = pStyleSheet->GetItemSet(); 814cdf0e10cSrcweir sal_Bool bNumFormatChanged; 815cdf0e10cSrcweir if ( ScGlobal::CheckWidthInvalidate( 816cdf0e10cSrcweir bNumFormatChanged, aOldSet, rNewSet ) ) 817cdf0e10cSrcweir pDoc->InvalidateTextWidth( NULL, NULL, bNumFormatChanged ); 818cdf0e10cSrcweir 819cdf0e10cSrcweir SCTAB nTabCount = pDoc->GetTableCount(); 820cdf0e10cSrcweir for (SCTAB nTab=0; nTab<nTabCount; nTab++) 821cdf0e10cSrcweir if (pDoc->IsStreamValid(nTab)) 822cdf0e10cSrcweir pDoc->SetStreamValid(nTab, sal_False); 823cdf0e10cSrcweir 824cdf0e10cSrcweir sal_uLong nOldFormat = ((const SfxUInt32Item&)aOldSet. 825cdf0e10cSrcweir Get( ATTR_VALUE_FORMAT )).GetValue(); 826cdf0e10cSrcweir sal_uLong nNewFormat = ((const SfxUInt32Item&)rNewSet. 827cdf0e10cSrcweir Get( ATTR_VALUE_FORMAT )).GetValue(); 828cdf0e10cSrcweir if ( nNewFormat != nOldFormat ) 829cdf0e10cSrcweir { 830cdf0e10cSrcweir SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); 831cdf0e10cSrcweir const SvNumberformat* pOld = pFormatter->GetEntry( nOldFormat ); 832cdf0e10cSrcweir const SvNumberformat* pNew = pFormatter->GetEntry( nNewFormat ); 833cdf0e10cSrcweir if ( pOld && pNew && pOld->GetLanguage() != pNew->GetLanguage() ) 834cdf0e10cSrcweir rNewSet.Put( SvxLanguageItem( 835cdf0e10cSrcweir pNew->GetLanguage(), ATTR_LANGUAGE_FORMAT ) ); 836cdf0e10cSrcweir } 837cdf0e10cSrcweir 838cdf0e10cSrcweir pDoc->GetPool()->CellStyleCreated( pStyleSheet->GetName() ); 839cdf0e10cSrcweir } 840cdf0e10cSrcweir else 841cdf0e10cSrcweir { 842cdf0e10cSrcweir //! auch fuer Seitenvorlagen die Abfragen hier 843cdf0e10cSrcweir 844cdf0e10cSrcweir String aNewName = pStyleSheet->GetName(); 845cdf0e10cSrcweir if ( aNewName != aOldName && 846cdf0e10cSrcweir pDoc->RenamePageStyleInUse( aOldName, aNewName ) ) 847cdf0e10cSrcweir { 848cdf0e10cSrcweir rBindings.Invalidate( SID_STATUS_PAGESTYLE ); 849cdf0e10cSrcweir rBindings.Invalidate( FID_RESET_PRINTZOOM ); 850cdf0e10cSrcweir } 851cdf0e10cSrcweir 852cdf0e10cSrcweir pDoc->ModifyStyleSheet( *pStyleSheet, *pOutSet ); 853cdf0e10cSrcweir rBindings.Invalidate( FID_RESET_PRINTZOOM ); 854cdf0e10cSrcweir } 855cdf0e10cSrcweir 856cdf0e10cSrcweir pDocSh->SetDocumentModified(); 857cdf0e10cSrcweir 858cdf0e10cSrcweir if ( SFX_STYLE_FAMILY_PARA == eFam ) 859cdf0e10cSrcweir { 860cdf0e10cSrcweir pTabViewShell->UpdateNumberFormatter( pDoc, 861cdf0e10cSrcweir (const SvxNumberInfoItem&) 862cdf0e10cSrcweir *(pDocSh->GetItem(SID_ATTR_NUMBERFORMAT_INFO)) ); 863cdf0e10cSrcweir 864cdf0e10cSrcweir pTabViewShell->UpdateStyleSheetInUse( pStyleSheet ); 865cdf0e10cSrcweir pTabViewShell->InvalidateAttribs(); 866cdf0e10cSrcweir } 867cdf0e10cSrcweir 868cdf0e10cSrcweir aNewData.InitFromStyle( pStyleSheet ); 869cdf0e10cSrcweir bAddUndo = sal_True; 870cdf0e10cSrcweir } 871cdf0e10cSrcweir } 872cdf0e10cSrcweir else 873cdf0e10cSrcweir { 874cdf0e10cSrcweir if ( nSlotId == SID_STYLE_NEW ) 875cdf0e10cSrcweir pStylePool->Remove( pStyleSheet ); 876cdf0e10cSrcweir else 877cdf0e10cSrcweir { 878cdf0e10cSrcweir // falls zwischendurch etwas mit dem temporaer geaenderten 879cdf0e10cSrcweir // ItemSet gepainted wurde: 880cdf0e10cSrcweir pDocSh->PostPaintGridAll(); 881cdf0e10cSrcweir } 882cdf0e10cSrcweir } 883cdf0e10cSrcweir delete pDlg; 884cdf0e10cSrcweir } 885cdf0e10cSrcweir } 886cdf0e10cSrcweir 887cdf0e10cSrcweir // if ( nRetMask != 0xffff )// Irgendein Wert MUSS geliefert werden JN 888cdf0e10cSrcweir rReq.SetReturnValue( SfxUInt16Item( nSlotId, nRetMask ) ); 889cdf0e10cSrcweir 890cdf0e10cSrcweir // #96983# only stylist sends focus to sheet 891cdf0e10cSrcweir // if ( bGrabFocus ) 892cdf0e10cSrcweir // pTabViewShell->GetActiveWin()->GrabFocus(); 893cdf0e10cSrcweir 894cdf0e10cSrcweir if ( bAddUndo && bUndo) 895cdf0e10cSrcweir pDocSh->GetUndoManager()->AddUndoAction( 896cdf0e10cSrcweir new ScUndoModifyStyle( pDocSh, eFamily, aOldData, aNewData ) ); 897cdf0e10cSrcweir 898cdf0e10cSrcweir if ( bStyleToMarked ) 899cdf0e10cSrcweir { 900cdf0e10cSrcweir // call SetStyleSheetToMarked after adding the ScUndoModifyStyle, 901cdf0e10cSrcweir // so redo will find the modified style 902cdf0e10cSrcweir pTabViewShell->SetStyleSheetToMarked( (SfxStyleSheet*)pStyleSheet ); 903cdf0e10cSrcweir pTabViewShell->InvalidateAttribs(); 904cdf0e10cSrcweir } 905cdf0e10cSrcweir 906cdf0e10cSrcweir if ( bListAction ) 907cdf0e10cSrcweir pDocSh->GetUndoManager()->LeaveListAction(); 908cdf0e10cSrcweir } 909cdf0e10cSrcweir else 910cdf0e10cSrcweir { 911cdf0e10cSrcweir DBG_ERROR( "Unknown slot (ScViewShell::ExecuteStyle)" ); 912cdf0e10cSrcweir } 913cdf0e10cSrcweir } 914cdf0e10cSrcweir 915cdf0e10cSrcweir void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) 916cdf0e10cSrcweir { 917cdf0e10cSrcweir ScModule* pScMod = SC_MOD(); 918cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 919cdf0e10cSrcweir const SfxItemSet* pReqArgs = rReq.GetArgs(); 920cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 921cdf0e10cSrcweir 922cdf0e10cSrcweir pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox 923cdf0e10cSrcweir 924cdf0e10cSrcweir // Eingabe beenden 925cdf0e10cSrcweir if ( GetViewData()->HasEditView( GetViewData()->GetActivePart() ) ) 926cdf0e10cSrcweir { 927cdf0e10cSrcweir switch ( nSlot ) 928cdf0e10cSrcweir { 929cdf0e10cSrcweir case SID_NUMBER_TWODEC: 930cdf0e10cSrcweir case SID_NUMBER_SCIENTIFIC: 931cdf0e10cSrcweir case SID_NUMBER_DATE: 932cdf0e10cSrcweir case SID_NUMBER_CURRENCY: 933cdf0e10cSrcweir case SID_NUMBER_PERCENT: 934cdf0e10cSrcweir case SID_NUMBER_STANDARD: 935cdf0e10cSrcweir case SID_NUMBER_FORMAT: 936cdf0e10cSrcweir case SID_NUMBER_INCDEC: 937cdf0e10cSrcweir case SID_NUMBER_DECDEC: 938cdf0e10cSrcweir case FID_DEFINE_NAME: 939cdf0e10cSrcweir case FID_USE_NAME: 940cdf0e10cSrcweir case FID_INSERT_NAME: 941cdf0e10cSrcweir case SID_SPELL_DIALOG: 942cdf0e10cSrcweir case SID_HANGUL_HANJA_CONVERSION: 943cdf0e10cSrcweir 944cdf0e10cSrcweir pScMod->InputEnterHandler(); 945cdf0e10cSrcweir pTabViewShell->UpdateInputHandler(); 946cdf0e10cSrcweir break; 947cdf0e10cSrcweir 948cdf0e10cSrcweir default: 949cdf0e10cSrcweir break; 950cdf0e10cSrcweir } 951cdf0e10cSrcweir } 952cdf0e10cSrcweir 953cdf0e10cSrcweir switch ( nSlot ) 954cdf0e10cSrcweir { 955cdf0e10cSrcweir case SID_NUMBER_TWODEC: 956cdf0e10cSrcweir pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER, 4 ); // Standard+4 = #.##0,00 957cdf0e10cSrcweir rReq.Done(); 958cdf0e10cSrcweir break; 959cdf0e10cSrcweir case SID_NUMBER_SCIENTIFIC: 960cdf0e10cSrcweir pTabViewShell->SetNumberFormat( NUMBERFORMAT_SCIENTIFIC ); 961cdf0e10cSrcweir rReq.Done(); 962cdf0e10cSrcweir break; 963cdf0e10cSrcweir case SID_NUMBER_DATE: 964cdf0e10cSrcweir pTabViewShell->SetNumberFormat( NUMBERFORMAT_DATE ); 965cdf0e10cSrcweir rReq.Done(); 966cdf0e10cSrcweir break; 967cdf0e10cSrcweir case SID_NUMBER_TIME: 968cdf0e10cSrcweir pTabViewShell->SetNumberFormat( NUMBERFORMAT_TIME ); 969cdf0e10cSrcweir rReq.Done(); 970cdf0e10cSrcweir break; 971cdf0e10cSrcweir case SID_NUMBER_CURRENCY: 972cdf0e10cSrcweir pTabViewShell->SetNumberFormat( NUMBERFORMAT_CURRENCY ); 973cdf0e10cSrcweir rReq.Done(); 974cdf0e10cSrcweir break; 975cdf0e10cSrcweir case SID_NUMBER_PERCENT: 976cdf0e10cSrcweir pTabViewShell->SetNumberFormat( NUMBERFORMAT_PERCENT ); 977cdf0e10cSrcweir rReq.Done(); 978cdf0e10cSrcweir break; 979cdf0e10cSrcweir case SID_NUMBER_STANDARD: 980cdf0e10cSrcweir pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER ); 981cdf0e10cSrcweir rReq.Done(); 982cdf0e10cSrcweir break; 983cdf0e10cSrcweir case SID_NUMBER_INCDEC: 984cdf0e10cSrcweir pTabViewShell->ChangeNumFmtDecimals( sal_True ); 985cdf0e10cSrcweir rReq.Done(); 986cdf0e10cSrcweir break; 987cdf0e10cSrcweir case SID_NUMBER_DECDEC: 988cdf0e10cSrcweir pTabViewShell->ChangeNumFmtDecimals( sal_False ); 989cdf0e10cSrcweir rReq.Done(); 990cdf0e10cSrcweir break; 991cdf0e10cSrcweir 992cdf0e10cSrcweir case SID_NUMBER_FORMAT: 993cdf0e10cSrcweir if ( pReqArgs ) 994cdf0e10cSrcweir { 995cdf0e10cSrcweir const SfxPoolItem* pItem; 996cdf0e10cSrcweir if(pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET) 997cdf0e10cSrcweir { 998cdf0e10cSrcweir String aCode = ((const SfxStringItem*)pItem)->GetValue(); 999cdf0e10cSrcweir pTabViewShell->SetNumFmtByStr( aCode ); 1000cdf0e10cSrcweir } 1001cdf0e10cSrcweir } 1002cdf0e10cSrcweir break; 1003cdf0e10cSrcweir 1004cdf0e10cSrcweir case SID_ATTR_NUMBERFORMAT_VALUE: 1005cdf0e10cSrcweir if ( pReqArgs ) 1006cdf0e10cSrcweir { 1007cdf0e10cSrcweir const SfxPoolItem* pItem; 1008cdf0e10cSrcweir if ( pReqArgs->GetItemState( ATTR_VALUE_FORMAT, sal_True, &pItem ) == SFX_ITEM_SET ) 1009cdf0e10cSrcweir { 1010cdf0e10cSrcweir // We have to accomplish this using ApplyAttributes() 1011cdf0e10cSrcweir // because we also need the language information to be 1012cdf0e10cSrcweir // considered. 1013cdf0e10cSrcweir const SfxItemSet& rOldSet = 1014cdf0e10cSrcweir pTabViewShell->GetSelectionPattern()->GetItemSet(); 1015cdf0e10cSrcweir SfxItemPool* pDocPool = GetViewData()->GetDocument()->GetPool(); 1016cdf0e10cSrcweir SfxItemSet aNewSet( *pDocPool, ATTR_PATTERN_START, ATTR_PATTERN_END ); 1017cdf0e10cSrcweir aNewSet.Put( *pItem ); 1018cdf0e10cSrcweir pTabViewShell->ApplyAttributes( &aNewSet, &rOldSet, sal_True ); 1019cdf0e10cSrcweir } 1020cdf0e10cSrcweir } 1021cdf0e10cSrcweir break; 1022cdf0e10cSrcweir 1023cdf0e10cSrcweir default: 1024cdf0e10cSrcweir DBG_ERROR("falscher Slot bei ExecuteEdit"); 1025cdf0e10cSrcweir break; 1026cdf0e10cSrcweir } 1027cdf0e10cSrcweir } 1028cdf0e10cSrcweir 1029cdf0e10cSrcweir 1030cdf0e10cSrcweir //------------------------------------------------------------------ 1031cdf0e10cSrcweir 1032cdf0e10cSrcweir #define APPLY_HOR_JUSTIFY(j) \ 1033cdf0e10cSrcweir { \ 1034cdf0e10cSrcweir if ( !pHorJustify || (eHorJustify != (j) ) ) \ 1035cdf0e10cSrcweir pTabViewShell->ApplyAttr( SvxHorJustifyItem( (j) ) ); \ 1036cdf0e10cSrcweir else \ 1037cdf0e10cSrcweir pTabViewShell->ApplyAttr( SvxHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD ) ); \ 1038cdf0e10cSrcweir } 1039cdf0e10cSrcweir 1040cdf0e10cSrcweir #define APPLY_VER_JUSTIFY(j) \ 1041cdf0e10cSrcweir { \ 1042cdf0e10cSrcweir if ( !pVerJustify || (eVerJustify != (j) ) ) \ 1043cdf0e10cSrcweir pTabViewShell->ApplyAttr( SvxVerJustifyItem( (j) ) ); \ 1044cdf0e10cSrcweir else \ 1045cdf0e10cSrcweir pTabViewShell->ApplyAttr( SvxVerJustifyItem( SVX_VER_JUSTIFY_STANDARD ) ); \ 1046cdf0e10cSrcweir } 1047cdf0e10cSrcweir 1048cdf0e10cSrcweir void ScFormatShell::ExecuteAlignment( SfxRequest& rReq ) 1049cdf0e10cSrcweir { 1050cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 1051cdf0e10cSrcweir SfxBindings& rBindings = pViewData->GetBindings(); 1052cdf0e10cSrcweir const SfxItemSet* pSet = rReq.GetArgs(); 1053cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 1054cdf0e10cSrcweir 1055cdf0e10cSrcweir pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox 1056cdf0e10cSrcweir 1057cdf0e10cSrcweir switch( nSlot ) 1058cdf0e10cSrcweir { 1059cdf0e10cSrcweir // pseudo slots for Format menu 1060cdf0e10cSrcweir case SID_ALIGN_ANY_HDEFAULT: 1061cdf0e10cSrcweir case SID_ALIGN_ANY_LEFT: 1062cdf0e10cSrcweir case SID_ALIGN_ANY_HCENTER: 1063cdf0e10cSrcweir case SID_ALIGN_ANY_RIGHT: 1064cdf0e10cSrcweir case SID_ALIGN_ANY_JUSTIFIED: 1065cdf0e10cSrcweir pTabViewShell->ApplyAttr( SvxHorJustifyItem( lclConvertSlotToHAlign( nSlot ), ATTR_HOR_JUSTIFY ) ); 1066cdf0e10cSrcweir break; 1067cdf0e10cSrcweir case SID_ALIGN_ANY_VDEFAULT: 1068cdf0e10cSrcweir case SID_ALIGN_ANY_TOP: 1069cdf0e10cSrcweir case SID_ALIGN_ANY_VCENTER: 1070cdf0e10cSrcweir case SID_ALIGN_ANY_BOTTOM: 1071cdf0e10cSrcweir pTabViewShell->ApplyAttr( SvxVerJustifyItem( lclConvertSlotToVAlign( nSlot ), ATTR_VER_JUSTIFY ) ); 1072cdf0e10cSrcweir break; 1073cdf0e10cSrcweir 1074cdf0e10cSrcweir default: 1075cdf0e10cSrcweir if( pSet ) 1076cdf0e10cSrcweir { 1077cdf0e10cSrcweir const SfxPoolItem* pItem = NULL; 1078cdf0e10cSrcweir if( pSet->GetItemState(GetPool().GetWhich(nSlot), sal_True, &pItem ) == SFX_ITEM_SET ) 1079cdf0e10cSrcweir { 1080cdf0e10cSrcweir 1081cdf0e10cSrcweir switch ( nSlot ) 1082cdf0e10cSrcweir { 1083cdf0e10cSrcweir case SID_ATTR_ALIGN_HOR_JUSTIFY: 1084cdf0e10cSrcweir case SID_ATTR_ALIGN_VER_JUSTIFY: 1085cdf0e10cSrcweir case SID_ATTR_ALIGN_INDENT: 1086cdf0e10cSrcweir case SID_ATTR_ALIGN_HYPHENATION: 1087cdf0e10cSrcweir case SID_ATTR_ALIGN_DEGREES: 1088cdf0e10cSrcweir case SID_ATTR_ALIGN_LOCKPOS: 1089cdf0e10cSrcweir case SID_ATTR_ALIGN_MARGIN: 1090cdf0e10cSrcweir case SID_ATTR_ALIGN_STACKED: 1091cdf0e10cSrcweir pTabViewShell->ApplyAttr( *pItem ); 1092cdf0e10cSrcweir break; 1093cdf0e10cSrcweir 1094cdf0e10cSrcweir case SID_H_ALIGNCELL: 1095cdf0e10cSrcweir { 1096cdf0e10cSrcweir SvxCellHorJustify eJust = (SvxCellHorJustify)((const SvxHorJustifyItem*)pItem)->GetValue(); 1097cdf0e10cSrcweir // #i78476# update alignment of text in cell edit mode 1098cdf0e10cSrcweir pTabViewShell->UpdateInputHandlerCellAdjust( eJust ); 1099cdf0e10cSrcweir pTabViewShell->ApplyAttr( SvxHorJustifyItem( eJust, ATTR_HOR_JUSTIFY ) ); 1100cdf0e10cSrcweir } 1101cdf0e10cSrcweir break; 1102cdf0e10cSrcweir case SID_V_ALIGNCELL: 1103cdf0e10cSrcweir pTabViewShell->ApplyAttr( SvxVerJustifyItem( (SvxCellVerJustify)((const SvxVerJustifyItem*)pItem)->GetValue(), ATTR_VER_JUSTIFY ) ); 1104cdf0e10cSrcweir break; 1105cdf0e10cSrcweir default: 1106cdf0e10cSrcweir DBG_ERROR( "ExecuteAlignment: invalid slot" ); 1107cdf0e10cSrcweir return; 1108cdf0e10cSrcweir } 1109cdf0e10cSrcweir } 1110cdf0e10cSrcweir } 1111cdf0e10cSrcweir } 1112cdf0e10cSrcweir 1113cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNLEFT ); 1114cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNRIGHT ); 1115cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNCENTERHOR ); 1116cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNBLOCK ); 1117cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNTOP ); 1118cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNBOTTOM ); 1119cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGNCENTERVER ); 1120cdf0e10cSrcweir rBindings.Invalidate( SID_V_ALIGNCELL ); 1121cdf0e10cSrcweir rBindings.Invalidate( SID_H_ALIGNCELL ); 1122cdf0e10cSrcweir // pseudo slots for Format menu 1123cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_HDEFAULT ); 1124cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_LEFT ); 1125cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_HCENTER ); 1126cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_RIGHT ); 1127cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED ); 1128cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_VDEFAULT ); 1129cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_TOP ); 1130cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_VCENTER ); 1131cdf0e10cSrcweir rBindings.Invalidate( SID_ALIGN_ANY_BOTTOM ); 1132cdf0e10cSrcweir rBindings.Update(); 1133cdf0e10cSrcweir 1134cdf0e10cSrcweir if( ! rReq.IsAPI() ) 1135cdf0e10cSrcweir rReq.Done(); 1136cdf0e10cSrcweir } 1137cdf0e10cSrcweir 1138cdf0e10cSrcweir void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) 1139cdf0e10cSrcweir { 1140cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 1141cdf0e10cSrcweir SfxBindings& rBindings = pViewData->GetBindings(); 1142cdf0e10cSrcweir const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern(); 1143cdf0e10cSrcweir const SfxItemSet* pSet = rReq.GetArgs(); 1144cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 1145cdf0e10cSrcweir SfxAllItemSet* pNewSet = 0; 1146cdf0e10cSrcweir 1147cdf0e10cSrcweir pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox 1148cdf0e10cSrcweir 1149cdf0e10cSrcweir if ( (nSlot == SID_ATTR_CHAR_WEIGHT) 1150cdf0e10cSrcweir ||(nSlot == SID_ATTR_CHAR_POSTURE) 1151cdf0e10cSrcweir ||(nSlot == SID_ATTR_CHAR_UNDERLINE) 1152cdf0e10cSrcweir ||(nSlot == SID_ULINE_VAL_NONE) 1153cdf0e10cSrcweir ||(nSlot == SID_ULINE_VAL_SINGLE) 1154cdf0e10cSrcweir ||(nSlot == SID_ULINE_VAL_DOUBLE) 1155cdf0e10cSrcweir ||(nSlot == SID_ULINE_VAL_DOTTED) ) 1156cdf0e10cSrcweir { 1157cdf0e10cSrcweir pNewSet = new SfxAllItemSet( GetPool() ); 1158cdf0e10cSrcweir 1159cdf0e10cSrcweir switch ( nSlot ) 1160cdf0e10cSrcweir { 1161cdf0e10cSrcweir case SID_ATTR_CHAR_WEIGHT: 1162cdf0e10cSrcweir { 1163cdf0e10cSrcweir // #i78017 establish the same behaviour as in Writer 1164cdf0e10cSrcweir sal_uInt8 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX; 1165cdf0e10cSrcweir 1166cdf0e10cSrcweir SfxItemPool& rPool = GetPool(); 1167cdf0e10cSrcweir SvxScriptSetItem aSetItem( nSlot, rPool ); 1168cdf0e10cSrcweir if ( pSet ) 1169cdf0e10cSrcweir aSetItem.PutItemForScriptType( nScript, pSet->Get( ATTR_FONT_WEIGHT ) ); 1170cdf0e10cSrcweir else 1171cdf0e10cSrcweir { 1172cdf0e10cSrcweir // toggle manually 1173cdf0e10cSrcweir 1174cdf0e10cSrcweir FontWeight eWeight = WEIGHT_BOLD; 1175cdf0e10cSrcweir SvxScriptSetItem aOldSetItem( nSlot, rPool ); 1176cdf0e10cSrcweir aOldSetItem.GetItemSet().Put( pAttrs->GetItemSet(), sal_False ); 1177cdf0e10cSrcweir const SfxPoolItem* pCore = aOldSetItem.GetItemOfScript( nScript ); 1178cdf0e10cSrcweir if ( pCore && ((const SvxWeightItem*)pCore)->GetWeight() == WEIGHT_BOLD ) 1179cdf0e10cSrcweir eWeight = WEIGHT_NORMAL; 1180cdf0e10cSrcweir 1181cdf0e10cSrcweir aSetItem.PutItemForScriptType( nScript, SvxWeightItem( eWeight, ATTR_FONT_WEIGHT ) ); 1182cdf0e10cSrcweir } 1183cdf0e10cSrcweir pTabViewShell->ApplyUserItemSet( aSetItem.GetItemSet() ); 1184cdf0e10cSrcweir pNewSet->Put( aSetItem.GetItemSet(), sal_False ); 1185cdf0e10cSrcweir } 1186cdf0e10cSrcweir break; 1187cdf0e10cSrcweir 1188cdf0e10cSrcweir case SID_ATTR_CHAR_POSTURE: 1189cdf0e10cSrcweir { 1190cdf0e10cSrcweir // #i78017 establish the same behaviour as in Writer 1191cdf0e10cSrcweir sal_uInt8 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX; 1192cdf0e10cSrcweir 1193cdf0e10cSrcweir SfxItemPool& rPool = GetPool(); 1194cdf0e10cSrcweir SvxScriptSetItem aSetItem( nSlot, rPool ); 1195cdf0e10cSrcweir if ( pSet ) 1196cdf0e10cSrcweir aSetItem.PutItemForScriptType( nScript, pSet->Get( ATTR_FONT_POSTURE ) ); 1197cdf0e10cSrcweir else 1198cdf0e10cSrcweir { 1199cdf0e10cSrcweir // toggle manually 1200cdf0e10cSrcweir 1201cdf0e10cSrcweir FontItalic eItalic = ITALIC_NORMAL; 1202cdf0e10cSrcweir SvxScriptSetItem aOldSetItem( nSlot, rPool ); 1203cdf0e10cSrcweir aOldSetItem.GetItemSet().Put( pAttrs->GetItemSet(), sal_False ); 1204cdf0e10cSrcweir const SfxPoolItem* pCore = aOldSetItem.GetItemOfScript( nScript ); 1205cdf0e10cSrcweir if ( pCore && ((const SvxPostureItem*)pCore)->GetPosture() == ITALIC_NORMAL ) 1206cdf0e10cSrcweir eItalic = ITALIC_NONE; 1207cdf0e10cSrcweir 1208cdf0e10cSrcweir aSetItem.PutItemForScriptType( nScript, SvxPostureItem( eItalic, ATTR_FONT_POSTURE ) ); 1209cdf0e10cSrcweir } 1210cdf0e10cSrcweir pTabViewShell->ApplyUserItemSet( aSetItem.GetItemSet() ); 1211cdf0e10cSrcweir pNewSet->Put( aSetItem.GetItemSet(), sal_False ); 1212cdf0e10cSrcweir } 1213cdf0e10cSrcweir break; 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir case SID_ATTR_CHAR_UNDERLINE: 1216cdf0e10cSrcweir { 1217cdf0e10cSrcweir FontUnderline eUnderline; 1218cdf0e10cSrcweir 1219cdf0e10cSrcweir if( pSet ) 1220cdf0e10cSrcweir { 1221cdf0e10cSrcweir const SfxPoolItem& rUnderline = pSet->Get( ATTR_FONT_UNDERLINE ); 1222cdf0e10cSrcweir 1223cdf0e10cSrcweir if( rUnderline.ISA(SvxUnderlineItem) ) 1224cdf0e10cSrcweir { 1225cdf0e10cSrcweir pTabViewShell->ApplyAttr( rUnderline ); 1226cdf0e10cSrcweir pNewSet->Put( rUnderline,rUnderline.Which() ); 1227cdf0e10cSrcweir } 1228cdf0e10cSrcweir else if ( rUnderline.ISA(SvxTextLineItem) ) 1229cdf0e10cSrcweir { 1230cdf0e10cSrcweir // #i106580# also allow SvxTextLineItem (base class of SvxUnderlineItem) 1231cdf0e10cSrcweir const SvxTextLineItem& rTextLineItem = static_cast<const SvxTextLineItem&>(rUnderline); 1232cdf0e10cSrcweir SvxUnderlineItem aNewItem( rTextLineItem.GetLineStyle(), rTextLineItem.Which() ); 1233cdf0e10cSrcweir aNewItem.SetColor( rTextLineItem.GetColor() ); 1234cdf0e10cSrcweir pTabViewShell->ApplyAttr( aNewItem ); 1235cdf0e10cSrcweir pNewSet->Put( aNewItem, aNewItem.Which() ); 1236cdf0e10cSrcweir } 1237cdf0e10cSrcweir } 1238cdf0e10cSrcweir else 1239cdf0e10cSrcweir { 1240cdf0e10cSrcweir SvxUnderlineItem aUnderline( (const SvxUnderlineItem&) 1241cdf0e10cSrcweir pAttrs->GetItem( 1242cdf0e10cSrcweir ATTR_FONT_UNDERLINE ) ); 1243cdf0e10cSrcweir eUnderline = (UNDERLINE_NONE != aUnderline.GetLineStyle()) 1244cdf0e10cSrcweir ? UNDERLINE_NONE 1245cdf0e10cSrcweir : UNDERLINE_SINGLE; 1246cdf0e10cSrcweir aUnderline.SetLineStyle( eUnderline ); 1247cdf0e10cSrcweir pTabViewShell->ApplyAttr( aUnderline ); 1248cdf0e10cSrcweir pNewSet->Put( aUnderline,aUnderline.Which() ); 1249cdf0e10cSrcweir } 1250cdf0e10cSrcweir } 1251cdf0e10cSrcweir break; 1252cdf0e10cSrcweir 1253cdf0e10cSrcweir case SID_ULINE_VAL_NONE: 1254cdf0e10cSrcweir pTabViewShell->ApplyAttr( SvxUnderlineItem( UNDERLINE_NONE, ATTR_FONT_UNDERLINE ) ); 1255cdf0e10cSrcweir break; 1256cdf0e10cSrcweir case SID_ULINE_VAL_SINGLE: // Toggles 1257cdf0e10cSrcweir case SID_ULINE_VAL_DOUBLE: 1258cdf0e10cSrcweir case SID_ULINE_VAL_DOTTED: 1259cdf0e10cSrcweir { 1260cdf0e10cSrcweir FontUnderline eOld = ((const SvxUnderlineItem&) 1261cdf0e10cSrcweir pAttrs->GetItem(ATTR_FONT_UNDERLINE)).GetLineStyle(); 1262cdf0e10cSrcweir FontUnderline eNew = eOld; 1263cdf0e10cSrcweir switch (nSlot) 1264cdf0e10cSrcweir { 1265cdf0e10cSrcweir case SID_ULINE_VAL_SINGLE: 1266cdf0e10cSrcweir eNew = ( eOld == UNDERLINE_SINGLE ) ? UNDERLINE_NONE : UNDERLINE_SINGLE; 1267cdf0e10cSrcweir break; 1268cdf0e10cSrcweir case SID_ULINE_VAL_DOUBLE: 1269cdf0e10cSrcweir eNew = ( eOld == UNDERLINE_DOUBLE ) ? UNDERLINE_NONE : UNDERLINE_DOUBLE; 1270cdf0e10cSrcweir break; 1271cdf0e10cSrcweir case SID_ULINE_VAL_DOTTED: 1272cdf0e10cSrcweir eNew = ( eOld == UNDERLINE_DOTTED ) ? UNDERLINE_NONE : UNDERLINE_DOTTED; 1273cdf0e10cSrcweir break; 1274cdf0e10cSrcweir } 1275cdf0e10cSrcweir pTabViewShell->ApplyAttr( SvxUnderlineItem( eNew, ATTR_FONT_UNDERLINE ) ); 1276cdf0e10cSrcweir } 1277cdf0e10cSrcweir break; 1278cdf0e10cSrcweir 1279cdf0e10cSrcweir default: 1280cdf0e10cSrcweir break; 1281cdf0e10cSrcweir } 1282cdf0e10cSrcweir rBindings.Invalidate( nSlot ); 1283cdf0e10cSrcweir } 1284cdf0e10cSrcweir else 1285cdf0e10cSrcweir { 1286cdf0e10cSrcweir /* 1287cdf0e10cSrcweir * "Selbstgemachte" RadioButton-Funktionalitaet 1288cdf0e10cSrcweir * Beim Toggle gibt es den Standard-State, d.h. kein 1289cdf0e10cSrcweir * Button ist gedrueckt 1290cdf0e10cSrcweir */ 1291cdf0e10cSrcweir 1292cdf0e10cSrcweir const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); 1293cdf0e10cSrcweir const SfxPoolItem* pItem = NULL; 1294cdf0e10cSrcweir const SvxHorJustifyItem* pHorJustify = NULL; 1295cdf0e10cSrcweir const SvxVerJustifyItem* pVerJustify = NULL; 1296cdf0e10cSrcweir SvxCellHorJustify eHorJustify = SVX_HOR_JUSTIFY_STANDARD; 1297cdf0e10cSrcweir SvxCellVerJustify eVerJustify = SVX_VER_JUSTIFY_STANDARD; 1298cdf0e10cSrcweir 1299cdf0e10cSrcweir if (rAttrSet.GetItemState(ATTR_HOR_JUSTIFY, sal_True,&pItem ) == SFX_ITEM_SET) 1300cdf0e10cSrcweir { 1301cdf0e10cSrcweir pHorJustify = (const SvxHorJustifyItem*)pItem; 1302cdf0e10cSrcweir eHorJustify = SvxCellHorJustify( pHorJustify->GetValue() ); 1303cdf0e10cSrcweir } 1304cdf0e10cSrcweir if (rAttrSet.GetItemState(ATTR_VER_JUSTIFY, sal_True,&pItem ) == SFX_ITEM_SET) 1305cdf0e10cSrcweir { 1306cdf0e10cSrcweir pVerJustify = (const SvxVerJustifyItem*)pItem; 1307cdf0e10cSrcweir eVerJustify = SvxCellVerJustify( pVerJustify->GetValue() ); 1308cdf0e10cSrcweir } 1309cdf0e10cSrcweir 1310cdf0e10cSrcweir switch ( nSlot ) 1311cdf0e10cSrcweir { 1312cdf0e10cSrcweir case SID_ALIGNLEFT: 1313cdf0e10cSrcweir rReq.SetSlot( SID_H_ALIGNCELL ); 1314cdf0e10cSrcweir rReq.AppendItem( SvxHorJustifyItem( 1315cdf0e10cSrcweir !pHorJustify || (eHorJustify != SVX_HOR_JUSTIFY_LEFT) ? 1316cdf0e10cSrcweir SVX_HOR_JUSTIFY_LEFT : SVX_HOR_JUSTIFY_STANDARD, SID_H_ALIGNCELL ) ); 1317cdf0e10cSrcweir ExecuteSlot( rReq, GetInterface() ); 1318cdf0e10cSrcweir return; 1319cdf0e10cSrcweir // APPLY_HOR_JUSTIFY( SVX_HOR_JUSTIFY_LEFT ); 1320cdf0e10cSrcweir //break; 1321cdf0e10cSrcweir 1322cdf0e10cSrcweir case SID_ALIGNRIGHT: 1323cdf0e10cSrcweir rReq.SetSlot( SID_H_ALIGNCELL ); 1324cdf0e10cSrcweir rReq.AppendItem( SvxHorJustifyItem( 1325cdf0e10cSrcweir !pHorJustify || (eHorJustify != SVX_HOR_JUSTIFY_RIGHT) ? 1326cdf0e10cSrcweir SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_STANDARD, SID_H_ALIGNCELL ) ); 1327cdf0e10cSrcweir ExecuteSlot( rReq, GetInterface() ); 1328cdf0e10cSrcweir return; 1329cdf0e10cSrcweir // APPLY_HOR_JUSTIFY( SVX_HOR_JUSTIFY_RIGHT ); 1330cdf0e10cSrcweir //break; 1331cdf0e10cSrcweir 1332cdf0e10cSrcweir case SID_ALIGNCENTERHOR: 1333cdf0e10cSrcweir rReq.SetSlot( SID_H_ALIGNCELL ); 1334cdf0e10cSrcweir rReq.AppendItem( SvxHorJustifyItem( 1335cdf0e10cSrcweir !pHorJustify || (eHorJustify != SVX_HOR_JUSTIFY_CENTER) ? 1336cdf0e10cSrcweir SVX_HOR_JUSTIFY_CENTER : SVX_HOR_JUSTIFY_STANDARD, SID_H_ALIGNCELL ) ); 1337cdf0e10cSrcweir ExecuteSlot( rReq, GetInterface() ); 1338cdf0e10cSrcweir return; 1339cdf0e10cSrcweir // APPLY_HOR_JUSTIFY( SVX_HOR_JUSTIFY_CENTER ); 1340cdf0e10cSrcweir //break; 1341cdf0e10cSrcweir 1342cdf0e10cSrcweir case SID_ALIGNBLOCK: 1343cdf0e10cSrcweir rReq.SetSlot( SID_H_ALIGNCELL ); 1344cdf0e10cSrcweir rReq.AppendItem( SvxHorJustifyItem( 1345cdf0e10cSrcweir !pHorJustify || (eHorJustify != SVX_HOR_JUSTIFY_BLOCK) ? 1346cdf0e10cSrcweir SVX_HOR_JUSTIFY_BLOCK : SVX_HOR_JUSTIFY_STANDARD, SID_H_ALIGNCELL ) ); 1347cdf0e10cSrcweir ExecuteSlot( rReq, GetInterface() ); 1348cdf0e10cSrcweir return; 1349cdf0e10cSrcweir // APPLY_HOR_JUSTIFY( SVX_HOR_JUSTIFY_BLOCK ); 1350cdf0e10cSrcweir //break; 1351cdf0e10cSrcweir 1352cdf0e10cSrcweir case SID_ALIGNTOP: 1353cdf0e10cSrcweir rReq.SetSlot( SID_V_ALIGNCELL ); 1354cdf0e10cSrcweir rReq.AppendItem( SvxVerJustifyItem( 1355cdf0e10cSrcweir !pVerJustify || (eVerJustify != SVX_VER_JUSTIFY_TOP) ? 1356cdf0e10cSrcweir SVX_VER_JUSTIFY_TOP : SVX_VER_JUSTIFY_STANDARD, SID_V_ALIGNCELL ) ); 1357cdf0e10cSrcweir ExecuteSlot( rReq, GetInterface() ); 1358cdf0e10cSrcweir return; 1359cdf0e10cSrcweir // APPLY_VER_JUSTIFY( SVX_VER_JUSTIFY_TOP ); 1360cdf0e10cSrcweir //break; 1361cdf0e10cSrcweir 1362cdf0e10cSrcweir case SID_ALIGNBOTTOM: 1363cdf0e10cSrcweir rReq.SetSlot( SID_V_ALIGNCELL ); 1364cdf0e10cSrcweir rReq.AppendItem( SvxVerJustifyItem( 1365cdf0e10cSrcweir !pVerJustify || (eVerJustify != SVX_VER_JUSTIFY_BOTTOM) ? 1366cdf0e10cSrcweir SVX_VER_JUSTIFY_BOTTOM : SVX_VER_JUSTIFY_STANDARD, SID_V_ALIGNCELL ) ); 1367cdf0e10cSrcweir ExecuteSlot( rReq, GetInterface() ); 1368cdf0e10cSrcweir return; 1369cdf0e10cSrcweir // APPLY_VER_JUSTIFY( SVX_VER_JUSTIFY_BOTTOM ); 1370cdf0e10cSrcweir //break; 1371cdf0e10cSrcweir 1372cdf0e10cSrcweir case SID_ALIGNCENTERVER: 1373cdf0e10cSrcweir rReq.SetSlot( SID_V_ALIGNCELL ); 1374cdf0e10cSrcweir rReq.AppendItem( SvxVerJustifyItem( 1375cdf0e10cSrcweir !pVerJustify || (eVerJustify != SVX_VER_JUSTIFY_CENTER) ? 1376cdf0e10cSrcweir SVX_VER_JUSTIFY_CENTER : SVX_VER_JUSTIFY_STANDARD, SID_V_ALIGNCELL ) ); 1377cdf0e10cSrcweir ExecuteSlot( rReq, GetInterface() ); 1378cdf0e10cSrcweir return; 1379cdf0e10cSrcweir // APPLY_VER_JUSTIFY( SVX_VER_JUSTIFY_CENTER ); 1380cdf0e10cSrcweir //break; 1381cdf0e10cSrcweir 1382cdf0e10cSrcweir default: 1383cdf0e10cSrcweir break; 1384cdf0e10cSrcweir } 1385cdf0e10cSrcweir 1386cdf0e10cSrcweir } 1387cdf0e10cSrcweir 1388cdf0e10cSrcweir rBindings.Update(); 1389cdf0e10cSrcweir // rReq.Done(); 1390cdf0e10cSrcweir 1391cdf0e10cSrcweir if( pNewSet ) 1392cdf0e10cSrcweir { 1393cdf0e10cSrcweir rReq.Done( *pNewSet ); 1394cdf0e10cSrcweir delete pNewSet; 1395cdf0e10cSrcweir } 1396cdf0e10cSrcweir else 1397cdf0e10cSrcweir { 1398cdf0e10cSrcweir rReq.Done(); 1399cdf0e10cSrcweir } 1400cdf0e10cSrcweir 1401cdf0e10cSrcweir } 1402cdf0e10cSrcweir 1403cdf0e10cSrcweir #undef APPLY_HOR_JUSTIFY 1404cdf0e10cSrcweir #undef APPLY_VER_JUSTIFY 1405cdf0e10cSrcweir 1406cdf0e10cSrcweir //------------------------------------------------------------------ 1407cdf0e10cSrcweir 1408cdf0e10cSrcweir void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) 1409cdf0e10cSrcweir { 1410cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 1411cdf0e10cSrcweir SfxBindings& rBindings = pViewData->GetBindings(); 1412cdf0e10cSrcweir const SfxItemSet* pNewAttrs = rReq.GetArgs(); 1413cdf0e10cSrcweir 1414cdf0e10cSrcweir pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox 1415cdf0e10cSrcweir 1416cdf0e10cSrcweir if ( !pNewAttrs ) 1417cdf0e10cSrcweir { 1418cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 1419cdf0e10cSrcweir 1420cdf0e10cSrcweir switch ( nSlot ) 1421cdf0e10cSrcweir { 1422cdf0e10cSrcweir case SID_ATTR_CHAR_FONT: 1423cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT: 1424cdf0e10cSrcweir pTabViewShell->ExecuteCellFormatDlg( rReq, TP_FONT ); // wenn ToolBar vertikal 1425cdf0e10cSrcweir break; 1426cdf0e10cSrcweir 1427cdf0e10cSrcweir case SID_ATTR_ALIGN_LINEBREAK: // ohne Parameter als Toggle 1428cdf0e10cSrcweir { 1429cdf0e10cSrcweir const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern(); 1430cdf0e10cSrcweir sal_Bool bOld = ((const SfxBoolItem&)pAttrs->GetItem(ATTR_LINEBREAK)).GetValue(); 1431cdf0e10cSrcweir SfxBoolItem aBreakItem( ATTR_LINEBREAK, !bOld ); 1432cdf0e10cSrcweir pTabViewShell->ApplyAttr( aBreakItem ); 1433cdf0e10cSrcweir 1434cdf0e10cSrcweir SfxAllItemSet aNewSet( GetPool() ); 1435cdf0e10cSrcweir aNewSet.Put( aBreakItem,aBreakItem.Which() ); 1436cdf0e10cSrcweir rReq.Done( aNewSet ); 1437cdf0e10cSrcweir 1438cdf0e10cSrcweir rBindings.Invalidate( nSlot ); 1439cdf0e10cSrcweir } 1440cdf0e10cSrcweir break; 1441cdf0e10cSrcweir 1442cdf0e10cSrcweir case SID_BACKGROUND_COLOR: 1443cdf0e10cSrcweir { 1444cdf0e10cSrcweir // SID_BACKGROUND_COLOR without arguments -> set transparent background 1445cdf0e10cSrcweir 1446cdf0e10cSrcweir SvxBrushItem aBrushItem( (const SvxBrushItem&) 1447cdf0e10cSrcweir pTabViewShell->GetSelectionPattern()-> 1448cdf0e10cSrcweir GetItem( ATTR_BACKGROUND ) ); 1449cdf0e10cSrcweir 1450cdf0e10cSrcweir aBrushItem.SetColor( COL_TRANSPARENT ); 1451cdf0e10cSrcweir 1452cdf0e10cSrcweir pTabViewShell->ApplyAttr( aBrushItem ); 1453cdf0e10cSrcweir } 1454cdf0e10cSrcweir break; 1455cdf0e10cSrcweir } 1456cdf0e10cSrcweir } 1457cdf0e10cSrcweir else 1458cdf0e10cSrcweir { 1459cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 1460cdf0e10cSrcweir 1461cdf0e10cSrcweir switch ( nSlot ) 1462cdf0e10cSrcweir { 1463cdf0e10cSrcweir case SID_ATTR_CHAR_OVERLINE: 1464cdf0e10cSrcweir case SID_ATTR_CHAR_STRIKEOUT: 1465cdf0e10cSrcweir case SID_ATTR_ALIGN_LINEBREAK: 1466cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR: 1467cdf0e10cSrcweir case SID_ATTR_CHAR_CONTOUR: 1468cdf0e10cSrcweir case SID_ATTR_CHAR_SHADOWED: 1469cdf0e10cSrcweir case SID_ATTR_CHAR_RELIEF: 1470cdf0e10cSrcweir case SID_SCATTR_PROTECTION : 1471cdf0e10cSrcweir pTabViewShell->ApplyAttr( pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich( nSlot ) ) ); 1472cdf0e10cSrcweir rBindings.Invalidate( nSlot ); 1473cdf0e10cSrcweir rBindings.Update( nSlot ); 1474cdf0e10cSrcweir break; 1475cdf0e10cSrcweir 1476cdf0e10cSrcweir case SID_ATTR_CHAR_FONT: 1477cdf0e10cSrcweir case SID_ATTR_CHAR_FONTHEIGHT: 1478cdf0e10cSrcweir { 1479cdf0e10cSrcweir // #i78017 establish the same behaviour as in Writer 1480cdf0e10cSrcweir sal_uInt8 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX; 1481cdf0e10cSrcweir if (nSlot == SID_ATTR_CHAR_FONT) 1482cdf0e10cSrcweir nScript = pTabViewShell->GetSelectionScriptType(); 1483cdf0e10cSrcweir 1484cdf0e10cSrcweir SfxItemPool& rPool = GetPool(); 1485cdf0e10cSrcweir SvxScriptSetItem aSetItem( nSlot, rPool ); 1486cdf0e10cSrcweir sal_uInt16 nWhich = rPool.GetWhich( nSlot ); 1487cdf0e10cSrcweir aSetItem.PutItemForScriptType( nScript, pNewAttrs->Get( nWhich ) ); 1488cdf0e10cSrcweir 1489cdf0e10cSrcweir pTabViewShell->ApplyUserItemSet( aSetItem.GetItemSet() ); 1490cdf0e10cSrcweir 1491cdf0e10cSrcweir rBindings.Invalidate( nSlot ); 1492cdf0e10cSrcweir rBindings.Update( nSlot ); 1493cdf0e10cSrcweir } 1494cdf0e10cSrcweir break; 1495cdf0e10cSrcweir 1496cdf0e10cSrcweir case SID_FRAME_LINESTYLE: 1497cdf0e10cSrcweir { 1498cdf0e10cSrcweir // Default-Linie aktualisieren 1499cdf0e10cSrcweir const SvxBorderLine* pLine = 1500cdf0e10cSrcweir ((const SvxLineItem&) 1501cdf0e10cSrcweir pNewAttrs->Get( SID_FRAME_LINESTYLE )). 1502cdf0e10cSrcweir GetLine(); 1503cdf0e10cSrcweir 1504cdf0e10cSrcweir if ( pLine ) 1505cdf0e10cSrcweir { 1506cdf0e10cSrcweir SvxBorderLine* pDefLine = pTabViewShell->GetDefaultFrameLine(); 1507cdf0e10cSrcweir 1508cdf0e10cSrcweir if ( pDefLine ) 1509cdf0e10cSrcweir { 1510cdf0e10cSrcweir pDefLine->SetOutWidth( pLine->GetOutWidth() ); 1511cdf0e10cSrcweir pDefLine->SetInWidth ( pLine->GetInWidth() ); 1512cdf0e10cSrcweir pDefLine->SetDistance( pLine->GetDistance() ); 1513cdf0e10cSrcweir pTabViewShell->SetSelectionFrameLines( pDefLine, sal_False ); 1514cdf0e10cSrcweir } 1515cdf0e10cSrcweir else 1516cdf0e10cSrcweir { 1517cdf0e10cSrcweir pTabViewShell->SetDefaultFrameLine( pLine ); 1518cdf0e10cSrcweir pTabViewShell->GetDefaultFrameLine()->SetColor( COL_BLACK ); 1519cdf0e10cSrcweir pTabViewShell->SetSelectionFrameLines( pLine, sal_False ); 1520cdf0e10cSrcweir } 1521cdf0e10cSrcweir } 1522cdf0e10cSrcweir else 1523cdf0e10cSrcweir { 1524cdf0e10cSrcweir Color aColorBlack( COL_BLACK ); 1525cdf0e10cSrcweir SvxBorderLine aDefLine( &aColorBlack, 20, 0, 0 ); 1526cdf0e10cSrcweir pTabViewShell->SetDefaultFrameLine( &aDefLine ); 1527cdf0e10cSrcweir pTabViewShell->SetSelectionFrameLines( NULL, sal_False ); 1528cdf0e10cSrcweir } 1529cdf0e10cSrcweir } 1530cdf0e10cSrcweir break; 1531cdf0e10cSrcweir 1532cdf0e10cSrcweir case SID_FRAME_LINECOLOR: 1533cdf0e10cSrcweir { 1534cdf0e10cSrcweir SvxBorderLine* pDefLine = pTabViewShell->GetDefaultFrameLine(); 1535cdf0e10cSrcweir const Color& rColor = ((const SvxColorItem&) 1536cdf0e10cSrcweir pNewAttrs->Get( SID_FRAME_LINECOLOR )). 1537cdf0e10cSrcweir GetValue(); 1538cdf0e10cSrcweir 1539cdf0e10cSrcweir // Default-Linie aktualisieren 1540cdf0e10cSrcweir if ( pDefLine ) 1541cdf0e10cSrcweir { 1542cdf0e10cSrcweir pDefLine->SetColor( rColor ); 1543cdf0e10cSrcweir pTabViewShell->SetSelectionFrameLines( pDefLine, sal_True ); 1544cdf0e10cSrcweir } 1545cdf0e10cSrcweir else 1546cdf0e10cSrcweir { 1547cdf0e10cSrcweir SvxBorderLine aDefLine( &rColor, 20, 0, 0 ); 1548cdf0e10cSrcweir pTabViewShell->SetDefaultFrameLine( &aDefLine ); 1549cdf0e10cSrcweir pTabViewShell->SetSelectionFrameLines( &aDefLine, sal_False ); 1550cdf0e10cSrcweir } 1551cdf0e10cSrcweir } 1552cdf0e10cSrcweir break; 1553cdf0e10cSrcweir 1554cdf0e10cSrcweir case SID_ATTR_BORDER_OUTER: 1555cdf0e10cSrcweir case SID_ATTR_BORDER: 1556cdf0e10cSrcweir { 1557cdf0e10cSrcweir SvxBorderLine* pDefLine = pTabViewShell->GetDefaultFrameLine(); 1558cdf0e10cSrcweir const ScPatternAttr* pOldAttrs = pTabViewShell->GetSelectionPattern(); 1559cdf0e10cSrcweir ScDocument* pDoc = GetViewData()->GetDocument(); 1560cdf0e10cSrcweir SfxItemSet* pOldSet = 1561cdf0e10cSrcweir new SfxItemSet( 1562cdf0e10cSrcweir *(pDoc->GetPool()), 1563cdf0e10cSrcweir ATTR_PATTERN_START, 1564cdf0e10cSrcweir ATTR_PATTERN_END ); 1565cdf0e10cSrcweir SfxItemSet* pNewSet = 1566cdf0e10cSrcweir new SfxItemSet( 1567cdf0e10cSrcweir *(pDoc->GetPool()), 1568cdf0e10cSrcweir ATTR_PATTERN_START, 1569cdf0e10cSrcweir ATTR_PATTERN_END ); 1570cdf0e10cSrcweir const SfxPoolItem& rBorderAttr = 1571cdf0e10cSrcweir pOldAttrs->GetItemSet(). 1572cdf0e10cSrcweir Get( ATTR_BORDER ); 1573cdf0e10cSrcweir 1574cdf0e10cSrcweir // Border-Items vom Controller auswerten: 1575cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 1576cdf0e10cSrcweir 1577cdf0e10cSrcweir if ( pNewAttrs->GetItemState( ATTR_BORDER, sal_True, &pItem ) 1578cdf0e10cSrcweir == SFX_ITEM_SET ) 1579cdf0e10cSrcweir { 1580cdf0e10cSrcweir // #100959# The SvxFrameToolBoxControl toolbox controller uses a default 1581cdf0e10cSrcweir // SvxBorderLine (all widths 0) to mark the lines that should be set. 1582cdf0e10cSrcweir // Macro recording uses a SvxBoxItem with the real values (OutWidth > 0) 1583cdf0e10cSrcweir // or NULL pointers for no lines. 1584cdf0e10cSrcweir // -> Substitute existing lines with pDefLine only if widths are 0. 1585cdf0e10cSrcweir SvxBoxItem aBoxItem ( *(const SvxBoxItem*)pItem ); 1586cdf0e10cSrcweir if ( aBoxItem.GetTop() && aBoxItem.GetTop()->GetOutWidth() == 0 ) 1587cdf0e10cSrcweir aBoxItem.SetLine( pDefLine, BOX_LINE_TOP ); 1588cdf0e10cSrcweir if ( aBoxItem.GetBottom() && aBoxItem.GetBottom()->GetOutWidth() == 0 ) 1589cdf0e10cSrcweir aBoxItem.SetLine( pDefLine, BOX_LINE_BOTTOM ); 1590cdf0e10cSrcweir if ( aBoxItem.GetLeft() && aBoxItem.GetLeft()->GetOutWidth() == 0 ) 1591cdf0e10cSrcweir aBoxItem.SetLine( pDefLine, BOX_LINE_LEFT ); 1592cdf0e10cSrcweir if ( aBoxItem.GetRight() && aBoxItem.GetRight()->GetOutWidth() == 0 ) 1593cdf0e10cSrcweir aBoxItem.SetLine( pDefLine, BOX_LINE_RIGHT ); 1594cdf0e10cSrcweir pNewSet->Put( aBoxItem ); 1595cdf0e10cSrcweir rReq.AppendItem( aBoxItem ); 1596cdf0e10cSrcweir } 1597cdf0e10cSrcweir 1598cdf0e10cSrcweir if ( pNewAttrs->GetItemState( ATTR_BORDER_INNER, sal_True, &pItem ) 1599cdf0e10cSrcweir == SFX_ITEM_SET ) 1600cdf0e10cSrcweir { 1601cdf0e10cSrcweir SvxBoxInfoItem aBoxInfoItem( *(const SvxBoxInfoItem*)pItem ); 1602cdf0e10cSrcweir if ( aBoxInfoItem.GetHori() && aBoxInfoItem.GetHori()->GetOutWidth() == 0 ) 1603cdf0e10cSrcweir aBoxInfoItem.SetLine( pDefLine, BOXINFO_LINE_HORI ); 1604cdf0e10cSrcweir if ( aBoxInfoItem.GetVert() && aBoxInfoItem.GetVert()->GetOutWidth() == 0 ) 1605cdf0e10cSrcweir aBoxInfoItem.SetLine( pDefLine, BOXINFO_LINE_VERT ); 1606cdf0e10cSrcweir pNewSet->Put( aBoxInfoItem ); 1607cdf0e10cSrcweir rReq.AppendItem( aBoxInfoItem ); 1608cdf0e10cSrcweir } 1609cdf0e10cSrcweir else 1610cdf0e10cSrcweir { 1611cdf0e10cSrcweir SvxBoxInfoItem aBoxInfoItem( ATTR_BORDER_INNER ); 1612cdf0e10cSrcweir aBoxInfoItem.SetLine( NULL, BOXINFO_LINE_HORI ); 1613cdf0e10cSrcweir aBoxInfoItem.SetLine( NULL, BOXINFO_LINE_VERT ); 1614cdf0e10cSrcweir pNewSet->Put( aBoxInfoItem ); 1615cdf0e10cSrcweir } 1616cdf0e10cSrcweir 1617cdf0e10cSrcweir pOldSet->Put( rBorderAttr ); 1618cdf0e10cSrcweir pTabViewShell->ApplyAttributes( pNewSet, pOldSet ); 1619cdf0e10cSrcweir 1620cdf0e10cSrcweir delete pOldSet; 1621cdf0e10cSrcweir delete pNewSet; 1622cdf0e10cSrcweir } 1623cdf0e10cSrcweir break; 1624cdf0e10cSrcweir 1625*facb16e7SArmin Le Grand case SID_ATTR_BORDER_DIAG_TLBR: 1626*facb16e7SArmin Le Grand case SID_ATTR_BORDER_DIAG_BLTR: 1627*facb16e7SArmin Le Grand { 1628*facb16e7SArmin Le Grand ScDocument* pDoc = GetViewData()->GetDocument(); 1629*facb16e7SArmin Le Grand const ScPatternAttr* pOldAttrs = pTabViewShell->GetSelectionPattern(); 1630*facb16e7SArmin Le Grand SfxItemSet* pOldSet = new SfxItemSet(pOldAttrs->GetItemSet()); 1631*facb16e7SArmin Le Grand SfxItemSet* pNewSet = new SfxItemSet(pOldAttrs->GetItemSet()); 1632*facb16e7SArmin Le Grand const SfxPoolItem* pItem = 0; 1633*facb16e7SArmin Le Grand 1634*facb16e7SArmin Le Grand if(SID_ATTR_BORDER_DIAG_TLBR == nSlot) 1635*facb16e7SArmin Le Grand { 1636*facb16e7SArmin Le Grand if(SFX_ITEM_SET == pNewAttrs->GetItemState(ATTR_BORDER_TLBR, true, &pItem)) 1637*facb16e7SArmin Le Grand { 1638*facb16e7SArmin Le Grand SvxLineItem aItem(ATTR_BORDER_TLBR); 1639*facb16e7SArmin Le Grand aItem.SetLine(((const SvxLineItem&)pNewAttrs->Get(ATTR_BORDER_TLBR)).GetLine()); 1640*facb16e7SArmin Le Grand pNewSet->Put(aItem); 1641*facb16e7SArmin Le Grand rReq.AppendItem(aItem); 1642*facb16e7SArmin Le Grand pTabViewShell->ApplyAttributes(pNewSet, pOldSet); 1643*facb16e7SArmin Le Grand } 1644*facb16e7SArmin Le Grand } 1645*facb16e7SArmin Le Grand else // if( nSlot == SID_ATTR_BORDER_DIAG_BLTR ) 1646*facb16e7SArmin Le Grand { 1647*facb16e7SArmin Le Grand if(SFX_ITEM_SET == pNewAttrs->GetItemState(ATTR_BORDER_BLTR, true, &pItem )) 1648*facb16e7SArmin Le Grand { 1649*facb16e7SArmin Le Grand SvxLineItem aItem(ATTR_BORDER_BLTR); 1650*facb16e7SArmin Le Grand aItem.SetLine(((const SvxLineItem&)pNewAttrs->Get(ATTR_BORDER_BLTR)).GetLine()); 1651*facb16e7SArmin Le Grand pNewSet->Put(aItem); 1652*facb16e7SArmin Le Grand rReq.AppendItem(aItem); 1653*facb16e7SArmin Le Grand pTabViewShell->ApplyAttributes(pNewSet, pOldSet); 1654*facb16e7SArmin Le Grand } 1655*facb16e7SArmin Le Grand } 1656*facb16e7SArmin Le Grand 1657*facb16e7SArmin Le Grand delete pOldSet; 1658*facb16e7SArmin Le Grand delete pNewSet; 1659*facb16e7SArmin Le Grand rBindings.Invalidate(nSlot); 1660*facb16e7SArmin Le Grand } 1661*facb16e7SArmin Le Grand break; 1662*facb16e7SArmin Le Grand 1663cdf0e10cSrcweir // ATTR_BACKGROUND (=SID_ATTR_BRUSH) muss ueber zwei IDs 1664cdf0e10cSrcweir // gesetzt werden: 1665cdf0e10cSrcweir case SID_BACKGROUND_COLOR: 1666cdf0e10cSrcweir { 1667cdf0e10cSrcweir const SvxColorItem rNewColorItem = (const SvxColorItem&) 1668cdf0e10cSrcweir pNewAttrs->Get( SID_BACKGROUND_COLOR ); 1669cdf0e10cSrcweir 1670cdf0e10cSrcweir SvxBrushItem aBrushItem( (const SvxBrushItem&) 1671cdf0e10cSrcweir pTabViewShell->GetSelectionPattern()-> 1672cdf0e10cSrcweir GetItem( ATTR_BACKGROUND ) ); 1673cdf0e10cSrcweir 1674cdf0e10cSrcweir aBrushItem.SetColor( rNewColorItem.GetValue() ); 1675cdf0e10cSrcweir 1676cdf0e10cSrcweir pTabViewShell->ApplyAttr( aBrushItem ); 1677cdf0e10cSrcweir } 1678cdf0e10cSrcweir break; 1679cdf0e10cSrcweir 1680cdf0e10cSrcweir case SID_ATTR_BRUSH: 1681cdf0e10cSrcweir { 1682cdf0e10cSrcweir SvxBrushItem aBrushItem( (const SvxBrushItem&) 1683cdf0e10cSrcweir pTabViewShell->GetSelectionPattern()-> 1684cdf0e10cSrcweir GetItem( ATTR_BACKGROUND ) ); 1685cdf0e10cSrcweir const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&) 1686cdf0e10cSrcweir pNewAttrs->Get( GetPool().GetWhich(nSlot) ); 1687cdf0e10cSrcweir aBrushItem.SetColor(rNewBrushItem.GetColor()); 1688cdf0e10cSrcweir pTabViewShell->ApplyAttr( aBrushItem ); 1689cdf0e10cSrcweir } 1690cdf0e10cSrcweir break; 1691cdf0e10cSrcweir 1692cdf0e10cSrcweir case SID_ATTR_BORDER_SHADOW: 1693cdf0e10cSrcweir { 1694cdf0e10cSrcweir const SvxShadowItem& rNewShadowItem = (const SvxShadowItem&) 1695cdf0e10cSrcweir pNewAttrs->Get( ATTR_SHADOW ); 1696cdf0e10cSrcweir pTabViewShell->ApplyAttr( rNewShadowItem ); 1697cdf0e10cSrcweir } 1698cdf0e10cSrcweir break; 1699cdf0e10cSrcweir 1700cdf0e10cSrcweir default: 1701cdf0e10cSrcweir break; 1702cdf0e10cSrcweir } 1703cdf0e10cSrcweir 1704cdf0e10cSrcweir if( ! rReq.IsAPI() ) 1705cdf0e10cSrcweir if( ! rReq.IsDone() ) 1706cdf0e10cSrcweir rReq.Done(); 1707cdf0e10cSrcweir } 1708cdf0e10cSrcweir } 1709cdf0e10cSrcweir 1710cdf0e10cSrcweir void ScFormatShell::GetAttrState( SfxItemSet& rSet ) 1711cdf0e10cSrcweir { 1712cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 1713cdf0e10cSrcweir const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); 1714cdf0e10cSrcweir const SvxBorderLine* pLine = pTabViewShell->GetDefaultFrameLine(); 1715cdf0e10cSrcweir const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rAttrSet.Get( ATTR_BACKGROUND ); 1716cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 1717cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 1718cdf0e10cSrcweir 1719cdf0e10cSrcweir rSet.Put( rAttrSet, sal_False ); 1720cdf0e10cSrcweir 1721cdf0e10cSrcweir // choose font info according to selection script type 1722cdf0e10cSrcweir sal_uInt8 nScript = 0; // GetSelectionScriptType never returns 0 1723cdf0e10cSrcweir if ( rSet.GetItemState( ATTR_FONT ) != SFX_ITEM_UNKNOWN ) 1724cdf0e10cSrcweir { 1725cdf0e10cSrcweir if (!nScript) nScript = pTabViewShell->GetSelectionScriptType(); 1726cdf0e10cSrcweir ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT, nScript ); 1727cdf0e10cSrcweir } 1728cdf0e10cSrcweir if ( rSet.GetItemState( ATTR_FONT_HEIGHT ) != SFX_ITEM_UNKNOWN ) 1729cdf0e10cSrcweir { 1730cdf0e10cSrcweir if (!nScript) nScript = pTabViewShell->GetSelectionScriptType(); 1731cdf0e10cSrcweir ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_HEIGHT, nScript ); 1732cdf0e10cSrcweir } 1733cdf0e10cSrcweir 1734cdf0e10cSrcweir while ( nWhich ) 1735cdf0e10cSrcweir { 1736cdf0e10cSrcweir switch(nWhich) 1737cdf0e10cSrcweir { 1738cdf0e10cSrcweir case SID_BACKGROUND_COLOR: 1739cdf0e10cSrcweir { 1740cdf0e10cSrcweir rSet.Put( SvxColorItem( rBrushItem.GetColor(), SID_BACKGROUND_COLOR ) ); 1741*facb16e7SArmin Le Grand 1742*facb16e7SArmin Le Grand if(SFX_ITEM_DONTCARE == rAttrSet.GetItemState(ATTR_BACKGROUND)) 1743*facb16e7SArmin Le Grand { 1744*facb16e7SArmin Le Grand rSet.InvalidateItem(SID_BACKGROUND_COLOR); 1745*facb16e7SArmin Le Grand } 1746cdf0e10cSrcweir } 1747cdf0e10cSrcweir break; 1748*facb16e7SArmin Le Grand case SID_FRAME_LINESTYLE: 1749cdf0e10cSrcweir case SID_FRAME_LINECOLOR: 1750cdf0e10cSrcweir { 1751*facb16e7SArmin Le Grand // handled together because both need the cell border information for decisions 1752*facb16e7SArmin Le Grand // rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) ); 1753*facb16e7SArmin Le Grand Color aCol = 0; 1754*facb16e7SArmin Le Grand sal_uInt16 nOut = 0, nIn = 0, nDis = 0; 1755*facb16e7SArmin Le Grand SvxBorderLine aLine(0,0,0,0); 1756*facb16e7SArmin Le Grand bool bCol = 0; 1757*facb16e7SArmin Le Grand bool bColDisable = 0, bStyleDisable = 0; 1758*facb16e7SArmin Le Grand SvxBoxItem aBoxItem(ATTR_BORDER); 1759*facb16e7SArmin Le Grand SvxBoxInfoItem aInfoItem(ATTR_BORDER_INNER); 1760*facb16e7SArmin Le Grand 1761*facb16e7SArmin Le Grand pTabViewShell->GetSelectionFrame(aBoxItem, aInfoItem); 1762*facb16e7SArmin Le Grand 1763*facb16e7SArmin Le Grand if( aBoxItem.GetTop() ) 1764*facb16e7SArmin Le Grand { 1765*facb16e7SArmin Le Grand bCol = 1; 1766*facb16e7SArmin Le Grand aCol = aBoxItem.GetTop()->GetColor() ; 1767*facb16e7SArmin Le Grand aLine.SetColor(aCol); 1768*facb16e7SArmin Le Grand aLine.SetOutWidth( aBoxItem.GetTop()->GetOutWidth()); 1769*facb16e7SArmin Le Grand aLine.SetInWidth( aBoxItem.GetTop()->GetInWidth()); 1770*facb16e7SArmin Le Grand aLine.SetDistance( aBoxItem.GetTop()->GetDistance()); 1771*facb16e7SArmin Le Grand } 1772*facb16e7SArmin Le Grand 1773*facb16e7SArmin Le Grand if( aBoxItem.GetBottom() ) 1774*facb16e7SArmin Le Grand { 1775*facb16e7SArmin Le Grand if(bCol == 0) 1776*facb16e7SArmin Le Grand { 1777*facb16e7SArmin Le Grand bCol = 1; 1778*facb16e7SArmin Le Grand aCol = aBoxItem.GetBottom()->GetColor() ; 1779*facb16e7SArmin Le Grand aLine.SetColor(aCol); 1780*facb16e7SArmin Le Grand aLine.SetOutWidth( aBoxItem.GetBottom()->GetOutWidth()); 1781*facb16e7SArmin Le Grand aLine.SetInWidth( aBoxItem.GetBottom()->GetInWidth()); 1782*facb16e7SArmin Le Grand aLine.SetDistance( aBoxItem.GetBottom()->GetDistance()); 1783*facb16e7SArmin Le Grand } 1784*facb16e7SArmin Le Grand else 1785*facb16e7SArmin Le Grand { 1786*facb16e7SArmin Le Grand if(aCol != aBoxItem.GetBottom()->GetColor() ) 1787*facb16e7SArmin Le Grand bColDisable = 1; 1788*facb16e7SArmin Le Grand if(!( aLine == *(aBoxItem.GetBottom())) ) 1789*facb16e7SArmin Le Grand bStyleDisable = 1; 1790*facb16e7SArmin Le Grand } 1791*facb16e7SArmin Le Grand } 1792*facb16e7SArmin Le Grand 1793*facb16e7SArmin Le Grand if( aBoxItem.GetLeft() ) 1794*facb16e7SArmin Le Grand { 1795*facb16e7SArmin Le Grand if(bCol == 0) 1796*facb16e7SArmin Le Grand { 1797*facb16e7SArmin Le Grand bCol = 1; 1798*facb16e7SArmin Le Grand aCol = aBoxItem.GetLeft()->GetColor() ; 1799*facb16e7SArmin Le Grand aLine.SetColor(aCol); 1800*facb16e7SArmin Le Grand aLine.SetOutWidth( aBoxItem.GetLeft()->GetOutWidth()); 1801*facb16e7SArmin Le Grand aLine.SetInWidth( aBoxItem.GetLeft()->GetInWidth()); 1802*facb16e7SArmin Le Grand aLine.SetDistance( aBoxItem.GetLeft()->GetDistance()); 1803*facb16e7SArmin Le Grand } 1804*facb16e7SArmin Le Grand else 1805*facb16e7SArmin Le Grand { 1806*facb16e7SArmin Le Grand if(aCol != aBoxItem.GetLeft()->GetColor() ) 1807*facb16e7SArmin Le Grand bColDisable = 1; 1808*facb16e7SArmin Le Grand if(!( aLine == *(aBoxItem.GetLeft())) ) 1809*facb16e7SArmin Le Grand bStyleDisable = 1; 1810*facb16e7SArmin Le Grand } 1811*facb16e7SArmin Le Grand } 1812*facb16e7SArmin Le Grand 1813*facb16e7SArmin Le Grand if( aBoxItem.GetRight() ) 1814*facb16e7SArmin Le Grand { 1815*facb16e7SArmin Le Grand if(bCol == 0) 1816*facb16e7SArmin Le Grand { 1817*facb16e7SArmin Le Grand bCol = 1; 1818*facb16e7SArmin Le Grand aCol = aBoxItem.GetRight()->GetColor() ; 1819*facb16e7SArmin Le Grand aLine.SetColor(aCol); 1820*facb16e7SArmin Le Grand aLine.SetOutWidth( aBoxItem.GetRight()->GetOutWidth()); 1821*facb16e7SArmin Le Grand aLine.SetInWidth( aBoxItem.GetRight()->GetInWidth()); 1822*facb16e7SArmin Le Grand aLine.SetDistance( aBoxItem.GetRight()->GetDistance()); 1823*facb16e7SArmin Le Grand } 1824*facb16e7SArmin Le Grand else 1825*facb16e7SArmin Le Grand { 1826*facb16e7SArmin Le Grand if(aCol != aBoxItem.GetRight()->GetColor() ) 1827*facb16e7SArmin Le Grand bColDisable = 1; 1828*facb16e7SArmin Le Grand if(!( aLine == *(aBoxItem.GetRight())) ) 1829*facb16e7SArmin Le Grand bStyleDisable = 1; 1830*facb16e7SArmin Le Grand } 1831*facb16e7SArmin Le Grand } 1832*facb16e7SArmin Le Grand 1833*facb16e7SArmin Le Grand if( aInfoItem.GetVert()) 1834*facb16e7SArmin Le Grand { 1835*facb16e7SArmin Le Grand if(bCol == 0) 1836*facb16e7SArmin Le Grand { 1837*facb16e7SArmin Le Grand bCol = 1; 1838*facb16e7SArmin Le Grand aCol = aInfoItem.GetVert()->GetColor() ; 1839*facb16e7SArmin Le Grand aLine.SetColor(aCol); 1840*facb16e7SArmin Le Grand aLine.SetOutWidth( aInfoItem.GetVert()->GetOutWidth()); 1841*facb16e7SArmin Le Grand aLine.SetInWidth( aInfoItem.GetVert()->GetInWidth()); 1842*facb16e7SArmin Le Grand aLine.SetDistance( aInfoItem.GetVert()->GetDistance()); 1843*facb16e7SArmin Le Grand } 1844*facb16e7SArmin Le Grand else 1845*facb16e7SArmin Le Grand { 1846*facb16e7SArmin Le Grand if(aCol != aInfoItem.GetVert()->GetColor() ) 1847*facb16e7SArmin Le Grand bColDisable = 1; 1848*facb16e7SArmin Le Grand if(!( aLine == *(aInfoItem.GetVert())) ) 1849*facb16e7SArmin Le Grand bStyleDisable = 1; 1850*facb16e7SArmin Le Grand } 1851*facb16e7SArmin Le Grand } 1852*facb16e7SArmin Le Grand 1853*facb16e7SArmin Le Grand if( aInfoItem.GetHori()) 1854*facb16e7SArmin Le Grand { 1855*facb16e7SArmin Le Grand if(bCol == 0) 1856*facb16e7SArmin Le Grand { 1857*facb16e7SArmin Le Grand bCol = 1; 1858*facb16e7SArmin Le Grand aCol = aInfoItem.GetHori()->GetColor() ; 1859*facb16e7SArmin Le Grand aLine.SetColor(aCol); 1860*facb16e7SArmin Le Grand aLine.SetOutWidth( aInfoItem.GetHori()->GetOutWidth()); 1861*facb16e7SArmin Le Grand aLine.SetInWidth( aInfoItem.GetHori()->GetInWidth()); 1862*facb16e7SArmin Le Grand aLine.SetDistance( aInfoItem.GetHori()->GetDistance()); 1863*facb16e7SArmin Le Grand } 1864*facb16e7SArmin Le Grand else 1865*facb16e7SArmin Le Grand { 1866*facb16e7SArmin Le Grand if(aCol != aInfoItem.GetHori()->GetColor() ) 1867*facb16e7SArmin Le Grand bColDisable = 1; 1868*facb16e7SArmin Le Grand if(!( aLine == *(aInfoItem.GetHori())) ) 1869*facb16e7SArmin Le Grand bStyleDisable = 1; 1870*facb16e7SArmin Le Grand } 1871*facb16e7SArmin Le Grand } 1872*facb16e7SArmin Le Grand 1873*facb16e7SArmin Le Grand if( !aInfoItem.IsValid( VALID_VERT ) 1874*facb16e7SArmin Le Grand || !aInfoItem.IsValid( VALID_HORI ) 1875*facb16e7SArmin Le Grand || !aInfoItem.IsValid( VALID_LEFT ) 1876*facb16e7SArmin Le Grand || !aInfoItem.IsValid( VALID_RIGHT ) 1877*facb16e7SArmin Le Grand || !aInfoItem.IsValid( VALID_TOP ) 1878*facb16e7SArmin Le Grand || !aInfoItem.IsValid( VALID_BOTTOM ) ) 1879*facb16e7SArmin Le Grand { 1880*facb16e7SArmin Le Grand bColDisable = 1; 1881*facb16e7SArmin Le Grand bStyleDisable = 1; 1882*facb16e7SArmin Le Grand } 1883*facb16e7SArmin Le Grand 1884*facb16e7SArmin Le Grand if(SID_FRAME_LINECOLOR == nWhich) 1885*facb16e7SArmin Le Grand { 1886*facb16e7SArmin Le Grand if(bColDisable) // if different lines have differernt colors 1887*facb16e7SArmin Le Grand { 1888*facb16e7SArmin Le Grand aCol = COL_TRANSPARENT; 1889*facb16e7SArmin Le Grand rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) ); 1890*facb16e7SArmin Le Grand rSet.InvalidateItem(SID_FRAME_LINECOLOR); 1891*facb16e7SArmin Le Grand } 1892*facb16e7SArmin Le Grand else if( bCol == 0 && bColDisable == 0) // if no line available 1893*facb16e7SArmin Le Grand { 1894*facb16e7SArmin Le Grand aCol = COL_AUTO; 1895*facb16e7SArmin Le Grand rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) ); 1896*facb16e7SArmin Le Grand } 1897*facb16e7SArmin Le Grand else 1898*facb16e7SArmin Le Grand rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) ); 1899*facb16e7SArmin Le Grand } 1900*facb16e7SArmin Le Grand else // if( nWhich == SID_FRAME_LINESTYLE) 1901*facb16e7SArmin Le Grand { 1902*facb16e7SArmin Le Grand if(bStyleDisable) // if have several lines but don't have same style 1903*facb16e7SArmin Le Grand { 1904*facb16e7SArmin Le Grand aLine.SetOutWidth( 1 ); 1905*facb16e7SArmin Le Grand aLine.SetInWidth( 0 ); 1906*facb16e7SArmin Le Grand aLine.SetDistance( 0 ); 1907*facb16e7SArmin Le Grand SvxLineItem aItem(SID_FRAME_LINESTYLE); 1908*facb16e7SArmin Le Grand aItem.SetLine(&aLine); 1909*facb16e7SArmin Le Grand rSet.Put( aItem ); 1910*facb16e7SArmin Le Grand rSet.InvalidateItem(SID_FRAME_LINESTYLE); 1911*facb16e7SArmin Le Grand } 1912*facb16e7SArmin Le Grand else // all the lines have same style or no line availavle, use initial value (0,0,0,0) 1913*facb16e7SArmin Le Grand { 1914*facb16e7SArmin Le Grand SvxLineItem aItem(SID_FRAME_LINESTYLE); 1915*facb16e7SArmin Le Grand aItem.SetLine(&aLine); 1916*facb16e7SArmin Le Grand rSet.Put( aItem ); 1917*facb16e7SArmin Le Grand } 1918*facb16e7SArmin Le Grand } 1919cdf0e10cSrcweir } 1920cdf0e10cSrcweir break; 1921cdf0e10cSrcweir case SID_ATTR_BRUSH: 1922cdf0e10cSrcweir { 1923cdf0e10cSrcweir rSet.Put( rBrushItem, GetPool().GetWhich(nWhich) ); 1924cdf0e10cSrcweir } 1925cdf0e10cSrcweir break; 1926cdf0e10cSrcweir /* case SID_ATTR_ALIGN_LINEBREAK: 1927cdf0e10cSrcweir { 1928cdf0e10cSrcweir const SfxBoolItem& rBreakItem = (const SfxBoolItem&)rAttrSet.Get( ATTR_LINEBREAK ); 1929cdf0e10cSrcweir rSet.Put( rBreakItem, GetPool().GetWhich(nWhich) ); 1930cdf0e10cSrcweir } 1931cdf0e10cSrcweir break; 1932cdf0e10cSrcweir */ 1933cdf0e10cSrcweir } 1934cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1935cdf0e10cSrcweir } 1936*facb16e7SArmin Le Grand 1937*facb16e7SArmin Le Grand if(nWhich) 1938*facb16e7SArmin Le Grand { 1939*facb16e7SArmin Le Grand // stuff for sidebar panels 1940*facb16e7SArmin Le Grand Invalidate(SID_ATTR_ALIGN_DEGREES); 1941*facb16e7SArmin Le Grand Invalidate(SID_ATTR_ALIGN_STACKED); 1942*facb16e7SArmin Le Grand } 1943cdf0e10cSrcweir } 1944cdf0e10cSrcweir 1945cdf0e10cSrcweir //------------------------------------------------------------------ 1946cdf0e10cSrcweir 1947cdf0e10cSrcweir void ScFormatShell::GetTextAttrState( SfxItemSet& rSet ) 1948cdf0e10cSrcweir { 1949cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 1950cdf0e10cSrcweir const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); 1951cdf0e10cSrcweir rSet.Put( rAttrSet, sal_False ); // ItemStates mitkopieren 1952cdf0e10cSrcweir 1953cdf0e10cSrcweir // choose font info according to selection script type 1954cdf0e10cSrcweir sal_uInt8 nScript = 0; // GetSelectionScriptType never returns 0 1955cdf0e10cSrcweir if ( rSet.GetItemState( ATTR_FONT_WEIGHT ) != SFX_ITEM_UNKNOWN ) 1956cdf0e10cSrcweir { 1957cdf0e10cSrcweir if (!nScript) nScript = pTabViewShell->GetSelectionScriptType(); 1958cdf0e10cSrcweir ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_WEIGHT, nScript ); 1959cdf0e10cSrcweir } 1960cdf0e10cSrcweir if ( rSet.GetItemState( ATTR_FONT_POSTURE ) != SFX_ITEM_UNKNOWN ) 1961cdf0e10cSrcweir { 1962cdf0e10cSrcweir if (!nScript) nScript = pTabViewShell->GetSelectionScriptType(); 1963cdf0e10cSrcweir ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_POSTURE, nScript ); 1964cdf0e10cSrcweir } 1965cdf0e10cSrcweir 1966cdf0e10cSrcweir SfxItemState eState; 1967cdf0e10cSrcweir // const SfxPoolItem* pItem; 1968cdf0e10cSrcweir 1969cdf0e10cSrcweir //-------------------------------------------------------------------- 1970cdf0e10cSrcweir // eigene Kontrolle ueber RadioButton-Funktionalitaet: 1971cdf0e10cSrcweir //-------------------------------------------------------------------- 1972cdf0e10cSrcweir // Unterstreichung 1973cdf0e10cSrcweir //------------------------ 1974cdf0e10cSrcweir 1975cdf0e10cSrcweir eState = rAttrSet.GetItemState( ATTR_FONT_UNDERLINE, sal_True ); 1976cdf0e10cSrcweir if ( eState == SFX_ITEM_DONTCARE ) 1977cdf0e10cSrcweir { 1978cdf0e10cSrcweir rSet.InvalidateItem( SID_ULINE_VAL_NONE ); 1979cdf0e10cSrcweir rSet.InvalidateItem( SID_ULINE_VAL_SINGLE ); 1980cdf0e10cSrcweir rSet.InvalidateItem( SID_ULINE_VAL_DOUBLE ); 1981cdf0e10cSrcweir rSet.InvalidateItem( SID_ULINE_VAL_DOTTED ); 1982cdf0e10cSrcweir } 1983cdf0e10cSrcweir else 1984cdf0e10cSrcweir { 1985cdf0e10cSrcweir FontUnderline eUnderline = ((const SvxUnderlineItem&) 1986cdf0e10cSrcweir rAttrSet.Get(ATTR_FONT_UNDERLINE)).GetLineStyle(); 1987cdf0e10cSrcweir sal_uInt16 nId = SID_ULINE_VAL_NONE; 1988cdf0e10cSrcweir switch (eUnderline) 1989cdf0e10cSrcweir { 1990cdf0e10cSrcweir case UNDERLINE_SINGLE: nId = SID_ULINE_VAL_SINGLE; break; 1991cdf0e10cSrcweir case UNDERLINE_DOUBLE: nId = SID_ULINE_VAL_DOUBLE; break; 1992cdf0e10cSrcweir case UNDERLINE_DOTTED: nId = SID_ULINE_VAL_DOTTED; break; 1993cdf0e10cSrcweir default: 1994cdf0e10cSrcweir break; 1995cdf0e10cSrcweir } 1996cdf0e10cSrcweir rSet.Put( SfxBoolItem( nId, sal_True ) ); 1997cdf0e10cSrcweir } 1998cdf0e10cSrcweir 1999cdf0e10cSrcweir //------------------------ 2000cdf0e10cSrcweir // horizontale Ausrichtung 2001cdf0e10cSrcweir //------------------------ 2002cdf0e10cSrcweir 2003cdf0e10cSrcweir const SvxHorJustifyItem* pHorJustify = NULL; 2004cdf0e10cSrcweir const SvxVerJustifyItem* pVerJustify = NULL; 2005cdf0e10cSrcweir SvxCellHorJustify eHorJustify = SVX_HOR_JUSTIFY_STANDARD; 2006cdf0e10cSrcweir SvxCellVerJustify eVerJustify = SVX_VER_JUSTIFY_STANDARD; 2007cdf0e10cSrcweir sal_uInt16 nWhich = 0; 2008cdf0e10cSrcweir sal_Bool bJustifyStd = sal_False; 2009cdf0e10cSrcweir SfxBoolItem aBoolItem ( 0, sal_True ); 2010cdf0e10cSrcweir 2011cdf0e10cSrcweir eState = rAttrSet.GetItemState( ATTR_HOR_JUSTIFY, sal_True, 2012cdf0e10cSrcweir (const SfxPoolItem**)&pHorJustify ); 2013cdf0e10cSrcweir switch ( eState ) 2014cdf0e10cSrcweir { 2015cdf0e10cSrcweir case SFX_ITEM_SET: 2016cdf0e10cSrcweir { 2017cdf0e10cSrcweir eHorJustify = SvxCellHorJustify( pHorJustify->GetValue() ); 2018cdf0e10cSrcweir 2019cdf0e10cSrcweir switch ( SvxCellHorJustify( pHorJustify->GetValue() ) ) 2020cdf0e10cSrcweir { 2021cdf0e10cSrcweir case SVX_HOR_JUSTIFY_STANDARD: 2022cdf0e10cSrcweir break; 2023cdf0e10cSrcweir 2024cdf0e10cSrcweir case SVX_HOR_JUSTIFY_LEFT: 2025cdf0e10cSrcweir nWhich = SID_ALIGNLEFT; 2026cdf0e10cSrcweir break; 2027cdf0e10cSrcweir 2028cdf0e10cSrcweir case SVX_HOR_JUSTIFY_RIGHT: 2029cdf0e10cSrcweir nWhich = SID_ALIGNRIGHT; 2030cdf0e10cSrcweir break; 2031cdf0e10cSrcweir 2032cdf0e10cSrcweir case SVX_HOR_JUSTIFY_CENTER: 2033cdf0e10cSrcweir nWhich = SID_ALIGNCENTERHOR; 2034cdf0e10cSrcweir break; 2035cdf0e10cSrcweir 2036cdf0e10cSrcweir case SVX_HOR_JUSTIFY_BLOCK: 2037cdf0e10cSrcweir nWhich = SID_ALIGNBLOCK; 2038cdf0e10cSrcweir break; 2039cdf0e10cSrcweir 2040cdf0e10cSrcweir case SVX_HOR_JUSTIFY_REPEAT: 2041cdf0e10cSrcweir default: 2042cdf0e10cSrcweir bJustifyStd = sal_True; 2043cdf0e10cSrcweir break; 2044cdf0e10cSrcweir } 2045cdf0e10cSrcweir } 2046cdf0e10cSrcweir break; 2047cdf0e10cSrcweir 2048cdf0e10cSrcweir case SFX_ITEM_DONTCARE: 2049cdf0e10cSrcweir rSet.InvalidateItem( SID_ALIGNLEFT ); 2050cdf0e10cSrcweir rSet.InvalidateItem( SID_ALIGNRIGHT ); 2051cdf0e10cSrcweir rSet.InvalidateItem( SID_ALIGNCENTERHOR ); 2052cdf0e10cSrcweir rSet.InvalidateItem( SID_ALIGNBLOCK ); 2053cdf0e10cSrcweir break; 2054cdf0e10cSrcweir 2055cdf0e10cSrcweir default: 2056cdf0e10cSrcweir bJustifyStd = sal_True; 2057cdf0e10cSrcweir break; 2058cdf0e10cSrcweir } 2059cdf0e10cSrcweir 2060cdf0e10cSrcweir if ( nWhich ) 2061cdf0e10cSrcweir { 2062cdf0e10cSrcweir aBoolItem.SetWhich( nWhich ); 2063cdf0e10cSrcweir rSet.Put( aBoolItem ); 2064cdf0e10cSrcweir } 2065cdf0e10cSrcweir else if ( bJustifyStd ) 2066cdf0e10cSrcweir { 2067cdf0e10cSrcweir aBoolItem.SetValue( sal_False ); 2068cdf0e10cSrcweir aBoolItem.SetWhich( SID_ALIGNLEFT ); rSet.Put( aBoolItem ); 2069cdf0e10cSrcweir aBoolItem.SetWhich( SID_ALIGNRIGHT ); rSet.Put( aBoolItem ); 2070cdf0e10cSrcweir aBoolItem.SetWhich( SID_ALIGNCENTERHOR ); rSet.Put( aBoolItem ); 2071cdf0e10cSrcweir aBoolItem.SetWhich( SID_ALIGNBLOCK ); rSet.Put( aBoolItem ); 2072cdf0e10cSrcweir bJustifyStd = sal_False; 2073cdf0e10cSrcweir } 2074cdf0e10cSrcweir 2075cdf0e10cSrcweir //------------------------ 2076cdf0e10cSrcweir // vertikale Ausrichtung 2077cdf0e10cSrcweir //------------------------ 2078cdf0e10cSrcweir 2079cdf0e10cSrcweir nWhich = 0; 2080cdf0e10cSrcweir aBoolItem.SetValue( sal_True ); 2081cdf0e10cSrcweir 2082cdf0e10cSrcweir eState = rAttrSet.GetItemState( ATTR_VER_JUSTIFY, sal_True, 2083cdf0e10cSrcweir (const SfxPoolItem**)&pVerJustify ); 2084cdf0e10cSrcweir 2085cdf0e10cSrcweir switch ( eState ) 2086cdf0e10cSrcweir { 2087cdf0e10cSrcweir case SFX_ITEM_SET: 2088cdf0e10cSrcweir { 2089cdf0e10cSrcweir eVerJustify = SvxCellVerJustify( pVerJustify->GetValue() ); 2090cdf0e10cSrcweir 2091cdf0e10cSrcweir switch ( eVerJustify ) 2092cdf0e10cSrcweir { 2093cdf0e10cSrcweir case SVX_VER_JUSTIFY_TOP: 2094cdf0e10cSrcweir nWhich = SID_ALIGNTOP; 2095cdf0e10cSrcweir break; 2096cdf0e10cSrcweir 2097cdf0e10cSrcweir case SVX_VER_JUSTIFY_BOTTOM: 2098cdf0e10cSrcweir nWhich = SID_ALIGNBOTTOM; 2099cdf0e10cSrcweir break; 2100cdf0e10cSrcweir 2101cdf0e10cSrcweir case SVX_VER_JUSTIFY_CENTER: 2102cdf0e10cSrcweir nWhich = SID_ALIGNCENTERVER; 2103cdf0e10cSrcweir break; 2104cdf0e10cSrcweir 2105cdf0e10cSrcweir case SVX_VER_JUSTIFY_STANDARD: 2106cdf0e10cSrcweir default: 2107cdf0e10cSrcweir bJustifyStd = sal_True; 2108cdf0e10cSrcweir break; 2109cdf0e10cSrcweir } 2110cdf0e10cSrcweir } 2111cdf0e10cSrcweir break; 2112cdf0e10cSrcweir 2113cdf0e10cSrcweir case SFX_ITEM_DONTCARE: 2114cdf0e10cSrcweir rSet.InvalidateItem( SID_ALIGNTOP ); 2115cdf0e10cSrcweir rSet.InvalidateItem( SID_ALIGNBOTTOM ); 2116cdf0e10cSrcweir rSet.InvalidateItem( SID_ALIGNCENTERVER ); 2117cdf0e10cSrcweir break; 2118cdf0e10cSrcweir 2119cdf0e10cSrcweir default: 2120cdf0e10cSrcweir bJustifyStd = sal_True; 2121cdf0e10cSrcweir break; 2122cdf0e10cSrcweir } 2123cdf0e10cSrcweir 2124cdf0e10cSrcweir if ( nWhich ) 2125cdf0e10cSrcweir { 2126cdf0e10cSrcweir aBoolItem.SetWhich( nWhich ); 2127cdf0e10cSrcweir rSet.Put( aBoolItem ); 2128cdf0e10cSrcweir } 2129cdf0e10cSrcweir else if ( bJustifyStd ) 2130cdf0e10cSrcweir { 2131cdf0e10cSrcweir aBoolItem.SetValue( sal_False ); 2132cdf0e10cSrcweir aBoolItem.SetWhich( SID_ALIGNTOP ); rSet.Put( aBoolItem ); 2133cdf0e10cSrcweir aBoolItem.SetWhich( SID_ALIGNBOTTOM ); rSet.Put( aBoolItem ); 2134cdf0e10cSrcweir aBoolItem.SetWhich( SID_ALIGNCENTERVER ); rSet.Put( aBoolItem ); 2135cdf0e10cSrcweir } 2136cdf0e10cSrcweir } 2137cdf0e10cSrcweir 2138cdf0e10cSrcweir 2139cdf0e10cSrcweir //------------------------------------------------------------------ 2140cdf0e10cSrcweir 2141cdf0e10cSrcweir void ScFormatShell::GetBorderState( SfxItemSet& rSet ) 2142cdf0e10cSrcweir { 2143cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 2144cdf0e10cSrcweir SvxBoxItem aBoxItem( ATTR_BORDER ); 2145cdf0e10cSrcweir SvxBoxInfoItem aInfoItem( ATTR_BORDER_INNER ); 2146cdf0e10cSrcweir 2147cdf0e10cSrcweir pTabViewShell->GetSelectionFrame( aBoxItem, aInfoItem ); 2148cdf0e10cSrcweir 2149cdf0e10cSrcweir if ( rSet.GetItemState( ATTR_BORDER ) != SFX_ITEM_UNKNOWN ) 2150cdf0e10cSrcweir rSet.Put( aBoxItem ); 2151cdf0e10cSrcweir if ( rSet.GetItemState( ATTR_BORDER_INNER ) != SFX_ITEM_UNKNOWN ) 2152cdf0e10cSrcweir rSet.Put( aInfoItem ); 2153cdf0e10cSrcweir } 2154cdf0e10cSrcweir 2155cdf0e10cSrcweir //------------------------------------------------------------------ 2156cdf0e10cSrcweir 2157cdf0e10cSrcweir void ScFormatShell::GetAlignState( SfxItemSet& rSet ) 2158cdf0e10cSrcweir { 2159cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 2160cdf0e10cSrcweir const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); 2161cdf0e10cSrcweir SfxWhichIter aIter(rSet); 2162cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 2163cdf0e10cSrcweir 2164cdf0e10cSrcweir SvxCellHorJustify eHAlign = SVX_HOR_JUSTIFY_STANDARD; 2165cdf0e10cSrcweir bool bHasHAlign = rAttrSet.GetItemState( ATTR_HOR_JUSTIFY ) != SFX_ITEM_DONTCARE; 2166cdf0e10cSrcweir if( bHasHAlign ) 2167cdf0e10cSrcweir eHAlign = (SvxCellHorJustify)((const SvxHorJustifyItem&) rAttrSet.Get( ATTR_HOR_JUSTIFY )).GetValue(); 2168cdf0e10cSrcweir 2169cdf0e10cSrcweir SvxCellVerJustify eVAlign = SVX_VER_JUSTIFY_STANDARD; 2170cdf0e10cSrcweir bool bHasVAlign = rAttrSet.GetItemState( ATTR_VER_JUSTIFY ) != SFX_ITEM_DONTCARE; 2171cdf0e10cSrcweir if( bHasVAlign ) 2172cdf0e10cSrcweir eVAlign = (SvxCellVerJustify)((const SvxVerJustifyItem&) rAttrSet.Get( ATTR_VER_JUSTIFY )).GetValue(); 2173cdf0e10cSrcweir 2174cdf0e10cSrcweir while ( nWhich ) 2175cdf0e10cSrcweir { 2176cdf0e10cSrcweir switch ( nWhich ) 2177cdf0e10cSrcweir { 2178cdf0e10cSrcweir case SID_H_ALIGNCELL: 2179cdf0e10cSrcweir if ( bHasHAlign ) 2180cdf0e10cSrcweir rSet.Put( SvxHorJustifyItem( eHAlign, nWhich )); 2181cdf0e10cSrcweir break; 2182cdf0e10cSrcweir case SID_V_ALIGNCELL: 2183cdf0e10cSrcweir if ( bHasVAlign ) 2184cdf0e10cSrcweir rSet.Put( SvxVerJustifyItem( eVAlign, nWhich )); 2185cdf0e10cSrcweir break; 2186cdf0e10cSrcweir 2187cdf0e10cSrcweir // pseudo slots for Format menu 2188cdf0e10cSrcweir case SID_ALIGN_ANY_HDEFAULT: 2189cdf0e10cSrcweir case SID_ALIGN_ANY_LEFT: 2190cdf0e10cSrcweir case SID_ALIGN_ANY_HCENTER: 2191cdf0e10cSrcweir case SID_ALIGN_ANY_RIGHT: 2192cdf0e10cSrcweir case SID_ALIGN_ANY_JUSTIFIED: 2193cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bHasHAlign && (eHAlign == lclConvertSlotToHAlign( nWhich )) ) ); 2194cdf0e10cSrcweir break; 2195cdf0e10cSrcweir case SID_ALIGN_ANY_VDEFAULT: 2196cdf0e10cSrcweir case SID_ALIGN_ANY_TOP: 2197cdf0e10cSrcweir case SID_ALIGN_ANY_VCENTER: 2198cdf0e10cSrcweir case SID_ALIGN_ANY_BOTTOM: 2199cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bHasVAlign && (eVAlign == lclConvertSlotToVAlign( nWhich )) ) ); 2200cdf0e10cSrcweir break; 2201cdf0e10cSrcweir } 2202cdf0e10cSrcweir nWhich = aIter.NextWhich(); 2203cdf0e10cSrcweir } 2204cdf0e10cSrcweir } 2205cdf0e10cSrcweir 2206cdf0e10cSrcweir void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) 2207cdf0e10cSrcweir { 2208cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 2209cdf0e10cSrcweir 2210cdf0e10cSrcweir // ScViewData* pViewData = GetViewData(); 2211cdf0e10cSrcweir ScDocument* pDoc = pViewData->GetDocument(); 2212cdf0e10cSrcweir 2213cdf0e10cSrcweir SfxWhichIter aIter(rSet); 2214cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 2215cdf0e10cSrcweir while ( nWhich ) 2216cdf0e10cSrcweir { 2217cdf0e10cSrcweir switch ( nWhich ) 2218cdf0e10cSrcweir { 2219cdf0e10cSrcweir case SID_NUMBER_FORMAT: 2220cdf0e10cSrcweir { 2221cdf0e10cSrcweir String aFormatCode; // bleibt leer, wenn dont-care 2222cdf0e10cSrcweir 2223cdf0e10cSrcweir const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); 2224cdf0e10cSrcweir if ( rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) != SFX_ITEM_DONTCARE ) 2225cdf0e10cSrcweir { 2226cdf0e10cSrcweir sal_uLong nNumberFormat = ((const SfxUInt32Item&)rAttrSet.Get( 2227cdf0e10cSrcweir ATTR_VALUE_FORMAT )).GetValue(); 2228cdf0e10cSrcweir 2229cdf0e10cSrcweir SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); 2230cdf0e10cSrcweir const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat ); 2231cdf0e10cSrcweir if ( pFormatEntry ) 2232cdf0e10cSrcweir aFormatCode = pFormatEntry->GetFormatstring(); 2233cdf0e10cSrcweir } 2234cdf0e10cSrcweir 2235cdf0e10cSrcweir rSet.Put( SfxStringItem( nWhich, aFormatCode ) ); 2236cdf0e10cSrcweir } 2237cdf0e10cSrcweir break; 2238cdf0e10cSrcweir 2239cdf0e10cSrcweir } 2240cdf0e10cSrcweir nWhich = aIter.NextWhich(); 2241cdf0e10cSrcweir } 2242cdf0e10cSrcweir } 2243cdf0e10cSrcweir 2244cdf0e10cSrcweir 2245cdf0e10cSrcweir void ScFormatShell::ExecuteTextDirection( SfxRequest& rReq ) 2246cdf0e10cSrcweir { 2247cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 2248cdf0e10cSrcweir pTabViewShell->HideListBox(); // Autofilter-DropDown-Listbox 2249cdf0e10cSrcweir if ( GetViewData()->HasEditView( GetViewData()->GetActivePart() ) ) 2250cdf0e10cSrcweir { 2251cdf0e10cSrcweir SC_MOD()->InputEnterHandler(); 2252cdf0e10cSrcweir pTabViewShell->UpdateInputHandler(); 2253cdf0e10cSrcweir } 2254cdf0e10cSrcweir 2255cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 2256cdf0e10cSrcweir switch( nSlot ) 2257cdf0e10cSrcweir { 2258cdf0e10cSrcweir case SID_TEXTDIRECTION_LEFT_TO_RIGHT: 2259cdf0e10cSrcweir case SID_TEXTDIRECTION_TOP_TO_BOTTOM: 2260cdf0e10cSrcweir { 2261cdf0e10cSrcweir sal_Bool bVert = (nSlot == SID_TEXTDIRECTION_TOP_TO_BOTTOM); 2262cdf0e10cSrcweir ScPatternAttr aAttr( GetViewData()->GetDocument()->GetPool() ); 2263cdf0e10cSrcweir SfxItemSet& rItemSet = aAttr.GetItemSet(); 2264cdf0e10cSrcweir rItemSet.Put( SfxBoolItem( ATTR_STACKED, bVert ) ); 2265cdf0e10cSrcweir rItemSet.Put( SfxBoolItem( ATTR_VERTICAL_ASIAN, bVert ) ); 2266cdf0e10cSrcweir pTabViewShell->ApplySelectionPattern( aAttr ); 2267cdf0e10cSrcweir pTabViewShell->AdjustBlockHeight(); 2268cdf0e10cSrcweir } 2269cdf0e10cSrcweir break; 2270cdf0e10cSrcweir 2271cdf0e10cSrcweir case SID_ATTR_PARA_LEFT_TO_RIGHT: 2272cdf0e10cSrcweir case SID_ATTR_PARA_RIGHT_TO_LEFT: 2273cdf0e10cSrcweir { 2274cdf0e10cSrcweir SvxFrameDirection eDirection = ( nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT ) ? 2275cdf0e10cSrcweir FRMDIR_HORI_LEFT_TOP : FRMDIR_HORI_RIGHT_TOP; 2276cdf0e10cSrcweir pTabViewShell->ApplyAttr( SvxFrameDirectionItem( eDirection, ATTR_WRITINGDIR ) ); 2277cdf0e10cSrcweir } 2278cdf0e10cSrcweir break; 2279cdf0e10cSrcweir } 2280cdf0e10cSrcweir } 2281cdf0e10cSrcweir 2282cdf0e10cSrcweir void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet ) 2283cdf0e10cSrcweir { 2284cdf0e10cSrcweir ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 2285cdf0e10cSrcweir const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); 2286cdf0e10cSrcweir 2287cdf0e10cSrcweir sal_Bool bVertDontCare = 2288cdf0e10cSrcweir (rAttrSet.GetItemState( ATTR_VERTICAL_ASIAN ) == SFX_ITEM_DONTCARE) || 2289cdf0e10cSrcweir (rAttrSet.GetItemState( ATTR_STACKED ) == SFX_ITEM_DONTCARE); 2290cdf0e10cSrcweir sal_Bool bLeftRight = !bVertDontCare && 2291cdf0e10cSrcweir !((const SfxBoolItem&) rAttrSet.Get( ATTR_STACKED )).GetValue(); 2292cdf0e10cSrcweir sal_Bool bTopBottom = !bVertDontCare && !bLeftRight && 2293cdf0e10cSrcweir ((const SfxBoolItem&) rAttrSet.Get( ATTR_VERTICAL_ASIAN )).GetValue(); 2294cdf0e10cSrcweir 2295cdf0e10cSrcweir sal_Bool bBidiDontCare = (rAttrSet.GetItemState( ATTR_WRITINGDIR ) == SFX_ITEM_DONTCARE); 2296cdf0e10cSrcweir EEHorizontalTextDirection eBidiDir = EE_HTEXTDIR_DEFAULT; 2297cdf0e10cSrcweir if ( !bBidiDontCare ) 2298cdf0e10cSrcweir { 2299cdf0e10cSrcweir SvxFrameDirection eCellDir = (SvxFrameDirection)((const SvxFrameDirectionItem&) 2300cdf0e10cSrcweir rAttrSet.Get( ATTR_WRITINGDIR )).GetValue(); 2301cdf0e10cSrcweir if ( eCellDir == FRMDIR_ENVIRONMENT ) 2302cdf0e10cSrcweir eBidiDir = (EEHorizontalTextDirection)GetViewData()->GetDocument()-> 2303cdf0e10cSrcweir GetEditTextDirection( GetViewData()->GetTabNo() ); 2304cdf0e10cSrcweir else if ( eCellDir == FRMDIR_HORI_RIGHT_TOP ) 2305cdf0e10cSrcweir eBidiDir = EE_HTEXTDIR_R2L; 2306cdf0e10cSrcweir else 2307cdf0e10cSrcweir eBidiDir = EE_HTEXTDIR_L2R; 2308cdf0e10cSrcweir } 2309cdf0e10cSrcweir 2310cdf0e10cSrcweir SvtLanguageOptions aLangOpt; 2311cdf0e10cSrcweir sal_Bool bDisableCTLFont = !aLangOpt.IsCTLFontEnabled(); 2312cdf0e10cSrcweir sal_Bool bDisableVerticalText = !aLangOpt.IsVerticalTextEnabled(); 2313cdf0e10cSrcweir 2314cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 2315cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 2316cdf0e10cSrcweir while( nWhich ) 2317cdf0e10cSrcweir { 2318cdf0e10cSrcweir switch( nWhich ) 2319cdf0e10cSrcweir { 2320cdf0e10cSrcweir case SID_TEXTDIRECTION_LEFT_TO_RIGHT: 2321cdf0e10cSrcweir case SID_TEXTDIRECTION_TOP_TO_BOTTOM: 2322cdf0e10cSrcweir if ( bDisableVerticalText ) 2323cdf0e10cSrcweir rSet.DisableItem( nWhich ); 2324cdf0e10cSrcweir else 2325cdf0e10cSrcweir { 2326cdf0e10cSrcweir if( bVertDontCare ) 2327cdf0e10cSrcweir rSet.InvalidateItem( nWhich ); 2328cdf0e10cSrcweir else if ( nWhich == SID_TEXTDIRECTION_LEFT_TO_RIGHT ) 2329cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bLeftRight ) ); 2330cdf0e10cSrcweir else 2331cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bTopBottom ) ); 2332cdf0e10cSrcweir } 2333cdf0e10cSrcweir break; 2334cdf0e10cSrcweir 2335cdf0e10cSrcweir case SID_ATTR_PARA_LEFT_TO_RIGHT: 2336cdf0e10cSrcweir case SID_ATTR_PARA_RIGHT_TO_LEFT: 2337cdf0e10cSrcweir if ( bDisableCTLFont ) 2338cdf0e10cSrcweir rSet.DisableItem( nWhich ); 2339cdf0e10cSrcweir else 2340cdf0e10cSrcweir { 2341cdf0e10cSrcweir if ( bTopBottom ) 2342cdf0e10cSrcweir rSet.DisableItem( nWhich ); 2343cdf0e10cSrcweir else if ( bBidiDontCare ) 2344cdf0e10cSrcweir rSet.InvalidateItem( nWhich ); 2345cdf0e10cSrcweir else if ( nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT ) 2346cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, eBidiDir == EE_HTEXTDIR_L2R ) ); 2347cdf0e10cSrcweir else 2348cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, eBidiDir == EE_HTEXTDIR_R2L ) ); 2349cdf0e10cSrcweir } 2350cdf0e10cSrcweir } 2351cdf0e10cSrcweir nWhich = aIter.NextWhich(); 2352cdf0e10cSrcweir } 2353cdf0e10cSrcweir } 2354cdf0e10cSrcweir 2355cdf0e10cSrcweir void ScFormatShell::ExecFormatPaintbrush( SfxRequest& rReq ) 2356cdf0e10cSrcweir { 2357cdf0e10cSrcweir ScViewFunc* pView = pViewData->GetView(); 2358cdf0e10cSrcweir if ( pView->HasPaintBrush() ) 2359cdf0e10cSrcweir { 2360cdf0e10cSrcweir // cancel paintbrush mode 2361cdf0e10cSrcweir pView->ResetBrushDocument(); 2362cdf0e10cSrcweir } 2363cdf0e10cSrcweir else 2364cdf0e10cSrcweir { 2365cdf0e10cSrcweir sal_Bool bLock = sal_False; 2366cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 2367cdf0e10cSrcweir if( pArgs && pArgs->Count() >= 1 ) 2368cdf0e10cSrcweir bLock = static_cast<const SfxBoolItem&>(pArgs->Get(SID_FORMATPAINTBRUSH)).GetValue(); 2369cdf0e10cSrcweir 2370cdf0e10cSrcweir // in case of multi selection, deselect all and use the cursor position 2371cdf0e10cSrcweir ScRange aDummy; 2372cdf0e10cSrcweir if ( pViewData->GetSimpleArea(aDummy) != SC_MARK_SIMPLE ) 2373cdf0e10cSrcweir pView->Unmark(); 2374cdf0e10cSrcweir 2375cdf0e10cSrcweir ScDocument* pBrushDoc = new ScDocument( SCDOCMODE_CLIP ); 2376cdf0e10cSrcweir pView->CopyToClip( pBrushDoc, sal_False, sal_True ); 2377cdf0e10cSrcweir pView->SetBrushDocument( pBrushDoc, bLock ); 2378cdf0e10cSrcweir } 2379cdf0e10cSrcweir } 2380cdf0e10cSrcweir 2381cdf0e10cSrcweir void ScFormatShell::StateFormatPaintbrush( SfxItemSet& rSet ) 2382cdf0e10cSrcweir { 2383cdf0e10cSrcweir if ( pViewData->HasEditView( pViewData->GetActivePart() ) ) 2384cdf0e10cSrcweir rSet.DisableItem( SID_FORMATPAINTBRUSH ); 2385cdf0e10cSrcweir else 2386cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, pViewData->GetView()->HasPaintBrush() ) ); 2387cdf0e10cSrcweir } 2388cdf0e10cSrcweir 2389*facb16e7SArmin Le Grand void ScFormatShell::ExecViewOptions( SfxRequest& rReq ) 2390*facb16e7SArmin Le Grand { 2391*facb16e7SArmin Le Grand ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 2392*facb16e7SArmin Le Grand SfxBindings& rBindings = pViewData->GetBindings(); 2393*facb16e7SArmin Le Grand const SfxItemSet* pNewAttrs = rReq.GetArgs(); 2394*facb16e7SArmin Le Grand 2395*facb16e7SArmin Le Grand if ( pNewAttrs ) 2396*facb16e7SArmin Le Grand { 2397*facb16e7SArmin Le Grand sal_uInt16 nSlot = rReq.GetSlot(); 2398*facb16e7SArmin Le Grand 2399*facb16e7SArmin Le Grand if( nSlot == SID_SCGRIDSHOW) 2400*facb16e7SArmin Le Grand { 2401*facb16e7SArmin Le Grand 2402*facb16e7SArmin Le Grand ScViewData* pViewData = pTabViewShell->GetViewData(); 2403*facb16e7SArmin Le Grand const ScViewOptions& rOldOpt = pViewData->GetOptions(); 2404*facb16e7SArmin Le Grand ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); 2405*facb16e7SArmin Le Grand bool bState = ((const SfxBoolItem &)pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich( nSlot ) )).GetValue(); 2406*facb16e7SArmin Le Grand 2407*facb16e7SArmin Le Grand if ( (bool)rOldOpt.GetOption( VOPT_GRID ) != bState) 2408*facb16e7SArmin Le Grand { 2409*facb16e7SArmin Le Grand ScViewOptions rNewOpt(rOldOpt); 2410*facb16e7SArmin Le Grand rNewOpt.SetOption( VOPT_GRID, bState); 2411*facb16e7SArmin Le Grand pViewData->SetOptions( rNewOpt ); 2412*facb16e7SArmin Le Grand pViewData->GetDocument()->SetViewOptions( rNewOpt ); 2413*facb16e7SArmin Le Grand pDocSh->SetDocumentModified(); 2414*facb16e7SArmin Le Grand //add , write the change to sc view config 2415*facb16e7SArmin Le Grand ScModule* pScMod = SC_MOD(); 2416*facb16e7SArmin Le Grand pScMod->SetViewOptions( rNewOpt ); 2417*facb16e7SArmin Le Grand //add end 2418*facb16e7SArmin Le Grand rBindings.Invalidate( nSlot ); 2419*facb16e7SArmin Le Grand } 2420*facb16e7SArmin Le Grand } 2421*facb16e7SArmin Le Grand } 2422*facb16e7SArmin Le Grand 2423*facb16e7SArmin Le Grand } 2424*facb16e7SArmin Le Grand 2425*facb16e7SArmin Le Grand void ScFormatShell::GetViewOptions( SfxItemSet& rSet ) 2426*facb16e7SArmin Le Grand { 2427*facb16e7SArmin Le Grand ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); 2428*facb16e7SArmin Le Grand if( pTabViewShell ) 2429*facb16e7SArmin Le Grand { 2430*facb16e7SArmin Le Grand ScViewOptions aViewOpt = pTabViewShell->GetViewData()->GetOptions(); 2431*facb16e7SArmin Le Grand rSet.ClearItem(SID_SCGRIDSHOW); 2432*facb16e7SArmin Le Grand SfxBoolItem aItem( SID_SCGRIDSHOW, aViewOpt.GetOption( VOPT_GRID ) ); 2433*facb16e7SArmin Le Grand rSet.Put(aItem); 2434*facb16e7SArmin Le Grand } 2435*facb16e7SArmin Le Grand } 2436*facb16e7SArmin Le Grand 2437*facb16e7SArmin Le Grand // eof 2438