18dcb2a10SAndre Fischer /**************************************************************
28dcb2a10SAndre Fischer  *
38dcb2a10SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
48dcb2a10SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
58dcb2a10SAndre Fischer  * distributed with this work for additional information
68dcb2a10SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
78dcb2a10SAndre Fischer  * to you under the Apache License, Version 2.0 (the
88dcb2a10SAndre Fischer  * "License"); you may not use this file except in compliance
98dcb2a10SAndre Fischer  * with the License.  You may obtain a copy of the License at
108dcb2a10SAndre Fischer  *
118dcb2a10SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
128dcb2a10SAndre Fischer  *
138dcb2a10SAndre Fischer  * Unless required by applicable law or agreed to in writing,
148dcb2a10SAndre Fischer  * software distributed under the License is distributed on an
158dcb2a10SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
168dcb2a10SAndre Fischer  * KIND, either express or implied.  See the License for the
178dcb2a10SAndre Fischer  * specific language governing permissions and limitations
188dcb2a10SAndre Fischer  * under the License.
198dcb2a10SAndre Fischer  *
208dcb2a10SAndre Fischer  *************************************************************/
218dcb2a10SAndre Fischer 
228dcb2a10SAndre Fischer #include "LineWidthPopup.hxx"
238dcb2a10SAndre Fischer #include "LineWidthControl.hxx"
248dcb2a10SAndre Fischer #include "LinePropertyPanel.hxx"
258dcb2a10SAndre Fischer 
268dcb2a10SAndre Fischer #include <unotools/viewoptions.hxx>
278dcb2a10SAndre Fischer 
288dcb2a10SAndre Fischer #include <boost/bind.hpp>
298dcb2a10SAndre Fischer 
308dcb2a10SAndre Fischer 
318dcb2a10SAndre Fischer namespace svx { namespace sidebar {
328dcb2a10SAndre Fischer 
LineWidthPopup(Window * pParent,const::boost::function<PopupControl * (PopupContainer *)> & rControlCreator)338dcb2a10SAndre Fischer LineWidthPopup::LineWidthPopup (
348dcb2a10SAndre Fischer     Window* pParent,
358dcb2a10SAndre Fischer     const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
368dcb2a10SAndre Fischer     : Popup(
378dcb2a10SAndre Fischer         pParent,
388dcb2a10SAndre Fischer         rControlCreator,
398dcb2a10SAndre Fischer         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width")))
408dcb2a10SAndre Fischer {
418dcb2a10SAndre Fischer     SetPopupModeEndHandler(::boost::bind(&LineWidthPopup::PopupModeEndCallback, this));
428dcb2a10SAndre Fischer }
438dcb2a10SAndre Fischer 
448dcb2a10SAndre Fischer 
458dcb2a10SAndre Fischer 
468dcb2a10SAndre Fischer 
~LineWidthPopup(void)478dcb2a10SAndre Fischer LineWidthPopup::~LineWidthPopup (void)
488dcb2a10SAndre Fischer {
498dcb2a10SAndre Fischer }
508dcb2a10SAndre Fischer 
518dcb2a10SAndre Fischer 
528dcb2a10SAndre Fischer 
538dcb2a10SAndre Fischer 
SetWidthSelect(long lValue,bool bValuable,SfxMapUnit eMapUnit)548dcb2a10SAndre Fischer void LineWidthPopup::SetWidthSelect (long lValue, bool bValuable, SfxMapUnit eMapUnit)
558dcb2a10SAndre Fischer {
568dcb2a10SAndre Fischer     ProvideContainerAndControl();
578dcb2a10SAndre Fischer 
588dcb2a10SAndre Fischer     LineWidthControl* pControl = dynamic_cast<LineWidthControl*>(mpControl.get());
598dcb2a10SAndre Fischer     if (pControl != NULL)
608dcb2a10SAndre Fischer         pControl->SetWidthSelect(lValue, bValuable, eMapUnit);
618dcb2a10SAndre Fischer }
628dcb2a10SAndre Fischer 
638dcb2a10SAndre Fischer 
648dcb2a10SAndre Fischer 
658dcb2a10SAndre Fischer 
PopupModeEndCallback(void)668dcb2a10SAndre Fischer void LineWidthPopup::PopupModeEndCallback (void)
678dcb2a10SAndre Fischer {
688dcb2a10SAndre Fischer     LineWidthControl* pControl = dynamic_cast<LineWidthControl*>(mpControl.get());
698dcb2a10SAndre Fischer 	if (pControl != NULL)
708dcb2a10SAndre Fischer 	{
718dcb2a10SAndre Fischer 		if (pControl->IsCloseByEdit())
728dcb2a10SAndre Fischer 		{
738dcb2a10SAndre Fischer 			SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE );
748dcb2a10SAndre Fischer 			::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
758dcb2a10SAndre Fischer 			aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineWidth") );
768dcb2a10SAndre Fischer 			aSeq[0].Value <<= ::rtl::OUString(
778dcb2a10SAndre Fischer                 String::CreateFromInt32(pControl->GetTmpCustomWidth()));
788dcb2a10SAndre Fischer 			aWinOpt.SetUserData( aSeq );
798dcb2a10SAndre Fischer 		}
808dcb2a10SAndre Fischer 	}
818dcb2a10SAndre Fischer }
828dcb2a10SAndre Fischer 
838dcb2a10SAndre Fischer 
848dcb2a10SAndre Fischer 
858dcb2a10SAndre Fischer } } // end of namespace svx::sidebar
868dcb2a10SAndre Fischer 
878dcb2a10SAndre Fischer 
88*4e8031e0SArmin Le Grand // eof
89