1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sd.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "DrawViewShell.hxx" 32*cdf0e10cSrcweir #include <com/sun/star/form/FormButtonType.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #ifndef _SVXIDS_HRC 36*cdf0e10cSrcweir #include <svx/svxids.hrc> 37*cdf0e10cSrcweir #endif 38*cdf0e10cSrcweir #ifndef _GLOBL3D_HXX 39*cdf0e10cSrcweir #include <svx/globl3d.hxx> 40*cdf0e10cSrcweir #endif 41*cdf0e10cSrcweir #include <svx/hlnkitem.hxx> 42*cdf0e10cSrcweir #include <editeng/eeitem.hxx> 43*cdf0e10cSrcweir #ifndef _FLDITEM_HXX 44*cdf0e10cSrcweir #include <editeng/flditem.hxx> 45*cdf0e10cSrcweir #endif 46*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 47*cdf0e10cSrcweir #include <svl/whiter.hxx> 48*cdf0e10cSrcweir #include <svl/eitem.hxx> 49*cdf0e10cSrcweir #include <svl/itempool.hxx> 50*cdf0e10cSrcweir #include <sfx2/tplpitem.hxx> 51*cdf0e10cSrcweir #ifndef _BINDING_HXX //autogen 52*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 53*cdf0e10cSrcweir #endif 54*cdf0e10cSrcweir #include <sfx2/app.hxx> 55*cdf0e10cSrcweir #include <sfx2/templdlg.hxx> 56*cdf0e10cSrcweir #include <svx/xdef.hxx> 57*cdf0e10cSrcweir #include <svx/svddef.hxx> 58*cdf0e10cSrcweir #include <svx/fmglob.hxx> 59*cdf0e10cSrcweir #include <svx/svdouno.hxx> 60*cdf0e10cSrcweir #include <tools/urlobj.hxx> 61*cdf0e10cSrcweir #include <svx/fmshell.hxx> 62*cdf0e10cSrcweir #include <svl/cjkoptions.hxx> 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir #ifndef SD_FRAME_VIEW 65*cdf0e10cSrcweir #include "FrameView.hxx" 66*cdf0e10cSrcweir #endif 67*cdf0e10cSrcweir #include "Outliner.hxx" 68*cdf0e10cSrcweir #include "app.hrc" 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir #include "app.hxx" 71*cdf0e10cSrcweir #include "stlsheet.hxx" 72*cdf0e10cSrcweir #include "drawview.hxx" 73*cdf0e10cSrcweir #include "drawdoc.hxx" 74*cdf0e10cSrcweir #include "Window.hxx" 75*cdf0e10cSrcweir #include "ViewShellBase.hxx" 76*cdf0e10cSrcweir #include "FormShellManager.hxx" 77*cdf0e10cSrcweir #include "cfgids.hxx" 78*cdf0e10cSrcweir #include "anminfo.hxx" 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir using ::rtl::OUString; 81*cdf0e10cSrcweir using namespace ::com::sun::star; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir namespace sd { 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir /************************************************************************* 86*cdf0e10cSrcweir |* 87*cdf0e10cSrcweir |* Status von Controller-SfxSlots setzen 88*cdf0e10cSrcweir |* 89*cdf0e10cSrcweir \************************************************************************/ 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir void DrawViewShell::GetCtrlState(SfxItemSet &rSet) 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir if (rSet.GetItemState(SID_RELOAD) != SFX_ITEM_UNKNOWN) 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir // "Letzte Version" vom SFx en/disablen lassen 96*cdf0e10cSrcweir GetViewFrame()->GetSlotState (SID_RELOAD, NULL, &rSet); 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK)) 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir SvxHyperlinkItem aHLinkItem; 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView(); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir if (pOLV) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir bool bField = false; 108*cdf0e10cSrcweir const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection(); 109*cdf0e10cSrcweir if (pFieldItem) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir ESelection aSel = pOLV->GetSelection(); 112*cdf0e10cSrcweir if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 ) 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir const SvxFieldData* pField = pFieldItem->GetField(); 115*cdf0e10cSrcweir if (pField->ISA(SvxURLField)) 116*cdf0e10cSrcweir { 117*cdf0e10cSrcweir aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation()); 118*cdf0e10cSrcweir aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL()); 119*cdf0e10cSrcweir aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame()); 120*cdf0e10cSrcweir bField = true; 121*cdf0e10cSrcweir } 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir if (!bField) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir // use selected text as name for urls 127*cdf0e10cSrcweir String sReturn = pOLV->GetSelected(); 128*cdf0e10cSrcweir sReturn.Erase(255); 129*cdf0e10cSrcweir sReturn.EraseTrailingChars(); 130*cdf0e10cSrcweir aHLinkItem.SetName(sReturn); 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir else 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir bool bFound = false; 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); 140*cdf0e10cSrcweir if( pMarkedObj && (FmFormInventor == pMarkedObj->GetObjInventor()) ) 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir SdrUnoObj* pUnoCtrl = dynamic_cast< SdrUnoObj* >( pMarkedObj ); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir if(pUnoCtrl) try 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW ); 147*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW ); 148*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW ); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir form::FormButtonType eButtonType = form::FormButtonType_URL; 151*cdf0e10cSrcweir const OUString sButtonType( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) ); 152*cdf0e10cSrcweir if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) ) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir OUString aString; 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir // Label 157*cdf0e10cSrcweir const OUString sLabel( RTL_CONSTASCII_USTRINGPARAM( "Label" ) ); 158*cdf0e10cSrcweir if(xPropInfo->hasPropertyByName(sLabel)) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir if( xPropSet->getPropertyValue(sLabel) >>= aString ) 161*cdf0e10cSrcweir aHLinkItem.SetName(String( aString )); 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir // URL 165*cdf0e10cSrcweir const OUString sTargetURL(RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )); 166*cdf0e10cSrcweir if(xPropInfo->hasPropertyByName(sTargetURL)) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir if( xPropSet->getPropertyValue(sTargetURL) >>= aString ) 169*cdf0e10cSrcweir aHLinkItem.SetURL(String( aString )); 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir // Target 173*cdf0e10cSrcweir const OUString sTargetFrame( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" ) ); 174*cdf0e10cSrcweir if(xPropInfo->hasPropertyByName(sTargetFrame) ) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir if( xPropSet->getPropertyValue(sTargetFrame) >>= aString ) 177*cdf0e10cSrcweir aHLinkItem.SetTargetFrame(String( aString )); 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir aHLinkItem.SetInsertMode(HLINK_BUTTON); 181*cdf0e10cSrcweir bFound = true; 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir catch( uno::Exception& ) 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir } 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir // try interaction link 190*cdf0e10cSrcweir if( !bFound && pMarkedObj ) 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj); 193*cdf0e10cSrcweir if( pInfo && (pInfo->meClickAction == presentation::ClickAction_DOCUMENT) ) 194*cdf0e10cSrcweir aHLinkItem.SetURL( pInfo->GetBookmark()); 195*cdf0e10cSrcweir aHLinkItem.SetInsertMode(HLINK_BUTTON); 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir rSet.Put(aHLinkItem); 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_READONLY_MODE, mbReadOnly ) ); 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir // Ausgabequalitaet 205*cdf0e10cSrcweir if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_COLOR ) || 206*cdf0e10cSrcweir SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_GRAYSCALE ) || 207*cdf0e10cSrcweir SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_BLACKWHITE ) || 208*cdf0e10cSrcweir SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_OUTPUT_QUALITY_CONTRAST ) ) 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir const sal_uLong nMode = (sal_Int32)GetActiveWindow()->GetDrawMode(); 211*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_COLOR, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_COLOR == nMode) ) ); 212*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_GRAYSCALE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_GRAYSCALE == nMode) ) ); 213*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_BLACKWHITE, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_BLACKWHITE == nMode) ) ); 214*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_OUTPUT_QUALITY_CONTRAST, (sal_Bool)((sal_uLong)OUTPUT_DRAWMODE_CONTRAST == nMode) ) ); 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) ) 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) ); 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_ATTR_YEAR2000) ) 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell(); 225*cdf0e10cSrcweir if (pFormShell != NULL) 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir sal_uInt16 nState = 0; 228*cdf0e10cSrcweir if (pFormShell->GetY2KState(nState)) 229*cdf0e10cSrcweir rSet.Put( SfxUInt16Item( SID_ATTR_YEAR2000, nState ) ); 230*cdf0e10cSrcweir else 231*cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_YEAR2000 ); 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir if ( !GetView()->GetTextEditOutliner() ) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir SvtCJKOptions aCJKOptions; 238*cdf0e10cSrcweir if( !aCJKOptions.IsChangeCaseMapEnabled() ) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False ); 241*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False ); 242*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False ); 243*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False ); 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir else 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True ); 248*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True ); 249*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True ); 250*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True ); 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_SENTENCE_CASE ); 254*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_TITLE_CASE ); 255*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_TOGGLE_CASE ); 256*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_UPPER ); 257*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_LOWER ); 258*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH ); 259*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH ); 260*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA ); 261*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_KATAGANA ); 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir else 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir SvtCJKOptions aCJKOptions; 266*cdf0e10cSrcweir if( !aCJKOptions.IsChangeCaseMapEnabled() ) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False ); 269*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False ); 270*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False ); 271*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False ); 272*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH ); 273*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH ); 274*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA ); 275*cdf0e10cSrcweir rSet.DisableItem( SID_TRANSLITERATE_KATAGANA ); 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir else 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True ); 280*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True ); 281*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True ); 282*cdf0e10cSrcweir GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True ); 283*cdf0e10cSrcweir } 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir /************************************************************************* 289*cdf0e10cSrcweir |* 290*cdf0e10cSrcweir |* Status der Attribut-Items 291*cdf0e10cSrcweir |* 292*cdf0e10cSrcweir \************************************************************************/ 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir void DrawViewShell::GetAttrState( SfxItemSet& rSet ) 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 297*cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir sal_Bool bAttr = sal_False; 300*cdf0e10cSrcweir SfxAllItemSet aAllSet( *rSet.GetPool() ); 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir while ( nWhich ) 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich) 305*cdf0e10cSrcweir ? GetPool().GetSlotId(nWhich) 306*cdf0e10cSrcweir : nWhich; 307*cdf0e10cSrcweir switch ( nSlotId ) 308*cdf0e10cSrcweir { 309*cdf0e10cSrcweir case SID_ATTR_FILL_STYLE: 310*cdf0e10cSrcweir case SID_ATTR_FILL_COLOR: 311*cdf0e10cSrcweir case SID_ATTR_FILL_GRADIENT: 312*cdf0e10cSrcweir case SID_ATTR_FILL_HATCH: 313*cdf0e10cSrcweir case SID_ATTR_FILL_BITMAP: 314*cdf0e10cSrcweir case SID_ATTR_FILL_SHADOW: 315*cdf0e10cSrcweir case SID_ATTR_LINE_STYLE: 316*cdf0e10cSrcweir case SID_ATTR_LINE_DASH: 317*cdf0e10cSrcweir case SID_ATTR_LINE_WIDTH: 318*cdf0e10cSrcweir case SID_ATTR_LINE_COLOR: 319*cdf0e10cSrcweir case SID_ATTR_TEXT_FITTOSIZE: 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir bAttr = sal_True; 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir break; 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir case SID_HYPHENATION: 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir SfxItemSet aAttrs( GetDoc()->GetPool() ); 328*cdf0e10cSrcweir mpDrawView->GetAttributes( aAttrs ); 329*cdf0e10cSrcweir if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE ) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir sal_Bool bValue = ( (const SfxBoolItem&) aAttrs.Get( EE_PARA_HYPHENATE ) ).GetValue(); 332*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_HYPHENATION, bValue ) ); 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir break; 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir case SID_STYLE_FAMILY2: 338*cdf0e10cSrcweir case SID_STYLE_FAMILY3: 339*cdf0e10cSrcweir case SID_STYLE_FAMILY5: 340*cdf0e10cSrcweir case SID_STYLE_APPLY: // StyleControl 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir SfxStyleSheet* pStyleSheet = mpDrawView->GetStyleSheet(); 343*cdf0e10cSrcweir if( pStyleSheet ) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir if( nSlotId != SID_STYLE_APPLY && !mpDrawView->AreObjectsMarked() ) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir SfxTemplateItem aTmpItem( nWhich, String() ); 348*cdf0e10cSrcweir aAllSet.Put( aTmpItem, aTmpItem.Which() ); 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir else 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir if (pStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) 353*cdf0e10cSrcweir pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet(); 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir if( pStyleSheet ) 356*cdf0e10cSrcweir { 357*cdf0e10cSrcweir SfxStyleFamily eFamily = pStyleSheet->GetFamily(); 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir if ((eFamily == SD_STYLE_FAMILY_GRAPHICS && nSlotId == SID_STYLE_FAMILY2) || 360*cdf0e10cSrcweir (eFamily == SD_STYLE_FAMILY_CELL && nSlotId == SID_STYLE_FAMILY3) || 361*cdf0e10cSrcweir (eFamily == SD_STYLE_FAMILY_PSEUDO && nSlotId == SID_STYLE_FAMILY5)) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir SfxTemplateItem aTmpItem ( nWhich, pStyleSheet->GetName() ); 364*cdf0e10cSrcweir aAllSet.Put( aTmpItem, aTmpItem.Which() ); 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir else 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir SfxTemplateItem aTmpItem(nWhich, String()); 369*cdf0e10cSrcweir aAllSet.Put(aTmpItem,aTmpItem.Which() ); 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir else 375*cdf0e10cSrcweir { SfxTemplateItem aItem( nWhich, String() ); 376*cdf0e10cSrcweir aAllSet.Put( aItem, aItem.Which() ); 377*cdf0e10cSrcweir // rSet.DisableItem( nWhich ); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir break; 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir case SID_SET_DEFAULT: 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir if( !mpDrawView->GetMarkedObjectList().GetMarkCount() || 385*cdf0e10cSrcweir ( !mpDrawView->IsTextEdit() && !mpDrawView->GetStyleSheet() ) 386*cdf0e10cSrcweir ) 387*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir break; 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir case SID_STYLE_WATERCAN: 392*cdf0e10cSrcweir { 393*cdf0e10cSrcweir ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings()); 394*cdf0e10cSrcweir if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO) 395*cdf0e10cSrcweir rSet.Put(SfxBoolItem(nWhich,sal_False)); 396*cdf0e10cSrcweir else 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir SfxBoolItem aItem(nWhich, SD_MOD()->GetWaterCan()); 399*cdf0e10cSrcweir aAllSet.Put( aItem, aItem.Which()); 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir } 402*cdf0e10cSrcweir break; 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir case SID_STYLE_NEW: 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings()); 407*cdf0e10cSrcweir if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO) 408*cdf0e10cSrcweir rSet.DisableItem(nWhich); 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir break; 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir case SID_STYLE_DRAGHIERARCHIE: 413*cdf0e10cSrcweir { 414*cdf0e10cSrcweir ISfxTemplateCommon* pTemplateCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings()); 415*cdf0e10cSrcweir if (pTemplateCommon && pTemplateCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO) 416*cdf0e10cSrcweir rSet.DisableItem(nWhich); 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir break; 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir case SID_STYLE_NEW_BY_EXAMPLE: 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir // PseudoStyleSheets koennen nicht 'by Example' erzeugt werden; 423*cdf0e10cSrcweir // normale StyleSheets brauchen dafuer ein selektiertes Objekt 424*cdf0e10cSrcweir ISfxTemplateCommon* pTemplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings()); 425*cdf0e10cSrcweir if (pTemplCommon) 426*cdf0e10cSrcweir { 427*cdf0e10cSrcweir if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir rSet.DisableItem(nWhich); 430*cdf0e10cSrcweir } 431*cdf0e10cSrcweir else if (pTemplCommon->GetActualFamily() == SD_STYLE_FAMILY_GRAPHICS) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir if (!mpDrawView->AreObjectsMarked()) 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir rSet.DisableItem(nWhich); 436*cdf0e10cSrcweir } 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir } 439*cdf0e10cSrcweir // falls (noch) kein Gestalter da ist, muessen wir uns auf den 440*cdf0e10cSrcweir // View-Zustand zurueckziehen; eine aktuell eingestellte Familie 441*cdf0e10cSrcweir // kann nicht beruecksichtigt werden 442*cdf0e10cSrcweir else 443*cdf0e10cSrcweir { 444*cdf0e10cSrcweir if (!mpDrawView->AreObjectsMarked()) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir rSet.DisableItem(nWhich); 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir } 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir break; 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir case SID_STYLE_UPDATE_BY_EXAMPLE: 454*cdf0e10cSrcweir { 455*cdf0e10cSrcweir if (!mpDrawView->AreObjectsMarked()) 456*cdf0e10cSrcweir { 457*cdf0e10cSrcweir rSet.DisableItem(nWhich); 458*cdf0e10cSrcweir } 459*cdf0e10cSrcweir } 460*cdf0e10cSrcweir break; 461*cdf0e10cSrcweir } 462*cdf0e10cSrcweir nWhich = aIter.NextWhich(); 463*cdf0e10cSrcweir } 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir SfxItemSet* pSet = NULL; 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir if( bAttr ) 468*cdf0e10cSrcweir { 469*cdf0e10cSrcweir pSet = new SfxItemSet( GetDoc()->GetPool() ); 470*cdf0e10cSrcweir mpDrawView->GetAttributes( *pSet ); 471*cdf0e10cSrcweir rSet.Put( *pSet, sal_False ); 472*cdf0e10cSrcweir } 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir rSet.Put( aAllSet, sal_False ); 475*cdf0e10cSrcweir 476*cdf0e10cSrcweir // Flaechen und/oder Linienattribute wurden geaendert 477*cdf0e10cSrcweir if( bAttr && pSet ) 478*cdf0e10cSrcweir { 479*cdf0e10cSrcweir // Wenn die View selektierte Objekte besitzt, muessen entspr. Items 480*cdf0e10cSrcweir // von SFX_ITEM_DEFAULT (_ON) auf SFX_ITEM_DISABLED geaendert werden 481*cdf0e10cSrcweir if( mpDrawView->AreObjectsMarked() ) 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir SfxWhichIter aNewIter( *pSet, XATTR_LINE_FIRST, XATTR_FILL_LAST ); 484*cdf0e10cSrcweir nWhich = aNewIter.FirstWhich(); 485*cdf0e10cSrcweir while( nWhich ) 486*cdf0e10cSrcweir { 487*cdf0e10cSrcweir if( SFX_ITEM_DEFAULT == pSet->GetItemState( nWhich ) ) 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir rSet.ClearItem( nWhich ); 490*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 491*cdf0e10cSrcweir } 492*cdf0e10cSrcweir nWhich = aNewIter.NextWhich(); 493*cdf0e10cSrcweir } 494*cdf0e10cSrcweir } 495*cdf0e10cSrcweir delete pSet; 496*cdf0e10cSrcweir } 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir // const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 499*cdf0e10cSrcweir // sal_uLong nMarkCount = rMarkList.GetMarkCount(); 500*cdf0e10cSrcweir // sal_Bool bDisabled = sal_False; 501*cdf0e10cSrcweir // 502*cdf0e10cSrcweir // for (sal_uLong i = 0; 503*cdf0e10cSrcweir // i < nMarkCount && !bDisabled && i < 50; i++) 504*cdf0e10cSrcweir // { 505*cdf0e10cSrcweir // SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 506*cdf0e10cSrcweir // 507*cdf0e10cSrcweir // if (pObj->GetObjInventor() == E3dInventor) 508*cdf0e10cSrcweir // { 509*cdf0e10cSrcweir // bDisabled = sal_True; 510*cdf0e10cSrcweir // rSet.ClearItem(SDRATTR_SHADOW); 511*cdf0e10cSrcweir // rSet.DisableItem(SDRATTR_SHADOW); 512*cdf0e10cSrcweir // } 513*cdf0e10cSrcweir // } 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir 517*cdf0e10cSrcweir /************************************************************************* 518*cdf0e10cSrcweir |* 519*cdf0e10cSrcweir |* Text der Selektion zurueckgeben 520*cdf0e10cSrcweir |* 521*cdf0e10cSrcweir \************************************************************************/ 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir String DrawViewShell::GetSelectionText(sal_Bool bCompleteWords) 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir String aStrSelection; 526*cdf0e10cSrcweir ::Outliner* pOl = mpDrawView->GetTextEditOutliner(); 527*cdf0e10cSrcweir OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView(); 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir if (pOl && pOlView) 530*cdf0e10cSrcweir { 531*cdf0e10cSrcweir if (bCompleteWords) 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir ESelection aSel = pOlView->GetSelection(); 534*cdf0e10cSrcweir String aStrCurrentDelimiters = pOl->GetWordDelimiters(); 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir pOl->SetWordDelimiters( String( RTL_CONSTASCII_USTRINGPARAM( " .,;\"'" ))); 537*cdf0e10cSrcweir aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos ); 538*cdf0e10cSrcweir pOl->SetWordDelimiters( aStrCurrentDelimiters ); 539*cdf0e10cSrcweir } 540*cdf0e10cSrcweir else 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir aStrSelection = pOlView->GetSelected(); 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir } 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir return (aStrSelection); 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir /************************************************************************* 550*cdf0e10cSrcweir |* 551*cdf0e10cSrcweir |* Ist etwas selektiert? 552*cdf0e10cSrcweir |* 553*cdf0e10cSrcweir \************************************************************************/ 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir sal_Bool DrawViewShell::HasSelection(sal_Bool bText) const 556*cdf0e10cSrcweir { 557*cdf0e10cSrcweir sal_Bool bReturn = sal_False; 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir if (bText) 560*cdf0e10cSrcweir { 561*cdf0e10cSrcweir OutlinerView* pOlView = mpDrawView->GetTextEditOutlinerView(); 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir if (pOlView && pOlView->GetSelected().Len() != 0) 564*cdf0e10cSrcweir { 565*cdf0e10cSrcweir bReturn = sal_True; 566*cdf0e10cSrcweir } 567*cdf0e10cSrcweir } 568*cdf0e10cSrcweir else if (mpDrawView->GetMarkedObjectList().GetMarkCount() != 0) 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir bReturn = sal_True; 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir return bReturn; 574*cdf0e10cSrcweir } 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir } // end of namespace sd 577