1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file
5f6e50924SAndrew Rist * distributed with this work for additional information
6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at
10f6e50924SAndrew Rist *
11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist *
13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist * software distributed under the License is distributed on an
15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the
17f6e50924SAndrew Rist * specific language governing permissions and limitations
18f6e50924SAndrew Rist * under the License.
19f6e50924SAndrew Rist *
20f6e50924SAndrew Rist *************************************************************/
21f6e50924SAndrew Rist
22f6e50924SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include <string> // HACK: prevent conflict between STLPORT and Workshop headers
30cdf0e10cSrcweir #include <sfx2/app.hxx>
31cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
32cdf0e10cSrcweir #include <sfx2/objsh.hxx>
33cdf0e10cSrcweir #include <sfx2/viewsh.hxx>
34cdf0e10cSrcweir #include <rtl/ustring.hxx>
35cdf0e10cSrcweir
36cdf0e10cSrcweir #include <svx/dialogs.hrc>
37cdf0e10cSrcweir
38cdf0e10cSrcweir #define DELAY_TIMEOUT 300
39cdf0e10cSrcweir
40cdf0e10cSrcweir #define TMP_STR_BEGIN '['
41cdf0e10cSrcweir #define TMP_STR_END ']'
42cdf0e10cSrcweir
43cdf0e10cSrcweir #include "svx/drawitem.hxx"
44cdf0e10cSrcweir #include "svx/xattr.hxx"
45cdf0e10cSrcweir #include <svx/xtable.hxx>
46cdf0e10cSrcweir #include <svx/fillctrl.hxx>
47cdf0e10cSrcweir #include <svx/itemwin.hxx>
48cdf0e10cSrcweir #include <svx/dialmgr.hxx>
49cdf0e10cSrcweir #include "helpid.hrc"
50cdf0e10cSrcweir
51cdf0e10cSrcweir using namespace ::com::sun::star::uno;
52cdf0e10cSrcweir using namespace ::com::sun::star::util;
53cdf0e10cSrcweir using namespace ::com::sun::star::beans;
54cdf0e10cSrcweir using namespace ::com::sun::star::frame;
55cdf0e10cSrcweir using namespace ::com::sun::star::lang;
56cdf0e10cSrcweir
57cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFillToolBoxControl, XFillStyleItem );
58cdf0e10cSrcweir
59cdf0e10cSrcweir /*************************************************************************
60cdf0e10cSrcweir |*
61cdf0e10cSrcweir |* SvxFillToolBoxControl
62cdf0e10cSrcweir |*
63cdf0e10cSrcweir \************************************************************************/
64cdf0e10cSrcweir
SvxFillToolBoxControl(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)65cdf0e10cSrcweir SvxFillToolBoxControl::SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
66cdf0e10cSrcweir SfxToolBoxControl( nSlotId, nId, rTbx ),
67cdf0e10cSrcweir
68cdf0e10cSrcweir pStyleItem ( NULL ),
69cdf0e10cSrcweir pColorItem ( NULL ),
70cdf0e10cSrcweir pGradientItem ( NULL ),
71cdf0e10cSrcweir pHatchItem ( NULL ),
72cdf0e10cSrcweir pBitmapItem ( NULL ),
73cdf0e10cSrcweir pFillControl ( NULL ),
74cdf0e10cSrcweir pFillTypeLB ( NULL ),
75cdf0e10cSrcweir pFillAttrLB ( NULL ),
76cdf0e10cSrcweir bUpdate ( sal_False ),
77cdf0e10cSrcweir eLastXFS ( XFILL_NONE )
78cdf0e10cSrcweir {
79cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillColor" )));
80cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillGradient" )));
81cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillHatch" )));
82cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillBitmap" )));
83cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColorTableState" )));
84cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GradientListState" )));
85cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:HatchListState" )));
86cdf0e10cSrcweir addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:BitmapListState" )));
87cdf0e10cSrcweir }
88cdf0e10cSrcweir
89cdf0e10cSrcweir //========================================================================
90cdf0e10cSrcweir
~SvxFillToolBoxControl()91cdf0e10cSrcweir SvxFillToolBoxControl::~SvxFillToolBoxControl()
92cdf0e10cSrcweir {
93cdf0e10cSrcweir delete pStyleItem;
94cdf0e10cSrcweir delete pColorItem;
95cdf0e10cSrcweir delete pGradientItem;
96cdf0e10cSrcweir delete pHatchItem;
97cdf0e10cSrcweir delete pBitmapItem;
98cdf0e10cSrcweir }
99cdf0e10cSrcweir
100cdf0e10cSrcweir //========================================================================
101cdf0e10cSrcweir
StateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)102cdf0e10cSrcweir void SvxFillToolBoxControl::StateChanged(
103cdf0e10cSrcweir
104cdf0e10cSrcweir sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
105cdf0e10cSrcweir
106cdf0e10cSrcweir {
107cdf0e10cSrcweir bool bEnableControls = sal_False;
108cdf0e10cSrcweir
109cdf0e10cSrcweir if( eState == SFX_ITEM_DISABLED )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir if( nSID == SID_ATTR_FILL_STYLE )
112cdf0e10cSrcweir {
113cdf0e10cSrcweir pFillTypeLB->Disable();
114cdf0e10cSrcweir pFillTypeLB->SetNoSelection();
115cdf0e10cSrcweir }
116cdf0e10cSrcweir pFillAttrLB->Disable();
117cdf0e10cSrcweir pFillAttrLB->SetNoSelection();
118cdf0e10cSrcweir }
119cdf0e10cSrcweir else
120cdf0e10cSrcweir {
121cdf0e10cSrcweir if ( SFX_ITEM_AVAILABLE == eState )
122cdf0e10cSrcweir {
123cdf0e10cSrcweir if( nSID == SID_ATTR_FILL_STYLE )
124cdf0e10cSrcweir {
125cdf0e10cSrcweir delete pStyleItem;
126cdf0e10cSrcweir pStyleItem = (XFillStyleItem*) pState->Clone();
127cdf0e10cSrcweir pFillTypeLB->Enable();
128cdf0e10cSrcweir }
129cdf0e10cSrcweir else if( pStyleItem )
130cdf0e10cSrcweir {
131cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
132cdf0e10cSrcweir
133cdf0e10cSrcweir if( nSID == SID_ATTR_FILL_COLOR )
134cdf0e10cSrcweir {
135cdf0e10cSrcweir delete pColorItem;
136cdf0e10cSrcweir pColorItem = (XFillColorItem*) pState->Clone();
137cdf0e10cSrcweir
138cdf0e10cSrcweir if( eXFS == XFILL_SOLID )
139cdf0e10cSrcweir bEnableControls = sal_True;
140cdf0e10cSrcweir }
141cdf0e10cSrcweir else if( nSID == SID_ATTR_FILL_GRADIENT )
142cdf0e10cSrcweir {
143cdf0e10cSrcweir delete pGradientItem;
144cdf0e10cSrcweir pGradientItem = (XFillGradientItem*) pState->Clone();
145cdf0e10cSrcweir
146cdf0e10cSrcweir if( eXFS == XFILL_GRADIENT )
147cdf0e10cSrcweir bEnableControls = sal_True;
148cdf0e10cSrcweir }
149cdf0e10cSrcweir else if( nSID == SID_ATTR_FILL_HATCH )
150cdf0e10cSrcweir {
151cdf0e10cSrcweir delete pHatchItem;
152cdf0e10cSrcweir pHatchItem = (XFillHatchItem*) pState->Clone();
153cdf0e10cSrcweir
154cdf0e10cSrcweir if( eXFS == XFILL_HATCH )
155cdf0e10cSrcweir bEnableControls = sal_True;
156cdf0e10cSrcweir }
157cdf0e10cSrcweir else if( nSID == SID_ATTR_FILL_BITMAP )
158cdf0e10cSrcweir {
159cdf0e10cSrcweir delete pBitmapItem;
160cdf0e10cSrcweir pBitmapItem = (XFillBitmapItem*) pState->Clone();
161cdf0e10cSrcweir
162cdf0e10cSrcweir if( eXFS == XFILL_BITMAP )
163cdf0e10cSrcweir bEnableControls = sal_True;
164cdf0e10cSrcweir }
165cdf0e10cSrcweir }
1668f1fbbb1SArmin Le Grand
1678f1fbbb1SArmin Le Grand if( pStyleItem )
1688f1fbbb1SArmin Le Grand {
1698f1fbbb1SArmin Le Grand // ensure that the correct entry is selected in pFillTypeLB. It
1708f1fbbb1SArmin Le Grand // might have been changed by nSID == SID_ATTR_FILL_STYLE, but
1718f1fbbb1SArmin Le Grand // it might also be in an in-between state when user had started to
1728f1fbbb1SArmin Le Grand // change fillstyle, but not yet changed fillvalue for new style
1738f1fbbb1SArmin Le Grand // and when nSID == SID_ATTR_FILL_COLOR/SID_ATTR_FILL_GRADIENT/
1748f1fbbb1SArmin Le Grand // SID_ATTR_FILL_HATCH/SID_ATTR_FILL_BITMAP value change is triggered
1758f1fbbb1SArmin Le Grand eLastXFS = pFillTypeLB->GetSelectEntryPos();
1768f1fbbb1SArmin Le Grand XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
1778f1fbbb1SArmin Le Grand
1788f1fbbb1SArmin Le Grand if(eLastXFS != eXFS)
1798f1fbbb1SArmin Le Grand {
1808f1fbbb1SArmin Le Grand bUpdate = sal_True;
1818f1fbbb1SArmin Le Grand pFillTypeLB->SelectEntryPos( sal::static_int_cast< sal_uInt16 >( eXFS ) );
1828f1fbbb1SArmin Le Grand }
1838f1fbbb1SArmin Le Grand
1848f1fbbb1SArmin Le Grand pFillAttrLB->Enable();
1858f1fbbb1SArmin Le Grand }
1868f1fbbb1SArmin Le Grand
1878f1fbbb1SArmin Le Grand if( bEnableControls )
188cdf0e10cSrcweir {
189cdf0e10cSrcweir //pFillTypeLB->Enable();
190cdf0e10cSrcweir pFillAttrLB->Enable();
191cdf0e10cSrcweir
192cdf0e10cSrcweir bUpdate = sal_True;
193cdf0e10cSrcweir }
194cdf0e10cSrcweir
195cdf0e10cSrcweir Update( pState );
196cdf0e10cSrcweir }
197cdf0e10cSrcweir else
198cdf0e10cSrcweir {
199cdf0e10cSrcweir // leerer oder uneindeutiger Status
200cdf0e10cSrcweir if( nSID == SID_ATTR_FILL_STYLE )
201cdf0e10cSrcweir {
202cdf0e10cSrcweir pFillTypeLB->SetNoSelection();
203cdf0e10cSrcweir pFillAttrLB->Disable();
204cdf0e10cSrcweir pFillAttrLB->SetNoSelection();
205cdf0e10cSrcweir bUpdate = sal_False;
206cdf0e10cSrcweir }
207cdf0e10cSrcweir else
208cdf0e10cSrcweir {
209cdf0e10cSrcweir XFillStyle eXFS = XFILL_NONE;
210cdf0e10cSrcweir if( pStyleItem )
211cdf0e10cSrcweir eXFS = (XFillStyle)pStyleItem->GetValue();
212cdf0e10cSrcweir if( !pStyleItem ||
213cdf0e10cSrcweir ( nSID == SID_ATTR_FILL_COLOR && eXFS == XFILL_SOLID ) ||
214cdf0e10cSrcweir ( nSID == SID_ATTR_FILL_GRADIENT && eXFS == XFILL_GRADIENT ) ||
215cdf0e10cSrcweir ( nSID == SID_ATTR_FILL_HATCH && eXFS == XFILL_HATCH ) ||
216cdf0e10cSrcweir ( nSID == SID_ATTR_FILL_BITMAP && eXFS == XFILL_BITMAP ) )
217cdf0e10cSrcweir {
218cdf0e10cSrcweir pFillAttrLB->SetNoSelection();
219cdf0e10cSrcweir //bUpdate = sal_False;
220cdf0e10cSrcweir }
221cdf0e10cSrcweir }
222cdf0e10cSrcweir }
223cdf0e10cSrcweir }
224cdf0e10cSrcweir }
225cdf0e10cSrcweir
226cdf0e10cSrcweir //========================================================================
227cdf0e10cSrcweir
Update(const SfxPoolItem * pState)228cdf0e10cSrcweir void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
229cdf0e10cSrcweir {
230cdf0e10cSrcweir if ( pStyleItem && pState && bUpdate )
231cdf0e10cSrcweir {
232cdf0e10cSrcweir bUpdate = sal_False;
233cdf0e10cSrcweir
234cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
235cdf0e10cSrcweir
236cdf0e10cSrcweir // Pruefen, ob Fuellstil schon vorher aktiv war
237cdf0e10cSrcweir //if( eTmpXFS != eXFS )
238cdf0e10cSrcweir if( (XFillStyle) eLastXFS != eXFS )
239cdf0e10cSrcweir pFillControl->SelectFillTypeHdl( NULL );
240cdf0e10cSrcweir //eLastXFS = eXFS;
241cdf0e10cSrcweir
242cdf0e10cSrcweir switch( eXFS )
243cdf0e10cSrcweir {
244cdf0e10cSrcweir case XFILL_NONE:
245cdf0e10cSrcweir break;
246cdf0e10cSrcweir
247cdf0e10cSrcweir case XFILL_SOLID:
248cdf0e10cSrcweir {
249cdf0e10cSrcweir if ( pColorItem )
250cdf0e10cSrcweir {
251cdf0e10cSrcweir String aString( pColorItem->GetName() );
252cdf0e10cSrcweir ::Color aColor = pColorItem->GetColorValue();
253cdf0e10cSrcweir
254cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString );
255cdf0e10cSrcweir
256cdf0e10cSrcweir if ( pFillAttrLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ||
257cdf0e10cSrcweir pFillAttrLB->GetSelectEntryColor() != aColor )
258cdf0e10cSrcweir pFillAttrLB->SelectEntry( aColor );
259cdf0e10cSrcweir
260cdf0e10cSrcweir // NEU
261cdf0e10cSrcweir // Pruefen, ob Eintrag nicht in der Liste ist
262cdf0e10cSrcweir if( pFillAttrLB->GetSelectEntryPos() ==
263cdf0e10cSrcweir LISTBOX_ENTRY_NOTFOUND ||
264cdf0e10cSrcweir pFillAttrLB->GetSelectEntryColor() != aColor )
265cdf0e10cSrcweir {
266cdf0e10cSrcweir sal_uInt16 nCount = pFillAttrLB->GetEntryCount();
267cdf0e10cSrcweir String aTmpStr;
268cdf0e10cSrcweir if( nCount > 0 )
269cdf0e10cSrcweir {
270cdf0e10cSrcweir //Letzter Eintrag wird auf temporaere Farbe geprueft
271cdf0e10cSrcweir aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
272cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN &&
273cdf0e10cSrcweir aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END )
274cdf0e10cSrcweir {
275cdf0e10cSrcweir pFillAttrLB->RemoveEntry( nCount - 1 );
276cdf0e10cSrcweir }
277cdf0e10cSrcweir }
278cdf0e10cSrcweir aTmpStr = TMP_STR_BEGIN;
279cdf0e10cSrcweir aTmpStr += aString;
280cdf0e10cSrcweir aTmpStr += TMP_STR_END;
281cdf0e10cSrcweir
282cdf0e10cSrcweir //pFillAttrLB->SetUpdateMode( sal_False );
283cdf0e10cSrcweir sal_uInt16 nPos = pFillAttrLB->InsertEntry( aColor, aTmpStr );
284cdf0e10cSrcweir //pFillAttrLB->SetUpdateMode( sal_True );
285cdf0e10cSrcweir pFillAttrLB->SelectEntryPos( nPos );
286cdf0e10cSrcweir }
287cdf0e10cSrcweir // NEU
288cdf0e10cSrcweir }
289cdf0e10cSrcweir else
290cdf0e10cSrcweir pFillAttrLB->SetNoSelection();
291cdf0e10cSrcweir }
292cdf0e10cSrcweir break;
293cdf0e10cSrcweir
294cdf0e10cSrcweir case XFILL_GRADIENT:
295cdf0e10cSrcweir {
296cdf0e10cSrcweir if ( pGradientItem )
297cdf0e10cSrcweir {
298cdf0e10cSrcweir String aString( pGradientItem->GetName() );
299cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString );
300cdf0e10cSrcweir // NEU
301cdf0e10cSrcweir // Pruefen, ob Eintrag nicht in der Liste ist
302cdf0e10cSrcweir if( pFillAttrLB->GetSelectEntry() != aString )
303cdf0e10cSrcweir {
304cdf0e10cSrcweir sal_uInt16 nCount = pFillAttrLB->GetEntryCount();
305cdf0e10cSrcweir String aTmpStr;
306cdf0e10cSrcweir if( nCount > 0 )
307cdf0e10cSrcweir {
308cdf0e10cSrcweir //Letzter Eintrag wird auf temporaeren Eintrag geprueft
309cdf0e10cSrcweir aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
310cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN &&
311cdf0e10cSrcweir aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END )
312cdf0e10cSrcweir {
313cdf0e10cSrcweir pFillAttrLB->RemoveEntry( nCount - 1 );
314cdf0e10cSrcweir }
315cdf0e10cSrcweir }
316cdf0e10cSrcweir aTmpStr = TMP_STR_BEGIN;
317cdf0e10cSrcweir aTmpStr += aString;
318cdf0e10cSrcweir aTmpStr += TMP_STR_END;
319cdf0e10cSrcweir
320cdf0e10cSrcweir XGradientEntry* pEntry = new XGradientEntry( pGradientItem->GetGradientValue(), aTmpStr );
321*c7be74b1SArmin Le Grand XGradientListSharedPtr aGradientList(XPropertyListFactory::CreateSharedXGradientList(String::CreateFromAscii("TmpList")));
322*c7be74b1SArmin Le Grand
323*c7be74b1SArmin Le Grand aGradientList->Insert(pEntry);
324*c7be74b1SArmin Le Grand aGradientList->SetDirty(false);
325*c7be74b1SArmin Le Grand const Bitmap aBmp = aGradientList->GetUiBitmap( 0 );
326cdf0e10cSrcweir
32797e8a929SArmin Le Grand if( !aBmp.IsEmpty() )
328cdf0e10cSrcweir {
32997e8a929SArmin Le Grand ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), aBmp );
330cdf0e10cSrcweir pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
331cdf0e10cSrcweir }
332cdf0e10cSrcweir }
333cdf0e10cSrcweir // NEU
334cdf0e10cSrcweir }
335cdf0e10cSrcweir else
336cdf0e10cSrcweir pFillAttrLB->SetNoSelection();
337cdf0e10cSrcweir }
338cdf0e10cSrcweir break;
339cdf0e10cSrcweir
340cdf0e10cSrcweir case XFILL_HATCH:
341cdf0e10cSrcweir {
342cdf0e10cSrcweir if ( pHatchItem )
343cdf0e10cSrcweir {
344cdf0e10cSrcweir String aString( pHatchItem->GetName() );
345cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString );
346cdf0e10cSrcweir // NEU
347cdf0e10cSrcweir // Pruefen, ob Eintrag nicht in der Liste ist
348cdf0e10cSrcweir if( pFillAttrLB->GetSelectEntry() != aString )
349cdf0e10cSrcweir {
350cdf0e10cSrcweir sal_uInt16 nCount = pFillAttrLB->GetEntryCount();
351cdf0e10cSrcweir String aTmpStr;
352cdf0e10cSrcweir if( nCount > 0 )
353cdf0e10cSrcweir {
354cdf0e10cSrcweir //Letzter Eintrag wird auf temporaeren Eintrag geprueft
355cdf0e10cSrcweir aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
356cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN &&
357cdf0e10cSrcweir aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END )
358cdf0e10cSrcweir {
359cdf0e10cSrcweir pFillAttrLB->RemoveEntry( nCount - 1 );
360cdf0e10cSrcweir }
361cdf0e10cSrcweir }
362cdf0e10cSrcweir aTmpStr = TMP_STR_BEGIN;
363cdf0e10cSrcweir aTmpStr += aString;
364cdf0e10cSrcweir aTmpStr += TMP_STR_END;
365cdf0e10cSrcweir
366cdf0e10cSrcweir XHatchEntry* pEntry = new XHatchEntry( pHatchItem->GetHatchValue(), aTmpStr );
367*c7be74b1SArmin Le Grand XHatchListSharedPtr aHatchList(XPropertyListFactory::CreateSharedXHatchList(String::CreateFromAscii("TmpList")));
368*c7be74b1SArmin Le Grand
369*c7be74b1SArmin Le Grand aHatchList->Insert( pEntry );
370*c7be74b1SArmin Le Grand aHatchList->SetDirty( sal_False );
371*c7be74b1SArmin Le Grand const Bitmap aBmp = aHatchList->GetUiBitmap( 0 );
372cdf0e10cSrcweir
37397e8a929SArmin Le Grand if( !aBmp.IsEmpty() )
374cdf0e10cSrcweir {
37597e8a929SArmin Le Grand ( (ListBox*)pFillAttrLB )->InsertEntry( pEntry->GetName(), aBmp );
376cdf0e10cSrcweir pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
377cdf0e10cSrcweir }
378cdf0e10cSrcweir }
379cdf0e10cSrcweir // NEU
380cdf0e10cSrcweir }
381cdf0e10cSrcweir else
382cdf0e10cSrcweir pFillAttrLB->SetNoSelection();
383cdf0e10cSrcweir }
384cdf0e10cSrcweir break;
385cdf0e10cSrcweir
386cdf0e10cSrcweir case XFILL_BITMAP:
387cdf0e10cSrcweir {
388cdf0e10cSrcweir if ( pBitmapItem )
389cdf0e10cSrcweir // &&
390cdf0e10cSrcweir // SfxObjectShell::Current() &&
391cdf0e10cSrcweir // SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) )
392cdf0e10cSrcweir {
393cdf0e10cSrcweir String aString( pBitmapItem->GetName() );
394cdf0e10cSrcweir // Bitmap aBitmap( pBitmapItem->GetValue() );
395cdf0e10cSrcweir
396cdf0e10cSrcweir // SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
397cdf0e10cSrcweir // SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) ) );
398cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString );
399cdf0e10cSrcweir // NEU
400cdf0e10cSrcweir // Pruefen, ob Eintrag nicht in der Liste ist
401cdf0e10cSrcweir if( pFillAttrLB->GetSelectEntry() != aString )
402cdf0e10cSrcweir {
403cdf0e10cSrcweir sal_uInt16 nCount = pFillAttrLB->GetEntryCount();
404cdf0e10cSrcweir String aTmpStr;
405cdf0e10cSrcweir if( nCount > 0 )
406cdf0e10cSrcweir {
407cdf0e10cSrcweir //Letzter Eintrag wird auf temporaeren Eintrag geprueft
408cdf0e10cSrcweir aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
409cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN &&
410cdf0e10cSrcweir aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END )
411cdf0e10cSrcweir {
412cdf0e10cSrcweir pFillAttrLB->RemoveEntry( nCount - 1 );
413cdf0e10cSrcweir }
414cdf0e10cSrcweir }
415cdf0e10cSrcweir aTmpStr = TMP_STR_BEGIN;
416cdf0e10cSrcweir aTmpStr += aString;
417cdf0e10cSrcweir aTmpStr += TMP_STR_END;
418cdf0e10cSrcweir
419*c7be74b1SArmin Le Grand XBitmapListSharedPtr aNew(XPropertyListFactory::CreateSharedXBitmapList(String::CreateFromAscii("TmpList")));
420*c7be74b1SArmin Le Grand aNew->Insert(new XBitmapEntry(pBitmapItem->GetGraphicObject(), aTmpStr));
421*c7be74b1SArmin Le Grand aNew->SetDirty(false);
422*c7be74b1SArmin Le Grand
423*c7be74b1SArmin Le Grand pFillAttrLB->Fill( aNew );
424*c7be74b1SArmin Le Grand pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
425cdf0e10cSrcweir }
426cdf0e10cSrcweir // NEU
427cdf0e10cSrcweir }
428cdf0e10cSrcweir else
429cdf0e10cSrcweir pFillAttrLB->SetNoSelection();
430cdf0e10cSrcweir }
431cdf0e10cSrcweir break;
432cdf0e10cSrcweir
433cdf0e10cSrcweir default:
434cdf0e10cSrcweir DBG_ERROR( "Nicht unterstuetzter Flaechentyp" );
435cdf0e10cSrcweir break;
436cdf0e10cSrcweir }
437cdf0e10cSrcweir }
438cdf0e10cSrcweir
439cdf0e10cSrcweir if( pState && pStyleItem )
440cdf0e10cSrcweir {
441cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle) pStyleItem->GetValue();
442cdf0e10cSrcweir
443cdf0e10cSrcweir // Die Listen haben sich geaendert ?
444cdf0e10cSrcweir if( pState->ISA( SvxColorTableItem ) &&
445cdf0e10cSrcweir eXFS == XFILL_SOLID )
446cdf0e10cSrcweir {
447cdf0e10cSrcweir ::Color aTmpColor( pFillAttrLB->GetSelectEntryColor() );
448cdf0e10cSrcweir pFillAttrLB->Clear();
449cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxColorTableItem*)pState )->GetColorTable() );
450cdf0e10cSrcweir pFillAttrLB->SelectEntry( aTmpColor );
451cdf0e10cSrcweir }
452cdf0e10cSrcweir if( pState->ISA( SvxGradientListItem ) &&
453cdf0e10cSrcweir eXFS == XFILL_GRADIENT )
454cdf0e10cSrcweir {
455cdf0e10cSrcweir String aString( pFillAttrLB->GetSelectEntry() );
456cdf0e10cSrcweir pFillAttrLB->Clear();
457cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxGradientListItem*)pState )->GetGradientList() );
458cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString );
459cdf0e10cSrcweir }
460cdf0e10cSrcweir if( pState->ISA( SvxHatchListItem ) &&
461cdf0e10cSrcweir eXFS == XFILL_HATCH )
462cdf0e10cSrcweir {
463cdf0e10cSrcweir String aString( pFillAttrLB->GetSelectEntry() );
464cdf0e10cSrcweir pFillAttrLB->Clear();
465cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxHatchListItem*)pState )->GetHatchList() );
466cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString );
467cdf0e10cSrcweir }
468cdf0e10cSrcweir if( pState->ISA( SvxBitmapListItem ) &&
469cdf0e10cSrcweir eXFS == XFILL_BITMAP )
470cdf0e10cSrcweir {
471cdf0e10cSrcweir String aString( pFillAttrLB->GetSelectEntry() );
472cdf0e10cSrcweir pFillAttrLB->Clear();
473cdf0e10cSrcweir pFillAttrLB->Fill( ( (SvxBitmapListItem*)pState )->GetBitmapList() );
474cdf0e10cSrcweir pFillAttrLB->SelectEntry( aString );
475cdf0e10cSrcweir }
476cdf0e10cSrcweir }
477cdf0e10cSrcweir }
478cdf0e10cSrcweir
479cdf0e10cSrcweir //========================================================================
480cdf0e10cSrcweir
CreateItemWindow(Window * pParent)481cdf0e10cSrcweir Window* SvxFillToolBoxControl::CreateItemWindow( Window *pParent )
482cdf0e10cSrcweir {
483cdf0e10cSrcweir if ( GetSlotId() == SID_ATTR_FILL_STYLE )
484cdf0e10cSrcweir {
485cdf0e10cSrcweir pFillControl = new FillControl( pParent );
486cdf0e10cSrcweir // Damit dem FillControl das SvxFillToolBoxControl bekannt ist
487cdf0e10cSrcweir // (und um kompatibel zu bleiben)
488cdf0e10cSrcweir pFillControl->SetData( this );
489cdf0e10cSrcweir
490cdf0e10cSrcweir pFillAttrLB = (SvxFillAttrBox*)pFillControl->pLbFillAttr;
491cdf0e10cSrcweir pFillTypeLB = (SvxFillTypeBox*)pFillControl->pLbFillType;
492cdf0e10cSrcweir
493cdf0e10cSrcweir pFillAttrLB->SetUniqueId( HID_FILL_ATTR_LISTBOX );
494cdf0e10cSrcweir pFillTypeLB->SetUniqueId( HID_FILL_TYPE_LISTBOX );
495cdf0e10cSrcweir
496cdf0e10cSrcweir return pFillControl;
497cdf0e10cSrcweir }
498cdf0e10cSrcweir return NULL;
499cdf0e10cSrcweir }
500cdf0e10cSrcweir
501cdf0e10cSrcweir /*************************************************************************
502cdf0e10cSrcweir |*
503cdf0e10cSrcweir |* FillControl
504cdf0e10cSrcweir |*
505cdf0e10cSrcweir \************************************************************************/
506cdf0e10cSrcweir
FillControl(Window * pParent,WinBits nStyle)507cdf0e10cSrcweir FillControl::FillControl( Window* pParent, WinBits nStyle ) :
508cdf0e10cSrcweir Window( pParent, nStyle | WB_DIALOGCONTROL ),
509cdf0e10cSrcweir pLbFillType(new SvxFillTypeBox( this )),
510cdf0e10cSrcweir aLogicalFillSize(40,80),
511cdf0e10cSrcweir aLogicalAttrSize(50,80)
512cdf0e10cSrcweir {
513cdf0e10cSrcweir pLbFillAttr = new SvxFillAttrBox( this );
514cdf0e10cSrcweir Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT));
515cdf0e10cSrcweir Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT));
516cdf0e10cSrcweir pLbFillType->SetSizePixel(aTypeSize);
517cdf0e10cSrcweir pLbFillAttr->SetSizePixel(aAttrSize);
518cdf0e10cSrcweir //to get the base height
519cdf0e10cSrcweir aTypeSize = pLbFillType->GetSizePixel();
520cdf0e10cSrcweir aAttrSize = pLbFillAttr->GetSizePixel();
521cdf0e10cSrcweir Point aAttrPnt = pLbFillAttr->GetPosPixel();
522cdf0e10cSrcweir SetSizePixel(
523cdf0e10cSrcweir Size( aAttrPnt.X() + aAttrSize.Width(),
524cdf0e10cSrcweir Max( aAttrSize.Height(), aTypeSize.Height() ) ) );
525cdf0e10cSrcweir
526cdf0e10cSrcweir pLbFillType->SetSelectHdl( LINK( this, FillControl, SelectFillTypeHdl ) );
527cdf0e10cSrcweir pLbFillAttr->SetSelectHdl( LINK( this, FillControl, SelectFillAttrHdl ) );
528cdf0e10cSrcweir
529cdf0e10cSrcweir aDelayTimer.SetTimeout( DELAY_TIMEOUT );
530cdf0e10cSrcweir aDelayTimer.SetTimeoutHdl( LINK( this, FillControl, DelayHdl ) );
531cdf0e10cSrcweir aDelayTimer.Start();
532cdf0e10cSrcweir }
533cdf0e10cSrcweir
534cdf0e10cSrcweir //------------------------------------------------------------------------
535cdf0e10cSrcweir
~FillControl()536cdf0e10cSrcweir FillControl::~FillControl()
537cdf0e10cSrcweir {
538cdf0e10cSrcweir delete pLbFillType;
539cdf0e10cSrcweir delete pLbFillAttr;
540cdf0e10cSrcweir }
541cdf0e10cSrcweir
542cdf0e10cSrcweir //------------------------------------------------------------------------
543cdf0e10cSrcweir
IMPL_LINK_INLINE_START(FillControl,DelayHdl,Timer *,EMPTYARG)544cdf0e10cSrcweir IMPL_LINK_INLINE_START( FillControl, DelayHdl, Timer *, EMPTYARG )
545cdf0e10cSrcweir {
546cdf0e10cSrcweir SelectFillTypeHdl( NULL );
547cdf0e10cSrcweir ( (SvxFillToolBoxControl*)GetData() )->updateStatus( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" )));
548cdf0e10cSrcweir // ( (SvxFillToolBoxControl*)GetData() )->GetBindings().Invalidate( SID_ATTR_FILL_STYLE );
549cdf0e10cSrcweir return 0;
550cdf0e10cSrcweir }
IMPL_LINK_INLINE_END(FillControl,DelayHdl,Timer *,pTimer)551cdf0e10cSrcweir IMPL_LINK_INLINE_END( FillControl, DelayHdl, Timer *, pTimer )
552cdf0e10cSrcweir
553cdf0e10cSrcweir //------------------------------------------------------------------------
554cdf0e10cSrcweir
555cdf0e10cSrcweir IMPL_LINK( FillControl, SelectFillTypeHdl, ListBox *, pBox )
556cdf0e10cSrcweir {
557cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos();
558cdf0e10cSrcweir
559cdf0e10cSrcweir // Spaeter sollte eine Optimierung derart erfolgen, dass die
560cdf0e10cSrcweir // Listen, bzw. Tables nur dann geloescht und wieder aufgebaut
561cdf0e10cSrcweir // werden, wenn sich die Listen, bzw. Tables tatsaechlich geaendert
562cdf0e10cSrcweir // haben (in den LBs natuerlich).
563cdf0e10cSrcweir
564cdf0e10cSrcweir if ( ( pBox && !pBox->IsTravelSelect() ) || !pBox )
565cdf0e10cSrcweir {
566cdf0e10cSrcweir // Damit wir in folgendem Fall einen Status anzeigen koennen:
567cdf0e10cSrcweir // Ein Typ wurde ausgewaehlt aber kein Attribut.
568cdf0e10cSrcweir // Die Selektion hat genau die gleichen Attribute wie die vorherige.
569cdf0e10cSrcweir // SvxFillToolBoxControl* pControlerItem = (SvxFillToolBoxControl*)GetData();
570cdf0e10cSrcweir // if( pControlerItem )
571cdf0e10cSrcweir // pControlerItem->ClearCache();
572cdf0e10cSrcweir
573cdf0e10cSrcweir pLbFillAttr->Clear();
574cdf0e10cSrcweir SfxObjectShell* pSh = SfxObjectShell::Current();
575cdf0e10cSrcweir
576cdf0e10cSrcweir switch( eXFS )
577cdf0e10cSrcweir {
578cdf0e10cSrcweir case XFILL_NONE:
579cdf0e10cSrcweir {
580cdf0e10cSrcweir pLbFillType->Selected();
581cdf0e10cSrcweir SelectFillAttrHdl( pBox );
582cdf0e10cSrcweir pLbFillAttr->Disable();
583cdf0e10cSrcweir }
584cdf0e10cSrcweir break;
585cdf0e10cSrcweir
586cdf0e10cSrcweir case XFILL_SOLID:
587cdf0e10cSrcweir {
588cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_COLOR_TABLE ) )
589cdf0e10cSrcweir {
590cdf0e10cSrcweir SvxColorTableItem aItem( *(const SvxColorTableItem*)(
591cdf0e10cSrcweir pSh->GetItem( SID_COLOR_TABLE ) ) );
592cdf0e10cSrcweir pLbFillAttr->Enable();
593cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetColorTable() );
594cdf0e10cSrcweir }
595cdf0e10cSrcweir else
596cdf0e10cSrcweir pLbFillAttr->Disable();
597cdf0e10cSrcweir }
598cdf0e10cSrcweir break;
599cdf0e10cSrcweir
600cdf0e10cSrcweir case XFILL_GRADIENT:
601cdf0e10cSrcweir {
602cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
603cdf0e10cSrcweir {
604cdf0e10cSrcweir SvxGradientListItem aItem( *(const SvxGradientListItem*)(
605cdf0e10cSrcweir pSh->GetItem( SID_GRADIENT_LIST ) ) );
606cdf0e10cSrcweir pLbFillAttr->Enable();
607cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetGradientList() );
608cdf0e10cSrcweir }
609cdf0e10cSrcweir else
610cdf0e10cSrcweir pLbFillAttr->Disable();
611cdf0e10cSrcweir }
612cdf0e10cSrcweir break;
613cdf0e10cSrcweir
614cdf0e10cSrcweir case XFILL_HATCH:
615cdf0e10cSrcweir {
616cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_HATCH_LIST ) )
617cdf0e10cSrcweir {
618cdf0e10cSrcweir SvxHatchListItem aItem( *(const SvxHatchListItem*)(
619cdf0e10cSrcweir pSh->GetItem( SID_HATCH_LIST ) ) );
620cdf0e10cSrcweir pLbFillAttr->Enable();
621cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetHatchList() );
622cdf0e10cSrcweir }
623cdf0e10cSrcweir else
624cdf0e10cSrcweir pLbFillAttr->Disable();
625cdf0e10cSrcweir }
626cdf0e10cSrcweir break;
627cdf0e10cSrcweir
628cdf0e10cSrcweir case XFILL_BITMAP:
629cdf0e10cSrcweir {
630cdf0e10cSrcweir if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) )
631cdf0e10cSrcweir {
632cdf0e10cSrcweir SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
633cdf0e10cSrcweir pSh->GetItem( SID_BITMAP_LIST ) ) );
634cdf0e10cSrcweir pLbFillAttr->Enable();
635cdf0e10cSrcweir pLbFillAttr->Fill( aItem.GetBitmapList() );
636cdf0e10cSrcweir }
637cdf0e10cSrcweir else
638cdf0e10cSrcweir pLbFillAttr->Disable();
639cdf0e10cSrcweir }
640cdf0e10cSrcweir break;
641cdf0e10cSrcweir }
642cdf0e10cSrcweir
643cdf0e10cSrcweir if( eXFS != XFILL_NONE ) // Wurde schon erledigt
644cdf0e10cSrcweir {
645cdf0e10cSrcweir if ( pBox )
646cdf0e10cSrcweir pLbFillType->Selected();
647cdf0e10cSrcweir
648cdf0e10cSrcweir // release focus
649cdf0e10cSrcweir if ( pBox && pLbFillType->IsRelease() )
650cdf0e10cSrcweir {
651cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::Current();
652cdf0e10cSrcweir if( pViewShell && pViewShell->GetWindow() )
653cdf0e10cSrcweir pViewShell->GetWindow()->GrabFocus();
654cdf0e10cSrcweir }
655cdf0e10cSrcweir }
656cdf0e10cSrcweir }
657cdf0e10cSrcweir return 0;
658cdf0e10cSrcweir }
659cdf0e10cSrcweir
660cdf0e10cSrcweir //------------------------------------------------------------------------
661cdf0e10cSrcweir
IMPL_LINK(FillControl,SelectFillAttrHdl,ListBox *,pBox)662cdf0e10cSrcweir IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox )
663cdf0e10cSrcweir {
664cdf0e10cSrcweir XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos();
665cdf0e10cSrcweir XFillStyleItem aXFillStyleItem( eXFS );
666cdf0e10cSrcweir sal_Bool bAction = pBox && !pLbFillAttr->IsTravelSelect();
667cdf0e10cSrcweir
668cdf0e10cSrcweir SfxObjectShell* pSh = SfxObjectShell::Current();
669cdf0e10cSrcweir if ( bAction )
670cdf0e10cSrcweir {
671cdf0e10cSrcweir Any a;
672cdf0e10cSrcweir Sequence< PropertyValue > aArgs( 1 );
673cdf0e10cSrcweir
674cdf0e10cSrcweir // First set the style
675cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ));
676cdf0e10cSrcweir aXFillStyleItem.QueryValue( a );
677cdf0e10cSrcweir aArgs[0].Value = a;
678cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch(
679cdf0e10cSrcweir ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" )), aArgs );
680cdf0e10cSrcweir
681cdf0e10cSrcweir switch( eXFS )
682cdf0e10cSrcweir {
683cdf0e10cSrcweir case XFILL_NONE:
684cdf0e10cSrcweir {
685cdf0e10cSrcweir }
686cdf0e10cSrcweir break;
687cdf0e10cSrcweir
688cdf0e10cSrcweir case XFILL_SOLID:
689cdf0e10cSrcweir {
690cdf0e10cSrcweir // NEU
691cdf0e10cSrcweir //Eintrag wird auf temporaere Farbe geprueft
692cdf0e10cSrcweir String aTmpStr = pLbFillAttr->GetSelectEntry();
693cdf0e10cSrcweir if( aTmpStr.GetChar(0) == TMP_STR_BEGIN && aTmpStr.GetChar(aTmpStr.Len()-1) == TMP_STR_END )
694cdf0e10cSrcweir {
695cdf0e10cSrcweir aTmpStr.Erase( aTmpStr.Len()-1, 1 );
696cdf0e10cSrcweir aTmpStr.Erase( 0, 1 );
697cdf0e10cSrcweir }
698cdf0e10cSrcweir
699cdf0e10cSrcweir XFillColorItem aXFillColorItem( aTmpStr, pLbFillAttr->GetSelectEntryColor() );
700cdf0e10cSrcweir
701cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ));
702cdf0e10cSrcweir aXFillColorItem.QueryValue( a );
703cdf0e10cSrcweir aArgs[0].Value = a;
704cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillColor" )),
705cdf0e10cSrcweir aArgs );
706cdf0e10cSrcweir }
707cdf0e10cSrcweir break;
708cdf0e10cSrcweir case XFILL_GRADIENT:
709cdf0e10cSrcweir {
710cdf0e10cSrcweir sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos();
711cdf0e10cSrcweir
712cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
713cdf0e10cSrcweir {
714cdf0e10cSrcweir SvxGradientListItem aItem(
715cdf0e10cSrcweir *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) );
716cdf0e10cSrcweir
717cdf0e10cSrcweir if ( nPos < aItem.GetGradientList()->Count() ) // kein temp. Eintrag ?
718cdf0e10cSrcweir {
719cdf0e10cSrcweir XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient();
720cdf0e10cSrcweir XFillGradientItem aXFillGradientItem( pLbFillAttr->GetSelectEntry(), aGradient );
721cdf0e10cSrcweir
722cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ));
723cdf0e10cSrcweir aXFillGradientItem.QueryValue( a );
724cdf0e10cSrcweir aArgs[0].Value = a;
725cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillGradient" )),
726cdf0e10cSrcweir aArgs );
727cdf0e10cSrcweir }
728cdf0e10cSrcweir }
729cdf0e10cSrcweir }
730cdf0e10cSrcweir break;
731cdf0e10cSrcweir
732cdf0e10cSrcweir case XFILL_HATCH:
733cdf0e10cSrcweir {
734cdf0e10cSrcweir sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos();
735cdf0e10cSrcweir
736cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) )
737cdf0e10cSrcweir {
738cdf0e10cSrcweir SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) );
739cdf0e10cSrcweir
740cdf0e10cSrcweir if ( nPos < aItem.GetHatchList()->Count() ) // kein temp. Eintrag ?
741cdf0e10cSrcweir {
742cdf0e10cSrcweir XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch();
743cdf0e10cSrcweir XFillHatchItem aXFillHatchItem( pLbFillAttr->GetSelectEntry(), aHatch );
744cdf0e10cSrcweir
745cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" ));
746cdf0e10cSrcweir aXFillHatchItem.QueryValue( a );
747cdf0e10cSrcweir aArgs[0].Value = a;
748cdf0e10cSrcweir ((SvxFillToolBoxControl*)GetData())->Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillHatch" )),
749cdf0e10cSrcweir aArgs );
750cdf0e10cSrcweir }
751cdf0e10cSrcweir }
752cdf0e10cSrcweir }
753cdf0e10cSrcweir break;
754cdf0e10cSrcweir
755cdf0e10cSrcweir case XFILL_BITMAP:
756cdf0e10cSrcweir {
757cdf0e10cSrcweir sal_uInt16 nPos = pLbFillAttr->GetSelectEntryPos();
758cdf0e10cSrcweir
759cdf0e10cSrcweir if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) )
760cdf0e10cSrcweir {
761cdf0e10cSrcweir SvxBitmapListItem aItem(
762cdf0e10cSrcweir *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) );
763cdf0e10cSrcweir
764cdf0e10cSrcweir if ( nPos < aItem.GetBitmapList()->Count() ) // kein temp. Eintrag ?
765cdf0e10cSrcweir {
76670d3707aSArmin Le Grand const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos);
76770d3707aSArmin Le Grand const XFillBitmapItem aXFillBitmapItem(pLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject());
768cdf0e10cSrcweir
769cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillBitmap" ));
770cdf0e10cSrcweir aXFillBitmapItem.QueryValue( a );
771cdf0e10cSrcweir aArgs[0].Value = a;
77270d3707aSArmin Le Grand ((SvxFillToolBoxControl*)GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillBitmap")), aArgs);
773cdf0e10cSrcweir }
774cdf0e10cSrcweir }
775cdf0e10cSrcweir }
776cdf0e10cSrcweir break;
777cdf0e10cSrcweir }
778cdf0e10cSrcweir
779cdf0e10cSrcweir // release focus
780cdf0e10cSrcweir if ( pLbFillAttr->IsRelease() && pBox )
781cdf0e10cSrcweir {
782cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::Current();
783cdf0e10cSrcweir if( pViewShell && pViewShell->GetWindow() )
784cdf0e10cSrcweir {
785cdf0e10cSrcweir pViewShell->GetWindow()->GrabFocus();
786cdf0e10cSrcweir }
787cdf0e10cSrcweir }
788cdf0e10cSrcweir }
789cdf0e10cSrcweir
790cdf0e10cSrcweir return 0;
791cdf0e10cSrcweir }
792cdf0e10cSrcweir
793cdf0e10cSrcweir //------------------------------------------------------------------------
794cdf0e10cSrcweir
Resize()795cdf0e10cSrcweir void FillControl::Resize()
796cdf0e10cSrcweir {
797cdf0e10cSrcweir // Breite der beiden ListBoxen nicht 1/2 : 1/2, sondern 2/5 : 3/5
798cdf0e10cSrcweir long nW = GetOutputSizePixel().Width() / 5;
799cdf0e10cSrcweir long nH = 180;
800cdf0e10cSrcweir long nSep = 0; // war vorher 4
801cdf0e10cSrcweir
802cdf0e10cSrcweir pLbFillType->SetSizePixel( Size( nW * 2 - nSep, nH ) );
803cdf0e10cSrcweir pLbFillAttr->SetPosSizePixel( Point( nW * 2 + nSep, 0 ), Size( nW * 3 - nSep, nH ) );
804cdf0e10cSrcweir }
805cdf0e10cSrcweir /* -----------------------------08.03.2002 15:04------------------------------
806cdf0e10cSrcweir
807cdf0e10cSrcweir ---------------------------------------------------------------------------*/
808cdf0e10cSrcweir
DataChanged(const DataChangedEvent & rDCEvt)809cdf0e10cSrcweir void FillControl::DataChanged( const DataChangedEvent& rDCEvt )
810cdf0e10cSrcweir {
811cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
812cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) )
813cdf0e10cSrcweir {
814cdf0e10cSrcweir Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT));
815cdf0e10cSrcweir Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT));
816cdf0e10cSrcweir pLbFillType->SetSizePixel(aTypeSize);
817cdf0e10cSrcweir pLbFillAttr->SetSizePixel(aAttrSize);
818cdf0e10cSrcweir //to get the base height
819cdf0e10cSrcweir aTypeSize = pLbFillType->GetSizePixel();
820cdf0e10cSrcweir aAttrSize = pLbFillAttr->GetSizePixel();
821cdf0e10cSrcweir Point aAttrPnt = pLbFillAttr->GetPosPixel();
822cdf0e10cSrcweir
823cdf0e10cSrcweir SetSizePixel(
824cdf0e10cSrcweir Size( aAttrPnt.X() + aAttrSize.Width(),
825cdf0e10cSrcweir Max( aAttrSize.Height(), aTypeSize.Height() ) ) );
826cdf0e10cSrcweir }
827cdf0e10cSrcweir Window::DataChanged( rDCEvt );
828cdf0e10cSrcweir }
829cdf0e10cSrcweir
830