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"
25*d29c2fc2SAndre Fischer #include <sfx2/sidebar/ResourceDefinitions.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
ParaBulletsControl(Window * pParent,svx::sidebar::ParaPropertyPanel & rPanel)397aed46aaSOliver-Rainer Wittmann ParaBulletsControl::ParaBulletsControl(
407aed46aaSOliver-Rainer Wittmann Window* pParent,
417aed46aaSOliver-Rainer Wittmann svx::sidebar::ParaPropertyPanel& rPanel )
427aed46aaSOliver-Rainer Wittmann : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_BULLETS) )
437aed46aaSOliver-Rainer Wittmann , maBulletsVS( this,SVX_RES(VS_VALUES) )
447aed46aaSOliver-Rainer Wittmann , maMoreButton( this,SVX_RES(CB_BULLET_MORE) )
457aed46aaSOliver-Rainer Wittmann , mrParaPropertyPanel( rPanel )
467aed46aaSOliver-Rainer Wittmann , mpBindings( mrParaPropertyPanel.GetBindings() )
47766ce4d0SZheng Fan {
487aed46aaSOliver-Rainer Wittmann FreeResource();
497aed46aaSOliver-Rainer Wittmann
507aed46aaSOliver-Rainer Wittmann maBulletsVS.SetColCount(3);
517aed46aaSOliver-Rainer Wittmann maBulletsVS.SetLineCount(3);
527aed46aaSOliver-Rainer Wittmann maBulletsVS.SetStyle( maBulletsVS.GetStyle() | WB_ITEMBORDER |WB_NO_DIRECTSELECT);
537aed46aaSOliver-Rainer Wittmann maBulletsVS.SetExtraSpacing(BULLET_IMAGE_SPACING);
547aed46aaSOliver-Rainer Wittmann maBulletsVS.SetItemWidth(BULLET_IMAGE_WIDTH);
557aed46aaSOliver-Rainer Wittmann maBulletsVS.SetItemHeight(BULLET_IMAGE_HEIGHT);
567aed46aaSOliver-Rainer Wittmann maBulletsVS.InsertItem( DEFAULT_NONE );
577aed46aaSOliver-Rainer Wittmann for( sal_uInt16 nVSIdx = 1; nVSIdx <= DEFAULT_BULLET_TYPES; ++nVSIdx )
587aed46aaSOliver-Rainer Wittmann {
597aed46aaSOliver-Rainer Wittmann maBulletsVS.InsertItem( nVSIdx );
607aed46aaSOliver-Rainer Wittmann }
617aed46aaSOliver-Rainer Wittmann
627aed46aaSOliver-Rainer Wittmann maBulletsVS.SetItemText( DEFAULT_NONE, SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE ));
637aed46aaSOliver-Rainer Wittmann NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
647aed46aaSOliver-Rainer Wittmann if ( pBullets )
657aed46aaSOliver-Rainer Wittmann {
667aed46aaSOliver-Rainer Wittmann for( sal_uInt16 nIndex = 0; nIndex < DEFAULT_BULLET_TYPES; ++nIndex )
677aed46aaSOliver-Rainer Wittmann {
687aed46aaSOliver-Rainer Wittmann maBulletsVS.SetItemText( nIndex + 1, pBullets->GetDescription(nIndex) );
697aed46aaSOliver-Rainer Wittmann }
707aed46aaSOliver-Rainer Wittmann }
71766ce4d0SZheng Fan
72766ce4d0SZheng Fan maBulletsVS.Show();
737aed46aaSOliver-Rainer Wittmann maBulletsVS.SetSelectHdl(LINK(this, ParaBulletsControl, BulletSelectHdl_Impl));
747aed46aaSOliver-Rainer Wittmann
757aed46aaSOliver-Rainer Wittmann maBulletsVS.SetColor( GetSettings().GetStyleSettings().GetHighContrastMode()
767aed46aaSOliver-Rainer Wittmann ? GetSettings().GetStyleSettings().GetMenuColor()
777aed46aaSOliver-Rainer Wittmann : sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );
787aed46aaSOliver-Rainer Wittmann maBulletsVS.SetBackground( GetSettings().GetStyleSettings().GetHighContrastMode()
797aed46aaSOliver-Rainer Wittmann ? GetSettings().GetStyleSettings().GetMenuColor()
807aed46aaSOliver-Rainer Wittmann : sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );
817aed46aaSOliver-Rainer Wittmann
827aed46aaSOliver-Rainer Wittmann maMoreButton.SetClickHdl(LINK(this, ParaBulletsControl, MoreButtonClickHdl_Impl));
83766ce4d0SZheng Fan
84766ce4d0SZheng Fan }
85766ce4d0SZheng Fan
867aed46aaSOliver-Rainer Wittmann
~ParaBulletsControl()87766ce4d0SZheng Fan ParaBulletsControl::~ParaBulletsControl()
88766ce4d0SZheng Fan {
89766ce4d0SZheng Fan }
90766ce4d0SZheng Fan
917aed46aaSOliver-Rainer Wittmann
UpdateValueSet()92766ce4d0SZheng Fan void ParaBulletsControl::UpdateValueSet()
93766ce4d0SZheng Fan {
947aed46aaSOliver-Rainer Wittmann maBulletsVS.StateChanged(STATE_CHANGE_STYLE);
957aed46aaSOliver-Rainer Wittmann maBulletsVS.StateChanged(STATE_CHANGE_INITSHOW);
967aed46aaSOliver-Rainer Wittmann
977aed46aaSOliver-Rainer Wittmann const sal_uInt16 nTypeIndex = mrParaPropertyPanel.GetBulletTypeIndex();
987aed46aaSOliver-Rainer Wittmann if ( nTypeIndex != (sal_uInt16)0xFFFF )
997aed46aaSOliver-Rainer Wittmann maBulletsVS.SelectItem( nTypeIndex );
1007aed46aaSOliver-Rainer Wittmann else
1017aed46aaSOliver-Rainer Wittmann {
1027aed46aaSOliver-Rainer Wittmann maBulletsVS.SelectItem(0);
1037aed46aaSOliver-Rainer Wittmann }
1047aed46aaSOliver-Rainer Wittmann maMoreButton.GrabFocus();
105766ce4d0SZheng Fan }
106766ce4d0SZheng Fan
1077aed46aaSOliver-Rainer Wittmann
IMPL_LINK(ParaBulletsControl,BulletSelectHdl_Impl,ValueSet *,EMPTYARG)108766ce4d0SZheng Fan IMPL_LINK(ParaBulletsControl, BulletSelectHdl_Impl, ValueSet*, EMPTYARG)
109766ce4d0SZheng Fan {
1107aed46aaSOliver-Rainer Wittmann const sal_uInt16 nIdx = maBulletsVS.GetSelectItemId();
1117aed46aaSOliver-Rainer Wittmann SfxUInt16Item aItem( FN_SVX_SET_BULLET, nIdx );
1127aed46aaSOliver-Rainer Wittmann if (mpBindings)
1137aed46aaSOliver-Rainer Wittmann mpBindings->GetDispatcher()->Execute( FN_SVX_SET_BULLET, SFX_CALLMODE_RECORD, &aItem, 0L );
1147aed46aaSOliver-Rainer Wittmann
1157aed46aaSOliver-Rainer Wittmann mrParaPropertyPanel.EndBulletsPopupMode();
1167aed46aaSOliver-Rainer Wittmann
1177aed46aaSOliver-Rainer Wittmann return 0;
118766ce4d0SZheng Fan }
119766ce4d0SZheng Fan
1207aed46aaSOliver-Rainer Wittmann
IMPL_LINK(ParaBulletsControl,MoreButtonClickHdl_Impl,void *,EMPTYARG)121766ce4d0SZheng Fan IMPL_LINK(ParaBulletsControl, MoreButtonClickHdl_Impl, void*, EMPTYARG)
122766ce4d0SZheng Fan {
1237aed46aaSOliver-Rainer Wittmann if (mpBindings)
1247aed46aaSOliver-Rainer Wittmann mpBindings->GetDispatcher()->Execute( SID_OUTLINE_BULLET, SFX_CALLMODE_ASYNCHRON );
125766ce4d0SZheng Fan
1267aed46aaSOliver-Rainer Wittmann mrParaPropertyPanel.EndBulletsPopupMode();
127766ce4d0SZheng Fan
1287aed46aaSOliver-Rainer Wittmann return 0;
129766ce4d0SZheng Fan }
130766ce4d0SZheng Fan
131766ce4d0SZheng Fan }} // end of namespace sidebar
132766ce4d0SZheng Fan
133766ce4d0SZheng Fan
134