1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <svx/dialmgr.hxx>
22 #include <svx/dialogs.hrc>
23 #include <svx/verttexttbxctrl.hxx>
24 #include <svl/languageoptions.hxx>
25 #include <sfx2/app.hxx>
26 #include <svl/eitem.hxx>
27 #include <vcl/toolbox.hxx>
28 #include <rtl/ustring.hxx>
30 SFX_IMPL_TOOLBOX_CONTROL(SvxCTLTextTbxCtrl
, SfxBoolItem
);
31 SFX_IMPL_TOOLBOX_CONTROL(SvxVertTextTbxCtrl
, SfxBoolItem
);
33 SvxCTLTextTbxCtrl::SvxCTLTextTbxCtrl(sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
) :
34 SvxVertCTLTextTbxCtrl( nSlotId
, nId
, rTbx
)
36 addStatusListener( OUString( ".uno:CTLFontState" ));
39 SvxVertTextTbxCtrl::SvxVertTextTbxCtrl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
) :
40 SvxVertCTLTextTbxCtrl( nSlotId
, nId
, rTbx
)
42 addStatusListener( OUString( ".uno:VerticalTextState" ));
45 SvxVertCTLTextTbxCtrl::SvxVertCTLTextTbxCtrl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
) :
46 SfxToolBoxControl( nSlotId
, nId
, rTbx
)
50 SvxVertCTLTextTbxCtrl::~SvxVertCTLTextTbxCtrl( )
54 void SvxVertCTLTextTbxCtrl::StateChanged(
57 const SfxPoolItem
* pState
)
59 SvtLanguageOptions aLangOptions
;
61 bool bEnabled
= false;
62 if ( nSID
== SID_VERTICALTEXT_STATE
)
63 bEnabled
= aLangOptions
.IsVerticalTextEnabled();
64 else if ( nSID
== SID_CTLFONT_STATE
)
65 bEnabled
= aLangOptions
.IsCTLFontEnabled();
68 SfxToolBoxControl::StateChanged(nSID
, eState
, pState
);
74 // always hide if either IsVerticalTextEnabled or IsCTLFontEnabled
76 GetToolBox().HideItem( GetId() );
81 ToolBox
& rTbx
= GetToolBox();
82 vcl::Window
* pParent
= rTbx
.GetParent();
83 WindowType nWinType
= pParent
->GetType();
84 if(WINDOW_FLOATINGWINDOW
== nWinType
)
86 Size
aSize(rTbx
.CalcWindowSizePixel());
87 rTbx
.SetPosSizePixel( Point(), aSize
);
88 pParent
->SetOutputSizePixel( aSize
);
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */