1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26
27 #include <svx/dialmgr.hxx>
28 #include <svx/dialogs.hrc>
29 #include <svx/verttexttbxctrl.hxx>
30 #include <svl/languageoptions.hxx>
31 #include <sfx2/app.hxx>
32 #include <svl/eitem.hxx>
33 #include <vcl/toolbox.hxx>
34 #include <rtl/ustring.hxx>
35
36 SFX_IMPL_TOOLBOX_CONTROL(SvxCTLTextTbxCtrl, SfxBoolItem);
37 SFX_IMPL_TOOLBOX_CONTROL(SvxVertTextTbxCtrl, SfxBoolItem);
38
39 // -----------------------------27.04.01 15:50--------------------------------
40
SvxCTLTextTbxCtrl(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)41 SvxCTLTextTbxCtrl::SvxCTLTextTbxCtrl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
42 SvxVertCTLTextTbxCtrl( nSlotId, nId, rTbx )
43 {
44 SetVert(sal_False);
45 addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CTLFontState" )));
46 }
47
SvxVertTextTbxCtrl(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)48 SvxVertTextTbxCtrl::SvxVertTextTbxCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
49 SvxVertCTLTextTbxCtrl( nSlotId, nId, rTbx )
50 {
51 SetVert(sal_True);
52 addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:VerticalTextState" )));
53 }
54
55 /* ---------------------------------------------------------------------------*/
SvxVertCTLTextTbxCtrl(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)56 SvxVertCTLTextTbxCtrl::SvxVertCTLTextTbxCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
57 SfxToolBoxControl( nSlotId, nId, rTbx ),
58 bCheckVertical(sal_True)
59 {
60 }
61
62 /* -----------------------------27.04.01 15:53--------------------------------
63
64 ---------------------------------------------------------------------------*/
~SvxVertCTLTextTbxCtrl()65 SvxVertCTLTextTbxCtrl::~SvxVertCTLTextTbxCtrl( )
66 {
67 }
68 /* -----------------------------27.04.01 15:50--------------------------------
69
70 ---------------------------------------------------------------------------*/
StateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)71 void SvxVertCTLTextTbxCtrl::StateChanged(
72 sal_uInt16 nSID,
73 SfxItemState eState,
74 const SfxPoolItem* pState )
75 {
76 SvtLanguageOptions aLangOptions;
77 sal_Bool bCalc = sal_False;
78 sal_Bool bVisible = GetToolBox().IsItemVisible(GetId());
79 sal_Bool bEnabled = sal_False;
80 if ( nSID == SID_VERTICALTEXT_STATE )
81 bEnabled = aLangOptions.IsVerticalTextEnabled();
82 else if ( nSID == SID_CTLFONT_STATE )
83 bEnabled = aLangOptions.IsCTLFontEnabled();
84 else
85 {
86 SfxToolBoxControl::StateChanged(nSID, eState, pState);
87 return;
88 }
89
90 if(bEnabled)
91 {
92 if(!bVisible)
93 {
94 GetToolBox().ShowItem( GetId(), sal_True );
95 bCalc = sal_True;
96 }
97 }
98 else if(bVisible)
99 {
100 GetToolBox().HideItem( GetId() );
101 bCalc = sal_True;
102 }
103 if(bCalc)
104 {
105 ToolBox& rTbx = GetToolBox();
106 Window* pParent = rTbx.GetParent();
107 WindowType nWinType = pParent->GetType();
108 if(WINDOW_FLOATINGWINDOW == nWinType)
109 {
110 Size aSize(rTbx.CalcWindowSizePixel());
111 rTbx.SetPosSizePixel( Point(), aSize );
112 pParent->SetOutputSizePixel( aSize );
113 }
114 }
115 }
116 /* -----------------------------27.04.01 15:50--------------------------------
117
118 ---------------------------------------------------------------------------*/
119
120