xref: /AOO41X/main/sd/source/ui/view/drviewsf.cxx (revision 766ce4d0f35a6d5b4b7c65174e638ff2dfbd4ec1)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "DrawViewShell.hxx"
28cdf0e10cSrcweir #include <com/sun/star/form/FormButtonType.hpp>
29cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #ifndef _SVXIDS_HRC
32cdf0e10cSrcweir #include <svx/svxids.hrc>
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir #ifndef _GLOBL3D_HXX
35cdf0e10cSrcweir #include <svx/globl3d.hxx>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir #include <svx/hlnkitem.hxx>
38cdf0e10cSrcweir #include <editeng/eeitem.hxx>
39cdf0e10cSrcweir #ifndef _FLDITEM_HXX
40cdf0e10cSrcweir #include <editeng/flditem.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
43cdf0e10cSrcweir #include <svl/whiter.hxx>
44cdf0e10cSrcweir #include <svl/eitem.hxx>
45cdf0e10cSrcweir #include <svl/itempool.hxx>
46cdf0e10cSrcweir #include <sfx2/tplpitem.hxx>
47cdf0e10cSrcweir #ifndef _BINDING_HXX //autogen
48cdf0e10cSrcweir #include <sfx2/bindings.hxx>
49cdf0e10cSrcweir #endif
50cdf0e10cSrcweir #include <sfx2/app.hxx>
51cdf0e10cSrcweir #include <sfx2/templdlg.hxx>
52cdf0e10cSrcweir #include <svx/xdef.hxx>
53cdf0e10cSrcweir #include <svx/svddef.hxx>
54cdf0e10cSrcweir #include <svx/fmglob.hxx>
55cdf0e10cSrcweir #include <svx/svdouno.hxx>
56cdf0e10cSrcweir #include <tools/urlobj.hxx>
57cdf0e10cSrcweir #include <svx/fmshell.hxx>
58cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
59cdf0e10cSrcweir 
60cdf0e10cSrcweir #ifndef SD_FRAME_VIEW
61cdf0e10cSrcweir #include "FrameView.hxx"
62cdf0e10cSrcweir #endif
63cdf0e10cSrcweir #include "Outliner.hxx"
64cdf0e10cSrcweir #include "app.hrc"
65cdf0e10cSrcweir 
66cdf0e10cSrcweir #include "app.hxx"
67cdf0e10cSrcweir #include "stlsheet.hxx"
68cdf0e10cSrcweir #include "drawview.hxx"
69cdf0e10cSrcweir #include "drawdoc.hxx"
70cdf0e10cSrcweir #include "Window.hxx"
71cdf0e10cSrcweir #include "ViewShellBase.hxx"
72cdf0e10cSrcweir #include "FormShellManager.hxx"
73cdf0e10cSrcweir #include "cfgids.hxx"
74cdf0e10cSrcweir #include "anminfo.hxx"
75cdf0e10cSrcweir 
76*766ce4d0SZheng Fan #include <editeng/lspcitem.hxx>
77*766ce4d0SZheng Fan #include <editeng/ulspitem.hxx>
78*766ce4d0SZheng Fan #include <editeng/lrspitem.hxx>
79*766ce4d0SZheng Fan #include <editeng/escpitem.hxx>
80cdf0e10cSrcweir using ::rtl::OUString;
81cdf0e10cSrcweir using namespace ::com::sun::star;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir namespace sd {
84cdf0e10cSrcweir 
85cdf0e10cSrcweir /*************************************************************************
86cdf0e10cSrcweir |*
87cdf0e10cSrcweir |* Status von Controller-SfxSlots setzen
88cdf0e10cSrcweir |*
89cdf0e10cSrcweir \************************************************************************/
90cdf0e10cSrcweir 
91cdf0e10cSrcweir void DrawViewShell::GetCtrlState(SfxItemSet &rSet)
92cdf0e10cSrcweir {
93cdf0e10cSrcweir 	if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN)
94cdf0e10cSrcweir 	{
95cdf0e10cSrcweir 		// "Letzte Version" vom SFx en/disablen lassen
96cdf0e10cSrcweir         GetViewFrame()->GetSlotState (SID_RELOAD, NULL, &rSet);
97cdf0e10cSrcweir 	}
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK))
100cdf0e10cSrcweir 	{
101cdf0e10cSrcweir 		SvxHyperlinkItem aHLinkItem;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 		OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 		if (pOLV)
106cdf0e10cSrcweir 		{
107cdf0e10cSrcweir 			bool bField = false;
108cdf0e10cSrcweir 			const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
109cdf0e10cSrcweir 			if (pFieldItem)
110cdf0e10cSrcweir 			{
111cdf0e10cSrcweir                 ESelection aSel = pOLV->GetSelection();
112cdf0e10cSrcweir                 if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
113cdf0e10cSrcweir                 {
114cdf0e10cSrcweir 				    const SvxFieldData* pField = pFieldItem->GetField();
115cdf0e10cSrcweir 				    if (pField->ISA(SvxURLField))
116cdf0e10cSrcweir 				    {
117cdf0e10cSrcweir 					    aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
118cdf0e10cSrcweir 					    aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
119cdf0e10cSrcweir 					    aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
120cdf0e10cSrcweir 						bField = true;
121cdf0e10cSrcweir 				    }
122cdf0e10cSrcweir                 }
123cdf0e10cSrcweir 			}
124cdf0e10cSrcweir 			if (!bField)
125cdf0e10cSrcweir 			{
126cdf0e10cSrcweir 				// use selected text as name for urls
127cdf0e10cSrcweir 				String sReturn = pOLV->GetSelected();
128cdf0e10cSrcweir 				sReturn.Erase(255);
129cdf0e10cSrcweir 				sReturn.EraseTrailingChars();
130cdf0e10cSrcweir 				aHLinkItem.SetName(sReturn);
131cdf0e10cSrcweir 			}
132cdf0e10cSrcweir 		}
133cdf0e10cSrcweir 		else
134cdf0e10cSrcweir 		{
135cdf0e10cSrcweir 			if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0)
136cdf0e10cSrcweir 			{
137cdf0e10cSrcweir                 bool bFound = false;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir                 SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
140cdf0e10cSrcweir                 if( pMarkedObj && (FmFormInventor == pMarkedObj->GetObjInventor()) )
141cdf0e10cSrcweir                 {
142cdf0e10cSrcweir 				    SdrUnoObj* pUnoCtrl = dynamic_cast< SdrUnoObj* >( pMarkedObj );
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 				    if(pUnoCtrl) try
145cdf0e10cSrcweir 				    {
146cdf0e10cSrcweir                         uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
147cdf0e10cSrcweir 					    uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
148cdf0e10cSrcweir 					    uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 					    form::FormButtonType eButtonType = form::FormButtonType_URL;
151cdf0e10cSrcweir                         const OUString sButtonType( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) );
152cdf0e10cSrcweir 					    if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) )
153cdf0e10cSrcweir 				        {
154cdf0e10cSrcweir 					        OUString aString;
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 					        // Label
157cdf0e10cSrcweir                             const OUString sLabel( RTL_CONSTASCII_USTRINGPARAM( "Label" ) );
158cdf0e10cSrcweir 					        if(xPropInfo->hasPropertyByName(sLabel))
159cdf0e10cSrcweir                             {
160cdf0e10cSrcweir 						        if( xPropSet->getPropertyValue(sLabel) >>= aString )
161cdf0e10cSrcweir     						        aHLinkItem.SetName(String( aString ));
162cdf0e10cSrcweir                             }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 					        // URL
165cdf0e10cSrcweir                             const OUString sTargetURL(RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ));
166cdf0e10cSrcweir 					        if(xPropInfo->hasPropertyByName(sTargetURL))
167cdf0e10cSrcweir                             {
168cdf0e10cSrcweir 						        if( xPropSet->getPropertyValue(sTargetURL) >>= aString )
169cdf0e10cSrcweir     						        aHLinkItem.SetURL(String( aString ));
170cdf0e10cSrcweir                             }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 					        // Target
173cdf0e10cSrcweir                             const OUString sTargetFrame( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" ) );
174cdf0e10cSrcweir 					        if(xPropInfo->hasPropertyByName(sTargetFrame) )
175cdf0e10cSrcweir                             {
176cdf0e10cSrcweir 					            if( xPropSet->getPropertyValue(sTargetFrame) >>= aString )
177cdf0e10cSrcweir 						            aHLinkItem.SetTargetFrame(String( aString ));
178cdf0e10cSrcweir                             }
179cdf0e10cSrcweir 
180cdf0e10cSrcweir 					        aHLinkItem.SetInsertMode(HLINK_BUTTON);
181cdf0e10cSrcweir                             bFound = true;
182cdf0e10cSrcweir 				        }
183cdf0e10cSrcweir                     }
184cdf0e10cSrcweir                     catch( uno::Exception& )
185cdf0e10cSrcweir                     {
186cdf0e10cSrcweir                     }
187cdf0e10cSrcweir 				}
188cdf0e10cSrcweir 
189cdf0e10cSrcweir                 // try interaction link
190cdf0e10cSrcweir                 if( !bFound && pMarkedObj )
191cdf0e10cSrcweir                 {
192cdf0e10cSrcweir                     SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj);
193cdf0e10cSrcweir                     if( pInfo && (pInfo->meClickAction == presentation::ClickAction_DOCUMENT) )
194cdf0e10cSrcweir                         aHLinkItem.SetURL( pInfo->GetBookmark());
195cdf0e10cSrcweir                     aHLinkItem.SetInsertMode(HLINK_BUTTON);
196cdf0e10cSrcweir                 }
197cdf0e10cSrcweir 			}
198cdf0e10cSrcweir 		}
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 		rSet.Put(aHLinkItem);
201cdf0e10cSrcweir 	}
202cdf0e10cSrcweir 	rSet.Put( SfxBoolItem( SID_READONLY_MODE, mbReadOnly ) );
203cdf0e10cSrcweir 
204cdf0e10cSrcweir 	// Ausgabequalitaet
205cdf0e10cSrcweir 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_COLOR ) ||
206cdf0e10cSrcweir 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_GRAYSCALE ) ||
207cdf0e10cSrcweir 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_BLACKWHITE ) ||
208cdf0e10cSrcweir         SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_CONTRAST ) )
209cdf0e10cSrcweir 	{
210cdf0e10cSrcweir 		const sal_uLong nMode = (sal_Int32)GetActiveWindow()->GetDrawMode();
211cdf0e10cSrcweir 		rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_COLOR, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_COLOR == nMode) ) );
212cdf0e10cSrcweir 		rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_GRAYSCALE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_GRAYSCALE == nMode) ) );
213cdf0e10cSrcweir 		rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_BLACKWHITE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_BLACKWHITE == nMode) ) );
214cdf0e10cSrcweir 		rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_CONTRAST, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_CONTRAST == nMode) ) );
215cdf0e10cSrcweir 	}
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 	if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) )
218cdf0e10cSrcweir 	{
219cdf0e10cSrcweir 		rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) );
220cdf0e10cSrcweir 	}
221cdf0e10cSrcweir 
222cdf0e10cSrcweir 	if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ATTR_YEAR2000) )
223cdf0e10cSrcweir 	{
224cdf0e10cSrcweir         FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
225cdf0e10cSrcweir         if (pFormShell != NULL)
226cdf0e10cSrcweir         {
227cdf0e10cSrcweir             sal_uInt16 nState = 0;
228cdf0e10cSrcweir             if (pFormShell->GetY2KState(nState))
229cdf0e10cSrcweir                 rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nState ) );
230cdf0e10cSrcweir             else
231cdf0e10cSrcweir                 rSet.DisableItem( SID_ATTR_YEAR2000 );
232cdf0e10cSrcweir         }
233cdf0e10cSrcweir 	}
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 	if ( !GetView()->GetTextEditOutliner() )
236cdf0e10cSrcweir 	{
237cdf0e10cSrcweir         SvtCJKOptions aCJKOptions;
238cdf0e10cSrcweir 		if( !aCJKOptions.IsChangeCaseMapEnabled() )
239cdf0e10cSrcweir         {
240cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
241cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
242cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
243cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
244cdf0e10cSrcweir         }
245cdf0e10cSrcweir         else
246cdf0e10cSrcweir         {
247cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
248cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
249cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
250cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
251cdf0e10cSrcweir         }
252cdf0e10cSrcweir 
253cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_SENTENCE_CASE );
254cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_TITLE_CASE );
255cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_TOGGLE_CASE );
256cdf0e10cSrcweir         rSet.DisableItem( SID_TRANSLITERATE_UPPER );
257cdf0e10cSrcweir 		rSet.DisableItem( SID_TRANSLITERATE_LOWER );
258cdf0e10cSrcweir 		rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
259cdf0e10cSrcweir 		rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
260cdf0e10cSrcweir 		rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
261cdf0e10cSrcweir 		rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
262cdf0e10cSrcweir 	}
263cdf0e10cSrcweir 	else
264cdf0e10cSrcweir 	{
265cdf0e10cSrcweir         SvtCJKOptions aCJKOptions;
266cdf0e10cSrcweir 		if( !aCJKOptions.IsChangeCaseMapEnabled() )
267cdf0e10cSrcweir 		{
268cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
269cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
270cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
271cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
272cdf0e10cSrcweir             rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
273cdf0e10cSrcweir 			rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
274cdf0e10cSrcweir 			rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
275cdf0e10cSrcweir 			rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
276cdf0e10cSrcweir 		}
277cdf0e10cSrcweir         else
278cdf0e10cSrcweir         {
279cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
280cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
281cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
282cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
283cdf0e10cSrcweir         }
284cdf0e10cSrcweir 	}
285cdf0e10cSrcweir }
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 
288cdf0e10cSrcweir /*************************************************************************
289cdf0e10cSrcweir |*
290cdf0e10cSrcweir |* Status der Attribut-Items
291cdf0e10cSrcweir |*
292cdf0e10cSrcweir \************************************************************************/
293cdf0e10cSrcweir 
294cdf0e10cSrcweir void DrawViewShell::GetAttrState( SfxItemSet& rSet )
295cdf0e10cSrcweir {
296cdf0e10cSrcweir 	SfxWhichIter	aIter( rSet );
297cdf0e10cSrcweir 	sal_uInt16			nWhich = aIter.FirstWhich();
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 	sal_Bool	bAttr = sal_False;
300cdf0e10cSrcweir 	SfxAllItemSet aAllSet( *rSet.GetPool() );
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 	while ( nWhich )
303cdf0e10cSrcweir 	{
304cdf0e10cSrcweir 		sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
305cdf0e10cSrcweir 			? GetPool().GetSlotId(nWhich)
306cdf0e10cSrcweir 			: nWhich;
307cdf0e10cSrcweir 		switch ( nSlotId )
308cdf0e10cSrcweir 		{
309*766ce4d0SZheng Fan 			case SID_ATTR_PARA_LRSPACE:
310*766ce4d0SZheng Fan 			{
311*766ce4d0SZheng Fan 				SfxItemSet aAttrs( GetDoc()->GetPool() );
312*766ce4d0SZheng Fan 				mpDrawView->GetAttributes( aAttrs );
313*766ce4d0SZheng Fan 				SvxLRSpaceItem aLRSpace = ( (const SvxLRSpaceItem&) aAttrs.Get( EE_PARA_LRSPACE ) );
314*766ce4d0SZheng Fan 				aLRSpace.SetWhich(SID_ATTR_PARA_LRSPACE);
315*766ce4d0SZheng Fan 				rSet.Put(aLRSpace);
316*766ce4d0SZheng Fan 				bAttr = sal_True;
317*766ce4d0SZheng Fan 				Invalidate(SID_ATTR_PARA_LRSPACE);
318*766ce4d0SZheng Fan 			}
319*766ce4d0SZheng Fan 			break;
320*766ce4d0SZheng Fan 			case SID_ATTR_PARA_LINESPACE:
321*766ce4d0SZheng Fan 			{
322*766ce4d0SZheng Fan 				SfxItemSet aAttrs( GetDoc()->GetPool() );
323*766ce4d0SZheng Fan 				mpDrawView->GetAttributes( aAttrs );
324*766ce4d0SZheng Fan 				SvxLineSpacingItem aLineLR = ( (const SvxLineSpacingItem&) aAttrs.Get( EE_PARA_SBL ) );
325*766ce4d0SZheng Fan 				rSet.Put(aLineLR);
326*766ce4d0SZheng Fan 				bAttr = sal_True;
327*766ce4d0SZheng Fan 				Invalidate(SID_ATTR_PARA_LINESPACE);
328*766ce4d0SZheng Fan 			}
329*766ce4d0SZheng Fan 			break;
330*766ce4d0SZheng Fan 			case SID_ATTR_PARA_ULSPACE:
331*766ce4d0SZheng Fan 			{
332*766ce4d0SZheng Fan 				SfxItemSet aAttrs( GetDoc()->GetPool() );
333*766ce4d0SZheng Fan 				mpDrawView->GetAttributes( aAttrs );
334*766ce4d0SZheng Fan 				SvxULSpaceItem aULSP = ( (const SvxULSpaceItem&) aAttrs.Get( EE_PARA_ULSPACE ) );
335*766ce4d0SZheng Fan 				aULSP.SetWhich(SID_ATTR_PARA_ULSPACE);
336*766ce4d0SZheng Fan 				rSet.Put(aULSP);
337*766ce4d0SZheng Fan 				bAttr = sal_True;
338*766ce4d0SZheng Fan 				Invalidate(SID_ATTR_PARA_ULSPACE);
339*766ce4d0SZheng Fan 			}
340*766ce4d0SZheng Fan 			break;
341cdf0e10cSrcweir 			case SID_ATTR_FILL_STYLE:
342cdf0e10cSrcweir 			case SID_ATTR_FILL_COLOR:
343cdf0e10cSrcweir 			case SID_ATTR_FILL_GRADIENT:
344cdf0e10cSrcweir 			case SID_ATTR_FILL_HATCH:
345cdf0e10cSrcweir 			case SID_ATTR_FILL_BITMAP:
346cdf0e10cSrcweir 			case SID_ATTR_FILL_SHADOW:
347d5370dc8SArmin Le Grand             case SID_ATTR_FILL_TRANSPARENCE:
348d5370dc8SArmin Le Grand             case SID_ATTR_FILL_FLOATTRANSPARENCE:
349cdf0e10cSrcweir 			case SID_ATTR_LINE_STYLE:
350cdf0e10cSrcweir 			case SID_ATTR_LINE_DASH:
351cdf0e10cSrcweir 			case SID_ATTR_LINE_WIDTH:
352cdf0e10cSrcweir 			case SID_ATTR_LINE_COLOR:
353d5370dc8SArmin Le Grand             case SID_ATTR_LINE_TRANSPARENCE:
354d5370dc8SArmin Le Grand             case SID_ATTR_LINE_JOINT:
355d5370dc8SArmin Le Grand             case SID_ATTR_LINE_CAP:
356cdf0e10cSrcweir 			case SID_ATTR_TEXT_FITTOSIZE:
357*766ce4d0SZheng Fan 			case SID_ATTR_CHAR_FONT:
358*766ce4d0SZheng Fan 			case SID_ATTR_CHAR_FONTHEIGHT:
359*766ce4d0SZheng Fan 			case SID_ATTR_CHAR_SHADOWED:
360*766ce4d0SZheng Fan 			case SID_ATTR_CHAR_POSTURE:
361*766ce4d0SZheng Fan 			case SID_ATTR_CHAR_UNDERLINE:
362*766ce4d0SZheng Fan 			case SID_ATTR_CHAR_STRIKEOUT:
363*766ce4d0SZheng Fan 			case SID_ATTR_CHAR_WEIGHT:
364*766ce4d0SZheng Fan 			case SID_ATTR_CHAR_COLOR:
365*766ce4d0SZheng Fan 			case SID_ATTR_CHAR_KERNING:
366*766ce4d0SZheng Fan 			case SID_SET_SUB_SCRIPT:
367*766ce4d0SZheng Fan 			case SID_SET_SUPER_SCRIPT:
368cdf0e10cSrcweir 			{
369cdf0e10cSrcweir 				bAttr = sal_True;
370cdf0e10cSrcweir 			}
371cdf0e10cSrcweir 			break;
372cdf0e10cSrcweir 
373cdf0e10cSrcweir 			case SID_HYPHENATION:
374cdf0e10cSrcweir 			{
375cdf0e10cSrcweir 				SfxItemSet aAttrs( GetDoc()->GetPool() );
376cdf0e10cSrcweir 				mpDrawView->GetAttributes( aAttrs );
377cdf0e10cSrcweir 				if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE )
378cdf0e10cSrcweir 				{
379cdf0e10cSrcweir 					sal_Bool bValue = ( (const SfxBoolItem&) aAttrs.Get( EE_PARA_HYPHENATE ) ).GetValue();
380cdf0e10cSrcweir 					rSet.Put( SfxBoolItem( SID_HYPHENATION, bValue ) );
381cdf0e10cSrcweir 				}
382cdf0e10cSrcweir 			}
383cdf0e10cSrcweir 			break;
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 			case SID_STYLE_FAMILY2:
386cdf0e10cSrcweir 			case SID_STYLE_FAMILY3:
387cdf0e10cSrcweir 			case SID_STYLE_FAMILY5:
388cdf0e10cSrcweir 			case SID_STYLE_APPLY: // StyleControl
389cdf0e10cSrcweir 			{
390cdf0e10cSrcweir 				SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet();
391cdf0e10cSrcweir 				if( pStyleSheet )
392cdf0e10cSrcweir 				{
393cdf0e10cSrcweir 					if( nSlotId != SID_STYLE_APPLY && !mpDrawView->AreObjectsMarked() )
394cdf0e10cSrcweir 					{
395cdf0e10cSrcweir 						SfxTemplateItem aTmpItem( nWhich, String() );
396cdf0e10cSrcweir 						aAllSet.Put( aTmpItem, aTmpItem.Which()  );
397cdf0e10cSrcweir 					}
398cdf0e10cSrcweir 					else
399cdf0e10cSrcweir 					{
400cdf0e10cSrcweir 						if (pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE)
401cdf0e10cSrcweir 							pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
402cdf0e10cSrcweir 
403cdf0e10cSrcweir 						if( pStyleSheet )
404cdf0e10cSrcweir 						{
405cdf0e10cSrcweir 							SfxStyleFamily eFamily = pStyleSheet->GetFamily();
406cdf0e10cSrcweir 
407cdf0e10cSrcweir 							if ((eFamily == SD_STYLE_FAMILY_GRAPHICS &&		nSlotId == SID_STYLE_FAMILY2)       ||
408cdf0e10cSrcweir 								(eFamily == SD_STYLE_FAMILY_CELL	 &&	nSlotId == SID_STYLE_FAMILY3)		||
409cdf0e10cSrcweir 								(eFamily == SD_STYLE_FAMILY_PSEUDO &&	nSlotId == SID_STYLE_FAMILY5))
410cdf0e10cSrcweir 							{
411cdf0e10cSrcweir 								SfxTemplateItem aTmpItem ( nWhich, pStyleSheet->GetName() );
412cdf0e10cSrcweir 								aAllSet.Put( aTmpItem, aTmpItem.Which()  );
413cdf0e10cSrcweir 							}
414cdf0e10cSrcweir 							else
415cdf0e10cSrcweir 							{
416cdf0e10cSrcweir 								SfxTemplateItem aTmpItem(nWhich, String());
417cdf0e10cSrcweir 								aAllSet.Put(aTmpItem,aTmpItem.Which()  );
418cdf0e10cSrcweir 							}
419cdf0e10cSrcweir 						}
420cdf0e10cSrcweir 					}
421cdf0e10cSrcweir 				}
422cdf0e10cSrcweir 				else
423cdf0e10cSrcweir 				{	SfxTemplateItem aItem( nWhich, String() );
424cdf0e10cSrcweir 					aAllSet.Put( aItem, aItem.Which() );
425cdf0e10cSrcweir 					// rSet.DisableItem( nWhich );
426cdf0e10cSrcweir 				}
427cdf0e10cSrcweir 			}
428cdf0e10cSrcweir 			break;
429cdf0e10cSrcweir 
430cdf0e10cSrcweir 			case SID_SET_DEFAULT:
431cdf0e10cSrcweir 			{
432cdf0e10cSrcweir                 if( !mpDrawView->GetMarkedObjectList().GetMarkCount() ||
433cdf0e10cSrcweir                     ( !mpDrawView->IsTextEdit() && !mpDrawView->GetStyleSheet() )
434cdf0e10cSrcweir                   )
435cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
436cdf0e10cSrcweir 			}
437cdf0e10cSrcweir 			break;
438cdf0e10cSrcweir 
439cdf0e10cSrcweir 			case SID_STYLE_WATERCAN:
440cdf0e10cSrcweir 			{
441cdf0e10cSrcweir 				ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
442cdf0e10cSrcweir 				if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
443cdf0e10cSrcweir 					rSet.Put(SfxBoolItem(nWhich,sal_False));
444cdf0e10cSrcweir 				else
445cdf0e10cSrcweir 				{
446cdf0e10cSrcweir 					SfxBoolItem aItem(nWhich, SD_MOD()->GetWaterCan());
447cdf0e10cSrcweir 					aAllSet.Put( aItem, aItem.Which());
448cdf0e10cSrcweir 				}
449cdf0e10cSrcweir 			}
450cdf0e10cSrcweir 			break;
451cdf0e10cSrcweir 
452cdf0e10cSrcweir 			case SID_STYLE_NEW:
453cdf0e10cSrcweir 			{
454cdf0e10cSrcweir 				ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
455cdf0e10cSrcweir 				if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
456cdf0e10cSrcweir 					rSet.DisableItem(nWhich);
457cdf0e10cSrcweir 			}
458cdf0e10cSrcweir 			break;
459cdf0e10cSrcweir 
460cdf0e10cSrcweir 			case SID_STYLE_DRAGHIERARCHIE:
461cdf0e10cSrcweir 			{
462cdf0e10cSrcweir 				ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
463cdf0e10cSrcweir 				if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
464cdf0e10cSrcweir 					rSet.DisableItem(nWhich);
465cdf0e10cSrcweir 			}
466cdf0e10cSrcweir 			break;
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 			case SID_STYLE_NEW_BY_EXAMPLE:
469cdf0e10cSrcweir 			{
470cdf0e10cSrcweir 				// PseudoStyleSheets koennen nicht 'by Example' erzeugt werden;
471cdf0e10cSrcweir 				// normale StyleSheets brauchen dafuer ein selektiertes Objekt
472cdf0e10cSrcweir 				ISfxTemplateCommon* pTemplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
473cdf0e10cSrcweir 				if (pTemplCommon)
474cdf0e10cSrcweir 				{
475cdf0e10cSrcweir 					if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
476cdf0e10cSrcweir 					{
477cdf0e10cSrcweir 						rSet.DisableItem(nWhich);
478cdf0e10cSrcweir 					}
479cdf0e10cSrcweir 					else if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_GRAPHICS)
480cdf0e10cSrcweir 					{
481cdf0e10cSrcweir 						if (!mpDrawView->AreObjectsMarked())
482cdf0e10cSrcweir 						{
483cdf0e10cSrcweir 							rSet.DisableItem(nWhich);
484cdf0e10cSrcweir 						}
485cdf0e10cSrcweir 					}
486cdf0e10cSrcweir 				}
487cdf0e10cSrcweir 				// falls (noch) kein Gestalter da ist, muessen wir uns auf den
488cdf0e10cSrcweir 				// View-Zustand zurueckziehen; eine aktuell eingestellte Familie
489cdf0e10cSrcweir 				// kann nicht beruecksichtigt werden
490cdf0e10cSrcweir 				else
491cdf0e10cSrcweir 				{
492cdf0e10cSrcweir 					if (!mpDrawView->AreObjectsMarked())
493cdf0e10cSrcweir 					{
494cdf0e10cSrcweir 						rSet.DisableItem(nWhich);
495cdf0e10cSrcweir 					}
496cdf0e10cSrcweir 				}
497cdf0e10cSrcweir 
498cdf0e10cSrcweir 			}
499cdf0e10cSrcweir 			break;
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 			case SID_STYLE_UPDATE_BY_EXAMPLE:
502cdf0e10cSrcweir 			{
503cdf0e10cSrcweir 				if (!mpDrawView->AreObjectsMarked())
504cdf0e10cSrcweir 				{
505cdf0e10cSrcweir 					rSet.DisableItem(nWhich);
506cdf0e10cSrcweir 				}
507cdf0e10cSrcweir 			}
508cdf0e10cSrcweir 			break;
509cdf0e10cSrcweir 		}
510cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
511cdf0e10cSrcweir 	}
512cdf0e10cSrcweir 
513cdf0e10cSrcweir 	SfxItemSet* pSet = NULL;
514cdf0e10cSrcweir 
515cdf0e10cSrcweir 	if( bAttr )
516cdf0e10cSrcweir 	{
517cdf0e10cSrcweir 		pSet = new SfxItemSet( GetDoc()->GetPool() );
518cdf0e10cSrcweir 		mpDrawView->GetAttributes( *pSet );
519cdf0e10cSrcweir 		rSet.Put( *pSet, sal_False );
520cdf0e10cSrcweir 	}
521cdf0e10cSrcweir 
522cdf0e10cSrcweir 	rSet.Put( aAllSet, sal_False );
523cdf0e10cSrcweir 
524cdf0e10cSrcweir 	// Flaechen und/oder Linienattribute wurden geaendert
525cdf0e10cSrcweir 	if( bAttr && pSet )
526cdf0e10cSrcweir 	{
527cdf0e10cSrcweir 		// Wenn die View selektierte Objekte besitzt, muessen entspr. Items
528cdf0e10cSrcweir 		// von SFX_ITEM_DEFAULT (_ON) auf SFX_ITEM_DISABLED geaendert werden
529cdf0e10cSrcweir 		if( mpDrawView->AreObjectsMarked() )
530cdf0e10cSrcweir 		{
531cdf0e10cSrcweir 			SfxWhichIter aNewIter( *pSet, XATTR_LINE_FIRST, XATTR_FILL_LAST );
532cdf0e10cSrcweir 			nWhich = aNewIter.FirstWhich();
533cdf0e10cSrcweir 			while( nWhich )
534cdf0e10cSrcweir 			{
535cdf0e10cSrcweir 				if( SFX_ITEM_DEFAULT == pSet->GetItemState( nWhich ) )
536cdf0e10cSrcweir 				{
537cdf0e10cSrcweir 					rSet.ClearItem( nWhich );
538cdf0e10cSrcweir 					rSet.DisableItem( nWhich );
539cdf0e10cSrcweir 				}
540cdf0e10cSrcweir 				nWhich = aNewIter.NextWhich();
541cdf0e10cSrcweir 			}
542cdf0e10cSrcweir 		}
543*766ce4d0SZheng Fan 
544*766ce4d0SZheng Fan 		SfxItemState eState = pSet->GetItemState( EE_PARA_LRSPACE );
545*766ce4d0SZheng Fan 		if ( eState == SFX_ITEM_DONTCARE )
546*766ce4d0SZheng Fan 		{
547*766ce4d0SZheng Fan 			rSet.InvalidateItem(EE_PARA_LRSPACE);
548*766ce4d0SZheng Fan 			rSet.InvalidateItem(SID_ATTR_PARA_LRSPACE);
549*766ce4d0SZheng Fan 		}
550*766ce4d0SZheng Fan 		eState = pSet->GetItemState( EE_PARA_SBL );
551*766ce4d0SZheng Fan 		if ( eState == SFX_ITEM_DONTCARE )
552*766ce4d0SZheng Fan 		{
553*766ce4d0SZheng Fan 			rSet.InvalidateItem(EE_PARA_SBL);
554*766ce4d0SZheng Fan 			rSet.InvalidateItem(SID_ATTR_PARA_LINESPACE);
555*766ce4d0SZheng Fan 		}
556*766ce4d0SZheng Fan 		eState = pSet->GetItemState( EE_PARA_ULSPACE );
557*766ce4d0SZheng Fan 		if ( eState == SFX_ITEM_DONTCARE )
558*766ce4d0SZheng Fan 		{
559*766ce4d0SZheng Fan 			rSet.InvalidateItem(EE_PARA_ULSPACE);
560*766ce4d0SZheng Fan 			rSet.InvalidateItem(SID_ATTR_PARA_ULSPACE);
561cdf0e10cSrcweir 		}
562cdf0e10cSrcweir 
563*766ce4d0SZheng Fan 		SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&)
564*766ce4d0SZheng Fan 						pSet->Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
565*766ce4d0SZheng Fan 		if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
566*766ce4d0SZheng Fan 		{
567*766ce4d0SZheng Fan 			rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) );
568*766ce4d0SZheng Fan 		}
569*766ce4d0SZheng Fan 		else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
570*766ce4d0SZheng Fan 		{
571*766ce4d0SZheng Fan 			rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) );
572*766ce4d0SZheng Fan 		}
573*766ce4d0SZheng Fan 
574*766ce4d0SZheng Fan 		eState = pSet->GetItemState( EE_CHAR_KERNING, sal_True );
575*766ce4d0SZheng Fan 		if ( eState == SFX_ITEM_DONTCARE )
576*766ce4d0SZheng Fan 		{
577*766ce4d0SZheng Fan 			rSet.InvalidateItem(EE_CHAR_KERNING);
578*766ce4d0SZheng Fan 			rSet.InvalidateItem(SID_ATTR_CHAR_KERNING);
579*766ce4d0SZheng Fan 		}
580*766ce4d0SZheng Fan 		delete pSet;
581*766ce4d0SZheng Fan 	}
582cdf0e10cSrcweir }
583cdf0e10cSrcweir 
584cdf0e10cSrcweir 
585cdf0e10cSrcweir /*************************************************************************
586cdf0e10cSrcweir |*
587cdf0e10cSrcweir |* Text der Selektion zurueckgeben
588cdf0e10cSrcweir |*
589cdf0e10cSrcweir \************************************************************************/
590cdf0e10cSrcweir 
591cdf0e10cSrcweir String DrawViewShell::GetSelectionText(sal_Bool bCompleteWords)
592cdf0e10cSrcweir {
593cdf0e10cSrcweir 	String aStrSelection;
594cdf0e10cSrcweir 	::Outliner* pOl = mpDrawView->GetTextEditOutliner();
595cdf0e10cSrcweir 	OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
596cdf0e10cSrcweir 
597cdf0e10cSrcweir 	if (pOl && pOlView)
598cdf0e10cSrcweir 	{
599cdf0e10cSrcweir 		if (bCompleteWords)
600cdf0e10cSrcweir 		{
601cdf0e10cSrcweir 			ESelection aSel = pOlView->GetSelection();
602cdf0e10cSrcweir 			String aStrCurrentDelimiters = pOl->GetWordDelimiters();
603cdf0e10cSrcweir 
604cdf0e10cSrcweir 			pOl->SetWordDelimiters( String( RTL_CONSTASCII_USTRINGPARAM( " .,;\"'" )));
605cdf0e10cSrcweir 			aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos );
606cdf0e10cSrcweir 			pOl->SetWordDelimiters( aStrCurrentDelimiters );
607cdf0e10cSrcweir 		}
608cdf0e10cSrcweir 		else
609cdf0e10cSrcweir 		{
610cdf0e10cSrcweir 			aStrSelection = pOlView->GetSelected();
611cdf0e10cSrcweir 		}
612cdf0e10cSrcweir 	}
613cdf0e10cSrcweir 
614cdf0e10cSrcweir 	return (aStrSelection);
615cdf0e10cSrcweir }
616cdf0e10cSrcweir 
617cdf0e10cSrcweir /*************************************************************************
618cdf0e10cSrcweir |*
619cdf0e10cSrcweir |* Ist etwas selektiert?
620cdf0e10cSrcweir |*
621cdf0e10cSrcweir \************************************************************************/
622cdf0e10cSrcweir 
623cdf0e10cSrcweir sal_Bool DrawViewShell::HasSelection(sal_Bool bText) const
624cdf0e10cSrcweir {
625cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
626cdf0e10cSrcweir 
627cdf0e10cSrcweir 	if (bText)
628cdf0e10cSrcweir 	{
629cdf0e10cSrcweir 		OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView();
630cdf0e10cSrcweir 
631cdf0e10cSrcweir 		if (pOlView && pOlView->GetSelected().Len() != 0)
632cdf0e10cSrcweir 		{
633cdf0e10cSrcweir 			bReturn = sal_True;
634cdf0e10cSrcweir 		}
635cdf0e10cSrcweir 	}
636cdf0e10cSrcweir 	else if (mpDrawView->GetMarkedObjectList().GetMarkCount() != 0)
637cdf0e10cSrcweir 	{
638cdf0e10cSrcweir 		bReturn = sal_True;
639cdf0e10cSrcweir 	}
640cdf0e10cSrcweir 
641cdf0e10cSrcweir 	return bReturn;
642cdf0e10cSrcweir }
643cdf0e10cSrcweir 
644cdf0e10cSrcweir } // end of namespace sd
645