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 "ParaLineSpacingPopup.hxx"
23 #include "ParaLineSpacingControl.hxx"
24 #include <boost/bind.hpp>
25 #include <unotools/viewoptions.hxx>
26 
27 namespace svx { namespace sidebar {
28 
ParaLineSpacingPopup(Window * pParent,const::boost::function<PopupControl * (PopupContainer *)> & rControlCreator)29 ParaLineSpacingPopup::ParaLineSpacingPopup (
30     Window* pParent,
31     const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
32     : Popup(
33         pParent,
34         rControlCreator,
35         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Paragraph Line Spacing")))
36 {
37 	SetPopupModeEndHandler(::boost::bind(&ParaLineSpacingPopup::PopupModeEndCallback, this));
38 }
39 
40 
41 
42 
~ParaLineSpacingPopup(void)43 ParaLineSpacingPopup::~ParaLineSpacingPopup (void)
44 {
45 }
46 
47 
48 
49 
Rearrange(SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem * currSPItem,const::sfx2::sidebar::EnumContext currentContext)50 void ParaLineSpacingPopup::Rearrange (SfxItemState currSPState,FieldUnit currMetricUnit,SvxLineSpacingItem* currSPItem,const ::sfx2::sidebar::EnumContext currentContext)
51 {
52     ProvideContainerAndControl();
53 
54     ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get());
55     if (pControl != NULL)
56         pControl->Rearrange(currSPState,currMetricUnit, currSPItem,currentContext);
57 }
58 
PopupModeEndCallback(void)59 void ParaLineSpacingPopup::PopupModeEndCallback (void)
60 {
61 	ProvideContainerAndControl();
62 	ParaLineSpacingControl* pControl = dynamic_cast<ParaLineSpacingControl*>(mpControl.get());
63 	if (pControl == NULL)
64 		return;
65 
66 	pControl->PopupModeEndCallback();
67 
68 	/*if( pControl->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT)
69 	{
70 		SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE );
71 		::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
72 		aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Spacing") );
73 		aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt32( pControl->GetLastCustomValue() ));
74 		aWinOpt.SetUserData( aSeq );
75 
76 	}*/
77 }
78 
79 
80 } } // end of namespace svx::sidebar
81 
82 
83