1*766ce4d0SZheng Fan /************************************************************** 2*766ce4d0SZheng Fan * 3*766ce4d0SZheng Fan * Licensed to the Apache Software Foundation (ASF) under one 4*766ce4d0SZheng Fan * or more contributor license agreements. See the NOTICE file 5*766ce4d0SZheng Fan * distributed with this work for additional information 6*766ce4d0SZheng Fan * regarding copyright ownership. The ASF licenses this file 7*766ce4d0SZheng Fan * to you under the Apache License, Version 2.0 (the 8*766ce4d0SZheng Fan * "License"); you may not use this file except in compliance 9*766ce4d0SZheng Fan * with the License. You may obtain a copy of the License at 10*766ce4d0SZheng Fan * 11*766ce4d0SZheng Fan * http://www.apache.org/licenses/LICENSE-2.0 12*766ce4d0SZheng Fan * 13*766ce4d0SZheng Fan * Unless required by applicable law or agreed to in writing, 14*766ce4d0SZheng Fan * software distributed under the License is distributed on an 15*766ce4d0SZheng Fan * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*766ce4d0SZheng Fan * KIND, either express or implied. See the License for the 17*766ce4d0SZheng Fan * specific language governing permissions and limitations 18*766ce4d0SZheng Fan * under the License. 19*766ce4d0SZheng Fan * 20*766ce4d0SZheng Fan *************************************************************/ 21*766ce4d0SZheng Fan 22*766ce4d0SZheng Fan #include "ParaLineSpacingPopup.hxx" 23*766ce4d0SZheng Fan #include "ParaLineSpacingControl.hxx" 24*766ce4d0SZheng Fan #include <boost/bind.hpp> 25*766ce4d0SZheng Fan #include <unotools/viewoptions.hxx> 26*766ce4d0SZheng Fan 27*766ce4d0SZheng Fan namespace svx { namespace sidebar { 28*766ce4d0SZheng Fan 29*766ce4d0SZheng Fan ParaLineSpacingPopup::ParaLineSpacingPopup ( 30*766ce4d0SZheng Fan Window* pParent, 31*766ce4d0SZheng Fan const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator) 32*766ce4d0SZheng Fan : Popup( 33*766ce4d0SZheng Fan pParent, 34*766ce4d0SZheng Fan rControlCreator, 35*766ce4d0SZheng Fan ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Paragraph Line Spacing"))) 36*766ce4d0SZheng Fan { 37*766ce4d0SZheng Fan SetPopupModeEndHandler(::boost::bind(&ParaLineSpacingPopup::PopupModeEndCallback, this)); 38*766ce4d0SZheng Fan } 39*766ce4d0SZheng Fan 40*766ce4d0SZheng Fan 41*766ce4d0SZheng Fan 42*766ce4d0SZheng Fan 43*766ce4d0SZheng Fan ParaLineSpacingPopup::~ParaLineSpacingPopup (void) 44*766ce4d0SZheng Fan { 45*766ce4d0SZheng Fan } 46*766ce4d0SZheng Fan 47*766ce4d0SZheng Fan 48*766ce4d0SZheng Fan 49*766ce4d0SZheng Fan 50*766ce4d0SZheng Fan void ParaLineSpacingPopup::Rearrange (SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext) 51*766ce4d0SZheng Fan { 52*766ce4d0SZheng Fan ProvideContainerAndControl(); 53*766ce4d0SZheng Fan 54*766ce4d0SZheng Fan ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get()); 55*766ce4d0SZheng Fan if (pControl != NULL) 56*766ce4d0SZheng Fan pControl->Rearrange(currSPState,currMetricUnit, currSPItem,currentContext); 57*766ce4d0SZheng Fan } 58*766ce4d0SZheng Fan 59*766ce4d0SZheng Fan void ParaLineSpacingPopup::PopupModeEndCallback (void) 60*766ce4d0SZheng Fan { 61*766ce4d0SZheng Fan ProvideContainerAndControl(); 62*766ce4d0SZheng Fan ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get()); 63*766ce4d0SZheng Fan if (pControl == NULL) 64*766ce4d0SZheng Fan return; 65*766ce4d0SZheng Fan 66*766ce4d0SZheng Fan pControl->PopupModeEndCallback(); 67*766ce4d0SZheng Fan 68*766ce4d0SZheng Fan /*if( pControl->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT) 69*766ce4d0SZheng Fan { 70*766ce4d0SZheng Fan SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE ); 71*766ce4d0SZheng Fan ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); 72*766ce4d0SZheng Fan aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Spacing") ); 73*766ce4d0SZheng Fan aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt32( pControl->GetLastCustomValue() )); 74*766ce4d0SZheng Fan aWinOpt.SetUserData( aSeq ); 75*766ce4d0SZheng Fan 76*766ce4d0SZheng Fan }*/ 77*766ce4d0SZheng Fan } 78*766ce4d0SZheng Fan 79*766ce4d0SZheng Fan 80*766ce4d0SZheng Fan } } // end of namespace svx::sidebar 81*766ce4d0SZheng Fan 82*766ce4d0SZheng Fan 83