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