1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include <svx/dialmgr.hxx>
31 #include <svx/dialogs.hrc>
32 #include <svx/verttexttbxctrl.hxx>
33 #include <svl/languageoptions.hxx>
34 #include <sfx2/app.hxx>
35 #include <svl/eitem.hxx>
36 #include <vcl/toolbox.hxx>
37 #include <rtl/ustring.hxx>
39 SFX_IMPL_TOOLBOX_CONTROL(SvxCTLTextTbxCtrl
, SfxBoolItem
);
40 SFX_IMPL_TOOLBOX_CONTROL(SvxVertTextTbxCtrl
, SfxBoolItem
);
42 SvxCTLTextTbxCtrl::SvxCTLTextTbxCtrl(sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
) :
43 SvxVertCTLTextTbxCtrl( nSlotId
, nId
, rTbx
)
46 addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CTLFontState" )));
49 SvxVertTextTbxCtrl::SvxVertTextTbxCtrl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
) :
50 SvxVertCTLTextTbxCtrl( nSlotId
, nId
, rTbx
)
53 addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:VerticalTextState" )));
56 /* ---------------------------------------------------------------------------*/
57 SvxVertCTLTextTbxCtrl::SvxVertCTLTextTbxCtrl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
) :
58 SfxToolBoxControl( nSlotId
, nId
, rTbx
),
59 bCheckVertical(sal_True
)
63 SvxVertCTLTextTbxCtrl::~SvxVertCTLTextTbxCtrl( )
67 void SvxVertCTLTextTbxCtrl::StateChanged(
70 const SfxPoolItem
* pState
)
72 SvtLanguageOptions aLangOptions
;
73 sal_Bool bCalc
= sal_False
;
74 sal_Bool bVisible
= GetToolBox().IsItemVisible(GetId());
75 sal_Bool bEnabled
= sal_False
;
76 if ( nSID
== SID_VERTICALTEXT_STATE
)
77 bEnabled
= aLangOptions
.IsVerticalTextEnabled();
78 else if ( nSID
== SID_CTLFONT_STATE
)
79 bEnabled
= aLangOptions
.IsCTLFontEnabled();
82 SfxToolBoxControl::StateChanged(nSID
, eState
, pState
);
90 GetToolBox().ShowItem( GetId(), sal_True
);
96 GetToolBox().HideItem( GetId() );
101 ToolBox
& rTbx
= GetToolBox();
102 Window
* pParent
= rTbx
.GetParent();
103 WindowType nWinType
= pParent
->GetType();
104 if(WINDOW_FLOATINGWINDOW
== nWinType
)
106 Size
aSize(rTbx
.CalcWindowSizePixel());
107 rTbx
.SetPosSizePixel( Point(), aSize
);
108 pParent
->SetOutputSizePixel( aSize
);
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */