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 "TextCharacterSpacingPopup.hxx"
19 : #include "TextCharacterSpacingControl.hxx"
20 : #include <boost/bind.hpp>
21 : #include <unotools/viewoptions.hxx>
22 :
23 : namespace svx { namespace sidebar {
24 :
25 0 : TextCharacterSpacingPopup::TextCharacterSpacingPopup (
26 : Window* pParent,
27 : const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
28 : : Popup(
29 : pParent,
30 : rControlCreator,
31 0 : OUString( "Character Spacing"))
32 : {
33 0 : SetPopupModeEndHandler(::boost::bind(&TextCharacterSpacingPopup::PopupModeEndCallback, this));
34 0 : }
35 :
36 :
37 :
38 :
39 0 : TextCharacterSpacingPopup::~TextCharacterSpacingPopup (void)
40 : {
41 0 : }
42 :
43 :
44 :
45 :
46 0 : void TextCharacterSpacingPopup::Rearrange (bool bLBAvailable,bool bAvailable, long nKerning)
47 : {
48 0 : ProvideContainerAndControl();
49 :
50 0 : TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mpControl.get());
51 0 : if (pControl != NULL)
52 0 : pControl->Rearrange(bLBAvailable,bAvailable,nKerning);
53 0 : }
54 :
55 0 : void TextCharacterSpacingPopup::PopupModeEndCallback (void)
56 : {
57 0 : ProvideContainerAndControl();
58 0 : TextCharacterSpacingControl* pControl = dynamic_cast<TextCharacterSpacingControl*>(mpControl.get());
59 0 : if (pControl == NULL)
60 0 : return;
61 :
62 0 : if( pControl->GetLastCustomState() == SPACING_CLOSE_BY_CUS_EDIT)
63 : {
64 0 : SvtViewOptions aWinOpt( E_WINDOW, SIDEBAR_SPACING_GLOBAL_VALUE );
65 0 : ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1);
66 0 : aSeq[0].Name = "Spacing";
67 0 : aSeq[0].Value <<= ::rtl::OUString::number(pControl->GetLastCustomValue());
68 0 : aWinOpt.SetUserData( aSeq );
69 :
70 : }
71 : }
72 :
73 :
74 0 : } } // end of namespace svx::sidebar
75 :
|