Line data Source code
1 : /*
2 : * This file is part of the LibreOffice project.
3 : *
4 : * This Source Code Form is subject to the terms of the Mozilla Public
5 : * License, v. 2.0. If a copy of the MPL was not distributed with this
6 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 : *
8 : * This file incorporates work covered by the following license notice:
9 : *
10 : * Licensed to the Apache Software Foundation (ASF) under one or more
11 : * contributor license agreements. See the NOTICE file distributed
12 : * with this work for additional information regarding copyright
13 : * ownership. The ASF licenses this file to you under the Apache
14 : * License, Version 2.0 (the "License"); you may not use this file
15 : * except in compliance with the License. You may obtain a copy of
16 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 : */
18 : #include "LineWidthPopup.hxx"
19 : #include "LineWidthControl.hxx"
20 : #include "LinePropertyPanel.hxx"
21 :
22 : #include <unotools/viewoptions.hxx>
23 :
24 : #include <boost/bind.hpp>
25 :
26 :
27 : namespace svx { namespace sidebar {
28 :
29 0 : LineWidthPopup::LineWidthPopup (
30 : Window* pParent,
31 : const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
32 : : Popup(
33 : pParent,
34 : rControlCreator,
35 0 : OUString( "Width"))
36 : {
37 0 : SetPopupModeEndHandler(::boost::bind(&LineWidthPopup::PopupModeEndCallback, this));
38 0 : }
39 :
40 :
41 :
42 :
43 0 : LineWidthPopup::~LineWidthPopup (void)
44 : {
45 0 : }
46 :
47 :
48 :
49 :
50 0 : void LineWidthPopup::SetWidthSelect (long lValue, bool bValuable, SfxMapUnit eMapUnit)
51 : {
52 0 : ProvideContainerAndControl();
53 :
54 0 : LineWidthControl* pControl = dynamic_cast<LineWidthControl*>(mpControl.get());
55 0 : if (pControl != NULL)
56 0 : pControl->SetWidthSelect(lValue, bValuable, eMapUnit);
57 0 : }
58 :
59 :
60 :
61 :
62 0 : void LineWidthPopup::PopupModeEndCallback (void)
63 : {
64 0 : LineWidthControl* pControl = dynamic_cast<LineWidthControl*>(mpControl.get());
65 0 : if (pControl != NULL)
66 : {
67 0 : if (pControl->IsCloseByEdit())
68 : {
69 0 : SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_LINE_WIDTH_GLOBAL_VALUE );
70 0 : ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
71 0 : aSeq[0].Name = "LineWidth";
72 0 : aSeq[0].Value <<= ::rtl::OUString::number(pControl->GetTmpCustomWidth());
73 0 : aWinOpt.SetUserData( aSeq );
74 : }
75 : }
76 0 : }
77 :
78 :
79 :
80 0 : } } // end of namespace svx::sidebar
81 :
82 :
83 : // eof
|