Update ooo320-m1
[ooovba.git] / svx / source / tbxctrls / verttexttbxctrl.cxx
blob287ed3513d6d31c137001212aeb2a43db0234789
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: verttexttbxctrl.cxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #include <svx/dialmgr.hxx>
35 #include <svx/dialogs.hrc>
36 #include <verttexttbxctrl.hxx>
37 #include <svtools/languageoptions.hxx>
38 #include <sfx2/app.hxx>
39 #include <svtools/eitem.hxx>
40 #include <vcl/toolbox.hxx>
41 #include <rtl/ustring.hxx>
43 SFX_IMPL_TOOLBOX_CONTROL(SvxCTLTextTbxCtrl, SfxBoolItem);
44 SFX_IMPL_TOOLBOX_CONTROL(SvxVertTextTbxCtrl, SfxBoolItem);
46 // -----------------------------27.04.01 15:50--------------------------------
48 SvxCTLTextTbxCtrl::SvxCTLTextTbxCtrl(USHORT nSlotId, USHORT nId, ToolBox& rTbx ) :
49 SvxVertCTLTextTbxCtrl( nSlotId, nId, rTbx )
51 SetVert(FALSE);
52 addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CTLFontState" )));
55 SvxVertTextTbxCtrl::SvxVertTextTbxCtrl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ) :
56 SvxVertCTLTextTbxCtrl( nSlotId, nId, rTbx )
58 SetVert(TRUE);
59 addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:VerticalTextState" )));
62 /* ---------------------------------------------------------------------------*/
63 SvxVertCTLTextTbxCtrl::SvxVertCTLTextTbxCtrl( USHORT nSlotId, USHORT nId, ToolBox& rTbx ) :
64 SfxToolBoxControl( nSlotId, nId, rTbx ),
65 bCheckVertical(sal_True)
69 /* -----------------------------27.04.01 15:53--------------------------------
71 ---------------------------------------------------------------------------*/
72 SvxVertCTLTextTbxCtrl::~SvxVertCTLTextTbxCtrl( )
75 /* -----------------------------27.04.01 15:50--------------------------------
77 ---------------------------------------------------------------------------*/
78 void SvxVertCTLTextTbxCtrl::StateChanged(
79 USHORT nSID,
80 SfxItemState eState,
81 const SfxPoolItem* pState )
83 SvtLanguageOptions aLangOptions;
84 BOOL bCalc = sal_False;
85 BOOL bVisible = GetToolBox().IsItemVisible(GetId());
86 sal_Bool bEnabled = sal_False;
87 if ( nSID == SID_VERTICALTEXT_STATE )
88 bEnabled = aLangOptions.IsVerticalTextEnabled();
89 else if ( nSID == SID_CTLFONT_STATE )
90 bEnabled = aLangOptions.IsCTLFontEnabled();
91 else
93 SfxToolBoxControl::StateChanged(nSID, eState, pState);
94 return;
97 if(bEnabled)
99 if(!bVisible)
101 GetToolBox().ShowItem( GetId(), TRUE );
102 bCalc = sal_True;
105 else if(bVisible)
107 GetToolBox().HideItem( GetId() );
108 bCalc = sal_True;
110 if(bCalc)
112 ToolBox& rTbx = GetToolBox();
113 Window* pParent = rTbx.GetParent();
114 WindowType nWinType = pParent->GetType();
115 if(WINDOW_FLOATINGWINDOW == nWinType)
117 Size aSize(rTbx.CalcWindowSizePixel());
118 rTbx.SetPosSizePixel( Point(), aSize );
119 pParent->SetOutputSizePixel( aSize );
123 /* -----------------------------27.04.01 15:50--------------------------------
125 ---------------------------------------------------------------------------*/