1766ce4d0SZheng Fan /************************************************************** 2766ce4d0SZheng Fan * 3766ce4d0SZheng Fan * Licensed to the Apache Software Foundation (ASF) under one 4766ce4d0SZheng Fan * or more contributor license agreements. See the NOTICE file 5766ce4d0SZheng Fan * distributed with this work for additional information 6766ce4d0SZheng Fan * regarding copyright ownership. The ASF licenses this file 7766ce4d0SZheng Fan * to you under the Apache License, Version 2.0 (the 8766ce4d0SZheng Fan * "License"); you may not use this file except in compliance 9766ce4d0SZheng Fan * with the License. You may obtain a copy of the License at 10766ce4d0SZheng Fan * 11766ce4d0SZheng Fan * http://www.apache.org/licenses/LICENSE-2.0 12766ce4d0SZheng Fan * 13766ce4d0SZheng Fan * Unless required by applicable law or agreed to in writing, 14766ce4d0SZheng Fan * software distributed under the License is distributed on an 15766ce4d0SZheng Fan * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16766ce4d0SZheng Fan * KIND, either express or implied. See the License for the 17766ce4d0SZheng Fan * specific language governing permissions and limitations 18766ce4d0SZheng Fan * under the License. 19766ce4d0SZheng Fan * 20766ce4d0SZheng Fan *************************************************************/ 21766ce4d0SZheng Fan 22766ce4d0SZheng Fan #include "precompiled_svx.hxx" 23766ce4d0SZheng Fan #include "ParaBulletsControl.hxx" 24766ce4d0SZheng Fan #include "ParaPropertyPanel.hrc" 25766ce4d0SZheng Fan #include <sfx2/sidebar/propertypanel.hrc> 26766ce4d0SZheng Fan #include <svx/dialogs.hrc> 27766ce4d0SZheng Fan #include <svx/dialmgr.hxx> 28766ce4d0SZheng Fan #include <unotools/viewoptions.hxx> 29766ce4d0SZheng Fan #include <editeng/kernitem.hxx> 30766ce4d0SZheng Fan #include <sfx2/bindings.hxx> 31766ce4d0SZheng Fan #include <sfx2/dispatch.hxx> 32766ce4d0SZheng Fan #include <sfx2/sidebar/Theme.hxx> 33766ce4d0SZheng Fan #include <svtools/unitconv.hxx> 34766ce4d0SZheng Fan #include <svx/nbdtmg.hxx> 35766ce4d0SZheng Fan #include <svx/nbdtmgfact.hxx> 36766ce4d0SZheng Fan 37766ce4d0SZheng Fan namespace svx { namespace sidebar { 38766ce4d0SZheng Fan 39*7aed46aaSOliver-Rainer Wittmann ParaBulletsControl::ParaBulletsControl( 40*7aed46aaSOliver-Rainer Wittmann Window* pParent, 41*7aed46aaSOliver-Rainer Wittmann svx::sidebar::ParaPropertyPanel& rPanel ) 42*7aed46aaSOliver-Rainer Wittmann : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_BULLETS) ) 43*7aed46aaSOliver-Rainer Wittmann , maBulletsVS( this,SVX_RES(VS_VALUES) ) 44*7aed46aaSOliver-Rainer Wittmann , maMoreButton( this,SVX_RES(CB_BULLET_MORE) ) 45*7aed46aaSOliver-Rainer Wittmann , mrParaPropertyPanel( rPanel ) 46*7aed46aaSOliver-Rainer Wittmann , mpBindings( mrParaPropertyPanel.GetBindings() ) 47766ce4d0SZheng Fan { 48766ce4d0SZheng Fan FreeResource(); 49*7aed46aaSOliver-Rainer Wittmann 50766ce4d0SZheng Fan maBulletsVS.SetColCount(3); 51766ce4d0SZheng Fan maBulletsVS.SetLineCount(3); 52766ce4d0SZheng Fan maBulletsVS.SetStyle( maBulletsVS.GetStyle() | WB_ITEMBORDER |WB_NO_DIRECTSELECT); 53766ce4d0SZheng Fan maBulletsVS.SetExtraSpacing(BULLET_IMAGE_SPACING); 54766ce4d0SZheng Fan maBulletsVS.SetItemWidth(BULLET_IMAGE_WIDTH); 55766ce4d0SZheng Fan maBulletsVS.SetItemHeight(BULLET_IMAGE_HEIGHT); 56766ce4d0SZheng Fan maBulletsVS.InsertItem( DEFAULT_NONE ); 57766ce4d0SZheng Fan for( sal_uInt16 nVSIdx = 1; nVSIdx <= DEFAULT_BULLET_TYPES; ++nVSIdx ) 58766ce4d0SZheng Fan { 59766ce4d0SZheng Fan maBulletsVS.InsertItem( nVSIdx ); 60766ce4d0SZheng Fan } 61766ce4d0SZheng Fan 62766ce4d0SZheng Fan maBulletsVS.SetItemText( DEFAULT_NONE, SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE )); 63766ce4d0SZheng Fan NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS); 64766ce4d0SZheng Fan if ( pBullets ) 65766ce4d0SZheng Fan { 66766ce4d0SZheng Fan for( sal_uInt16 nIndex = 0; nIndex < DEFAULT_BULLET_TYPES; ++nIndex ) 67766ce4d0SZheng Fan { 68766ce4d0SZheng Fan maBulletsVS.SetItemText( nIndex + 1, pBullets->GetDescription(nIndex) ); 69766ce4d0SZheng Fan } 70766ce4d0SZheng Fan } 71766ce4d0SZheng Fan 72766ce4d0SZheng Fan maBulletsVS.Show(); 73766ce4d0SZheng Fan maBulletsVS.SetSelectHdl(LINK(this, ParaBulletsControl, BulletSelectHdl_Impl)); 74766ce4d0SZheng Fan 75*7aed46aaSOliver-Rainer Wittmann maBulletsVS.SetColor( GetSettings().GetStyleSettings().GetHighContrastMode() 76*7aed46aaSOliver-Rainer Wittmann ? GetSettings().GetStyleSettings().GetMenuColor() 77*7aed46aaSOliver-Rainer Wittmann : sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) ); 78*7aed46aaSOliver-Rainer Wittmann maBulletsVS.SetBackground( GetSettings().GetStyleSettings().GetHighContrastMode() 79*7aed46aaSOliver-Rainer Wittmann ? GetSettings().GetStyleSettings().GetMenuColor() 80*7aed46aaSOliver-Rainer Wittmann : sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) ); 81766ce4d0SZheng Fan 82766ce4d0SZheng Fan maMoreButton.SetClickHdl(LINK(this, ParaBulletsControl, MoreButtonClickHdl_Impl)); 83766ce4d0SZheng Fan 84766ce4d0SZheng Fan } 85766ce4d0SZheng Fan 86*7aed46aaSOliver-Rainer Wittmann 87766ce4d0SZheng Fan ParaBulletsControl::~ParaBulletsControl() 88766ce4d0SZheng Fan { 89766ce4d0SZheng Fan } 90766ce4d0SZheng Fan 91*7aed46aaSOliver-Rainer Wittmann 92766ce4d0SZheng Fan void ParaBulletsControl::UpdateValueSet() 93766ce4d0SZheng Fan { 94766ce4d0SZheng Fan maBulletsVS.StateChanged(STATE_CHANGE_STYLE); 95766ce4d0SZheng Fan maBulletsVS.StateChanged(STATE_CHANGE_INITSHOW); 96*7aed46aaSOliver-Rainer Wittmann 97*7aed46aaSOliver-Rainer Wittmann const sal_uInt16 nTypeIndex = mrParaPropertyPanel.GetBulletTypeIndex(); 98766ce4d0SZheng Fan if ( nTypeIndex != (sal_uInt16)0xFFFF ) 99766ce4d0SZheng Fan maBulletsVS.SelectItem( nTypeIndex ); 100766ce4d0SZheng Fan else 101766ce4d0SZheng Fan { 102766ce4d0SZheng Fan maBulletsVS.SelectItem(0); 103766ce4d0SZheng Fan } 104766ce4d0SZheng Fan maMoreButton.GrabFocus(); 105766ce4d0SZheng Fan } 106766ce4d0SZheng Fan 107*7aed46aaSOliver-Rainer Wittmann 108766ce4d0SZheng Fan IMPL_LINK(ParaBulletsControl, BulletSelectHdl_Impl, ValueSet*, EMPTYARG) 109766ce4d0SZheng Fan { 110*7aed46aaSOliver-Rainer Wittmann const sal_uInt16 nIdx = maBulletsVS.GetSelectItemId(); 111766ce4d0SZheng Fan SfxUInt16Item aItem( FN_SVX_SET_BULLET, nIdx ); 112766ce4d0SZheng Fan if (mpBindings) 113766ce4d0SZheng Fan mpBindings->GetDispatcher()->Execute( FN_SVX_SET_BULLET, SFX_CALLMODE_RECORD, &aItem, 0L ); 114766ce4d0SZheng Fan 115766ce4d0SZheng Fan mrParaPropertyPanel.EndBulletsPopupMode(); 116766ce4d0SZheng Fan 117766ce4d0SZheng Fan return 0; 118766ce4d0SZheng Fan } 119766ce4d0SZheng Fan 120*7aed46aaSOliver-Rainer Wittmann 121766ce4d0SZheng Fan IMPL_LINK(ParaBulletsControl, MoreButtonClickHdl_Impl, void*, EMPTYARG) 122766ce4d0SZheng Fan { 123766ce4d0SZheng Fan if (mpBindings) 124766ce4d0SZheng Fan mpBindings->GetDispatcher()->Execute( SID_OUTLINE_BULLET, SFX_CALLMODE_ASYNCHRON ); 125766ce4d0SZheng Fan 126766ce4d0SZheng Fan mrParaPropertyPanel.EndBulletsPopupMode(); 127766ce4d0SZheng Fan 128766ce4d0SZheng Fan return 0; 129766ce4d0SZheng Fan } 130766ce4d0SZheng Fan 131766ce4d0SZheng Fan }} // end of namespace sidebar 132766ce4d0SZheng Fan 133766ce4d0SZheng Fan 134