Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
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.
15 : : *
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).
21 : : *
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.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <com/sun/star/presentation/FadeEffect.hpp>
30 : :
31 : : #include <svx/dialogs.hrc>
32 : :
33 : : #include "sdattr.hxx"
34 : : #include "strings.hrc"
35 : :
36 : : #define _SD_DIACTRL_CXX
37 : : #include "diactrl.hxx"
38 : :
39 : : #include "sdresid.hxx"
40 : : #include "app.hrc"
41 : : #include "res_bmp.hrc"
42 : : #include <sfx2/dispatch.hxx>
43 : : #include <sfx2/viewfrm.hxx>
44 : : #include <sfx2/app.hxx>
45 : :
46 : : using namespace ::com::sun::star;
47 : :
48 [ # # ]: 25 : SFX_IMPL_TOOLBOX_CONTROL( SdTbxCtlDiaPages, SfxUInt16Item )
49 : :
50 : :
51 : : //========================================================================
52 : : // SdPagesField
53 : : //========================================================================
54 : :
55 : 0 : SdPagesField::SdPagesField( Window* pParent,
56 : : const uno::Reference< frame::XFrame >& rFrame,
57 : : WinBits nBits ) :
58 : : SvxMetricField ( pParent, rFrame, nBits ),
59 : 0 : m_xFrame ( rFrame )
60 : : {
61 [ # # ][ # # ]: 0 : String aStr( SdResId( STR_SLIDE_PLURAL ) );
62 [ # # ]: 0 : SetCustomUnitText( aStr );
63 : :
64 : : // Groesse setzen
65 [ # # ]: 0 : aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "XXX" ) );
66 [ # # ][ # # ]: 0 : Size aSize( GetTextWidth( aStr )+20, GetTextHeight()+6 );
67 : :
68 : :
69 [ # # ]: 0 : SetSizePixel( aSize );
70 : :
71 : : // Parameter des MetricFields setzen
72 [ # # ]: 0 : SetUnit( FUNIT_CUSTOM );
73 [ # # ]: 0 : SetMin( 1 );
74 [ # # ]: 0 : SetFirst( 1 );
75 [ # # ]: 0 : SetMax( 15 );
76 [ # # ]: 0 : SetLast( 15 );
77 : 0 : SetSpinSize( 1 );
78 [ # # ]: 0 : SetDecimalDigits( 0 );
79 [ # # ][ # # ]: 0 : Show();
80 : 0 : }
81 : :
82 : : // -----------------------------------------------------------------------
83 : :
84 : 0 : SdPagesField::~SdPagesField()
85 : : {
86 [ # # ]: 0 : }
87 : :
88 : : // -----------------------------------------------------------------------
89 : :
90 : 0 : void SdPagesField::UpdatePagesField( const SfxUInt16Item* pItem )
91 : : {
92 [ # # ]: 0 : if( pItem )
93 : : {
94 : 0 : long nValue = (long) pItem->GetValue();
95 : 0 : SetValue( nValue );
96 [ # # ]: 0 : if( nValue == 1 )
97 [ # # ][ # # ]: 0 : SetCustomUnitText( String( SdResId( STR_SLIDE_SINGULAR ) ) );
[ # # ]
98 : : else
99 [ # # ][ # # ]: 0 : SetCustomUnitText( String( SdResId( STR_SLIDE_PLURAL ) ) );
[ # # ]
100 : : }
101 : : else
102 [ # # ]: 0 : SetText( String() );
103 : 0 : }
104 : :
105 : : // -----------------------------------------------------------------------
106 : :
107 : 0 : void SdPagesField::Modify()
108 : : {
109 [ # # ][ # # ]: 0 : SfxUInt16Item aItem( SID_PAGES_PER_ROW, (sal_uInt16) GetValue() );
110 : :
111 : 0 : ::uno::Any a;
112 [ # # ]: 0 : ::uno::Sequence< ::beans::PropertyValue > aArgs( 1 );
113 [ # # ]: 0 : aArgs[0].Name = "PagesPerRow";
114 [ # # ]: 0 : aItem.QueryValue( a );
115 [ # # ]: 0 : aArgs[0].Value = a;
116 [ # # ]: 0 : SfxToolBoxControl::Dispatch( ::uno::Reference< ::frame::XDispatchProvider >( m_xFrame->getController(), ::uno::UNO_QUERY ),
117 : : ".uno:PagesPerRow",
118 [ # # ][ # # ]: 0 : aArgs );
[ # # ][ # # ]
[ # # ]
119 : 0 : }
120 : :
121 : : /*************************************************************************
122 : : |*
123 : : |* SdTbxCtlDiaPages
124 : : |*
125 : : \************************************************************************/
126 : :
127 : 0 : SdTbxCtlDiaPages::SdTbxCtlDiaPages( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
128 : 0 : SfxToolBoxControl( nSlotId, nId, rTbx )
129 : : {
130 : 0 : }
131 : :
132 : : //========================================================================
133 : :
134 : 0 : SdTbxCtlDiaPages::~SdTbxCtlDiaPages()
135 : : {
136 [ # # ]: 0 : }
137 : :
138 : : //========================================================================
139 : :
140 : 0 : void SdTbxCtlDiaPages::StateChanged( sal_uInt16,
141 : : SfxItemState eState, const SfxPoolItem* pState )
142 : : {
143 : 0 : SdPagesField* pFld = (SdPagesField*) GetToolBox().GetItemWindow( GetId() );
144 : : DBG_ASSERT( pFld, "Window not found" );
145 : :
146 [ # # ]: 0 : if ( eState == SFX_ITEM_DISABLED )
147 : : {
148 : 0 : pFld->Disable();
149 [ # # ]: 0 : pFld->SetText( String() );
150 : : }
151 : : else
152 : : {
153 : 0 : pFld->Enable();
154 : :
155 : 0 : const SfxUInt16Item* pItem = 0;
156 [ # # ]: 0 : if ( eState == SFX_ITEM_AVAILABLE )
157 : : {
158 [ # # ]: 0 : pItem = dynamic_cast< const SfxUInt16Item* >( pState );
159 : : DBG_ASSERT( pItem, "sd::SdTbxCtlDiaPages::StateChanged(), wrong item type!" );
160 : : }
161 : :
162 : 0 : pFld->UpdatePagesField( pItem );
163 : : }
164 : 0 : }
165 : :
166 : : //========================================================================
167 : :
168 : 0 : Window* SdTbxCtlDiaPages::CreateItemWindow( Window* pParent )
169 : : {
170 [ # # ]: 0 : return new SdPagesField( pParent, m_xFrame );
171 : : }
172 : :
173 : :
174 : :
175 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|