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