summaryrefslogtreecommitdiff
path: root/sd/source/ui/func
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/func')
-rw-r--r--sd/source/ui/func/bulmaper.cxx191
-rw-r--r--sd/source/ui/func/fuarea.cxx117
-rw-r--r--sd/source/ui/func/fubullet.cxx360
-rw-r--r--sd/source/ui/func/fuchar.cxx147
-rw-r--r--sd/source/ui/func/fucon3d.cxx531
-rw-r--r--sd/source/ui/func/fuconarc.cxx339
-rw-r--r--sd/source/ui/func/fuconbez.cxx538
-rw-r--r--sd/source/ui/func/fuconcs.cxx344
-rw-r--r--sd/source/ui/func/fuconnct.cxx91
-rw-r--r--sd/source/ui/func/fuconrec.cxx1024
-rwxr-xr-xsd/source/ui/func/fuconstr.cxx420
-rw-r--r--sd/source/ui/func/fuconuno.cxx221
-rw-r--r--sd/source/ui/func/fucopy.cxx315
-rw-r--r--sd/source/ui/func/fucushow.cxx99
-rwxr-xr-xsd/source/ui/func/fudraw.cxx1142
-rw-r--r--sd/source/ui/func/fudspord.cxx194
-rw-r--r--sd/source/ui/func/fuediglu.cxx464
-rw-r--r--sd/source/ui/func/fuexpand.cxx275
-rw-r--r--sd/source/ui/func/fuformatpaintbrush.cxx295
-rw-r--r--sd/source/ui/func/fuhhconv.cxx290
-rwxr-xr-xsd/source/ui/func/fuinsert.cxx780
-rw-r--r--sd/source/ui/func/fuinsfil.cxx824
-rw-r--r--sd/source/ui/func/fuline.cxx130
-rw-r--r--sd/source/ui/func/fulinend.cxx183
-rw-r--r--sd/source/ui/func/fulink.cxx92
-rw-r--r--sd/source/ui/func/fumeasur.cxx92
-rw-r--r--sd/source/ui/func/fumorph.cxx513
-rw-r--r--sd/source/ui/func/fuoaprms.cxx839
-rw-r--r--sd/source/ui/func/fuolbull.cxx146
-rw-r--r--sd/source/ui/func/fuoltext.cxx361
-rwxr-xr-xsd/source/ui/func/fuoutl.cxx94
-rw-r--r--sd/source/ui/func/fupage.cxx622
-rw-r--r--sd/source/ui/func/fuparagr.cxx187
-rwxr-xr-xsd/source/ui/func/fupoor.cxx1277
-rw-r--r--sd/source/ui/func/fuprlout.cxx287
-rw-r--r--sd/source/ui/func/fuprobjs.cxx179
-rw-r--r--sd/source/ui/func/fuscale.cxx216
-rwxr-xr-xsd/source/ui/func/fusearch.cxx178
-rw-r--r--sd/source/ui/func/fusel.cxx1498
-rw-r--r--sd/source/ui/func/fusldlg.cxx265
-rwxr-xr-xsd/source/ui/func/fusnapln.cxx219
-rw-r--r--sd/source/ui/func/fusumry.cxx243
-rw-r--r--sd/source/ui/func/futempl.cxx733
-rw-r--r--sd/source/ui/func/futext.cxx1543
-rw-r--r--sd/source/ui/func/futhes.cxx170
-rwxr-xr-xsd/source/ui/func/futransf.cxx139
-rw-r--r--sd/source/ui/func/futxtatt.cxx105
-rw-r--r--sd/source/ui/func/fuvect.cxx116
-rw-r--r--sd/source/ui/func/fuzoom.cxx262
-rwxr-xr-xsd/source/ui/func/makefile.mk185
-rw-r--r--sd/source/ui/func/sdundo.cxx36
-rwxr-xr-xsd/source/ui/func/sdundogr.cxx118
-rwxr-xr-xsd/source/ui/func/smarttag.cxx479
-rw-r--r--sd/source/ui/func/undoback.cxx98
-rw-r--r--sd/source/ui/func/undoheaderfooter.cxx65
-rw-r--r--sd/source/ui/func/undolayer.cxx90
-rw-r--r--sd/source/ui/func/undopage.cxx140
-rw-r--r--sd/source/ui/func/unmovss.cxx108
-rwxr-xr-xsd/source/ui/func/unoaprms.cxx141
-rw-r--r--sd/source/ui/func/unprlout.cxx119
60 files changed, 21269 insertions, 0 deletions
diff --git a/sd/source/ui/func/bulmaper.cxx b/sd/source/ui/func/bulmaper.cxx
new file mode 100644
index 000000000000..1a6e8992a10e
--- /dev/null
+++ b/sd/source/ui/func/bulmaper.cxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#ifdef SD_DLLIMPLEMENTATION
+#undef SD_DLLIMPLEMENTATION
+#endif
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+
+//-> Fonts & Items
+#include <vcl/font.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/shdditem.hxx>
+
+//<- Fonts & Items
+#include <editeng/bulitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <vcl/graph.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/eeitem.hxx>
+
+#include "bulmaper.hxx"
+
+
+#define GetWhich(nSlot) rSet.GetPool()->GetWhich( nSlot )
+
+/* #i35937#
+
+void SdBulletMapper::PreMapNumBulletForDialog( SfxItemSet& rSet )
+{
+ if( SFX_ITEM_SET == rSet.GetItemState( EE_PARA_NUMBULLET, FALSE ) )
+ {
+ SvxNumRule* pRule = ((SvxNumBulletItem*)rSet.GetItem( EE_PARA_NUMBULLET ))->GetNumRule();
+
+ if(pRule && pRule->GetNumRuleType() == SVX_RULETYPE_PRESENTATION_NUMBERING)
+ {
+ // 10er Bullet Item auf 9er Item mappen
+ SvxNumRule aNewRule( pRule->GetFeatureFlags(), 9, FALSE, SVX_RULETYPE_PRESENTATION_NUMBERING );
+
+ for( USHORT i = 0; i < 9; i++ )
+ aNewRule.SetLevel(i, pRule->GetLevel(i));
+
+ rSet.Put( SvxNumBulletItem( aNewRule, EE_PARA_NUMBULLET ) );
+ }
+ }
+}
+
+void SdBulletMapper::PostMapNumBulletForDialog( SfxItemSet& rSet )
+{
+ if( SFX_ITEM_SET == rSet.GetItemState( EE_PARA_NUMBULLET, FALSE ) )
+ {
+ SvxNumRule* pRule = ((SvxNumBulletItem*)rSet.GetItem( EE_PARA_NUMBULLET ))->GetNumRule();
+
+ if(pRule)
+ {
+ pRule->UnLinkGraphics();
+ if(pRule->GetNumRuleType() == SVX_RULETYPE_PRESENTATION_NUMBERING)
+ {
+ // 9er Bullet Item auf 10er Item mappen
+ SvxNumRule aNewRule( pRule->GetFeatureFlags(), 10, FALSE, SVX_RULETYPE_PRESENTATION_NUMBERING );
+
+ for( USHORT i = 0; i < 9; i++ )
+ aNewRule.SetLevel(i, pRule->GetLevel(i));
+
+ rSet.Put( SvxNumBulletItem( aNewRule, EE_PARA_NUMBULLET ) );
+ }
+ }
+ }
+}
+*/
+
+void SdBulletMapper::MapFontsInNumRule( SvxNumRule& aNumRule, const SfxItemSet& rSet )
+{
+ const USHORT nCount = aNumRule.GetLevelCount();
+ for( USHORT nLevel = 0; nLevel < nCount; nLevel++ )
+ {
+ const SvxNumberFormat& rSrcLevel = aNumRule.GetLevel(nLevel);
+ SvxNumberFormat aNewLevel( rSrcLevel );
+
+ if(rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::CHAR_SPECIAL &&
+ rSrcLevel.GetNumberingType() != com::sun::star::style::NumberingType::NUMBER_NONE )
+ {
+ // wenn Aufzaehlung statt Bullet gewaehlt wurde, wird der Bullet-Font
+ // dem Vorlagen-Font angeglichen
+
+ // to be implemented if module supports CJK
+ long nFontID = SID_ATTR_CHAR_FONT;
+ long nFontHeightID = SID_ATTR_CHAR_FONTHEIGHT;
+ long nWeightID = SID_ATTR_CHAR_WEIGHT;
+ long nPostureID = SID_ATTR_CHAR_POSTURE;
+
+ if( 0 )
+ {
+ nFontID = EE_CHAR_FONTINFO_CJK;
+ nFontHeightID = EE_CHAR_FONTHEIGHT_CJK;
+ nWeightID = EE_CHAR_WEIGHT_CJK;
+ nPostureID = EE_CHAR_ITALIC_CJK;
+ }
+ else if( 0 )
+ {
+ nFontID = EE_CHAR_FONTINFO_CTL;
+ nFontHeightID = EE_CHAR_FONTHEIGHT_CTL;
+ nWeightID = EE_CHAR_WEIGHT_CTL;
+ nPostureID = EE_CHAR_ITALIC_CTL;
+ }
+
+ Font aMyFont;
+ const SvxFontItem& rFItem =
+ (SvxFontItem&)rSet.Get(GetWhich( (USHORT)nFontID ));
+ aMyFont.SetFamily(rFItem.GetFamily());
+ aMyFont.SetName(rFItem.GetFamilyName());
+ aMyFont.SetCharSet(rFItem.GetCharSet());
+ aMyFont.SetPitch(rFItem.GetPitch());
+
+ const SvxFontHeightItem& rFHItem =
+ (SvxFontHeightItem&)rSet.Get(GetWhich( (USHORT)nFontHeightID ));
+ aMyFont.SetSize(Size(0, rFHItem.GetHeight()));
+
+ const SvxWeightItem& rWItem =
+ (SvxWeightItem&)rSet.Get(GetWhich( (USHORT)nWeightID ));
+ aMyFont.SetWeight(rWItem.GetWeight());
+
+ const SvxPostureItem& rPItem =
+ (SvxPostureItem&)rSet.Get(GetWhich( (USHORT)nPostureID ));
+ aMyFont.SetItalic(rPItem.GetPosture());
+
+ const SvxUnderlineItem& rUItem = (SvxUnderlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_UNDERLINE));
+ aMyFont.SetUnderline(rUItem.GetLineStyle());
+
+ const SvxOverlineItem& rOItem = (SvxOverlineItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_OVERLINE));
+ aMyFont.SetOverline(rOItem.GetLineStyle());
+
+ const SvxCrossedOutItem& rCOItem = (SvxCrossedOutItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_STRIKEOUT));
+ aMyFont.SetStrikeout(rCOItem.GetStrikeout());
+
+ const SvxContourItem& rCItem = (SvxContourItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_CONTOUR));
+ aMyFont.SetOutline(rCItem.GetValue());
+
+ const SvxShadowedItem& rSItem = (SvxShadowedItem&)rSet.Get(GetWhich(SID_ATTR_CHAR_SHADOWED));
+ aMyFont.SetShadow(rSItem.GetValue());
+
+ aNewLevel.SetBulletFont(&aMyFont);
+// aNewLevel.SetBulletRelSize( 75 );
+ aNumRule.SetLevel(nLevel, aNewLevel );
+ }
+ else if( rSrcLevel.GetNumberingType() == com::sun::star::style::NumberingType::CHAR_SPECIAL )
+ {
+ String aEmpty;
+ aNewLevel.SetPrefix( aEmpty );
+ aNewLevel.SetSuffix( aEmpty );
+ aNumRule.SetLevel(nLevel, aNewLevel );
+ }
+ }
+}
diff --git a/sd/source/ui/func/fuarea.cxx b/sd/source/ui/func/fuarea.cxx
new file mode 100644
index 000000000000..31c4c1358d3a
--- /dev/null
+++ b/sd/source/ui/func/fuarea.cxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuarea.hxx"
+
+#include <svx/svxids.hrc>
+#include <svx/tabarea.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include "ViewShell.hxx"
+
+#include "drawdoc.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "app.hrc"
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+namespace sd {
+TYPEINIT1( FuArea, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuArea::FuArea( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* _pView, SdDrawDocument* pDoc, SfxRequest& rReq)
+: FuPoor(pViewSh, pWin, _pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuArea::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* _pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuArea( pViewSh, pWin, _pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuArea::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SfxItemSet aNewAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aNewAttr );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ AbstractSvxAreaTabDialog * pDlg = pFact ? pFact->CreateSvxAreaTabDialog( NULL,
+ &aNewAttr,
+ mpDoc,
+ mpView) : 0;
+ if( pDlg && (pDlg->Execute() == RET_OK) )
+ {
+ mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
+ }
+
+ // Attribute wurden geaendert, Listboxes in Objectbars muessen aktualisiert werden
+ static USHORT SidArray[] = {
+ SID_ATTR_FILL_STYLE,
+ SID_ATTR_FILL_COLOR,
+ SID_ATTR_FILL_GRADIENT,
+ SID_ATTR_FILL_HATCH,
+ SID_ATTR_FILL_BITMAP,
+ 0 };
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+
+ delete pDlg;
+ }
+
+ rReq.Ignore ();
+
+}
+
+void FuArea::Activate()
+{
+}
+
+void FuArea::Deactivate()
+{
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx
new file mode 100644
index 000000000000..92b1450624e1
--- /dev/null
+++ b/sd/source/ui/func/fubullet.cxx
@@ -0,0 +1,360 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fubullet.hxx"
+
+#ifndef _BINDING_HXX //autogen
+#include <sfx2/bindings.hxx>
+#endif
+#include <editeng/eeitem.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/fontitem.hxx>
+#include "OutlineViewShell.hxx"
+#include "DrawViewShell.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include <svx/svdoutl.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+#include <svl/ctloptions.hxx>
+#include <svl/itempool.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include "drawview.hxx"
+
+#include "app.hrc"
+
+namespace sd {
+
+const sal_Unicode CHAR_HARDBLANK = ((sal_Unicode)0x00A0);
+const sal_Unicode CHAR_HARDHYPHEN = ((sal_Unicode)0x2011);
+const sal_Unicode CHAR_SOFTHYPHEN = ((sal_Unicode)0x00AD);
+const sal_Unicode CHAR_RLM = ((sal_Unicode)0x200F);
+const sal_Unicode CHAR_LRM = ((sal_Unicode)0x200E);
+const sal_Unicode CHAR_ZWSP = ((sal_Unicode)0x200B);
+const sal_Unicode CHAR_ZWNBSP = ((sal_Unicode)0x2060);
+
+TYPEINIT1( FuBullet, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuBullet::FuBullet (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* _pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, _pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuBullet::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuBullet( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuBullet::DoExecute( SfxRequest& rReq )
+{
+ if( rReq.GetSlot() == SID_CHARMAP )
+ InsertSpecialCharacter(rReq);
+ else
+ {
+ sal_Unicode cMark = 0;
+ switch( rReq.GetSlot() )
+ {
+ case FN_INSERT_SOFT_HYPHEN: cMark = CHAR_SOFTHYPHEN ; break;
+ case FN_INSERT_HARDHYPHEN: cMark = CHAR_HARDHYPHEN ; break;
+ case FN_INSERT_HARD_SPACE: cMark = CHAR_HARDBLANK ; break;
+ case SID_INSERT_RLM : cMark = CHAR_RLM ; break;
+ case SID_INSERT_LRM : cMark = CHAR_LRM ; break;
+ case SID_INSERT_ZWSP : cMark = CHAR_ZWSP ; break;
+ case SID_INSERT_ZWNBSP: cMark = CHAR_ZWNBSP; break;
+ }
+
+ DBG_ASSERT( cMark != 0, "FuBullet::FuBullet(), illegal slot used!" );
+
+ if( cMark )
+ InsertFormattingMark( cMark );
+ }
+
+}
+
+void FuBullet::InsertFormattingMark( sal_Unicode cMark )
+{
+ OutlinerView* pOV = NULL;
+ ::Outliner* pOL = NULL;
+
+ // depending on ViewShell set Outliner and OutlinerView
+ if (mpViewShell->ISA(DrawViewShell))
+ {
+ pOV = mpView->GetTextEditOutlinerView();
+ if (pOV)
+ pOL = mpView->GetTextEditOutliner();
+ }
+ else if (mpViewShell->ISA(OutlineViewShell))
+ {
+ pOL = static_cast<OutlineView*>(mpView)->GetOutliner();
+ pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
+ mpViewShell->GetActiveWindow());
+ }
+
+ // insert string
+ if(pOV && pOL)
+ {
+ // prevent flickering
+ pOV->HideCursor();
+ pOL->SetUpdateMode(FALSE);
+
+ // remove old selected text
+ pOV->InsertText( aEmptyStr );
+
+ // prepare undo
+ SfxUndoManager& rUndoMgr = pOL->GetUndoManager();
+ rUndoMgr.EnterListAction(String(SdResId(STR_UNDO_INSERT_SPECCHAR)),
+ aEmptyStr );
+
+ // insert given text
+ String aStr( cMark );
+ pOV->InsertText( cMark, TRUE);
+
+ ESelection aSel = pOV->GetSelection();
+ aSel.nStartPara = aSel.nEndPara;
+ aSel.nStartPos = aSel.nEndPos;
+ pOV->SetSelection(aSel);
+
+ rUndoMgr.LeaveListAction();
+
+ // restart repainting
+ pOL->SetUpdateMode(TRUE);
+ pOV->ShowCursor();
+ }
+}
+
+void FuBullet::InsertSpecialCharacter( SfxRequest& rReq )
+{
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ if( pArgs )
+ pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_CHARMAP), FALSE, &pItem);
+
+ String aChars, aFontName;
+ Font aFont;
+ if ( pItem )
+ {
+ aChars = ((const SfxStringItem*)pItem)->GetValue();
+ const SfxPoolItem* pFtItem = NULL;
+ pArgs->GetItemState( mpDoc->GetPool().GetWhich(SID_ATTR_SPECIALCHAR), FALSE, &pFtItem);
+ const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
+ if ( pFontItem )
+ {
+ aFontName = pFontItem->GetValue();
+ aFont = Font( aFontName, Size(1,1) );
+ }
+ else
+ {
+ SfxItemSet aFontAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aFontAttr );
+ const SvxFontItem* pFItem = (const SvxFontItem*)aFontAttr.GetItem( SID_ATTR_CHAR_FONT );
+ if( pFItem )
+ aFont = Font( pFItem->GetFamilyName(), pFItem->GetStyleName(), Size( 1, 1 ) );
+ }
+ }
+
+ if (!aChars.Len() )
+ {
+ SfxAllItemSet aSet( mpDoc->GetPool() );
+ aSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) );
+
+ SfxItemSet aFontAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aFontAttr );
+ const SvxFontItem* pFontItem = (const SvxFontItem*)aFontAttr.GetItem( SID_ATTR_CHAR_FONT );
+ if( pFontItem )
+ aSet.Put( *pFontItem );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractDialog* pDlg = pFact ? pFact->CreateSfxDialog( &mpView->GetViewShell()->GetViewFrame()->GetWindow(), aSet,
+ mpView->GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(),
+ RID_SVXDLG_CHARMAP ) : 0;
+ if( !pDlg )
+ return;
+
+ // Wenn Zeichen selektiert ist kann es angezeigt werden
+ // pDLg->SetFont( );
+ // pDlg->SetChar( );
+ USHORT nResult = pDlg->Execute();
+ if( nResult == RET_OK )
+ {
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, FALSE );
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE );
+ if ( pFItem )
+ {
+ aFont.SetName( pFItem->GetFamilyName() );
+ aFont.SetStyleName( pFItem->GetStyleName() );
+ aFont.SetCharSet( pFItem->GetCharSet() );
+ aFont.SetPitch( pFItem->GetPitch() );
+ }
+
+ if ( pCItem )
+ aChars = pCItem->GetValue();
+ }
+
+ delete( pDlg );
+ }
+
+ if( aChars.Len() )
+ {
+ OutlinerView* pOV = NULL;
+ ::Outliner* pOL = NULL;
+
+ // je nach ViewShell Outliner und OutlinerView bestimmen
+ if(mpViewShell && mpViewShell->ISA(DrawViewShell))
+ {
+ pOV = mpView->GetTextEditOutlinerView();
+ if (pOV)
+ {
+ pOL = mpView->GetTextEditOutliner();
+ }
+ }
+ else if(mpViewShell && mpViewShell->ISA(OutlineViewShell))
+ {
+ pOL = static_cast<OutlineView*>(mpView)->GetOutliner();
+ pOV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
+ mpViewShell->GetActiveWindow());
+ }
+
+ // Sonderzeichen einfuegen
+ if (pOV)
+ {
+ // nicht flackern
+ pOV->HideCursor();
+ pOL->SetUpdateMode(FALSE);
+
+ // alte Attributierung merken;
+ // dazu vorher selektierten Bereich loeschen, denn der muss eh weg
+ // und so gibt es immer eine eindeutige Attributierung (und da es
+ // kein DeleteSelected() an der OutlinerView gibt, wird durch
+ // Einfuegen eines Leerstrings geloescht)
+ pOV->InsertText( aEmptyStr );
+
+ SfxItemSet aOldSet( mpDoc->GetPool(), EE_CHAR_FONTINFO, EE_CHAR_FONTINFO, 0 );
+ aOldSet.Put( pOV->GetAttribs() );
+
+ SfxUndoManager& rUndoMgr = pOL->GetUndoManager();
+ rUndoMgr.EnterListAction(String(SdResId(STR_UNDO_INSERT_SPECCHAR)),
+ aEmptyStr );
+ pOV->InsertText(aChars, TRUE);
+
+ // attributieren (Font setzen)
+ SfxItemSet aSet(pOL->GetEmptyItemSet());
+ SvxFontItem aFontItem (aFont.GetFamily(), aFont.GetName(),
+ aFont.GetStyleName(), aFont.GetPitch(),
+ aFont.GetCharSet(),
+ EE_CHAR_FONTINFO);
+ aSet.Put(aFontItem);
+ aSet.Put(aFontItem, EE_CHAR_FONTINFO_CJK);
+ aSet.Put(aFontItem, EE_CHAR_FONTINFO_CTL);
+ pOV->SetAttribs(aSet);
+
+ ESelection aSel = pOV->GetSelection();
+ aSel.nStartPara = aSel.nEndPara;
+ aSel.nStartPos = aSel.nEndPos;
+ pOV->SetSelection(aSel);
+
+ // nicht mit Sonderzeichenattributierung weiterschreiben
+ pOV->GetOutliner()->QuickSetAttribs(aOldSet, aSel);
+
+ rUndoMgr.LeaveListAction();
+
+ // ab jetzt wieder anzeigen
+ pOL->SetUpdateMode(TRUE);
+ pOV->ShowCursor();
+ }
+ }
+}
+
+void FuBullet::GetSlotState( SfxItemSet& rSet, ViewShell* pViewShell, SfxViewFrame* pViewFrame )
+{
+ if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_CHARMAP ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( FN_INSERT_SOFT_HYPHEN ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( FN_INSERT_HARDHYPHEN ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( FN_INSERT_HARD_SPACE ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_RLM ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_LRM ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_ZWNBSP ) ||
+ SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_INSERT_ZWSP ))
+ {
+ ::sd::View* pView = pViewShell ? pViewShell->GetView() : 0;
+ OutlinerView* pOLV = pView ? pView->GetTextEditOutlinerView() : 0;
+
+ const bool bTextEdit = pOLV;
+
+ SvtCTLOptions aCTLOptions;
+ const sal_Bool bCtlEnabled = aCTLOptions.IsCTLFontEnabled();
+
+ if(!bTextEdit )
+ {
+ rSet.DisableItem(FN_INSERT_SOFT_HYPHEN);
+ rSet.DisableItem(FN_INSERT_HARDHYPHEN);
+ rSet.DisableItem(FN_INSERT_HARD_SPACE);
+ }
+
+ if( !bTextEdit && (dynamic_cast<OutlineViewShell*>( pViewShell ) == 0) )
+ rSet.DisableItem(SID_CHARMAP);
+
+ if(!bTextEdit || !bCtlEnabled )
+ {
+ rSet.DisableItem(SID_INSERT_RLM);
+ rSet.DisableItem(SID_INSERT_LRM);
+ rSet.DisableItem(SID_INSERT_ZWNBSP);
+ rSet.DisableItem(SID_INSERT_ZWSP);
+ }
+
+ if( pViewFrame )
+ {
+ SfxBindings& rBindings = pViewFrame->GetBindings();
+
+ rBindings.SetVisibleState( SID_INSERT_RLM, bCtlEnabled );
+ rBindings.SetVisibleState( SID_INSERT_LRM, bCtlEnabled );
+ rBindings.SetVisibleState( SID_INSERT_ZWNBSP, bCtlEnabled );
+ rBindings.SetVisibleState( SID_INSERT_ZWSP, bCtlEnabled );
+ }
+ }
+}
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuchar.cxx b/sd/source/ui/func/fuchar.cxx
new file mode 100644
index 000000000000..f43b33c8318a
--- /dev/null
+++ b/sd/source/ui/func/fuchar.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuchar.hxx"
+
+#include <sfx2/viewfrm.hxx>
+
+#include <editeng/editdata.hxx>
+#include <svx/svxids.hrc>
+#include <editeng/eeitem.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include "View.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "DrawViewShell.hxx"
+#include "ViewShell.hxx"
+#include "DrawDocShell.hxx"
+#include "sdabstdlg.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuChar, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuChar::FuChar (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuChar::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuChar( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuChar::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SfxItemSet aEditAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aEditAttr );
+
+ SfxItemSet aNewAttr( mpViewShell->GetPool(),
+ EE_ITEMS_START, EE_ITEMS_END );
+ aNewAttr.Put( aEditAttr, FALSE );
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdTabCharDialog( NULL, &aNewAttr, mpDoc->GetDocSh() ) : 0;
+ if( pDlg )
+ {
+ USHORT nResult = pDlg->Execute();
+
+ if( nResult == RET_OK )
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ pArgs = rReq.GetArgs();
+ }
+
+ delete pDlg;
+
+ if( nResult != RET_OK )
+ {
+ return;
+ }
+ }
+ }
+ mpView->SetAttributes(*pArgs);
+
+ // invalidieren der Slots, die in der DrTxtObjBar auftauchen
+ static USHORT SidArray[] = {
+ SID_ATTR_CHAR_FONT,
+ SID_ATTR_CHAR_POSTURE,
+ SID_ATTR_CHAR_WEIGHT,
+ SID_ATTR_CHAR_UNDERLINE,
+ SID_ATTR_CHAR_FONTHEIGHT,
+ SID_ATTR_CHAR_COLOR,
+ SID_SET_SUPER_SCRIPT,
+ SID_SET_SUB_SCRIPT,
+ 0 };
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+
+ if( mpDoc->GetOnlineSpell() )
+ {
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE, FALSE, &pItem ) ||
+ SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CJK, FALSE, &pItem ) ||
+ SFX_ITEM_SET == pArgs->GetItemState(EE_CHAR_LANGUAGE_CTL, FALSE, &pItem ) )
+ {
+ mpDoc->StopOnlineSpelling();
+ mpDoc->StartOnlineSpelling();
+ }
+ }
+}
+
+void FuChar::Activate()
+{
+}
+
+void FuChar::Deactivate()
+{
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fucon3d.cxx b/sd/source/ui/func/fucon3d.cxx
new file mode 100644
index 000000000000..ef0827cc6efc
--- /dev/null
+++ b/sd/source/ui/func/fucon3d.cxx
@@ -0,0 +1,531 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fucon3d.hxx"
+#include <vcl/waitobj.hxx>
+
+#include <svx/svxids.hrc>
+#include <svl/aeitem.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <tools/poly.hxx>
+
+#include <math.h>
+#include <svx/globl3d.hxx>
+#include <svx/scene3d.hxx>
+#include <svx/sphere3d.hxx>
+#include <svx/cube3d.hxx>
+#include <svx/lathe3d.hxx>
+#include <svx/camera3d.hxx>
+
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "View.hxx"
+#include "Window.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+#include <svx/svx3ditems.hxx>
+
+// #97016#
+#include <svx/polysc3d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+namespace sd {
+
+TYPEINIT1( FuConstruct3dObject, FuConstruct );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstruct3dObject::FuConstruct3dObject (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuConstruct3dObject::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuConstruct3dObject* pFunc;
+ FunctionReference xFunc( pFunc = new FuConstruct3dObject( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent(bPermanent);
+ return xFunc;
+}
+
+void FuConstruct3dObject::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msDrawingObjectToolBar);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+// #97016#
+E3dCompoundObject* FuConstruct3dObject::ImpCreateBasic3DShape()
+{
+ E3dCompoundObject* p3DObj = NULL;
+
+ switch (nSlotId)
+ {
+ default:
+ case SID_3D_CUBE:
+ {
+ p3DObj = new E3dCubeObj(
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B3DPoint(-2500, -2500, -2500),
+ ::basegfx::B3DVector(5000, 5000, 5000));
+ break;
+ }
+
+ case SID_3D_SPHERE:
+ {
+ p3DObj = new E3dSphereObj(
+ mpView->Get3DDefaultAttributes(),
+ ::basegfx::B3DPoint(0, 0, 0),
+ ::basegfx::B3DVector(5000, 5000, 5000));
+ break;
+ }
+
+ case SID_3D_SHELL:
+ {
+ XPolygon aXPoly(Point (0, 1250), 2500, 2500, 0, 900, FALSE);
+ aXPoly.Scale(5.0, 5.0);
+
+ ::basegfx::B2DPolygon aB2DPolygon(aXPoly.getB2DPolygon());
+ if(aB2DPolygon.areControlPointsUsed())
+ {
+ aB2DPolygon = ::basegfx::tools::adaptiveSubdivideByAngle(aB2DPolygon);
+ }
+ p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon));
+
+ // Dies ist ein offenes Objekt, muss daher defaultmaessig
+ // doppelseitig behandelt werden
+ p3DObj->SetMergedItem(Svx3DDoubleSidedItem(TRUE));
+ break;
+ }
+
+ case SID_3D_HALF_SPHERE:
+ {
+ XPolygon aXPoly(Point (0, 1250), 2500, 2500, 0, 900, FALSE);
+ aXPoly.Scale(5.0, 5.0);
+
+ aXPoly.Insert(0, Point (2400*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (2000*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (1500*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (1000*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (500*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (250*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (50*5, 1250*5), XPOLY_NORMAL);
+ aXPoly.Insert(0, Point (0*5, 1250*5), XPOLY_NORMAL);
+
+ ::basegfx::B2DPolygon aB2DPolygon(aXPoly.getB2DPolygon());
+ if(aB2DPolygon.areControlPointsUsed())
+ {
+ aB2DPolygon = ::basegfx::tools::adaptiveSubdivideByAngle(aB2DPolygon);
+ }
+ p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon));
+ break;
+ }
+
+ case SID_3D_TORUS:
+ {
+ ::basegfx::B2DPolygon aB2DPolygon(::basegfx::tools::createPolygonFromCircle(::basegfx::B2DPoint(1000.0, 0.0), 500.0));
+ if(aB2DPolygon.areControlPointsUsed())
+ {
+ aB2DPolygon = ::basegfx::tools::adaptiveSubdivideByAngle(aB2DPolygon);
+ }
+ p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aB2DPolygon));
+ break;
+ }
+
+ case SID_3D_CYLINDER:
+ {
+ ::basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(::basegfx::B2DPoint(0, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(50*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(100*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(200*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(300*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(400*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(450*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(500*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(500*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(450*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(400*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(300*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(200*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(100*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(50*5, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(0*5, -1000*5));
+ aInnerPoly.setClosed(true);
+
+ p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly));
+ break;
+ }
+
+ case SID_3D_CONE:
+ {
+ ::basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(::basegfx::B2DPoint(0, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(25*5, -900*5));
+ aInnerPoly.append(::basegfx::B2DPoint(50*5, -800*5));
+ aInnerPoly.append(::basegfx::B2DPoint(100*5, -600*5));
+ aInnerPoly.append(::basegfx::B2DPoint(200*5, -200*5));
+ aInnerPoly.append(::basegfx::B2DPoint(300*5, 200*5));
+ aInnerPoly.append(::basegfx::B2DPoint(400*5, 600*5));
+ aInnerPoly.append(::basegfx::B2DPoint(500*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(400*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(300*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(200*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(100*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(50*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(0*5, 1000*5));
+ aInnerPoly.setClosed(true);
+
+ p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly));
+ break;
+ }
+
+ case SID_3D_PYRAMID:
+ {
+ ::basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(::basegfx::B2DPoint(0, -1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(25*5, -900*5));
+ aInnerPoly.append(::basegfx::B2DPoint(50*5, -800*5));
+ aInnerPoly.append(::basegfx::B2DPoint(100*5, -600*5));
+ aInnerPoly.append(::basegfx::B2DPoint(200*5, -200*5));
+ aInnerPoly.append(::basegfx::B2DPoint(300*5, 200*5));
+ aInnerPoly.append(::basegfx::B2DPoint(400*5, 600*5));
+ aInnerPoly.append(::basegfx::B2DPoint(500*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(400*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(300*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(200*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(100*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(50*5, 1000*5));
+ aInnerPoly.append(::basegfx::B2DPoint(0, 1000*5));
+ aInnerPoly.setClosed(true);
+
+ p3DObj = new E3dLatheObj(mpView->Get3DDefaultAttributes(), ::basegfx::B2DPolyPolygon(aInnerPoly));
+ p3DObj->SetMergedItem(Svx3DHorizontalSegmentsItem(4));
+ break;
+ }
+ }
+
+ return p3DObj;
+}
+
+// #97016#
+void FuConstruct3dObject::ImpPrepareBasic3DShape(E3dCompoundObject* p3DObj, E3dScene *pScene)
+{
+ Camera3D &aCamera = (Camera3D&) pScene->GetCamera ();
+
+ // get transformed BoundVolume of the new object
+ basegfx::B3DRange aBoundVol;
+ basegfx::B3DRange aObjVol(p3DObj->GetBoundVolume());
+ aObjVol.transform(p3DObj->GetTransform());
+ aBoundVol.expand(aObjVol);
+ double fDeepth(aBoundVol.getDepth());
+
+ aCamera.SetPRP(::basegfx::B3DPoint(0.0, 0.0, 1000.0));
+ aCamera.SetPosition(::basegfx::B3DPoint(0.0, 0.0, mpView->GetDefaultCamPosZ() + fDeepth / 2));
+ aCamera.SetFocalLength(mpView->GetDefaultCamFocal());
+ pScene->SetCamera(aCamera);
+ basegfx::B3DHomMatrix aTransformation;
+
+ switch (nSlotId)
+ {
+ case SID_3D_CUBE:
+ {
+ aTransformation.rotate(DEG2RAD(20), 0.0, 0.0);
+ }
+ break;
+
+ case SID_3D_SPHERE:
+ {
+// pScene->RotateX(DEG2RAD(60));
+ }
+ break;
+
+ case SID_3D_SHELL:
+ case SID_3D_HALF_SPHERE:
+ {
+ aTransformation.rotate(DEG2RAD(200), 0.0, 0.0);
+ }
+ break;
+
+ case SID_3D_CYLINDER:
+ case SID_3D_CONE:
+ case SID_3D_PYRAMID:
+ {
+// pScene->RotateX(DEG2RAD(25));
+ }
+ break;
+
+ case SID_3D_TORUS:
+ {
+// pScene->RotateX(DEG2RAD(15));
+ aTransformation.rotate(DEG2RAD(90), 0.0, 0.0);
+ }
+ break;
+
+ default:
+ {
+ }
+ break;
+ }
+
+ pScene->SetTransform(aTransformation * pScene->GetTransform());
+
+ SfxItemSet aAttr (mpViewShell->GetPool());
+ pScene->SetMergedItemSetAndBroadcast(aAttr);
+}
+
+BOOL FuConstruct3dObject::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FuConstruct::MouseButtonDown(rMEvt);
+
+ if ( rMEvt.IsLeft() && !mpView->IsAction() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ mpWindow->CaptureMouse();
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ E3dCompoundObject* p3DObj = NULL;
+
+ WaitObject aWait( (Window*)mpViewShell->GetActiveWindow() );
+
+ // #97016#
+ p3DObj = ImpCreateBasic3DShape();
+ E3dScene* pScene = mpView->SetCurrent3DObj(p3DObj);
+
+ // #97016#
+ ImpPrepareBasic3DShape(p3DObj, pScene);
+ bReturn = mpView->BegCreatePreparedObject(aPnt, nDrgLog, pScene);
+
+ SdrObject* pObj = mpView->GetCreateObj();
+
+ if (pObj)
+ {
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, pObj);
+
+ // LineStyle rausnehmen
+ aAttr.Put(XLineStyleItem (XLINE_NONE));
+
+ pObj->SetMergedItemSet(aAttr);
+ }
+ }
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuConstruct3dObject::MouseMove(const MouseEvent& rMEvt)
+{
+ return FuConstruct::MouseMove(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL FuConstruct3dObject::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+
+ if ( mpView->IsCreateObj() && rMEvt.IsLeft() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+ mpView->EndCreateObj(SDRCREATE_FORCEEND);
+ bReturn = TRUE;
+ }
+
+ bReturn = FuConstruct::MouseButtonUp(rMEvt) || bReturn;
+
+ if (!bPermanent)
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+BOOL FuConstruct3dObject::KeyInput(const KeyEvent& rKEvt)
+{
+ return( FuConstruct::KeyInput(rKEvt) );
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuConstruct3dObject::Activate()
+{
+ mpView->SetCurrentObj(OBJ_NONE);
+
+ FuConstruct::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuConstruct3dObject::Deactivate()
+{
+ FuConstruct::Deactivate();
+}
+
+// #97016#
+SdrObject* FuConstruct3dObject::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
+{
+ // case SID_3D_CUBE:
+ // case SID_3D_SHELL:
+ // case SID_3D_SPHERE:
+ // case SID_3D_TORUS:
+ // case SID_3D_HALF_SPHERE:
+ // case SID_3D_CYLINDER:
+ // case SID_3D_CONE:
+ // case SID_3D_PYRAMID:
+
+ E3dCompoundObject* p3DObj = ImpCreateBasic3DShape();
+
+ // E3dView::SetCurrent3DObj part
+ // get transformed BoundVolume of the object
+ basegfx::B3DRange aObjVol(p3DObj->GetBoundVolume());
+ aObjVol.transform(p3DObj->GetTransform());
+ basegfx::B3DRange aVolume(aObjVol);
+ double fW(aVolume.getWidth());
+ double fH(aVolume.getHeight());
+ Rectangle a3DRect(0, 0, (long)fW, (long)fH);
+ E3dScene* pScene = new E3dPolyScene(mpView->Get3DDefaultAttributes());
+
+ // mpView->InitScene(pScene, fW, fH, aVolume.MaxVec().Z() + ((fW + fH) / 4.0));
+ // copied code from E3dView::InitScene
+ double fCamZ(aVolume.getMaxZ() + ((fW + fH) / 4.0));
+ Camera3D aCam(pScene->GetCamera());
+ aCam.SetAutoAdjustProjection(FALSE);
+ aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
+ ::basegfx::B3DPoint aLookAt;
+ double fDefaultCamPosZ = mpView->GetDefaultCamPosZ();
+ ::basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
+ aCam.SetPosAndLookAt(aCamPos, aLookAt);
+ aCam.SetFocalLength(mpView->GetDefaultCamFocal());
+ aCam.SetDefaults(::basegfx::B3DPoint(0.0, 0.0, fDefaultCamPosZ), aLookAt, mpView->GetDefaultCamFocal());
+ pScene->SetCamera(aCam);
+
+ pScene->Insert3DObj(p3DObj);
+ pScene->NbcSetSnapRect(a3DRect);
+ pScene->SetModel(mpDoc);
+
+ ImpPrepareBasic3DShape(p3DObj, pScene);
+
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, p3DObj);
+ aAttr.Put(XLineStyleItem (XLINE_NONE));
+ p3DObj->SetMergedItemSet(aAttr);
+
+ // make object interactive at once
+ pScene->SetRectsDirty();
+
+ // Take care of restrictions for the rectangle
+ Rectangle aRect(rRectangle);
+
+ switch(nID)
+ {
+ case SID_3D_CUBE:
+ case SID_3D_SPHERE:
+ case SID_3D_TORUS:
+ {
+ // force quadratic
+ ImpForceQuadratic(aRect);
+ break;
+ }
+
+ case SID_3D_SHELL:
+ case SID_3D_HALF_SPHERE:
+ {
+ // force horizontal layout
+ break;
+ }
+
+ case SID_3D_CYLINDER:
+ case SID_3D_CONE:
+ case SID_3D_PYRAMID:
+ {
+ // force vertical layout
+ break;
+ }
+ }
+
+ // #97016#, #98245# use changed rectangle, not original one
+ pScene->SetLogicRect(aRect);
+
+ return pScene;
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuconarc.cxx b/sd/source/ui/func/fuconarc.cxx
new file mode 100644
index 000000000000..7a7ab2b9dc2e
--- /dev/null
+++ b/sd/source/ui/func/fuconarc.cxx
@@ -0,0 +1,339 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuconarc.hxx"
+#include <svx/svdpagv.hxx>
+#include <svx/svdocirc.hxx>
+#include <sfx2/request.hxx>
+#include <svl/intitem.hxx>
+#include <svl/aeitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdobj.hxx>
+#include <sfx2/viewfrm.hxx>
+
+
+#include <svx/svxids.hrc>
+#include <math.h>
+
+#include "app.hrc"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "res_bmp.hrc"
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+
+// #97016#
+#include <svx/sxciaitm.hxx>
+
+namespace sd {
+
+TYPEINIT1( FuConstructArc, FuConstruct );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstructArc::FuConstructArc (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq )
+ : FuConstruct( pViewSh, pWin, pView, pDoc, rReq )
+{
+}
+
+FunctionReference FuConstructArc::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuConstructArc* pFunc;
+ FunctionReference xFunc( pFunc = new FuConstructArc( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent(bPermanent);
+ return xFunc;
+}
+
+void FuConstructArc::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msDrawingObjectToolBar);
+
+ const SfxItemSet *pArgs = rReq.GetArgs ();
+
+ if (pArgs)
+ {
+ SFX_REQUEST_ARG (rReq, pCenterX, SfxUInt32Item, ID_VAL_CENTER_X, FALSE);
+ SFX_REQUEST_ARG (rReq, pCenterY, SfxUInt32Item, ID_VAL_CENTER_Y, FALSE);
+ SFX_REQUEST_ARG (rReq, pAxisX, SfxUInt32Item, ID_VAL_AXIS_X, FALSE);
+ SFX_REQUEST_ARG (rReq, pAxisY, SfxUInt32Item, ID_VAL_AXIS_Y, FALSE);
+ SFX_REQUEST_ARG (rReq, pPhiStart, SfxUInt32Item, ID_VAL_ANGLESTART, FALSE);
+ SFX_REQUEST_ARG (rReq, pPhiEnd, SfxUInt32Item, ID_VAL_ANGLEEND, FALSE);
+
+ Rectangle aNewRectangle (pCenterX->GetValue () - pAxisX->GetValue () / 2,
+ pCenterY->GetValue () - pAxisY->GetValue () / 2,
+ pCenterX->GetValue () + pAxisX->GetValue () / 2,
+ pCenterY->GetValue () + pAxisY->GetValue () / 2);
+
+ Activate(); // Setzt aObjKind
+ SdrCircObj* pNewCircle =
+ new SdrCircObj((SdrObjKind) mpView->GetCurrentObjIdentifier(),
+ aNewRectangle,
+ (long) (pPhiStart->GetValue () * 10.0),
+ (long) (pPhiEnd->GetValue () * 10.0));
+ SdrPageView *pPV = mpView->GetSdrPageView();
+
+ mpView->InsertObjectAtView(pNewCircle, *pPV, SDRINSERT_SETDEFLAYER);
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL FuConstructArc::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ BOOL bReturn = FuConstruct::MouseButtonDown( rMEvt );
+
+ if ( rMEvt.IsLeft() && !mpView->IsAction() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+ mpWindow->CaptureMouse();
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpView->BegCreateObj(aPnt, (OutputDevice*) NULL, nDrgLog);
+
+ SdrObject* pObj = mpView->GetCreateObj();
+
+ if (pObj)
+ {
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, pObj);
+
+//-/ pObj->NbcSetAttributes(aAttr, FALSE);
+ pObj->SetMergedItemSet(aAttr);
+ }
+
+ bReturn = TRUE;
+ }
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuConstructArc::MouseMove( const MouseEvent& rMEvt )
+{
+ return FuConstruct::MouseMove(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL FuConstructArc::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ BOOL bReturn = FALSE;
+ BOOL bCreated = FALSE;
+
+ if ( mpView->IsCreateObj() && rMEvt.IsLeft() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ ULONG nCount = mpView->GetSdrPageView()->GetObjList()->GetObjCount();
+
+ if (mpView->EndCreateObj(SDRCREATE_NEXTPOINT) )
+ {
+ if (nCount != mpView->GetSdrPageView()->GetObjList()->GetObjCount())
+ {
+ bCreated = TRUE;
+ }
+ }
+
+ bReturn = TRUE;
+ }
+
+ bReturn = FuConstruct::MouseButtonUp (rMEvt) || bReturn;
+
+ if (!bPermanent && bCreated)
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+BOOL FuConstructArc::KeyInput(const KeyEvent& rKEvt)
+{
+ BOOL bReturn = FuConstruct::KeyInput(rKEvt);
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuConstructArc::Activate()
+{
+ SdrObjKind aObjKind;
+
+ switch( nSlotId )
+ {
+ case SID_DRAW_ARC :
+ case SID_DRAW_CIRCLEARC:
+ {
+ aObjKind = OBJ_CARC;
+ }
+ break;
+
+ case SID_DRAW_PIE :
+ case SID_DRAW_PIE_NOFILL :
+ case SID_DRAW_CIRCLEPIE :
+ case SID_DRAW_CIRCLEPIE_NOFILL:
+ {
+ aObjKind = OBJ_SECT;
+ }
+ break;
+
+ case SID_DRAW_ELLIPSECUT :
+ case SID_DRAW_ELLIPSECUT_NOFILL:
+ case SID_DRAW_CIRCLECUT :
+ case SID_DRAW_CIRCLECUT_NOFILL :
+ {
+ aObjKind = OBJ_CCUT;
+ }
+ break;
+
+ default:
+ {
+ aObjKind = OBJ_CARC;
+ }
+ break;
+ }
+
+ mpView->SetCurrentObj((UINT16)aObjKind);
+
+ FuConstruct::Activate();
+// FuDraw::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuConstructArc::Deactivate()
+{
+ FuConstruct::Deactivate();
+// FuDraw::Deactivate();
+}
+
+// #97016#
+SdrObject* FuConstructArc::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
+{
+ // case SID_DRAW_ARC:
+ // case SID_DRAW_CIRCLEARC:
+ // case SID_DRAW_PIE:
+ // case SID_DRAW_PIE_NOFILL:
+ // case SID_DRAW_CIRCLEPIE:
+ // case SID_DRAW_CIRCLEPIE_NOFILL:
+ // case SID_DRAW_ELLIPSECUT:
+ // case SID_DRAW_ELLIPSECUT_NOFILL:
+ // case SID_DRAW_CIRCLECUT:
+ // case SID_DRAW_CIRCLECUT_NOFILL:
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
+ 0L, mpDoc);
+
+ if(pObj)
+ {
+ if(pObj->ISA(SdrCircObj))
+ {
+ Rectangle aRect(rRectangle);
+
+ if(SID_DRAW_ARC == nID ||
+ SID_DRAW_CIRCLEARC == nID ||
+ SID_DRAW_CIRCLEPIE == nID ||
+ SID_DRAW_CIRCLEPIE_NOFILL == nID ||
+ SID_DRAW_CIRCLECUT == nID ||
+ SID_DRAW_CIRCLECUT_NOFILL == nID)
+ {
+ // force quadratic
+ ImpForceQuadratic(aRect);
+ }
+
+ pObj->SetLogicRect(aRect);
+
+ SfxItemSet aAttr(mpDoc->GetPool());
+ aAttr.Put(SdrCircStartAngleItem(9000));
+ aAttr.Put(SdrCircEndAngleItem(0));
+
+ if(SID_DRAW_PIE_NOFILL == nID ||
+ SID_DRAW_CIRCLEPIE_NOFILL == nID ||
+ SID_DRAW_ELLIPSECUT_NOFILL == nID ||
+ SID_DRAW_CIRCLECUT_NOFILL == nID)
+ {
+ aAttr.Put(XFillStyleItem(XFILL_NONE));
+ }
+
+ pObj->SetMergedItemSet(aAttr);
+ }
+ else
+ {
+ DBG_ERROR("Object is NO circle object");
+ }
+ }
+
+ return pObj;
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx
new file mode 100644
index 000000000000..e95a2377e4ee
--- /dev/null
+++ b/sd/source/ui/func/fuconbez.cxx
@@ -0,0 +1,538 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+
+#include "fuconbez.hxx"
+#include <svl/aeitem.hxx>
+#include <svx/svdopath.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdobj.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+
+
+#include <svx/svxids.hrc>
+#include <svx/svdpagv.hxx>
+
+#include "app.hrc"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "ToolBarManager.hxx"
+#include "drawdoc.hxx"
+#include "res_bmp.hrc"
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+#include "CustomAnimationEffect.hxx"
+
+using namespace ::com::sun::star::uno;
+
+namespace sd {
+
+TYPEINIT1( FuConstructBezierPolygon, FuConstruct );
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstructBezierPolygon::FuConstructBezierPolygon (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuConstruct(pViewSh, pWin, pView, pDoc, rReq),
+ nEditMode(SID_BEZIER_MOVE)
+{
+}
+
+FunctionReference FuConstructBezierPolygon::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuConstructBezierPolygon* pFunc;
+ FunctionReference xFunc( pFunc = new FuConstructBezierPolygon( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent(bPermanent);
+ return xFunc;
+}
+
+void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if( pArgs )
+ {
+ const SfxPoolItem* pPoolItem = NULL;
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_ADD_MOTION_PATH, TRUE, &pPoolItem ) )
+ maTargets = ( ( const SfxUnoAnyItem* ) pPoolItem )->GetValue();
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL FuConstructBezierPolygon::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FuConstruct::MouseButtonDown(rMEvt);
+
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_HANDLE || rMEvt.IsMod1())
+ {
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+ }
+ else
+ {
+ mpView->SetEditMode(SDREDITMODE_CREATE);
+ }
+
+ if (aVEvt.eEvent == SDREVENT_BEGTEXTEDIT)
+ {
+ // Texteingabe hier nicht zulassen
+ aVEvt.eEvent = SDREVENT_BEGDRAGOBJ;
+ mpView->EnableExtendedMouseEventDispatcher(FALSE);
+ }
+ else
+ {
+ mpView->EnableExtendedMouseEventDispatcher(TRUE);
+ }
+
+ if (eHit == SDRHIT_MARKEDOBJECT && nEditMode == SID_BEZIER_INSERT)
+ {
+ /******************************************************************
+ * Klebepunkt einfuegen
+ ******************************************************************/
+ mpView->BegInsObjPoint(aMDPos, rMEvt.IsMod1());
+ }
+ else
+ {
+ mpView->MouseButtonDown(rMEvt, mpWindow);
+
+ SdrObject* pObj = mpView->GetCreateObj();
+
+ if (pObj)
+ {
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, pObj);
+ pObj->SetMergedItemSet(aAttr);
+ }
+ }
+
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuConstructBezierPolygon::MouseMove(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FuConstruct::MouseMove(rMEvt);
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL FuConstructBezierPolygon::MouseButtonUp(const MouseEvent& rMEvt )
+{
+ BOOL bReturn = FALSE;
+ BOOL bCreated = FALSE;
+
+ SdrViewEvent aVEvt;
+ mpView->PickAnything(rMEvt, SDRMOUSEBUTTONUP, aVEvt);
+
+ ULONG nCount = mpView->GetSdrPageView()->GetObjList()->GetObjCount();
+
+ if (mpView->IsInsObjPoint())
+ {
+ mpView->EndInsObjPoint(SDRCREATE_FORCEEND);
+ }
+ else
+ {
+ mpView->MouseButtonUp(rMEvt, mpWindow);
+ }
+
+ if (aVEvt.eEvent == SDREVENT_ENDCREATE)
+ {
+ bReturn = TRUE;
+
+ if (nCount == (mpView->GetSdrPageView()->GetObjList()->GetObjCount() - 1))
+ {
+ bCreated = TRUE;
+ }
+
+ // Trick, um FuDraw::DoubleClick nicht auszuloesen
+ bMBDown = FALSE;
+
+ }
+
+ bReturn = FuConstruct::MouseButtonUp(rMEvt) || bReturn;
+
+ bool bDeleted = false;
+ if( bCreated && maTargets.hasValue() )
+ {
+ SdrPathObj* pPathObj = dynamic_cast< SdrPathObj* >( mpView->GetSdrPageView()->GetObjList()->GetObj( nCount ) );
+ SdPage* pPage = dynamic_cast< SdPage* >( pPathObj ? pPathObj->GetPage() : 0 );
+ if( pPage )
+ {
+ boost::shared_ptr< sd::MainSequence > pMainSequence( pPage->getMainSequence() );
+ if( pMainSequence.get() )
+ {
+ Sequence< Any > aTargets;
+ maTargets >>= aTargets;
+
+ sal_Int32 nTCount = aTargets.getLength();
+ if( nTCount > 1 )
+ {
+ const Any* pTarget = aTargets.getConstArray();
+ double fDuration = 0.0;
+ *pTarget++ >>= fDuration;
+ bool bFirst = true;
+ while( --nTCount )
+ {
+ CustomAnimationEffectPtr pCreated( pMainSequence->append( *pPathObj, *pTarget++, fDuration ) );
+ if( bFirst )
+ bFirst = false;
+ else
+ pCreated->setNodeType( ::com::sun::star::presentation::EffectNodeType::WITH_PREVIOUS );
+ }
+ }
+ }
+ }
+ mpView->DeleteMarked();
+ bDeleted = true;
+ }
+
+ if ((!bPermanent && bCreated) || bDeleted)
+ {
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ }
+
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+BOOL FuConstructBezierPolygon::KeyInput(const KeyEvent& rKEvt)
+{
+ BOOL bReturn = FuConstruct::KeyInput(rKEvt);
+
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuConstructBezierPolygon::Activate()
+{
+ mpView->EnableExtendedMouseEventDispatcher(TRUE);
+
+ SdrObjKind eKind;
+
+ switch (nSlotId)
+ {
+ case SID_DRAW_POLYGON_NOFILL:
+ case SID_DRAW_XPOLYGON_NOFILL:
+ {
+ eKind = OBJ_PLIN;
+ }
+ break;
+
+ case SID_DRAW_POLYGON:
+ case SID_DRAW_XPOLYGON:
+ {
+ eKind = OBJ_POLY;
+ }
+ break;
+
+ case SID_DRAW_BEZIER_NOFILL:
+ {
+ eKind = OBJ_PATHLINE;
+ }
+ break;
+
+ case SID_DRAW_BEZIER_FILL:
+ {
+ eKind = OBJ_PATHFILL;
+ }
+ break;
+
+ case SID_DRAW_FREELINE_NOFILL:
+ {
+ eKind = OBJ_FREELINE;
+ }
+ break;
+
+ case SID_DRAW_FREELINE:
+ {
+ eKind = OBJ_FREEFILL;
+ }
+ break;
+
+ default:
+ {
+ eKind = OBJ_PATHLINE;
+ }
+ break;
+ }
+
+ mpView->SetCurrentObj((UINT16)eKind);
+
+ FuConstruct::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuConstructBezierPolygon::Deactivate()
+{
+ mpView->EnableExtendedMouseEventDispatcher(FALSE);
+
+ FuConstruct::Deactivate();
+}
+
+
+/*************************************************************************
+|*
+|* Selektion hat sich geaendert
+|*
+\************************************************************************/
+
+void FuConstructBezierPolygon::SelectionHasChanged()
+{
+ FuDraw::SelectionHasChanged();
+
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SelectionHasChanged(
+ *mpViewShell,
+ *mpView);
+}
+
+
+
+/*************************************************************************
+|*
+|* Aktuellen Bezier-Editmodus setzen
+|*
+\************************************************************************/
+
+void FuConstructBezierPolygon::SetEditMode(USHORT nMode)
+{
+ nEditMode = nMode;
+ ForcePointer();
+
+ SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate(SID_BEZIER_MOVE);
+ rBindings.Invalidate(SID_BEZIER_INSERT);
+}
+
+// #97016#
+SdrObject* FuConstructBezierPolygon::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
+{
+ // case SID_DRAW_POLYGON:
+ // case SID_DRAW_POLYGON_NOFILL:
+ // case SID_DRAW_XPOLYGON:
+ // case SID_DRAW_XPOLYGON_NOFILL:
+ // case SID_DRAW_FREELINE:
+ // case SID_DRAW_FREELINE_NOFILL:
+ // case SID_DRAW_BEZIER_FILL: // BASIC
+ // case SID_DRAW_BEZIER_NOFILL: // BASIC
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
+ 0L, mpDoc);
+
+ if(pObj)
+ {
+ if(pObj->ISA(SdrPathObj))
+ {
+ basegfx::B2DPolyPolygon aPoly;
+
+ switch(nID)
+ {
+ case SID_DRAW_BEZIER_FILL:
+ {
+ const sal_Int32 nWdt(rRectangle.GetWidth() / 2);
+ const sal_Int32 nHgt(rRectangle.GetHeight() / 2);
+ const basegfx::B2DPolygon aInnerPoly(basegfx::tools::createPolygonFromEllipse(basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Center().Y()), nWdt, nHgt));
+
+ aPoly.append(aInnerPoly);
+ break;
+ }
+ case SID_DRAW_BEZIER_NOFILL:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom()));
+
+ const basegfx::B2DPoint aCenterBottom(rRectangle.Center().X(), rRectangle.Bottom());
+ aInnerPoly.appendBezierSegment(
+ aCenterBottom,
+ aCenterBottom,
+ basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Center().Y()));
+
+ const basegfx::B2DPoint aCenterTop(rRectangle.Center().X(), rRectangle.Top());
+ aInnerPoly.appendBezierSegment(
+ aCenterTop,
+ aCenterTop,
+ basegfx::B2DPoint(rRectangle.Right(), rRectangle.Top()));
+
+ aPoly.append(aInnerPoly);
+ break;
+ }
+ case SID_DRAW_FREELINE:
+ case SID_DRAW_FREELINE_NOFILL:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom()));
+
+ aInnerPoly.appendBezierSegment(
+ basegfx::B2DPoint(rRectangle.Left(), rRectangle.Top()),
+ basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Top()),
+ basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Center().Y()));
+
+ aInnerPoly.appendBezierSegment(
+ basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Bottom()),
+ basegfx::B2DPoint(rRectangle.Right(), rRectangle.Bottom()),
+ basegfx::B2DPoint(rRectangle.Right(), rRectangle.Top()));
+
+ if(SID_DRAW_FREELINE == nID)
+ {
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Bottom()));
+ }
+ else
+ {
+ aInnerPoly.setClosed(true);
+ }
+
+ aPoly.append(aInnerPoly);
+ break;
+ }
+ case SID_DRAW_XPOLYGON:
+ case SID_DRAW_XPOLYGON_NOFILL:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Top()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Top()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Center().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Center().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Right(), rRectangle.Bottom()));
+
+ if(SID_DRAW_XPOLYGON_NOFILL == nID)
+ {
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Bottom()));
+ }
+ else
+ {
+ aInnerPoly.setClosed(true);
+ }
+
+ aPoly.append(aInnerPoly);
+ break;
+ }
+ case SID_DRAW_POLYGON:
+ case SID_DRAW_POLYGON_NOFILL:
+ {
+ basegfx::B2DPolygon aInnerPoly;
+ const sal_Int32 nWdt(rRectangle.GetWidth());
+ const sal_Int32 nHgt(rRectangle.GetHeight());
+
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Bottom()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left() + (nWdt * 30) / 100, rRectangle.Top() + (nHgt * 70) / 100));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left(), rRectangle.Top() + (nHgt * 15) / 100));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left() + (nWdt * 65) / 100, rRectangle.Top()));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left() + nWdt, rRectangle.Top() + (nHgt * 30) / 100));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left() + (nWdt * 80) / 100, rRectangle.Top() + (nHgt * 50) / 100));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Left() + (nWdt * 80) / 100, rRectangle.Top() + (nHgt * 75) / 100));
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Bottom(), rRectangle.Right()));
+
+ if(SID_DRAW_POLYGON_NOFILL == nID)
+ {
+ aInnerPoly.append(basegfx::B2DPoint(rRectangle.Center().X(), rRectangle.Bottom()));
+ }
+ else
+ {
+ aInnerPoly.setClosed(true);
+ }
+
+ aPoly.append(aInnerPoly);
+ break;
+ }
+ }
+
+ ((SdrPathObj*)pObj)->SetPathPoly(aPoly);
+ }
+ else
+ {
+ DBG_ERROR("Object is NO path object");
+ }
+
+ pObj->SetLogicRect(rRectangle);
+ }
+
+ return pObj;
+}
+
+} // end of namespace sd
+
+// eof
diff --git a/sd/source/ui/func/fuconcs.cxx b/sd/source/ui/func/fuconcs.cxx
new file mode 100644
index 000000000000..0627abdd62fc
--- /dev/null
+++ b/sd/source/ui/func/fuconcs.cxx
@@ -0,0 +1,344 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuconcs.hxx"
+#include <svx/svdpagv.hxx>
+
+
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+
+#include "app.hrc"
+#include <svl/aeitem.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/sdtmfitm.hxx>
+#include <svx/sxekitm.hxx>
+#include <svx/sderitm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdocirc.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/xtable.hxx>
+#include <svx/sdasitm.hxx>
+#include <svx/tbxcustomshapes.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/sdtagitm.hxx>
+
+// #88751#
+#include <svx/svdocapt.hxx>
+
+// #97016#
+#include <svx/svdomeas.hxx>
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+// #109583#
+#include <editeng/writingmodeitem.hxx>
+#include <svx/gallery.hxx>
+#include <svl/itempool.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+#include "sdresid.hxx"
+#include "View.hxx"
+#include "sdpage.hxx"
+#include "Window.hxx"
+#include "stlpool.hxx"
+#include "drawdoc.hxx"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+
+namespace sd {
+
+TYPEINIT1( FuConstructCustomShape, FuConstruct );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstructCustomShape::FuConstructCustomShape (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq ) :
+ FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuConstructCustomShape::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuConstructCustomShape* pFunc;
+ FunctionReference xFunc( pFunc = new FuConstructCustomShape( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent( bPermanent );
+ return xFunc;
+}
+
+void FuConstructCustomShape::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if ( pArgs )
+ {
+ const SfxStringItem& rItm = (const SfxStringItem&)pArgs->Get( rReq.GetSlot() );
+ aCustomShape = rItm.GetValue();
+ }
+
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msDrawingObjectToolBar);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL FuConstructCustomShape::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FuConstruct::MouseButtonDown(rMEvt);
+
+ if ( rMEvt.IsLeft() && !mpView->IsAction() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ mpWindow->CaptureMouse();
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ mpView->BegCreateObj(aPnt, (OutputDevice*) NULL, nDrgLog);
+
+ SdrObject* pObj = mpView->GetCreateObj();
+ if ( pObj )
+ {
+ SetAttributes( pObj );
+ sal_Bool bForceFillStyle = sal_True;
+ sal_Bool bForceNoFillStyle = sal_False;
+ if ( ((SdrObjCustomShape*)pObj)->UseNoFillStyle() )
+ {
+ bForceFillStyle = sal_False;
+ bForceNoFillStyle = sal_True;
+ }
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet( aAttr, pObj, bForceFillStyle, bForceNoFillStyle );
+ pObj->SetMergedItemSet(aAttr);
+ }
+ }
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuConstructCustomShape::MouseMove(const MouseEvent& rMEvt)
+{
+ return FuConstruct::MouseMove(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL FuConstructCustomShape::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn(sal_False);
+
+ if(mpView->IsCreateObj() && rMEvt.IsLeft())
+ {
+ SdrObject* pObj = mpView->GetCreateObj();
+ if( pObj && mpView->EndCreateObj( SDRCREATE_FORCEEND ) )
+ {
+ bReturn = sal_True;
+ }
+ }
+ bReturn = FuConstruct::MouseButtonUp (rMEvt) || bReturn;
+
+ if (!bPermanent)
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+BOOL FuConstructCustomShape::KeyInput(const KeyEvent& rKEvt)
+{
+ BOOL bReturn = FuConstruct::KeyInput(rKEvt);
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuConstructCustomShape::Activate()
+{
+ mpView->SetCurrentObj( OBJ_CUSTOMSHAPE );
+ FuConstruct::Activate();
+}
+
+/*************************************************************************
+|*
+|* Attribute fuer das zu erzeugende Objekt setzen
+|*
+\************************************************************************/
+
+void FuConstructCustomShape::SetAttributes( SdrObject* pObj )
+{
+ sal_Bool bAttributesAppliedFromGallery = sal_False;
+
+ if ( GalleryExplorer::GetSdrObjCount( GALLERY_THEME_POWERPOINT ) )
+ {
+ std::vector< rtl::OUString > aObjList;
+ if ( GalleryExplorer::FillObjListTitle( GALLERY_THEME_POWERPOINT, aObjList ) )
+ {
+ sal_uInt16 i;
+ for ( i = 0; i < aObjList.size(); i++ )
+ {
+ if ( aObjList[ i ].equalsIgnoreAsciiCase( aCustomShape ) )
+ {
+ FmFormModel aFormModel;
+ SfxItemPool& rPool = aFormModel.GetItemPool();
+ rPool.FreezeIdRanges();
+ if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) )
+ {
+ const SdrPage* pPage = aFormModel.GetPage( 0 );
+ if ( pPage )
+ {
+ const SdrObject* pSourceObj = pPage->GetObj( 0 );
+ if( pSourceObj )
+ {
+ const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
+ SfxItemSet aDest( pObj->GetModel()->GetItemPool(), // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+ // Graphic Attributes
+ SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
+ // 3d Properties
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+ // CustomShape properties
+ SDRATTR_CUSTOMSHAPE_FIRST, SDRATTR_CUSTOMSHAPE_LAST,
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+ // end
+ 0, 0);
+ aDest.Set( rSource );
+ pObj->SetMergedItemSet( aDest );
+ sal_Int32 nAngle = pSourceObj->GetRotateAngle();
+ if ( nAngle )
+ {
+ double a = nAngle * F_PI18000;
+ pObj->NbcRotate( pObj->GetSnapRect().Center(), nAngle, sin( a ), cos( a ) );
+ }
+ bAttributesAppliedFromGallery = sal_True;
+
+
+ /*
+ com::sun::star::uno::Any aAny;
+ if ( ((SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )).QueryValue( aAny ) )
+ {
+ aGeometryItem.PutValue( aAny );
+ pObj->SetMergedItem( aGeometryItem );
+ bAttributesAppliedFromGallery = sal_True;
+ }
+ */
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ if ( !bAttributesAppliedFromGallery )
+ {
+ pObj->SetMergedItem( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
+ pObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
+ pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) );
+ pObj->SetMergedItem( SdrTextAutoGrowHeightItem( sal_False ) );
+ ((SdrObjCustomShape*)pObj)->MergeDefaultAttributes( &aCustomShape );
+ }
+}
+
+// #97016#
+SdrObject* FuConstructCustomShape::CreateDefaultObject(const sal_uInt16, const Rectangle& rRectangle)
+{
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
+ 0L, mpDoc);
+
+ if( pObj )
+ {
+ Rectangle aRect( rRectangle );
+ if ( doConstructOrthogonal() )
+ ImpForceQuadratic( aRect );
+ pObj->SetLogicRect( aRect );
+ SetAttributes( pObj );
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, pObj);
+ pObj->SetMergedItemSet(aAttr);
+ }
+ return pObj;
+}
+
+// #i33136#
+bool FuConstructCustomShape::doConstructOrthogonal() const
+{
+ return SdrObjCustomShape::doConstructOrthogonal(aCustomShape);
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuconnct.cxx b/sd/source/ui/func/fuconnct.cxx
new file mode 100644
index 000000000000..edce9a5e38e4
--- /dev/null
+++ b/sd/source/ui/func/fuconnct.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+
+#include "fuconnct.hxx"
+#include <sfx2/request.hxx>
+#include <vcl/msgbox.hxx>
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+namespace sd {
+
+TYPEINIT1( FuConnectionDlg, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConnectionDlg::FuConnectionDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuConnectionDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuConnectionDlg( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuConnectionDlg::DoExecute( SfxRequest& rReq )
+{
+ SfxItemSet aNewAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aNewAttr );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ::std::auto_ptr<SfxAbstractDialog> pDlg( pFact ? pFact->CreateSfxDialog( NULL, aNewAttr, mpView, RID_SVXPAGE_CONNECTION) : 0);
+
+ if( pDlg.get() && (pDlg->Execute() == RET_OK) )
+ {
+ rReq.Done( *pDlg->GetOutputItemSet() );
+ pArgs = rReq.GetArgs();
+ }
+ }
+ if( pArgs )
+ mpView->SetAttributes( *pArgs );
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx
new file mode 100644
index 000000000000..ef7eaae17004
--- /dev/null
+++ b/sd/source/ui/func/fuconrec.cxx
@@ -0,0 +1,1024 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuconrec.hxx"
+#include <svx/svdpagv.hxx>
+
+
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
+
+#include "app.hrc"
+#include <svl/aeitem.hxx>
+#include <svx/xlnstwit.hxx>
+#include <svx/xlnedwit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnwtit.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/sdtmfitm.hxx>
+#include <svx/sxekitm.hxx>
+#include <svx/sderitm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdocirc.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/adjitem.hxx>
+#include <svx/xtable.hxx>
+
+// #88751#
+#include <svx/svdocapt.hxx>
+
+// #97016#
+#include <svx/svdomeas.hxx>
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+// #109583#
+#include <editeng/writingmodeitem.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+#include "sdresid.hxx"
+#include "View.hxx"
+#include "sdpage.hxx"
+#include "Window.hxx"
+#include "stlpool.hxx"
+#include "drawdoc.hxx"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+
+namespace sd {
+
+TYPEINIT1( FuConstructRectangle, FuConstruct );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstructRectangle::FuConstructRectangle (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuConstructRectangle::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuConstructRectangle* pFunc;
+ FunctionReference xFunc( pFunc = new FuConstructRectangle( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent(bPermanent);
+ return xFunc;
+}
+
+void FuConstructRectangle::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msDrawingObjectToolBar);
+
+ const SfxItemSet *pArgs = rReq.GetArgs ();
+
+ if (pArgs)
+ {
+ switch (nSlotId)
+ {
+ case SID_DRAW_ELLIPSE :
+ {
+ SFX_REQUEST_ARG (rReq, pCenterX, SfxUInt32Item, ID_VAL_CENTER_X, FALSE);
+ SFX_REQUEST_ARG (rReq, pCenterY, SfxUInt32Item, ID_VAL_CENTER_Y, FALSE);
+ SFX_REQUEST_ARG (rReq, pAxisX, SfxUInt32Item, ID_VAL_AXIS_X, FALSE);
+ SFX_REQUEST_ARG (rReq, pAxisY, SfxUInt32Item, ID_VAL_AXIS_Y, FALSE);
+
+ Rectangle aNewRectangle (pCenterX->GetValue () - pAxisX->GetValue () / 2,
+ pCenterY->GetValue () - pAxisY->GetValue () / 2,
+ pCenterX->GetValue () + pAxisX->GetValue () / 2,
+ pCenterY->GetValue () + pAxisY->GetValue () / 2);
+ SdrCircObj *pNewCircle = new SdrCircObj (OBJ_CIRC, aNewRectangle);
+ SdrPageView *pPV = mpView->GetSdrPageView();
+
+ mpView->InsertObjectAtView(pNewCircle, *pPV, SDRINSERT_SETDEFLAYER | SDRINSERT_SETDEFATTR);
+ }
+ break;
+
+ case SID_DRAW_RECT :
+ {
+ SFX_REQUEST_ARG (rReq, pMouseStartX, SfxUInt32Item, ID_VAL_MOUSESTART_X, FALSE);
+ SFX_REQUEST_ARG (rReq, pMouseStartY, SfxUInt32Item, ID_VAL_MOUSESTART_Y, FALSE);
+ SFX_REQUEST_ARG (rReq, pMouseEndX, SfxUInt32Item, ID_VAL_MOUSEEND_X, FALSE);
+ SFX_REQUEST_ARG (rReq, pMouseEndY, SfxUInt32Item, ID_VAL_MOUSEEND_Y, FALSE);
+
+ Rectangle aNewRectangle (pMouseStartX->GetValue (),
+ pMouseStartY->GetValue (),
+ pMouseEndX->GetValue (),
+ pMouseEndY->GetValue ());
+ SdrRectObj *pNewRect = new SdrRectObj (aNewRectangle);
+ SdrPageView *pPV = mpView->GetSdrPageView();
+
+ mpView->InsertObjectAtView(pNewRect, *pPV, SDRINSERT_SETDEFLAYER | SDRINSERT_SETDEFATTR);
+ }
+ break;
+ }
+ }
+
+ if (nSlotId == SID_TOOL_CONNECTOR ||
+ nSlotId == SID_CONNECTOR_ARROW_START ||
+ nSlotId == SID_CONNECTOR_ARROW_END ||
+ nSlotId == SID_CONNECTOR_ARROWS ||
+ nSlotId == SID_CONNECTOR_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_CIRCLES ||
+ nSlotId == SID_CONNECTOR_LINE ||
+ nSlotId == SID_CONNECTOR_LINE_ARROW_START ||
+ nSlotId == SID_CONNECTOR_LINE_ARROW_END ||
+ nSlotId == SID_CONNECTOR_LINE_ARROWS ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLES ||
+ nSlotId == SID_CONNECTOR_CURVE ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROW_START ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROW_END ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROWS ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLES ||
+ nSlotId == SID_CONNECTOR_LINES ||
+ nSlotId == SID_CONNECTOR_LINES_ARROW_START ||
+ nSlotId == SID_CONNECTOR_LINES_ARROW_END ||
+ nSlotId == SID_CONNECTOR_LINES_ARROWS ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLES ||
+ nSlotId == SID_LINE_ARROW_START ||
+ nSlotId == SID_LINE_ARROW_END ||
+ nSlotId == SID_LINE_ARROWS ||
+ nSlotId == SID_LINE_ARROW_CIRCLE ||
+ nSlotId == SID_LINE_CIRCLE_ARROW ||
+ nSlotId == SID_LINE_ARROW_SQUARE ||
+ nSlotId == SID_LINE_SQUARE_ARROW )
+ {
+ mpView->UnmarkAll();
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL FuConstructRectangle::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FuConstruct::MouseButtonDown(rMEvt);
+
+ if ( rMEvt.IsLeft() && !mpView->IsAction() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ mpWindow->CaptureMouse();
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ if (mpView->GetCurrentObjIdentifier() == OBJ_CAPTION)
+ {
+ Size aCaptionSize(846, 846); // (4x2)cm
+ bReturn = mpView->BegCreateCaptionObj(aPnt, aCaptionSize,
+ (OutputDevice*) NULL, nDrgLog);
+ }
+ else
+ {
+ mpView->BegCreateObj(aPnt, (OutputDevice*) NULL, nDrgLog);
+ }
+
+ SdrObject* pObj = mpView->GetCreateObj();
+
+ if (pObj)
+ {
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, pObj);
+ SetAttributes(aAttr, pObj);
+ SetLineEnds(aAttr, pObj);
+ pObj->SetMergedItemSet(aAttr);
+
+ if( nSlotId == SID_DRAW_CAPTION_VERTICAL )
+ ( (SdrTextObj*) pObj)->SetVerticalWriting( TRUE );
+ }
+ }
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuConstructRectangle::MouseMove(const MouseEvent& rMEvt)
+{
+ return FuConstruct::MouseMove(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL FuConstructRectangle::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn(sal_False);
+
+ if(mpView->IsCreateObj() && rMEvt.IsLeft())
+ {
+ SdrObject* pObj = mpView->GetCreateObj();
+
+ if(pObj && mpView->EndCreateObj(SDRCREATE_FORCEEND))
+ {
+ if(SID_DRAW_MEASURELINE == nSlotId)
+ {
+ SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
+ String aStr(SdResId(STR_LAYER_MEASURELINES));
+ pObj->SetLayer(rAdmin.GetLayerID(aStr, FALSE));
+ }
+
+ // #88751# init text position when vertica caption object is created
+ if(pObj->ISA(SdrCaptionObj) && SID_DRAW_CAPTION_VERTICAL == nSlotId)
+ {
+ // draw text object, needs to be initialized when vertical text is used
+ SfxItemSet aSet(pObj->GetMergedItemSet());
+
+ aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+
+ // #109583#
+ // Correct the value of SDRATTR_TEXTDIRECTION to avoid SetItemSet
+ // calling SetVerticalWriting() again since this item may not yet
+ // be set at the object and thus may differ from verical state of
+ // the object.
+ aSet.Put(SvxWritingModeItem(com::sun::star::text::WritingMode_TB_RL, SDRATTR_TEXTDIRECTION));
+ pObj->SetMergedItemSet(aSet);
+ }
+
+ bReturn = sal_True;
+ }
+ }
+
+ bReturn = FuConstruct::MouseButtonUp (rMEvt) || bReturn;
+
+ if (!bPermanent)
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+BOOL FuConstructRectangle::KeyInput(const KeyEvent& rKEvt)
+{
+ BOOL bReturn = FuConstruct::KeyInput(rKEvt);
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuConstructRectangle::Activate()
+{
+ SdrObjKind aObjKind;
+
+ switch (nSlotId)
+ {
+ case SID_LINE_ARROW_START:
+ case SID_LINE_ARROW_END:
+ case SID_LINE_ARROWS:
+ case SID_LINE_ARROW_CIRCLE:
+ case SID_LINE_CIRCLE_ARROW:
+ case SID_LINE_ARROW_SQUARE:
+ case SID_LINE_SQUARE_ARROW:
+ mpView->SetGlueVisible();
+ // keine break !
+ case SID_DRAW_LINE :
+ case SID_DRAW_XLINE:
+ aObjKind = OBJ_LINE;
+ break;
+
+ case SID_DRAW_MEASURELINE:
+ {
+ aObjKind = OBJ_MEASURE;
+ }
+ break;
+
+ case SID_DRAW_RECT :
+ case SID_DRAW_RECT_NOFILL :
+ case SID_DRAW_RECT_ROUND :
+ case SID_DRAW_RECT_ROUND_NOFILL:
+ case SID_DRAW_SQUARE :
+ case SID_DRAW_SQUARE_NOFILL :
+ case SID_DRAW_SQUARE_ROUND :
+ case SID_DRAW_SQUARE_ROUND_NOFILL:
+ {
+ aObjKind = OBJ_RECT;
+ }
+ break;
+
+ case SID_DRAW_ELLIPSE :
+ case SID_DRAW_ELLIPSE_NOFILL:
+ case SID_DRAW_CIRCLE :
+ case SID_DRAW_CIRCLE_NOFILL :
+ {
+ aObjKind = OBJ_CIRC;
+ }
+ break;
+
+ case SID_DRAW_CAPTION:
+ case SID_DRAW_CAPTION_VERTICAL:
+ {
+ aObjKind = OBJ_CAPTION;
+ }
+ break;
+
+ case SID_TOOL_CONNECTOR:
+ case SID_CONNECTOR_ARROW_START:
+ case SID_CONNECTOR_ARROW_END:
+ case SID_CONNECTOR_ARROWS:
+ case SID_CONNECTOR_CIRCLE_START:
+ case SID_CONNECTOR_CIRCLE_END:
+ case SID_CONNECTOR_CIRCLES:
+ case SID_CONNECTOR_LINE:
+ case SID_CONNECTOR_LINE_ARROW_START:
+ case SID_CONNECTOR_LINE_ARROW_END:
+ case SID_CONNECTOR_LINE_ARROWS:
+ case SID_CONNECTOR_LINE_CIRCLE_START:
+ case SID_CONNECTOR_LINE_CIRCLE_END:
+ case SID_CONNECTOR_LINE_CIRCLES:
+ case SID_CONNECTOR_CURVE:
+ case SID_CONNECTOR_CURVE_ARROW_START:
+ case SID_CONNECTOR_CURVE_ARROW_END:
+ case SID_CONNECTOR_CURVE_ARROWS:
+ case SID_CONNECTOR_CURVE_CIRCLE_START:
+ case SID_CONNECTOR_CURVE_CIRCLE_END:
+ case SID_CONNECTOR_CURVE_CIRCLES:
+ case SID_CONNECTOR_LINES:
+ case SID_CONNECTOR_LINES_ARROW_START:
+ case SID_CONNECTOR_LINES_ARROW_END:
+ case SID_CONNECTOR_LINES_ARROWS:
+ case SID_CONNECTOR_LINES_CIRCLE_START:
+ case SID_CONNECTOR_LINES_CIRCLE_END:
+ case SID_CONNECTOR_LINES_CIRCLES:
+ {
+ aObjKind = OBJ_EDGE;
+ mpView->SetGlueVisible();
+ }
+ break;
+
+ default:
+ {
+ aObjKind = OBJ_RECT;
+ }
+ break;
+ }
+
+ mpView->SetCurrentObj((UINT16)aObjKind);
+
+ FuConstruct::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuConstructRectangle::Deactivate()
+{
+ if( nSlotId == SID_TOOL_CONNECTOR ||
+ nSlotId == SID_CONNECTOR_ARROW_START ||
+ nSlotId == SID_CONNECTOR_ARROW_END ||
+ nSlotId == SID_CONNECTOR_ARROWS ||
+ nSlotId == SID_CONNECTOR_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_CIRCLES ||
+ nSlotId == SID_CONNECTOR_LINE ||
+ nSlotId == SID_CONNECTOR_LINE_ARROW_START ||
+ nSlotId == SID_CONNECTOR_LINE_ARROW_END ||
+ nSlotId == SID_CONNECTOR_LINE_ARROWS ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLES ||
+ nSlotId == SID_CONNECTOR_CURVE ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROW_START ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROW_END ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROWS ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLES ||
+ nSlotId == SID_CONNECTOR_LINES ||
+ nSlotId == SID_CONNECTOR_LINES_ARROW_START ||
+ nSlotId == SID_CONNECTOR_LINES_ARROW_END ||
+ nSlotId == SID_CONNECTOR_LINES_ARROWS ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLES ||
+ nSlotId == SID_LINE_ARROW_START ||
+ nSlotId == SID_LINE_ARROW_END ||
+ nSlotId == SID_LINE_ARROWS ||
+ nSlotId == SID_LINE_ARROW_CIRCLE ||
+ nSlotId == SID_LINE_CIRCLE_ARROW ||
+ nSlotId == SID_LINE_ARROW_SQUARE ||
+ nSlotId == SID_LINE_SQUARE_ARROW )
+ {
+ mpView->SetGlueVisible( FALSE );
+ }
+ FuConstruct::Deactivate();
+}
+
+
+/*************************************************************************
+|*
+|* Attribute fuer das zu erzeugende Objekt setzen
+|*
+\************************************************************************/
+
+void FuConstructRectangle::SetAttributes(SfxItemSet& rAttr, SdrObject* pObj)
+{
+ if (nSlotId == SID_DRAW_RECT_ROUND ||
+ nSlotId == SID_DRAW_RECT_ROUND_NOFILL ||
+ nSlotId == SID_DRAW_SQUARE_ROUND ||
+ nSlotId == SID_DRAW_SQUARE_ROUND_NOFILL)
+ {
+ /**********************************************************************
+ * Abgerundete Ecken
+ **********************************************************************/
+ rAttr.Put(SdrEckenradiusItem(500));
+ }
+ else if (nSlotId == SID_CONNECTOR_LINE ||
+ nSlotId == SID_CONNECTOR_LINE_ARROW_START ||
+ nSlotId == SID_CONNECTOR_LINE_ARROW_END ||
+ nSlotId == SID_CONNECTOR_LINE_ARROWS ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_LINE_CIRCLES)
+ {
+ /**********************************************************************
+ * Direkt-Verbinder
+ **********************************************************************/
+ rAttr.Put(SdrEdgeKindItem(SDREDGE_ONELINE));
+ }
+ else if (nSlotId == SID_CONNECTOR_LINES ||
+ nSlotId == SID_CONNECTOR_LINES_ARROW_START ||
+ nSlotId == SID_CONNECTOR_LINES_ARROW_END ||
+ nSlotId == SID_CONNECTOR_LINES_ARROWS ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_LINES_CIRCLES)
+ {
+ /**********************************************************************
+ * Linien-Verbinder
+ **********************************************************************/
+ rAttr.Put(SdrEdgeKindItem(SDREDGE_THREELINES));
+ }
+ else if (nSlotId == SID_CONNECTOR_CURVE ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROW_START ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROW_END ||
+ nSlotId == SID_CONNECTOR_CURVE_ARROWS ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLE_START ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLE_END ||
+ nSlotId == SID_CONNECTOR_CURVE_CIRCLES)
+ {
+ /**********************************************************************
+ * Kurven-Verbinder
+ **********************************************************************/
+ rAttr.Put(SdrEdgeKindItem(SDREDGE_BEZIER));
+ }
+ else if ( nSlotId == SID_DRAW_CAPTION || nSlotId == SID_DRAW_CAPTION_VERTICAL )
+ {
+ /**********************************************************************
+ * Legendenobjekt
+ **********************************************************************/
+ Size aSize(pObj->GetLogicRect().GetSize());
+ rAttr.Put( SdrTextMinFrameHeightItem( aSize.Height() ) );
+ rAttr.Put( SdrTextMinFrameWidthItem( aSize.Width() ) );
+ rAttr.Put( SdrTextAutoGrowHeightItem( TRUE ) );
+ rAttr.Put( SdrTextAutoGrowWidthItem( TRUE ) );
+
+ // #103516# Support full with for vertical caption objects, too
+ if(SID_DRAW_CAPTION == nSlotId)
+ rAttr.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) );
+ else
+ rAttr.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_BLOCK ) );
+
+ rAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
+ rAttr.Put( SdrTextLeftDistItem( 100 ) );
+ rAttr.Put( SdrTextRightDistItem( 100 ) );
+ rAttr.Put( SdrTextUpperDistItem( 100 ) );
+ rAttr.Put( SdrTextLowerDistItem( 100 ) );
+ }
+ else if (nSlotId == SID_DRAW_MEASURELINE)
+ {
+ /**********************************************************************
+ * Masslinie
+ **********************************************************************/
+ SdPage* pPage = (SdPage*) mpView->GetSdrPageView()->GetPage();
+ String aName(SdResId(STR_POOLSHEET_MEASURE));
+ SfxStyleSheet* pSheet = (SfxStyleSheet*) pPage->GetModel()->
+ GetStyleSheetPool()->
+ Find(aName, SD_STYLE_FAMILY_GRAPHICS);
+ DBG_ASSERT(pSheet, "Objektvorlage nicht gefunden");
+
+ if (pSheet)
+ {
+ pObj->SetStyleSheet(pSheet, FALSE);
+ }
+
+ SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
+ String aStr(SdResId(STR_LAYER_MEASURELINES));
+ pObj->SetLayer(rAdmin.GetLayerID(aStr, FALSE));
+ }
+ else if (nSlotId == OBJ_CUSTOMSHAPE )
+ {
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Linienanfaenge und -enden fuer das zu erzeugende Objekt setzen
+|*
+\************************************************************************/
+
+::basegfx::B2DPolyPolygon getPolygon( sal_uInt16 nResId, SdrModel* pDoc )
+{
+ ::basegfx::B2DPolyPolygon aRetval;
+ XLineEndList* pLineEndList = pDoc->GetLineEndList();
+
+ if( pLineEndList )
+ {
+ String aArrowName( SVX_RES(nResId) );
+ long nCount = pLineEndList->Count();
+ long nIndex;
+ for( nIndex = 0L; nIndex < nCount; nIndex++ )
+ {
+ XLineEndEntry* pEntry = pLineEndList->GetLineEnd(nIndex);
+ if( pEntry->GetName() == aArrowName )
+ {
+ aRetval = pEntry->GetLineEnd();
+ break;
+ }
+ }
+ }
+
+ return aRetval;
+}
+
+void FuConstructRectangle::SetLineEnds(SfxItemSet& rAttr, SdrObject* pObj)
+{
+ if ( (pObj->GetObjIdentifier() == OBJ_EDGE &&
+ nSlotId != SID_TOOL_CONNECTOR &&
+ nSlotId != SID_CONNECTOR_LINE &&
+ nSlotId != SID_CONNECTOR_LINES &&
+ nSlotId != SID_CONNECTOR_CURVE) ||
+ nSlotId == SID_LINE_ARROW_START ||
+ nSlotId == SID_LINE_ARROW_END ||
+ nSlotId == SID_LINE_ARROWS ||
+ nSlotId == SID_LINE_ARROW_CIRCLE ||
+ nSlotId == SID_LINE_CIRCLE_ARROW ||
+ nSlotId == SID_LINE_ARROW_SQUARE ||
+ nSlotId == SID_LINE_SQUARE_ARROW )
+ {
+ /**************************************************************
+ * Linienanfaenge und -enden attributieren
+ **************************************************************/
+
+ // Pfeilspitze
+ ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, mpDoc ) );
+ if( !aArrow.count() )
+ {
+ ::basegfx::B2DPolygon aNewArrow;
+ aNewArrow.append(::basegfx::B2DPoint(10.0, 0.0));
+ aNewArrow.append(::basegfx::B2DPoint(0.0, 30.0));
+ aNewArrow.append(::basegfx::B2DPoint(20.0, 30.0));
+ aNewArrow.setClosed(true);
+ aArrow.append(aNewArrow);
+ }
+
+ // Kreis
+ ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, mpDoc ) );
+ if( !aCircle.count() )
+ {
+ ::basegfx::B2DPolygon aNewCircle;
+ aNewCircle = ::basegfx::tools::createPolygonFromEllipse(::basegfx::B2DPoint(0.0, 0.0), 250.0, 250.0);
+ aNewCircle.setClosed(true);
+ aCircle.append(aNewCircle);
+ }
+
+ // Quadrat
+ ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, mpDoc ) );
+ if( !aSquare.count() )
+ {
+ ::basegfx::B2DPolygon aNewSquare;
+ aNewSquare.append(::basegfx::B2DPoint(0.0, 0.0));
+ aNewSquare.append(::basegfx::B2DPoint(10.0, 0.0));
+ aNewSquare.append(::basegfx::B2DPoint(10.0, 10.0));
+ aNewSquare.append(::basegfx::B2DPoint(0.0, 10.0));
+ aNewSquare.setClosed(true);
+ aSquare.append(aNewSquare);
+ }
+
+ SfxItemSet aSet( mpDoc->GetPool() );
+ mpView->GetAttributes( aSet );
+
+ // #i3908# Here, the default Line Start/End width for arrow construction is
+ // set. To have the same value in all situations (construction) in i3908
+ // it was decided to change the default to 0.03 cm for all situations.
+ long nWidth = 300; // (1/100th mm)
+
+ // Linienstaerke ermitteln und daraus die Linienendenstaerke berechnen
+ if( aSet.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE )
+ {
+ long nValue = ( ( const XLineWidthItem& ) aSet.Get( XATTR_LINEWIDTH ) ).GetValue();
+ if( nValue > 0 )
+ nWidth = nValue * 3;
+ }
+
+ switch (nSlotId)
+ {
+ case SID_CONNECTOR_ARROWS:
+ case SID_CONNECTOR_LINE_ARROWS:
+ case SID_CONNECTOR_LINES_ARROWS:
+ case SID_CONNECTOR_CURVE_ARROWS:
+ case SID_LINE_ARROWS:
+ {
+ // Verbinder mit Pfeil-Enden
+ rAttr.Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW), aArrow));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ rAttr.Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_ARROW), aArrow));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
+
+ case SID_CONNECTOR_ARROW_START:
+ case SID_CONNECTOR_LINE_ARROW_START:
+ case SID_CONNECTOR_LINES_ARROW_START:
+ case SID_CONNECTOR_CURVE_ARROW_START:
+ case SID_LINE_ARROW_START:
+ case SID_LINE_ARROW_CIRCLE:
+ case SID_LINE_ARROW_SQUARE:
+ {
+ // Verbinder mit Pfeil-Anfang
+ rAttr.Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_ARROW), aArrow));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ }
+ break;
+
+ case SID_CONNECTOR_ARROW_END:
+ case SID_CONNECTOR_LINE_ARROW_END:
+ case SID_CONNECTOR_LINES_ARROW_END:
+ case SID_CONNECTOR_CURVE_ARROW_END:
+ case SID_LINE_ARROW_END:
+ case SID_LINE_CIRCLE_ARROW:
+ case SID_LINE_SQUARE_ARROW:
+ {
+ // Verbinder mit Pfeil-Ende
+ rAttr.Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_ARROW), aArrow));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
+
+ case SID_CONNECTOR_CIRCLES:
+ case SID_CONNECTOR_LINE_CIRCLES:
+ case SID_CONNECTOR_LINES_CIRCLES:
+ case SID_CONNECTOR_CURVE_CIRCLES:
+ {
+ // Verbinder mit Kreis-Enden
+ rAttr.Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ rAttr.Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
+
+ case SID_CONNECTOR_CIRCLE_START:
+ case SID_CONNECTOR_LINE_CIRCLE_START:
+ case SID_CONNECTOR_LINES_CIRCLE_START:
+ case SID_CONNECTOR_CURVE_CIRCLE_START:
+ {
+ // Verbinder mit Kreis-Anfang
+ rAttr.Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ }
+ break;
+
+ case SID_CONNECTOR_CIRCLE_END:
+ case SID_CONNECTOR_LINE_CIRCLE_END:
+ case SID_CONNECTOR_LINES_CIRCLE_END:
+ case SID_CONNECTOR_CURVE_CIRCLE_END:
+ {
+ // Verbinder mit Kreis-Ende
+ rAttr.Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
+ };
+
+ // Und nochmal fuer die noch fehlenden Enden
+ switch (nSlotId)
+ {
+ case SID_LINE_ARROW_CIRCLE:
+ {
+ // Kreis-Ende
+ rAttr.Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
+
+ case SID_LINE_CIRCLE_ARROW:
+ {
+ // Kreis-Anfang
+ rAttr.Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ }
+ break;
+
+ case SID_LINE_ARROW_SQUARE:
+ {
+ // Quadrat-Ende
+ rAttr.Put(XLineEndItem(SVX_RESSTR(RID_SVXSTR_SQUARE), aSquare));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
+
+ case SID_LINE_SQUARE_ARROW:
+ {
+ // Quadrat-Anfang
+ rAttr.Put(XLineStartItem(SVX_RESSTR(RID_SVXSTR_SQUARE), aSquare));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ }
+ break;
+ }
+ }
+}
+
+// #97016#
+SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
+{
+ DBG_ASSERT( (nID != SID_DRAW_FONTWORK) && (nID != SID_DRAW_FONTWORK_VERTICAL ), "FuConstRectangle::CreateDefaultObject can not create Fontwork shapes!" );
+
+ // case SID_DRAW_LINE:
+ // case SID_DRAW_XLINE:
+ // case SID_DRAW_MEASURELINE:
+ // case SID_LINE_ARROW_START:
+ // case SID_LINE_ARROW_END:
+ // case SID_LINE_ARROWS:
+ // case SID_LINE_ARROW_CIRCLE:
+ // case SID_LINE_CIRCLE_ARROW:
+ // case SID_LINE_ARROW_SQUARE:
+ // case SID_LINE_SQUARE_ARROW:
+ // case SID_DRAW_RECT:
+ // case SID_DRAW_RECT_NOFILL:
+ // case SID_DRAW_RECT_ROUND:
+ // case SID_DRAW_RECT_ROUND_NOFILL:
+ // case SID_DRAW_SQUARE:
+ // case SID_DRAW_SQUARE_NOFILL:
+ // case SID_DRAW_SQUARE_ROUND:
+ // case SID_DRAW_SQUARE_ROUND_NOFILL:
+ // case SID_DRAW_ELLIPSE:
+ // case SID_DRAW_ELLIPSE_NOFILL:
+ // case SID_DRAW_CIRCLE:
+ // case SID_DRAW_CIRCLE_NOFILL:
+ // case SID_DRAW_CAPTION:
+ // case SID_DRAW_CAPTION_VERTICAL:
+ // case SID_TOOL_CONNECTOR:
+ // case SID_CONNECTOR_ARROW_START:
+ // case SID_CONNECTOR_ARROW_END:
+ // case SID_CONNECTOR_ARROWS:
+ // case SID_CONNECTOR_CIRCLE_START:
+ // case SID_CONNECTOR_CIRCLE_END:
+ // case SID_CONNECTOR_CIRCLES:
+ // case SID_CONNECTOR_LINE:
+ // case SID_CONNECTOR_LINE_ARROW_START:
+ // case SID_CONNECTOR_LINE_ARROW_END:
+ // case SID_CONNECTOR_LINE_ARROWS:
+ // case SID_CONNECTOR_LINE_CIRCLE_START:
+ // case SID_CONNECTOR_LINE_CIRCLE_END:
+ // case SID_CONNECTOR_LINE_CIRCLES:
+ // case SID_CONNECTOR_CURVE:
+ // case SID_CONNECTOR_CURVE_ARROW_START:
+ // case SID_CONNECTOR_CURVE_ARROW_END:
+ // case SID_CONNECTOR_CURVE_ARROWS:
+ // case SID_CONNECTOR_CURVE_CIRCLE_START:
+ // case SID_CONNECTOR_CURVE_CIRCLE_END:
+ // case SID_CONNECTOR_CURVE_CIRCLES:
+ // case SID_CONNECTOR_LINES:
+ // case SID_CONNECTOR_LINES_ARROW_START:
+ // case SID_CONNECTOR_LINES_ARROW_END:
+ // case SID_CONNECTOR_LINES_ARROWS:
+ // case SID_CONNECTOR_LINES_CIRCLE_START:
+ // case SID_CONNECTOR_LINES_CIRCLE_END:
+ // case SID_CONNECTOR_LINES_CIRCLES:
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
+ 0L, mpDoc);
+
+ if(pObj)
+ {
+ Rectangle aRect(rRectangle);
+
+ if(SID_DRAW_SQUARE == nID ||
+ SID_DRAW_SQUARE_NOFILL == nID ||
+ SID_DRAW_SQUARE_ROUND == nID ||
+ SID_DRAW_SQUARE_ROUND_NOFILL == nID ||
+ SID_DRAW_CIRCLE == nID ||
+ SID_DRAW_CIRCLE_NOFILL == nID)
+ {
+ // force quadratic
+ ImpForceQuadratic(aRect);
+ }
+
+ Point aStart = aRect.TopLeft();
+ Point aEnd = aRect.BottomRight();
+
+ switch(nID)
+ {
+ case SID_DRAW_LINE:
+ case SID_DRAW_XLINE:
+ case SID_LINE_ARROW_START:
+ case SID_LINE_ARROW_END:
+ case SID_LINE_ARROWS:
+ case SID_LINE_ARROW_CIRCLE:
+ case SID_LINE_CIRCLE_ARROW:
+ case SID_LINE_ARROW_SQUARE:
+ case SID_LINE_SQUARE_ARROW:
+ {
+ if(pObj->ISA(SdrPathObj))
+ {
+ sal_Int32 nYMiddle((aRect.Top() + aRect.Bottom()) / 2);
+
+ ::basegfx::B2DPolygon aB2DPolygon;
+ aB2DPolygon.append(::basegfx::B2DPoint(aStart.X(), nYMiddle));
+ aB2DPolygon.append(::basegfx::B2DPoint(aEnd.X(), nYMiddle));
+ ((SdrPathObj*)pObj)->SetPathPoly(::basegfx::B2DPolyPolygon(aB2DPolygon));
+ }
+ else
+ {
+ DBG_ERROR("Object is NO line object");
+ }
+
+ break;
+ }
+
+ case SID_DRAW_MEASURELINE:
+ {
+ if(pObj->ISA(SdrMeasureObj))
+ {
+ sal_Int32 nYMiddle((aRect.Top() + aRect.Bottom()) / 2);
+ ((SdrMeasureObj*)pObj)->SetPoint(Point(aStart.X(), nYMiddle), 0);
+ ((SdrMeasureObj*)pObj)->SetPoint(Point(aEnd.X(), nYMiddle), 1);
+ }
+ else
+ {
+ DBG_ERROR("Object is NO measure object");
+ }
+
+ break;
+ }
+
+ case SID_TOOL_CONNECTOR:
+ case SID_CONNECTOR_ARROW_START:
+ case SID_CONNECTOR_ARROW_END:
+ case SID_CONNECTOR_ARROWS:
+ case SID_CONNECTOR_CIRCLE_START:
+ case SID_CONNECTOR_CIRCLE_END:
+ case SID_CONNECTOR_CIRCLES:
+ case SID_CONNECTOR_LINE:
+ case SID_CONNECTOR_LINE_ARROW_START:
+ case SID_CONNECTOR_LINE_ARROW_END:
+ case SID_CONNECTOR_LINE_ARROWS:
+ case SID_CONNECTOR_LINE_CIRCLE_START:
+ case SID_CONNECTOR_LINE_CIRCLE_END:
+ case SID_CONNECTOR_LINE_CIRCLES:
+ case SID_CONNECTOR_CURVE:
+ case SID_CONNECTOR_CURVE_ARROW_START:
+ case SID_CONNECTOR_CURVE_ARROW_END:
+ case SID_CONNECTOR_CURVE_ARROWS:
+ case SID_CONNECTOR_CURVE_CIRCLE_START:
+ case SID_CONNECTOR_CURVE_CIRCLE_END:
+ case SID_CONNECTOR_CURVE_CIRCLES:
+ case SID_CONNECTOR_LINES:
+ case SID_CONNECTOR_LINES_ARROW_START:
+ case SID_CONNECTOR_LINES_ARROW_END:
+ case SID_CONNECTOR_LINES_ARROWS:
+ case SID_CONNECTOR_LINES_CIRCLE_START:
+ case SID_CONNECTOR_LINES_CIRCLE_END:
+ case SID_CONNECTOR_LINES_CIRCLES:
+ {
+ if(pObj->ISA(SdrEdgeObj))
+ {
+ ((SdrEdgeObj*)pObj)->SetTailPoint(FALSE, aStart);
+ ((SdrEdgeObj*)pObj)->SetTailPoint(TRUE, aEnd);
+ }
+ else
+ {
+ DBG_ERROR("Object is NO connector object");
+ }
+
+ break;
+ }
+ case SID_DRAW_CAPTION:
+ case SID_DRAW_CAPTION_VERTICAL:
+ {
+ if(pObj->ISA(SdrCaptionObj))
+ {
+ sal_Bool bIsVertical(SID_DRAW_CAPTION_VERTICAL == nID);
+
+ ((SdrTextObj*)pObj)->SetVerticalWriting(bIsVertical);
+
+ if(bIsVertical)
+ {
+ SfxItemSet aSet(pObj->GetMergedItemSet());
+ aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER));
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+ pObj->SetMergedItemSet(aSet);
+ }
+
+ // For task #105815# the default text is not inserted anymore.
+ // String aText(SdResId(STR_POOLSHEET_TEXT));
+ // ((SdrCaptionObj*)pObj)->SetText(aText);
+
+ ((SdrCaptionObj*)pObj)->SetLogicRect(aRect);
+ ((SdrCaptionObj*)pObj)->SetTailPos(
+ aRect.TopLeft() - Point(aRect.GetWidth() / 2, aRect.GetHeight() / 2));
+ }
+ else
+ {
+ DBG_ERROR("Object is NO caption object");
+ }
+
+ break;
+ }
+
+ default:
+ {
+ pObj->SetLogicRect(aRect);
+
+ break;
+ }
+ }
+
+ SfxItemSet aAttr(mpDoc->GetPool());
+ SetStyleSheet(aAttr, pObj);
+ SetAttributes(aAttr, pObj);
+ SetLineEnds(aAttr, pObj);
+ pObj->SetMergedItemSet(aAttr);
+ }
+
+ return pObj;
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx
new file mode 100755
index 000000000000..c0d8235e97fb
--- /dev/null
+++ b/sd/source/ui/func/fuconstr.cxx
@@ -0,0 +1,420 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuconstr.hxx"
+
+#include <svx/svxids.hrc>
+#include <svl/aeitem.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/xdef.hxx>
+#include <svx/xfillit0.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include "app.hrc"
+#include "glob.hrc"
+#include "fudraw.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include "FrameView.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "stlpool.hxx"
+#include <svx/globl3d.hxx>
+
+namespace sd {
+
+TYPEINIT1( FuConstruct, FuDraw );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstruct::FuConstruct (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuDraw(pViewSh, pWin, pView, pDoc, rReq),
+ bSelectionChanged(FALSE)
+{
+}
+
+void FuConstruct::DoExecute( SfxRequest& rReq )
+{
+ FuDraw::DoExecute( rReq );
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL FuConstruct::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FuDraw::MouseButtonDown(rMEvt);
+
+ bMBDown = TRUE;
+ bSelectionChanged = FALSE;
+
+ if ( mpView->IsAction() )
+ {
+ // #90235# this extra triggering is an error and leads to
+ // erasing the last two points when creating a polygon.
+ // if ( rMEvt.IsRight() )
+ // mpView->BckAction();
+ return TRUE;
+ }
+
+ bFirstMouseMove = TRUE;
+ aDragTimer.Start();
+
+ aMDPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
+ USHORT nHitLog = USHORT (mpWindow->PixelToLogic(Size(HITPIX,0)).Width());
+
+ if (rMEvt.IsLeft() && mpView->IsExtendedMouseEventDispatcherEnabled())
+ {
+ mpWindow->CaptureMouse();
+
+ SdrHdl* pHdl = mpView->PickHandle(aMDPos);
+
+ if ( pHdl != NULL || mpView->IsMarkedHit(aMDPos, nHitLog) )
+ {
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
+ bReturn = TRUE;
+ }
+ else if ( mpView->AreObjectsMarked() )
+ {
+ mpView->UnmarkAll();
+ bReturn = TRUE;
+ }
+ }
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuConstruct::MouseMove(const MouseEvent& rMEvt)
+{
+ FuDraw::MouseMove(rMEvt);
+
+ if (aDragTimer.IsActive() )
+ {
+ if( bFirstMouseMove )
+ bFirstMouseMove = FALSE;
+ else
+ aDragTimer.Stop();
+ }
+
+ Point aPix(rMEvt.GetPosPixel());
+ Point aPnt( mpWindow->PixelToLogic(aPix) );
+
+ if ( mpView->IsAction() )
+ {
+ ForceScroll(aPix);
+ mpView->MovAction(aPnt);
+ }
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL FuConstruct::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = TRUE;
+
+ if (aDragTimer.IsActive() )
+ {
+ aDragTimer.Stop();
+ bIsInDragMode = FALSE;
+ }
+
+ FuDraw::MouseButtonUp(rMEvt);
+
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( mpView && mpView->IsDragObj() )
+ {
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+ BOOL bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
+
+ if (bDragWithCopy)
+ {
+ bDragWithCopy = !mpView->IsPresObjSelected(FALSE, TRUE);
+ }
+
+ mpView->SetDragWithCopy(bDragWithCopy);
+ mpView->EndDragObj( mpView->IsDragWithCopy() );
+ }
+ else if ( mpView && mpView->IsMarkObj() )
+ {
+ mpView->EndMarkObj();
+ }
+ else
+ {
+ bReturn = FALSE;
+ }
+
+ if ( mpView && !mpView->IsAction() )
+ {
+ mpWindow->ReleaseMouse();
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ if ( !mpView->AreObjectsMarked() )
+ {
+ SdrObject* pObj;
+ SdrPageView* pPV;
+ USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+
+ if (!mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV))
+ {
+ mpView->MarkObj(aPnt, nHitLog);
+ }
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ }
+ else if (rMEvt.IsLeft() && !rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() &&
+ !bSelectionChanged &&
+ Abs(aPnt.X() - aMDPos.X()) < nDrgLog &&
+ Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
+ {
+ /**************************************************************
+ * Toggle zw. Selektion und Rotation
+ **************************************************************/
+ SdrObject* pSingleObj = NULL;
+ ULONG nMarkCount = mpView->GetMarkedObjectList().GetMarkCount();
+
+ if (nMarkCount==1)
+ {
+ pSingleObj = mpView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ }
+
+ if (mpView->GetDragMode() == SDRDRAG_MOVE && mpView->IsRotateAllowed() &&
+ (mpViewShell->GetFrameView()->IsClickChangeRotation() ||
+ (pSingleObj && pSingleObj->GetObjInventor()==E3dInventor)))
+ {
+ mpView->SetDragMode(SDRDRAG_ROTATE);
+ }
+ else
+ {
+ mpView->SetDragMode(SDRDRAG_MOVE);
+ }
+ }
+ }
+
+ USHORT nClicks = rMEvt.GetClicks();
+
+ if (nClicks == 2 && rMEvt.IsLeft() && bMBDown &&
+ !rMEvt.IsMod1() && !rMEvt.IsMod2() && !rMEvt.IsShift() )
+ {
+ DoubleClick(rMEvt);
+ }
+ bMBDown = FALSE;
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+BOOL FuConstruct::KeyInput(const KeyEvent& rKEvt)
+{
+ BOOL bReturn = FALSE;
+
+ if ( !bReturn )
+ bReturn = FuDraw::KeyInput(rKEvt);
+
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuConstruct::Activate()
+{
+ mpView->SetEditMode(SDREDITMODE_CREATE);
+ FuDraw::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuConstruct::Deactivate()
+{
+ FuDraw::Deactivate();
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+}
+
+/*************************************************************************
+|*
+|* StyleSheet fuer das zu erzeugende Objekt setzen
+|*
+\************************************************************************/
+
+void FuConstruct::SetStyleSheet(SfxItemSet& rAttr, SdrObject* pObj)
+{
+ sal_Bool bUseFillStyle, bUseNoFillStyle;
+ bUseFillStyle = bUseNoFillStyle = sal_False;
+
+ if (nSlotId == SID_DRAW_RECT || // Rechteck
+ nSlotId == SID_DRAW_RECT_ROUND || // Rechteck, rund
+ nSlotId == SID_DRAW_SQUARE || // Quadrat
+ nSlotId == SID_DRAW_SQUARE_ROUND || // Quadrat, rund
+ nSlotId == SID_DRAW_ELLIPSE || // Ellipse
+ nSlotId == SID_DRAW_PIE || // Ellipsensegment
+ nSlotId == SID_DRAW_ELLIPSECUT || // Ellipsenabschnitt
+ nSlotId == SID_DRAW_CIRCLE || // Kreis
+ nSlotId == SID_DRAW_CIRCLEPIE || // Kreissegment
+ nSlotId == SID_DRAW_CIRCLECUT || // Ellipsenabschnitt
+ nSlotId == SID_DRAW_POLYGON || // Polygon
+ nSlotId == SID_DRAW_XPOLYGON || // 45ø-Polygon
+ nSlotId == SID_DRAW_FREELINE || // Freihandlinie
+ nSlotId == SID_DRAW_BEZIER_FILL) // Bezier
+ {
+ bUseFillStyle = sal_True;
+ }
+ else if
+ (nSlotId == SID_DRAW_RECT_NOFILL || // Rechteck
+ nSlotId == SID_DRAW_RECT_ROUND_NOFILL || // Rechteck, rund
+ nSlotId == SID_DRAW_SQUARE_NOFILL || // Quadrat
+ nSlotId == SID_DRAW_SQUARE_ROUND_NOFILL || // Quadrat, rund
+ nSlotId == SID_DRAW_ELLIPSE_NOFILL || // Ellipse
+ nSlotId == SID_DRAW_PIE_NOFILL || // Ellipsensegment
+ nSlotId == SID_DRAW_ELLIPSECUT_NOFILL || // Ellipsenabschnitt
+ nSlotId == SID_DRAW_CIRCLE_NOFILL || // Kreis
+ nSlotId == SID_DRAW_CIRCLEPIE_NOFILL || // Kreissegment
+ nSlotId == SID_DRAW_CIRCLECUT_NOFILL || // Ellipsenabschnitt
+ nSlotId == SID_DRAW_POLYGON_NOFILL || // Polygon
+ nSlotId == SID_DRAW_XPOLYGON_NOFILL || // 45ø-Polygon
+ nSlotId == SID_DRAW_FREELINE_NOFILL || // Freihandlinie
+ nSlotId == SID_DRAW_BEZIER_NOFILL) // Bezier
+ {
+ bUseNoFillStyle = sal_True;
+ }
+ SetStyleSheet( rAttr, pObj, bUseFillStyle, bUseNoFillStyle );
+}
+
+void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, SdrObject* pObj,
+ const sal_Bool bForceFillStyle, const sal_Bool bForceNoFillStyle )
+{
+ SdPage* pPage = (SdPage*)mpView->GetSdrPageView()->GetPage();
+ if ( pPage->IsMasterPage() && pPage->GetPageKind() == PK_STANDARD &&
+ mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
+ {
+ /**********************************************
+ * Objects was created on the slide master page
+ ***********************************************/
+ String aName( pPage->GetLayoutName() );
+ String aSep = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ) );
+ USHORT n = aName.Search(aSep);
+ n = n + aSep.Len();
+ aName.Erase(n);
+ aName.Append( String ( SdResId( STR_LAYOUT_BACKGROUNDOBJECTS ) ) );
+ SfxStyleSheet* pSheet = (SfxStyleSheet*)pPage->GetModel()->
+ GetStyleSheetPool()->
+ Find(aName, SD_STYLE_FAMILY_MASTERPAGE);
+ DBG_ASSERT(pSheet, "Objektvorlage nicht gefunden");
+ if (pSheet)
+ {
+ // applying style sheet for background objects
+ pObj->SetStyleSheet(pSheet, FALSE);
+ SfxItemSet& rSet = pSheet->GetItemSet();
+ const XFillStyleItem& rFillStyle = (const XFillStyleItem&)rSet.Get(XATTR_FILLSTYLE);
+ if ( bForceFillStyle )
+ {
+ if (rFillStyle.GetValue() == XFILL_NONE)
+ rAttr.Put(XFillStyleItem(XFILL_SOLID));
+ }
+ else if ( bForceNoFillStyle )
+ {
+ if (rFillStyle.GetValue() != XFILL_NONE)
+ rAttr.Put(XFillStyleItem(XFILL_NONE));
+ }
+ }
+ }
+ else
+ {
+ /***********************************
+ * object was created on normal page
+ ************************************/
+ if ( bForceNoFillStyle )
+ {
+ String aName(SdResId(STR_POOLSHEET_OBJWITHOUTFILL));
+ SfxStyleSheet* pSheet = (SfxStyleSheet*)pPage->GetModel()->
+ GetStyleSheetPool()->
+ Find(aName, SD_STYLE_FAMILY_GRAPHICS);
+ DBG_ASSERT(pSheet, "Objektvorlage nicht gefunden");
+ if (pSheet)
+ {
+ pObj->SetStyleSheet(pSheet, FALSE);
+ SfxItemSet aAttr(*mpView->GetDefaultAttr().Clone());
+ aAttr.Put(pSheet->GetItemSet().Get(XATTR_FILLSTYLE));
+ pObj->SetMergedItemSet(aAttr);
+ }
+ else
+ {
+ SfxItemSet aAttr(*mpView->GetDefaultAttr().Clone());
+ rAttr.Put(XFillStyleItem(XFILL_NONE));
+ pObj->SetMergedItemSet(aAttr);
+ }
+ }
+ }
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuconuno.cxx b/sd/source/ui/func/fuconuno.cxx
new file mode 100644
index 000000000000..fffcaf3c0b9f
--- /dev/null
+++ b/sd/source/ui/func/fuconuno.cxx
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuconuno.hxx"
+#include <svl/aeitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/request.hxx>
+#include <svl/intitem.hxx>
+
+
+#include <svx/fmglob.hxx>
+
+#include <svx/dialogs.hrc>
+
+class SbModule;
+
+
+#include "app.hrc"
+#include "glob.hrc"
+#include "ViewShell.hxx"
+#include "View.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+#include "res_bmp.hrc"
+
+namespace sd {
+
+TYPEINIT1( FuConstructUnoControl, FuConstruct );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuConstructUnoControl::FuConstructUnoControl (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuConstructUnoControl::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuConstructUnoControl* pFunc;
+ FunctionReference xFunc( pFunc = new FuConstructUnoControl( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent(bPermanent);
+ return xFunc;
+}
+
+void FuConstructUnoControl::DoExecute( SfxRequest& rReq )
+{
+ FuConstruct::DoExecute( rReq );
+
+ SFX_REQUEST_ARG( rReq, pInventorItem, SfxUInt32Item, SID_FM_CONTROL_INVENTOR, FALSE );
+ SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, FALSE );
+ if( pInventorItem )
+ nInventor = pInventorItem->GetValue();
+ if( pIdentifierItem )
+ nIdentifier = pIdentifierItem->GetValue();
+
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msDrawingObjectToolBar);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+BOOL FuConstructUnoControl::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FuConstruct::MouseButtonDown(rMEvt);
+
+ if ( rMEvt.IsLeft() && !mpView->IsAction() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+ mpWindow->CaptureMouse();
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpView->BegCreateObj(aPnt, (OutputDevice*) NULL, nDrgLog);
+ bReturn = TRUE;
+ }
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+BOOL FuConstructUnoControl::MouseMove(const MouseEvent& rMEvt)
+{
+ return FuConstruct::MouseMove(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+BOOL FuConstructUnoControl::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+
+ if ( mpView->IsCreateObj() && rMEvt.IsLeft() )
+ {
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+ mpView->EndCreateObj(SDRCREATE_FORCEEND);
+ bReturn = TRUE;
+ }
+
+ bReturn = (FuConstruct::MouseButtonUp(rMEvt) || bReturn);
+
+ if (!bPermanent)
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+BOOL FuConstructUnoControl::KeyInput(const KeyEvent& rKEvt)
+{
+ BOOL bReturn = FuConstruct::KeyInput(rKEvt);
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+void FuConstructUnoControl::Activate()
+{
+ mpView->SetCurrentObj( nIdentifier, nInventor );
+
+ aNewPointer = Pointer(POINTER_DRAW_RECT);
+ aOldPointer = mpWindow->GetPointer();
+ mpWindow->SetPointer( aNewPointer );
+
+ aOldLayer = mpView->GetActiveLayer();
+ String aStr(SdResId(STR_LAYER_CONTROLS));
+ mpView->SetActiveLayer( aStr );
+
+ FuConstruct::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+void FuConstructUnoControl::Deactivate()
+{
+ FuConstruct::Deactivate();
+ mpView->SetActiveLayer( aOldLayer );
+ mpWindow->SetPointer( aOldPointer );
+}
+
+// #97016#
+SdrObject* FuConstructUnoControl::CreateDefaultObject(const sal_uInt16, const Rectangle& rRectangle)
+{
+ // case SID_FM_CREATE_CONTROL:
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
+ 0L, mpDoc);
+
+ if(pObj)
+ {
+ pObj->SetLogicRect(rRectangle);
+ }
+
+ return pObj;
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx
new file mode 100644
index 000000000000..0335ff9aa13c
--- /dev/null
+++ b/sd/source/ui/func/fucopy.cxx
@@ -0,0 +1,315 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fucopy.hxx"
+#include <sfx2/progress.hxx>
+#include <svx/svxids.hrc>
+
+#include "sdresid.hxx"
+#include "sdattr.hxx"
+#include "strings.hrc"
+#include "ViewShell.hxx"
+#include "View.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include <vcl/wrkwin.hxx>
+#include <svx/svdobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/app.hxx>
+#include <svx/xcolit.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xdef.hxx>
+#include <svx/xfillit0.hxx>
+#include <sfx2/request.hxx>
+#include "sdabstdlg.hxx"
+#include "copydlg.hrc"
+namespace sd {
+
+TYPEINIT1( FuCopy, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuCopy::FuCopy (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuCopy::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuCopy( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuCopy::DoExecute( SfxRequest& rReq )
+{
+ if( mpView->AreObjectsMarked() )
+ {
+ // Undo
+ String aString( mpView->GetDescriptionOfMarkedObjects() );
+ aString.Append( sal_Unicode(' ') );
+ aString.Append( String( SdResId( STR_UNDO_COPYOBJECTS ) ) );
+ mpView->BegUndo( aString );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SfxItemSet aSet( mpViewShell->GetPool(),
+ ATTR_COPY_START, ATTR_COPY_END, 0 );
+
+ // Farb-Attribut angeben
+ SfxItemSet aAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aAttr );
+ const SfxPoolItem* pPoolItem = NULL;
+
+ if( SFX_ITEM_SET == aAttr.GetItemState( XATTR_FILLSTYLE, TRUE, &pPoolItem ) )
+ {
+ XFillStyle eStyle = ( ( const XFillStyleItem* ) pPoolItem )->GetValue();
+
+ if( eStyle == XFILL_SOLID &&
+ SFX_ITEM_SET == aAttr.GetItemState( XATTR_FILLCOLOR, TRUE, &pPoolItem ) )
+ {
+ const XFillColorItem* pItem = ( const XFillColorItem* ) pPoolItem;
+ XColorItem aXColorItem( ATTR_COPY_START_COLOR, pItem->GetName(),
+ pItem->GetColorValue() );
+ aSet.Put( aXColorItem );
+
+ }
+ }
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ if( pFact )
+ {
+ AbstractCopyDlg* pDlg = pFact->CreateCopyDlg(NULL, aSet, mpDoc->GetColorTable(), mpView );
+ if( pDlg )
+ {
+ USHORT nResult = pDlg->Execute();
+
+ switch( nResult )
+ {
+ case RET_OK:
+ pDlg->GetAttr( aSet );
+ rReq.Done( aSet );
+ pArgs = rReq.GetArgs();
+ break;
+
+ default:
+ {
+ delete pDlg;
+ mpView->EndUndo();
+ }
+ return; // Abbruch
+ }
+ delete( pDlg );
+ }
+ }
+ }
+
+ Rectangle aRect;
+ INT32 lWidth = 0, lHeight = 0, lSizeX = 0L, lSizeY = 0L, lAngle = 0L;
+ UINT16 nNumber = 0;
+ Color aStartColor, aEndColor;
+ BOOL bColor = FALSE;
+ const SfxPoolItem* pPoolItem = NULL;
+
+ // Anzahl
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_NUMBER, TRUE, &pPoolItem ) )
+ nNumber = ( ( const SfxUInt16Item* ) pPoolItem )->GetValue();
+
+ // Verschiebung
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_MOVE_X, TRUE, &pPoolItem ) )
+ lSizeX = ( ( const SfxInt32Item* ) pPoolItem )->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_MOVE_Y, TRUE, &pPoolItem ) )
+ lSizeY = ( ( const SfxInt32Item* ) pPoolItem )->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_ANGLE, TRUE, &pPoolItem ) )
+ lAngle = ( ( const SfxInt32Item* )pPoolItem )->GetValue();
+
+ // Verrgroesserung / Verkleinerung
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_WIDTH, TRUE, &pPoolItem ) )
+ lWidth = ( ( const SfxInt32Item* ) pPoolItem )->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_HEIGHT, TRUE, &pPoolItem ) )
+ lHeight = ( ( const SfxInt32Item* ) pPoolItem )->GetValue();
+
+ // Startfarbe / Endfarbe
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_START_COLOR, TRUE, &pPoolItem ) )
+ {
+ aStartColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue();
+ bColor = TRUE;
+ }
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_COPY_END_COLOR, TRUE, &pPoolItem ) )
+ {
+ aEndColor = ( ( const XColorItem* ) pPoolItem )->GetColorValue();
+ if( aStartColor == aEndColor )
+ bColor = FALSE;
+ }
+ else
+ bColor = FALSE;
+
+ // Handles wegnehmen
+ //HMHmpView->HideMarkHdl();
+
+ SfxProgress* pProgress = NULL;
+ BOOL bWaiting = FALSE;
+
+ if( nNumber > 1 )
+ {
+ String aStr( SdResId( STR_OBJECTS ) );
+ aStr.Append( sal_Unicode(' ') );
+ aStr.Append( String( SdResId( STR_UNDO_COPYOBJECTS ) ) );
+
+ pProgress = new SfxProgress( mpDocSh, aStr, nNumber );
+ mpDocSh->SetWaitCursor( TRUE );
+ bWaiting = TRUE;
+ }
+
+ const SdrMarkList aMarkList( mpView->GetMarkedObjectList() );
+ const ULONG nMarkCount = aMarkList.GetMarkCount();
+ SdrObject* pObj = NULL;
+
+ // Anzahl moeglicher Kopien berechnen
+ aRect = mpView->GetAllMarkedRect();
+
+ if( lWidth < 0L )
+ {
+ long nTmp = ( aRect.Right() - aRect.Left() ) / -lWidth;
+ nNumber = (UINT16) Min( nTmp, (long)nNumber );
+ }
+
+ if( lHeight < 0L )
+ {
+ long nTmp = ( aRect.Bottom() - aRect.Top() ) / -lHeight;
+ nNumber = (UINT16) Min( nTmp, (long)nNumber );
+ }
+
+ for( USHORT i = 1; i <= nNumber; i++ )
+ {
+ if( pProgress )
+ pProgress->SetState( i );
+
+ aRect = mpView->GetAllMarkedRect();
+
+ if( ( 1 == i ) && bColor )
+ {
+ SfxItemSet aNewSet( mpViewShell->GetPool(), XATTR_FILLSTYLE, XATTR_FILLCOLOR, 0L );
+ aNewSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aNewSet.Put( XFillColorItem( String(), aStartColor ) );
+ mpView->SetAttributes( aNewSet );
+ }
+
+ // make a copy of selected objects
+ mpView->CopyMarked();
+
+ // get newly selected objects
+ SdrMarkList aCopyMarkList( mpView->GetMarkedObjectList() );
+ ULONG j, nCopyMarkCount = aMarkList.GetMarkCount();
+
+ // set protection flags at marked copies to null
+ for( j = 0; j < nCopyMarkCount; j++ )
+ {
+ pObj = aCopyMarkList.GetMark( j )->GetMarkedSdrObj();
+
+ if( pObj )
+ {
+ pObj->SetMoveProtect( FALSE );
+ pObj->SetResizeProtect( FALSE );
+ }
+ }
+
+ Fraction aWidth( aRect.Right() - aRect.Left() + lWidth, aRect.Right() - aRect.Left() );
+ Fraction aHeight( aRect.Bottom() - aRect.Top() + lHeight, aRect.Bottom() - aRect.Top() );
+
+ if( mpView->IsResizeAllowed() )
+ mpView->ResizeAllMarked( aRect.TopLeft(), aWidth, aHeight );
+
+ if( mpView->IsRotateAllowed() )
+ mpView->RotateAllMarked( aRect.Center(), lAngle * 100 );
+
+ if( mpView->IsMoveAllowed() )
+ mpView->MoveAllMarked( Size( lSizeX, lSizeY ) );
+
+ // set protection flags at marked copies to original values
+ if( nMarkCount == nCopyMarkCount )
+ {
+ for( j = 0; j < nMarkCount; j++ )
+ {
+ SdrObject* pSrcObj = aMarkList.GetMark( j )->GetMarkedSdrObj();
+ SdrObject* pDstObj = aCopyMarkList.GetMark( j )->GetMarkedSdrObj();
+
+ if( pSrcObj && pDstObj &&
+ ( pSrcObj->GetObjInventor() == pDstObj->GetObjInventor() ) &&
+ ( pSrcObj->GetObjIdentifier() == pDstObj->GetObjIdentifier() ) )
+ {
+ pDstObj->SetMoveProtect( pSrcObj->IsMoveProtect() );
+ pDstObj->SetResizeProtect( pSrcObj->IsResizeProtect() );
+ }
+ }
+ }
+
+ if( bColor )
+ {
+ // Koennte man sicher noch optimieren, wuerde aber u.U.
+ // zu Rundungsfehlern fuehren
+ BYTE nRed = aStartColor.GetRed() + (BYTE) ( ( (long) aEndColor.GetRed() - (long) aStartColor.GetRed() ) * (long) i / (long) nNumber );
+ BYTE nGreen = aStartColor.GetGreen() + (BYTE) ( ( (long) aEndColor.GetGreen() - (long) aStartColor.GetGreen() ) * (long) i / (long) nNumber );
+ BYTE nBlue = aStartColor.GetBlue() + (BYTE) ( ( (long) aEndColor.GetBlue() - (long) aStartColor.GetBlue() ) * (long) i / (long) nNumber );
+ Color aNewColor( nRed, nGreen, nBlue );
+ SfxItemSet aNewSet( mpViewShell->GetPool(), XATTR_FILLSTYLE, XATTR_FILLCOLOR, 0L );
+ aNewSet.Put( XFillStyleItem( XFILL_SOLID ) );
+ aNewSet.Put( XFillColorItem( String(), aNewColor ) );
+ mpView->SetAttributes( aNewSet );
+ }
+ }
+
+ if ( pProgress )
+ delete pProgress;
+
+ if ( bWaiting )
+ mpDocSh->SetWaitCursor( FALSE );
+
+ // Handles zeigen
+ mpView->AdjustMarkHdl(); //HMH TRUE );
+ //HMHpView->ShowMarkHdl();
+
+ mpView->EndUndo();
+ }
+}
+
+} // end of namespace
diff --git a/sd/source/ui/func/fucushow.cxx b/sd/source/ui/func/fucushow.cxx
new file mode 100644
index 000000000000..1ca6da60a713
--- /dev/null
+++ b/sd/source/ui/func/fucushow.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fucushow.hxx"
+
+#include <svx/svxids.hrc>
+
+#include "app.hrc"
+#include "sdresid.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include "sdabstdlg.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuCustomShowDlg, FuPoor );
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuCustomShowDlg::FuCustomShowDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
+{
+}
+
+FunctionReference FuCustomShowDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuCustomShowDlg( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuCustomShowDlg::DoExecute( SfxRequest& )
+{
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdCustomShowDlg* pDlg = pFact ? pFact->CreateSdCustomShowDlg( NULL, *mpDoc ) : 0;
+ if( pDlg )
+ {
+ USHORT nRet = pDlg->Execute();
+ if( pDlg->IsModified() )
+ {
+ mpDoc->SetChanged( TRUE );
+ sd::PresentationSettings& rSettings = mpDoc->getPresentationSettings();
+ rSettings.mbCustomShow = pDlg->IsCustomShow();
+ }
+ delete pDlg;
+
+ if( nRet == RET_YES )
+ {
+ mpViewShell->SetStartShowWithDialog();
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ }
+ }
+}
+
+} // end of namespace
diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx
new file mode 100755
index 000000000000..5cc3cc49ca88
--- /dev/null
+++ b/sd/source/ui/func/fudraw.cxx
@@ -0,0 +1,1142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <sot/object.hxx>
+#include <editeng/eeitem.hxx>
+#include <vcl/waitobj.hxx>
+
+#include <editeng/flditem.hxx>
+#include <svx/svdogrp.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/help.hxx>
+#include <svx/bmpmask.hxx>
+#include <svx/svdotext.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <svx/svdpagv.hxx>
+#include <svtools/imapobj.hxx>
+#include <svx/svxids.hrc>
+#include <svx/obj3d.hxx>
+#include <svx/polysc3d.hxx>
+#include <svx/svdpagv.hxx>
+
+#include <sfx2/viewfrm.hxx>
+
+#include "anminfo.hxx"
+#include "anmdef.hxx"
+#include "imapinfo.hxx"
+#include "app.hrc"
+#include "glob.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+
+#include "app.hxx"
+#include "GraphicDocShell.hxx"
+#include "fudraw.hxx"
+#include "ViewShell.hxx"
+#include "FrameView.hxx"
+#include "View.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "Client.hxx"
+#include "sdresid.hxx"
+#include "drawview.hxx"
+#include "fusel.hxx"
+#include <svl/aeitem.hxx>
+#include <vcl/msgbox.hxx>
+#include "slideshow.hxx"
+#include <svx/sdrhittesthelper.hxx>
+
+using namespace ::com::sun::star;
+
+namespace sd {
+
+TYPEINIT1( FuDraw, FuPoor );
+
+/*************************************************************************
+|*
+|* Base-class for all drawmodul-specific functions
+|*
+\************************************************************************/
+
+FuDraw::FuDraw(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq) :
+ FuPoor(pViewSh, pWin, pView, pDoc, rReq),
+ bMBDown(FALSE),
+ bDragHelpLine(FALSE),
+ bPermanent(FALSE)
+{
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuDraw::~FuDraw()
+{
+ mpView->BrkAction();
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL FuDraw::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ // #95491# remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ BOOL bReturn = FALSE;
+
+ bDragHelpLine = FALSE;
+
+ aMDPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
+
+ if ( rMEvt.IsLeft() )
+ {
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+
+// BOOL bOrtho = mpView->IsOrthoDesired() || pFrameView->IsOrtho();
+// bOrtho = bOrtho != rMEvt.IsShift();
+ BOOL bOrtho = FALSE;
+
+ BOOL bRestricted = TRUE;
+
+ if (mpView->IsDragObj())
+ {
+ // object is dragged (move, resize,...)
+ const SdrHdl* pHdl = mpView->GetDragStat().GetHdl();
+
+ if (!pHdl || (!pHdl->IsCornerHdl() && !pHdl->IsVertexHdl()))
+ {
+ // Move
+ bRestricted = FALSE;
+ }
+ }
+
+ // #i33136#
+ if(bRestricted && doConstructOrthogonal())
+ {
+ // Restrict movement:
+ // rectangle->quadrat, ellipse->circle etc.
+ bOrtho = !rMEvt.IsShift();
+ }
+ else
+ {
+ bOrtho = rMEvt.IsShift() != pFrameView->IsOrtho();
+ }
+
+ if (!mpView->IsSnapEnabled())
+ mpView->SetSnapEnabled(TRUE);
+ BOOL bCntrl = rMEvt.IsMod1();
+
+ BOOL bGridSnap = pFrameView->IsGridSnap();
+ bGridSnap = (bCntrl != bGridSnap);
+
+ if (mpView->IsGridSnap() != bGridSnap)
+ mpView->SetGridSnap(bGridSnap);
+
+ BOOL bBordSnap = pFrameView->IsBordSnap();
+ bBordSnap = (bCntrl != bBordSnap);
+
+ if (mpView->IsBordSnap() != bBordSnap)
+ mpView->SetBordSnap(bBordSnap);
+
+ BOOL bHlplSnap = pFrameView->IsHlplSnap();
+ bHlplSnap = (bCntrl != bHlplSnap);
+
+ if (mpView->IsHlplSnap() != bHlplSnap)
+ mpView->SetHlplSnap(bHlplSnap);
+
+ BOOL bOFrmSnap = pFrameView->IsOFrmSnap();
+ bOFrmSnap = (bCntrl != bOFrmSnap);
+
+ if (mpView->IsOFrmSnap() != bOFrmSnap)
+ mpView->SetOFrmSnap(bOFrmSnap);
+
+ BOOL bOPntSnap = pFrameView->IsOPntSnap();
+ bOPntSnap = (bCntrl != bOPntSnap);
+
+ if (mpView->IsOPntSnap() != bOPntSnap)
+ mpView->SetOPntSnap(bOPntSnap);
+
+ BOOL bOConSnap = pFrameView->IsOConSnap();
+ bOConSnap = (bCntrl != bOConSnap);
+
+ if (mpView->IsOConSnap() != bOConSnap)
+ mpView->SetOConSnap(bOConSnap);
+
+ BOOL bAngleSnap = rMEvt.IsShift() == !pFrameView->IsAngleSnapEnabled();
+
+ if (mpView->IsAngleSnapEnabled() != bAngleSnap)
+ mpView->SetAngleSnapEnabled(bAngleSnap);
+
+ if (mpView->IsOrtho() != bOrtho)
+ mpView->SetOrtho(bOrtho);
+
+ BOOL bCenter = rMEvt.IsMod2();
+
+ if ( mpView->IsCreate1stPointAsCenter() != bCenter ||
+ mpView->IsResizeAtCenter() != bCenter )
+ {
+ mpView->SetCreate1stPointAsCenter(bCenter);
+ mpView->SetResizeAtCenter(bCenter);
+ }
+
+ SdrPageView* pPV = 0;
+ USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+
+ // #76572# look only for HelpLines when they are visible (!)
+ BOOL bHelpLine(FALSE);
+ if(mpView->IsHlplVisible())
+ bHelpLine = mpView->PickHelpLine(aMDPos, nHitLog, *mpWindow, nHelpLine, pPV);
+ BOOL bHitHdl = (mpView->PickHandle(aMDPos) != NULL);
+
+ if ( bHelpLine
+ && !mpView->IsCreateObj()
+ && ((mpView->GetEditMode() == SDREDITMODE_EDIT && !bHitHdl) || (rMEvt.IsShift() && bCntrl)) )
+ {
+ mpWindow->CaptureMouse();
+ mpView->BegDragHelpLine(nHelpLine, pPV);
+ bDragHelpLine = mpView->IsDragHelpLine();
+ bReturn = TRUE;
+ }
+ }
+ ForcePointer(&rMEvt);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuDraw::MouseMove(const MouseEvent& rMEvt)
+{
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+ Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
+
+// BOOL bOrtho = mpView->IsOrthoDesired() || pFrameView->IsOrtho();
+// bOrtho = bOrtho != rMEvt.IsShift();
+ BOOL bOrtho = FALSE;
+
+ BOOL bRestricted = TRUE;
+
+ if (mpView->IsDragObj())
+ {
+ // object is dragged (move, resize, ...)
+ const SdrHdl* pHdl = mpView->GetDragStat().GetHdl();
+
+ if (!pHdl || (!pHdl->IsCornerHdl() && !pHdl->IsVertexHdl()))
+ {
+ // Move
+ bRestricted = FALSE;
+ }
+ }
+
+ if (mpView->IsAction())
+ {
+ // #i33136#
+ if(bRestricted && doConstructOrthogonal())
+ {
+ // Restrict movement:
+ // rectangle->quadrat, ellipse->circle etc.
+ bOrtho = !rMEvt.IsShift();
+ }
+ else
+ {
+ bOrtho = rMEvt.IsShift() != pFrameView->IsOrtho();
+ }
+
+ BOOL bCntrl = rMEvt.IsMod1();
+ mpView->SetDragWithCopy(rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
+
+ BOOL bGridSnap = pFrameView->IsGridSnap();
+ bGridSnap = (bCntrl != bGridSnap);
+
+ if (mpView->IsGridSnap() != bGridSnap)
+ mpView->SetGridSnap(bGridSnap);
+
+ BOOL bBordSnap = pFrameView->IsBordSnap();
+ bBordSnap = (bCntrl != bBordSnap);
+
+ if (mpView->IsBordSnap() != bBordSnap)
+ mpView->SetBordSnap(bBordSnap);
+
+ BOOL bHlplSnap = pFrameView->IsHlplSnap();
+ bHlplSnap = (bCntrl != bHlplSnap);
+
+ if (mpView->IsHlplSnap() != bHlplSnap)
+ mpView->SetHlplSnap(bHlplSnap);
+
+ BOOL bOFrmSnap = pFrameView->IsOFrmSnap();
+ bOFrmSnap = (bCntrl != bOFrmSnap);
+
+ if (mpView->IsOFrmSnap() != bOFrmSnap)
+ mpView->SetOFrmSnap(bOFrmSnap);
+
+ BOOL bOPntSnap = pFrameView->IsOPntSnap();
+ bOPntSnap = (bCntrl != bOPntSnap);
+
+ if (mpView->IsOPntSnap() != bOPntSnap)
+ mpView->SetOPntSnap(bOPntSnap);
+
+ BOOL bOConSnap = pFrameView->IsOConSnap();
+ bOConSnap = (bCntrl != bOConSnap);
+
+ if (mpView->IsOConSnap() != bOConSnap)
+ mpView->SetOConSnap(bOConSnap);
+
+ BOOL bAngleSnap = rMEvt.IsShift() == !pFrameView->IsAngleSnapEnabled();
+
+ if (mpView->IsAngleSnapEnabled() != bAngleSnap)
+ mpView->SetAngleSnapEnabled(bAngleSnap);
+
+ if (mpView->IsOrtho() != bOrtho)
+ mpView->SetOrtho(bOrtho);
+
+ BOOL bCenter = rMEvt.IsMod2();
+
+ if ( mpView->IsCreate1stPointAsCenter() != bCenter ||
+ mpView->IsResizeAtCenter() != bCenter )
+ {
+ mpView->SetCreate1stPointAsCenter(bCenter);
+ mpView->SetResizeAtCenter(bCenter);
+ }
+
+ if ( mpView->IsDragHelpLine() )
+ mpView->MovDragHelpLine(aPos);
+ }
+
+ BOOL bReturn = mpView->MouseMove(rMEvt, mpWindow);
+
+ if (mpView->IsAction())
+ {
+ // Because the flag set back if necessary in MouseMove
+ if (mpView->IsOrtho() != bOrtho)
+ mpView->SetOrtho(bOrtho);
+ }
+
+ ForcePointer(&rMEvt);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL FuDraw::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ if ( mpView->IsDragHelpLine() )
+ mpView->EndDragHelpLine();
+
+ if ( bDragHelpLine )
+ {
+ Rectangle aOutputArea(Point(0,0), mpWindow->GetOutputSizePixel());
+
+ if ( !aOutputArea.IsInside(rMEvt.GetPosPixel()) )
+ mpView->GetSdrPageView()->DeleteHelpLine(nHelpLine);
+
+ mpWindow->ReleaseMouse();
+ }
+
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+ mpView->SetOrtho( pFrameView->IsOrtho() );
+ mpView->SetAngleSnapEnabled( pFrameView->IsAngleSnapEnabled() );
+ mpView->SetSnapEnabled(TRUE);
+ mpView->SetCreate1stPointAsCenter(FALSE);
+ mpView->SetResizeAtCenter(FALSE);
+ mpView->SetDragWithCopy(pFrameView->IsDragWithCopy());
+ mpView->SetGridSnap(pFrameView->IsGridSnap());
+ mpView->SetBordSnap(pFrameView->IsBordSnap());
+ mpView->SetHlplSnap(pFrameView->IsHlplSnap());
+ mpView->SetOFrmSnap(pFrameView->IsOFrmSnap());
+ mpView->SetOPntSnap(pFrameView->IsOPntSnap());
+ mpView->SetOConSnap(pFrameView->IsOConSnap());
+
+ bIsInDragMode = FALSE;
+ ForcePointer(&rMEvt);
+ FuPoor::MouseButtonUp(rMEvt);
+
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* Process keyboard-events
+|*
+|* When processing a KeyEvent the returnvalue is TRUE, otherwise FALSE.
+|*
+\************************************************************************/
+
+BOOL FuDraw::KeyInput(const KeyEvent& rKEvt)
+{
+ BOOL bReturn = FALSE;
+
+ switch ( rKEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_ESCAPE:
+ {
+ bReturn = FuDraw::cancel();
+ }
+ break;
+
+ case KEY_DELETE:
+ case KEY_BACKSPACE:
+ {
+ if (!mpDocSh->IsReadOnly())
+ {
+ if ( mpView && mpView->IsPresObjSelected(FALSE, TRUE, FALSE, TRUE) )
+ {
+ InfoBox(mpWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
+ }
+ else
+ {
+ // Falls IP-Client aktiv, werden die Pointer
+ // auf das OLE- und das alte Graphic-Object
+ // am SdClient zurueckgesetzt, damit bei
+ // ::SelectionHasChanged nach dem Loeschen
+ // nicht mehr versucht wird, ein Grafik-Objekt
+ // zu restaurieren, das gar nicht mehr existiert.
+ // Alle anderen OLE-Objekte sind davon nicht
+ // betroffen (KA 06.10.95)
+ OSL_ASSERT (mpViewShell->GetViewShell()!=NULL);
+ Client* pIPClient = static_cast<Client*>(
+ mpViewShell->GetViewShell()->GetIPClient());
+ if (pIPClient && pIPClient->IsObjectInPlaceActive())
+ pIPClient->SetSdrGrafObj(NULL);
+
+ // wait-mousepointer while deleting object
+ WaitObject aWait( (Window*)mpViewShell->GetActiveWindow() );
+ // delete object
+ mpView->DeleteMarked();
+ }
+ }
+ bReturn = TRUE;
+ }
+ break;
+
+ case KEY_TAB:
+ {
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+ if ( !aCode.IsMod1() && !aCode.IsMod2() )
+ {
+ // #105336# Moved next line which was a bugfix itself into
+ // the scope which really does the object selection travel
+ // and thus is allowed to call SelectionHasChanged().
+
+ // Switch to FuSelect.
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_OBJECT_SELECT,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+
+ // changeover to the next object
+ if(!mpView->MarkNextObj( !aCode.IsShift() ))
+ {
+ // #97016# No next object: go over open end and
+ // get first from the other side
+ mpView->UnmarkAllObj();
+ mpView->MarkNextObj(!aCode.IsShift());
+ }
+
+ // #97016# II
+ if(mpView->AreObjectsMarked())
+ mpView->MakeVisible(mpView->GetAllMarkedRect(), *mpWindow);
+
+ bReturn = TRUE;
+ }
+ }
+ break;
+
+ case KEY_END:
+ {
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+ if ( aCode.IsMod1() )
+ {
+ // #97016# mark last object
+ mpView->UnmarkAllObj();
+ mpView->MarkNextObj(FALSE);
+
+ // #97016# II
+ if(mpView->AreObjectsMarked())
+ mpView->MakeVisible(mpView->GetAllMarkedRect(), *mpWindow);
+
+ bReturn = TRUE;
+ }
+ }
+ break;
+
+ case KEY_HOME:
+ {
+ KeyCode aCode = rKEvt.GetKeyCode();
+
+ if ( aCode.IsMod1() )
+ {
+ // #97016# mark first object
+ mpView->UnmarkAllObj();
+ mpView->MarkNextObj(TRUE);
+
+ // #97016# II
+ if(mpView->AreObjectsMarked())
+ mpView->MakeVisible(mpView->GetAllMarkedRect(), *mpWindow);
+
+ bReturn = TRUE;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (!bReturn)
+ {
+ bReturn = FuPoor::KeyInput(rKEvt);
+ }
+ else
+ {
+ mpWindow->ReleaseMouse();
+ }
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Fade out the selection-presentation before scrolling
+|*
+\************************************************************************/
+
+void FuDraw::ScrollStart()
+{
+}
+
+/*************************************************************************
+|*
+|* After scrolling show the selection-presentation again
+|*
+\************************************************************************/
+
+void FuDraw::ScrollEnd()
+{
+}
+
+/*************************************************************************
+|*
+|* Aktivate function
+|*
+\************************************************************************/
+
+void FuDraw::Activate()
+{
+ FuPoor::Activate();
+ ForcePointer();
+}
+
+/*************************************************************************
+|*
+|* Deaktivate function
+|*
+\************************************************************************/
+
+void FuDraw::Deactivate()
+{
+ FuPoor::Deactivate();
+}
+
+
+/*************************************************************************
+|*
+|* Toggle mouse-pointer
+|*
+\************************************************************************/
+
+void FuDraw::ForcePointer(const MouseEvent* pMEvt)
+{
+ Point aPnt;
+ USHORT nModifier = 0;
+ BOOL bLeftDown = FALSE;
+ BOOL bDefPointer = TRUE;
+
+ if (pMEvt)
+ {
+ aPnt = mpWindow->PixelToLogic(pMEvt->GetPosPixel());
+ nModifier = pMEvt->GetModifier();
+ bLeftDown = pMEvt->IsLeft();
+ }
+ else
+ {
+ aPnt = mpWindow->PixelToLogic(mpWindow->GetPointerPosPixel());
+ }
+
+ if (mpView->IsDragObj())
+ {
+ if (SD_MOD()->GetWaterCan() && !mpView->PickHandle(aPnt))
+ {
+ /******************************************************************
+ * Giesskannenmodus
+ ******************************************************************/
+ bDefPointer = FALSE;
+ mpWindow->SetPointer(Pointer(POINTER_FILL));
+ }
+ }
+ else
+ {
+ SdrHdl* pHdl = mpView->PickHandle(aPnt);
+
+ if (SD_MOD()->GetWaterCan() && !pHdl)
+ {
+ /******************************************************************
+ * Giesskannenmodus
+ ******************************************************************/
+ bDefPointer = FALSE;
+ mpWindow->SetPointer(Pointer(POINTER_FILL));
+ }
+ else if (!pHdl &&
+ mpViewShell->GetViewFrame()->HasChildWindow(SvxBmpMaskChildWindow::GetChildWindowId()))
+ {
+ /******************************************************************
+ * Pipettenmodus
+ ******************************************************************/
+ SvxBmpMask* pMask = (SvxBmpMask*) mpViewShell->GetViewFrame()->GetChildWindow(SvxBmpMaskChildWindow::GetChildWindowId())->GetWindow();
+
+ if (pMask && pMask->IsEyedropping())
+ {
+ bDefPointer = FALSE;
+ mpWindow->SetPointer(Pointer(POINTER_REFHAND));
+ }
+ }
+ else if (!mpView->IsAction())
+ {
+ SdrObject* pObj = NULL;
+ SdrPageView* pPV = NULL;
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = SDRHIT_NONE;
+ SdrDragMode eDragMode = mpView->GetDragMode();
+
+ if (pMEvt)
+ {
+ eHit = mpView->PickAnything(*pMEvt, SDRMOUSEMOVE, aVEvt);
+ }
+
+ if ((eDragMode == SDRDRAG_ROTATE) && (eHit == SDRHIT_MARKEDOBJECT))
+ {
+ // The goal of this request is show always the rotation-arrow for 3D-objects at rotation-modus
+ // Independent of the settings at Extras->Optionen->Grafik "Objekte immer verschieben"
+ // 2D-objects acquit in an other way. Otherwise, the rotation of 3d-objects around any axises
+ // wouldn't be possible per default.
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ SdrObject* pObject = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if ((pObject->ISA(E3dObject)) && (rMarkList.GetMarkCount() == 1))
+ {
+ mpWindow->SetPointer(Pointer(POINTER_ROTATE));
+ bDefPointer = FALSE; // Otherwise it'll be calles Joes routine and the mousepointer will reconfigurate again
+ }
+ }
+
+ if (eHit == SDRHIT_NONE)
+ {
+ // found nothing -> look after at the masterpage
+ mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER);
+ }
+ else if (eHit == SDRHIT_UNMARKEDOBJECT)
+ {
+ pObj = aVEvt.pObj;
+ }
+ else if (eHit == SDRHIT_TEXTEDITOBJ && this->ISA(FuSelection))
+ {
+ UINT16 nSdrObjKind = aVEvt.pObj->GetObjIdentifier();
+
+ if ( nSdrObjKind != OBJ_TEXT &&
+ nSdrObjKind != OBJ_TITLETEXT &&
+ nSdrObjKind != OBJ_OUTLINETEXT &&
+ aVEvt.pObj->IsEmptyPresObj() )
+ {
+ pObj = NULL;
+ bDefPointer = FALSE;
+ mpWindow->SetPointer(Pointer(POINTER_ARROW));
+ }
+ }
+
+ if (pObj && pMEvt && !pMEvt->IsMod2() && this->ISA(FuSelection))
+ {
+ // Auf Animation oder ImageMap pruefen
+ bDefPointer = !SetPointer(pObj, aPnt);
+
+ if (bDefPointer && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene)))
+ {
+ // In die Gruppe hineinschauen
+ if (mpView->PickObj(aPnt, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP))
+ bDefPointer = !SetPointer(pObj, aPnt);
+ }
+ }
+ }
+ }
+
+ if (bDefPointer)
+ {
+ mpWindow->SetPointer(mpView->GetPreferedPointer(
+ aPnt, mpWindow, nModifier, bLeftDown));
+ }
+}
+
+/*************************************************************************
+|*
+|* Set cursor for animaton or imagemap
+|*
+\************************************************************************/
+
+BOOL FuDraw::SetPointer(SdrObject* pObj, const Point& rPos)
+{
+ BOOL bSet = FALSE;
+
+ BOOL bAnimationInfo = (!mpDocSh->ISA(GraphicDocShell) &&
+ mpDoc->GetAnimationInfo(pObj)) ? TRUE:FALSE;
+
+ BOOL bImageMapInfo = FALSE;
+
+ if (!bAnimationInfo)
+ bImageMapInfo = mpDoc->GetIMapInfo(pObj) ? TRUE:FALSE;
+
+ if (bAnimationInfo || bImageMapInfo)
+ {
+ const SetOfByte* pVisiLayer = &mpView->GetSdrPageView()->GetVisibleLayers();
+ USHORT nHitLog(USHORT (mpWindow->PixelToLogic(Size(HITPIX,0)).Width()));
+ long n2HitLog(nHitLog * 2);
+ Point aHitPosR(rPos);
+ Point aHitPosL(rPos);
+ Point aHitPosT(rPos);
+ Point aHitPosB(rPos);
+
+ aHitPosR.X() += n2HitLog;
+ aHitPosL.X() -= n2HitLog;
+ aHitPosT.Y() += n2HitLog;
+ aHitPosB.Y() -= n2HitLog;
+
+ if ( !pObj->IsClosedObj() ||
+ ( SdrObjectPrimitiveHit(*pObj, aHitPosR, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pObj, aHitPosL, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pObj, aHitPosT, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pObj, aHitPosB, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false)))
+ {
+ /**********************************************************
+ * hit inside the object (without margin) or open object
+ ********************************************************/
+
+ if (bAnimationInfo)
+ {
+ /******************************************************
+ * Click-Action
+ ******************************************************/
+ SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj);
+
+ if ((mpView->ISA(DrawView) &&
+ (pInfo->meClickAction == presentation::ClickAction_BOOKMARK ||
+ pInfo->meClickAction == presentation::ClickAction_DOCUMENT ||
+ pInfo->meClickAction == presentation::ClickAction_PREVPAGE ||
+ pInfo->meClickAction == presentation::ClickAction_NEXTPAGE ||
+ pInfo->meClickAction == presentation::ClickAction_FIRSTPAGE ||
+ pInfo->meClickAction == presentation::ClickAction_LASTPAGE ||
+ pInfo->meClickAction == presentation::ClickAction_VERB ||
+ pInfo->meClickAction == presentation::ClickAction_PROGRAM ||
+ pInfo->meClickAction == presentation::ClickAction_MACRO ||
+ pInfo->meClickAction == presentation::ClickAction_SOUND))
+ ||
+ (mpView->ISA(DrawView) &&
+ SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) &&
+ (pInfo->meClickAction == presentation::ClickAction_VANISH ||
+ pInfo->meClickAction == presentation::ClickAction_INVISIBLE ||
+ pInfo->meClickAction == presentation::ClickAction_STOPPRESENTATION ||
+ (pInfo->mbActive &&
+ ( pInfo->meEffect != presentation::AnimationEffect_NONE ||
+ pInfo->meTextEffect != presentation::AnimationEffect_NONE )))))
+ {
+ // Animations-Objekt
+ bSet = TRUE;
+ mpWindow->SetPointer(Pointer(POINTER_REFHAND));
+ }
+ }
+ else if (bImageMapInfo &&
+ mpDoc->GetHitIMapObject(pObj, rPos, *mpWindow))
+ {
+ /******************************************************
+ * ImageMap
+ ******************************************************/
+ bSet = TRUE;
+ mpWindow->SetPointer(Pointer(POINTER_REFHAND));
+ }
+ }
+ }
+
+ return bSet;
+}
+
+
+
+/*************************************************************************
+|*
+|* Response of doubleclick
+|*
+\************************************************************************/
+
+void FuDraw::DoubleClick(const MouseEvent& rMEvt)
+{
+ USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+
+ if ( mpView->AreObjectsMarked() )
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ UINT32 nInv = pObj->GetObjInventor();
+ UINT16 nSdrObjKind = pObj->GetObjIdentifier();
+
+ if (nInv == SdrInventor && nSdrObjKind == OBJ_OLE2)
+ {
+ DrawDocShell* pDocSh = mpDoc->GetDocSh();
+
+ if ( !pDocSh->IsUIActive() )
+ {
+ /**********************************************************
+ * aktivate OLE-object
+ **********************************************************/
+ //HMHmpView->HideMarkHdl();
+ mpViewShell->ActivateObject( (SdrOle2Obj*) pObj, 0);
+ }
+ }
+ else if (nInv == SdrInventor && nSdrObjKind == OBJ_GRAF && pObj->IsEmptyPresObj() )
+ {
+ mpViewShell->GetViewFrame()->
+ GetDispatcher()->Execute( SID_INSERT_GRAPHIC,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ }
+ else if ( ( pObj->ISA(SdrTextObj) || pObj->ISA(SdrObjGroup) ) &&
+ !SD_MOD()->GetWaterCan() &&
+ mpViewShell->GetFrameView()->IsDoubleClickTextEdit() &&
+ !mpDocSh->IsReadOnly())
+ {
+ SfxUInt16Item aItem(SID_TEXTEDIT, 2);
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_TEXTEDIT, SFX_CALLMODE_ASYNCHRON |
+ SFX_CALLMODE_RECORD, &aItem, 0L);
+ }
+ else if (nInv == SdrInventor && nSdrObjKind == OBJ_GRUP)
+ {
+ // hit group -> select subobject
+ mpView->UnMarkAll();
+ mpView->MarkObj(aMDPos, nHitLog, rMEvt.IsShift(), TRUE);
+ }
+ }
+ }
+ else
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+}
+
+/*************************************************************************
+|*
+|* Help-event
+|*
+\************************************************************************/
+
+BOOL FuDraw::RequestHelp(const HelpEvent& rHEvt)
+{
+ BOOL bReturn = FALSE;
+
+ if (Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled())
+ {
+ SdrViewEvent aVEvt;
+
+ MouseEvent aMEvt(mpWindow->GetPointerPosPixel(), 1, 0, MOUSE_LEFT);
+
+ SdrHitKind eHit = mpView->PickAnything(aMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ SdrObject* pObj = aVEvt.pObj;
+
+ if (eHit != SDRHIT_NONE && pObj != NULL)
+ {
+ Point aPosPixel = rHEvt.GetMousePosPixel();
+
+ bReturn = SetHelpText(pObj, aPosPixel, aVEvt);
+
+ if (!bReturn && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene)))
+ {
+ // In die Gruppe hineinschauen
+ SdrPageView* pPV = NULL;
+
+ Point aPos(mpWindow->PixelToLogic(mpWindow->ScreenToOutputPixel(aPosPixel)));
+
+ if (mpView->PickObj(aPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP))
+ bReturn = SetHelpText(pObj, aPosPixel, aVEvt);
+ }
+ }
+ }
+
+ if (!bReturn)
+ {
+ bReturn = FuPoor::RequestHelp(rHEvt);
+ }
+
+ return(bReturn);
+}
+
+
+
+/*************************************************************************
+|*
+|* Command-event
+|*
+\************************************************************************/
+
+BOOL FuDraw::SetHelpText(SdrObject* pObj, const Point& rPosPixel, const SdrViewEvent& rVEvt)
+{
+ BOOL bSet = FALSE;
+ String aHelpText;
+ Point aPos(mpWindow->PixelToLogic(mpWindow->ScreenToOutputPixel(rPosPixel)));
+
+ // URL fuer IMapObject unter Pointer ist Hilfetext
+ if ( mpDoc->GetIMapInfo(pObj) )
+ {
+ IMapObject* pIMapObj = mpDoc->GetHitIMapObject(pObj, aPos, *mpWindow );
+
+ if ( pIMapObj )
+ {
+ // show name
+ aHelpText = pIMapObj->GetAltText();
+
+ if (aHelpText.Len() == 0)
+ {
+ // show url if no name is available
+ aHelpText = INetURLObject::decode( pIMapObj->GetURL(), '%', INetURLObject::DECODE_WITH_CHARSET );
+ }
+ }
+ }
+ else if (!mpDocSh->ISA(GraphicDocShell) && mpDoc->GetAnimationInfo(pObj))
+ {
+ SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj);
+
+ switch (pInfo->meClickAction)
+ {
+ case presentation::ClickAction_PREVPAGE:
+ {
+ // jump to the prior page
+ aHelpText = String(SdResId(STR_CLICK_ACTION_PREVPAGE));
+ }
+ break;
+
+ case presentation::ClickAction_NEXTPAGE:
+ {
+ // jump to the next page
+ aHelpText = String(SdResId(STR_CLICK_ACTION_NEXTPAGE));
+ }
+ break;
+
+ case presentation::ClickAction_FIRSTPAGE:
+ {
+ // jump to the first page
+ aHelpText = String(SdResId(STR_CLICK_ACTION_FIRSTPAGE));
+ }
+ break;
+
+ case presentation::ClickAction_LASTPAGE:
+ {
+ // jump to the last page
+ aHelpText = String(SdResId(STR_CLICK_ACTION_LASTPAGE));
+ }
+ break;
+
+ case presentation::ClickAction_BOOKMARK:
+ {
+ // jump to object/page
+ aHelpText = String(SdResId(STR_CLICK_ACTION_BOOKMARK));
+ aHelpText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ aHelpText.Append( String(INetURLObject::decode( pInfo->GetBookmark(), '%', INetURLObject::DECODE_WITH_CHARSET ) ));
+ }
+ break;
+
+ case presentation::ClickAction_DOCUMENT:
+ {
+ // jump to document (object/page)
+ aHelpText = String(SdResId(STR_CLICK_ACTION_DOCUMENT));
+ aHelpText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ aHelpText.Append( String(INetURLObject::decode( pInfo->GetBookmark(), '%', INetURLObject::DECODE_WITH_CHARSET ) ));
+ }
+ break;
+
+ case presentation::ClickAction_PROGRAM:
+ {
+ // execute program
+ aHelpText = String(SdResId(STR_CLICK_ACTION_PROGRAM));
+ aHelpText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+ aHelpText.Append( String(INetURLObject::decode( pInfo->GetBookmark(), '%', INetURLObject::DECODE_WITH_CHARSET ) ));
+ }
+ break;
+
+ case presentation::ClickAction_MACRO:
+ {
+ // execute program
+ aHelpText = String(SdResId(STR_CLICK_ACTION_MACRO));
+ aHelpText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
+
+ if ( SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) )
+ {
+ aHelpText.Append( pInfo->GetBookmark() );
+ }
+ else
+ {
+ String sBookmark( pInfo->GetBookmark() );
+ sal_Unicode cToken = '.';
+ aHelpText.Append( sBookmark.GetToken( 2, cToken ) );
+ aHelpText.Append( cToken );
+ aHelpText.Append( sBookmark.GetToken( 1, cToken ) );
+ aHelpText.Append( cToken );
+ aHelpText.Append( sBookmark.GetToken( 0, cToken ) );
+ }
+ }
+ break;
+
+ case presentation::ClickAction_SOUND:
+ {
+ // play-back sound
+ aHelpText = String(SdResId(STR_CLICK_ACTION_SOUND));
+ }
+ break;
+
+ case presentation::ClickAction_VERB:
+ {
+ // execute OLE-verb
+ aHelpText = String(SdResId(STR_CLICK_ACTION_VERB));
+ }
+ break;
+
+ case presentation::ClickAction_STOPPRESENTATION:
+ {
+ // quit presentation
+ aHelpText = String(SdResId(STR_CLICK_ACTION_STOPPRESENTATION));
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ else if (rVEvt.pURLField)
+ {
+ /**************************************************************
+ * URL-Field
+ **************************************************************/
+ aHelpText = INetURLObject::decode( rVEvt.pURLField->GetURL(), '%', INetURLObject::DECODE_WITH_CHARSET );
+ }
+
+ if (aHelpText.Len())
+ {
+ bSet = TRUE;
+ Rectangle aLogicPix = mpWindow->LogicToPixel(pObj->GetLogicRect());
+ Rectangle aScreenRect(mpWindow->OutputToScreenPixel(aLogicPix.TopLeft()),
+ mpWindow->OutputToScreenPixel(aLogicPix.BottomRight()));
+
+ if (Help::IsBalloonHelpEnabled())
+ Help::ShowBalloon( (Window*)mpWindow, rPosPixel, aScreenRect, aHelpText);
+ else if (Help::IsQuickHelpEnabled())
+ Help::ShowQuickHelp( (Window*)mpWindow, aScreenRect, aHelpText);
+ }
+
+ return bSet;
+}
+
+
+/** is called when the currenct function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns true if a active function was aborted
+*/
+bool FuDraw::cancel()
+{
+ bool bReturn = false;
+
+ if ( mpView->IsAction() )
+ {
+ mpView->BrkAction();
+ bReturn = true;
+ }
+ else if ( mpView->IsTextEdit() )
+ {
+ mpView->SdrEndTextEdit();
+ bReturn = true;
+
+ SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_PARASPACE_INCREASE );
+ rBindings.Invalidate( SID_PARASPACE_DECREASE );
+ }
+ else if ( mpView->AreObjectsMarked() )
+ {
+ // #97016# II
+ const SdrHdlList& rHdlList = mpView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ ((SdrHdlList&)rHdlList).ResetFocusHdl();
+ }
+ else
+ {
+ mpView->UnmarkAll();
+ }
+
+ // Switch to FuSelect.
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_OBJECT_SELECT,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+
+ bReturn = true;
+ }
+
+ return bReturn;
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fudspord.cxx b/sd/source/ui/func/fudspord.cxx
new file mode 100644
index 000000000000..2e6ad66e11f1
--- /dev/null
+++ b/sd/source/ui/func/fudspord.cxx
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+
+#include "fudspord.hxx"
+
+#include <svx/svxids.hrc>
+#include <vcl/pointr.hxx>
+
+#include "app.hrc"
+#include "fupoor.hxx"
+#include "ViewShell.hxx"
+#include "View.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "drawdoc.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuDisplayOrder, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuDisplayOrder::FuDisplayOrder( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq)
+: FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+, mpRefObj(NULL)
+, mpOverlay(0L)
+{
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuDisplayOrder::~FuDisplayOrder()
+{
+ implClearOverlay();
+}
+
+void FuDisplayOrder::implClearOverlay()
+{
+ if(mpOverlay)
+ {
+ delete mpOverlay;
+ mpOverlay = 0L;
+ }
+}
+
+FunctionReference FuDisplayOrder::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuDisplayOrder( pViewSh, pWin, pView, pDoc, rReq ) );
+ return xFunc;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL FuDisplayOrder::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ // #95491# remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuDisplayOrder::MouseMove(const MouseEvent& rMEvt)
+{
+ SdrObject* pPickObj;
+ SdrPageView* pPV;
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), pPickObj, pPV) )
+ {
+ if (mpRefObj != pPickObj)
+ {
+ // delete current overlay
+ implClearOverlay();
+
+ // create new one
+ mpOverlay = new SdrDropMarkerOverlay(*mpView, *pPickObj);
+
+ // remember referenced object
+ mpRefObj = pPickObj;
+ }
+ }
+ else
+ {
+ mpRefObj = NULL;
+ implClearOverlay();
+ }
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL FuDisplayOrder::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ // #95491# remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ SdrPageView* pPV = NULL;
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( mpView->PickObj(aPnt, mpView->getHitTolLog(), mpRefObj, pPV) )
+ {
+ if (nSlotId == SID_BEFORE_OBJ)
+ {
+ mpView->PutMarkedInFrontOfObj(mpRefObj);
+ }
+ else
+ {
+ mpView->PutMarkedBehindObj(mpRefObj);
+ }
+ }
+
+ mpViewShell->Cancel();
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuDisplayOrder::Activate()
+{
+ maPtr = mpWindow->GetPointer();
+ mpWindow->SetPointer( Pointer( POINTER_REFHAND ) );
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuDisplayOrder::Deactivate()
+{
+ mpWindow->SetPointer( maPtr );
+}
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuediglu.cxx b/sd/source/ui/func/fuediglu.cxx
new file mode 100644
index 000000000000..ddae68d8b9ab
--- /dev/null
+++ b/sd/source/ui/func/fuediglu.cxx
@@ -0,0 +1,464 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuediglu.hxx"
+#include <svl/eitem.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svdglue.hxx>
+#include <sfx2/request.hxx>
+
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "drawdoc.hxx"
+#ifndef SD_FRAMW_VIEW_HXX
+#include "FrameView.hxx"
+#endif
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "ToolBarManager.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuEditGluePoints, FuDraw );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuEditGluePoints::FuEditGluePoints (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuDraw(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuEditGluePoints::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
+{
+ FuEditGluePoints* pFunc;
+ FunctionReference xFunc( pFunc = new FuEditGluePoints( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ pFunc->SetPermanent( bPermanent );
+ return xFunc;
+}
+
+void FuEditGluePoints::DoExecute( SfxRequest& rReq )
+{
+ FuDraw::DoExecute( rReq );
+ mpView->SetInsGluePointMode(FALSE);
+ mpViewShell->GetViewShellBase().GetToolBarManager()->AddToolBar(
+ ToolBarManager::TBG_FUNCTION,
+ ToolBarManager::msGluePointsToolBar);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuEditGluePoints::~FuEditGluePoints()
+{
+ mpView->BrkAction();
+ mpView->UnmarkAllGluePoints();
+ mpView->SetInsGluePointMode(FALSE);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL FuEditGluePoints::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ mpView->SetActualWin( mpWindow );
+
+ BOOL bReturn = FuDraw::MouseButtonDown(rMEvt);
+
+ if (mpView->IsAction())
+ {
+ if (rMEvt.IsRight())
+ mpView->BckAction();
+
+ return TRUE;
+ }
+
+ if (rMEvt.IsLeft())
+ {
+ bReturn = TRUE;
+ USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpWindow->CaptureMouse();
+
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_HANDLE)
+ {
+ /******************************************************************
+ * Handle draggen
+ ******************************************************************/
+ SdrHdl* pHdl = aVEvt.pHdl;
+
+ if (mpView->IsGluePointMarked(aVEvt.pObj, aVEvt.nGlueId) && rMEvt.IsShift())
+ {
+ mpView->UnmarkGluePoint(aVEvt.pObj, aVEvt.nGlueId, aVEvt.pPV);
+ pHdl = NULL;
+ }
+
+ if (pHdl)
+ {
+ // Handle draggen
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
+ }
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && mpView->IsInsGluePointMode())
+ {
+ /******************************************************************
+ * Klebepunkt einfuegen
+ ******************************************************************/
+ mpView->BegInsGluePoint(aMDPos);
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1())
+ {
+ /******************************************************************
+ * Klebepunkt selektieren
+ ******************************************************************/
+ if (!rMEvt.IsShift())
+ mpView->UnmarkAllGluePoints();
+
+ mpView->BegMarkGluePoints(aMDPos);
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2())
+ {
+ /******************************************************************
+ * Objekt verschieben
+ ******************************************************************/
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, NULL, nDrgLog);
+ }
+ else if (eHit == SDRHIT_GLUEPOINT)
+ {
+ /******************************************************************
+ * Klebepunkt selektieren
+ ******************************************************************/
+ if (!rMEvt.IsShift())
+ mpView->UnmarkAllGluePoints();
+
+ mpView->MarkGluePoint(aVEvt.pObj, aVEvt.nGlueId, aVEvt.pPV);
+ SdrHdl* pHdl = mpView->GetGluePointHdl(aVEvt.pObj, aVEvt.nGlueId);
+
+ if (pHdl)
+ {
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
+ }
+ }
+ else
+ {
+ /******************************************************************
+ * Objekt selektieren oder draggen
+ ******************************************************************/
+ if (!rMEvt.IsShift() && !rMEvt.IsMod2() && eHit == SDRHIT_UNMARKEDOBJECT)
+ {
+ mpView->UnmarkAllObj();
+ }
+
+ BOOL bMarked = FALSE;
+
+ if (!rMEvt.IsMod1())
+ {
+ if (rMEvt.IsMod2())
+ {
+ bMarked = mpView->MarkNextObj(aMDPos, nHitLog, rMEvt.IsShift());
+ }
+ else
+ {
+ bMarked = mpView->MarkObj(aMDPos, nHitLog, rMEvt.IsShift());
+ }
+ }
+
+ if (bMarked &&
+ (!rMEvt.IsShift() || eHit == SDRHIT_MARKEDOBJECT))
+ {
+ // Objekt verschieben
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
+ }
+ else if (mpView->AreObjectsMarked())
+ {
+ /**************************************************************
+ * Klebepunkt selektieren
+ **************************************************************/
+ if (!rMEvt.IsShift())
+ mpView->UnmarkAllGluePoints();
+
+ mpView->BegMarkGluePoints(aMDPos);
+ }
+ else
+ {
+ /**************************************************************
+ * Objekt selektieren
+ **************************************************************/
+ mpView->BegMarkObj(aMDPos);
+ }
+ }
+
+ ForcePointer(&rMEvt);
+ }
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuEditGluePoints::MouseMove(const MouseEvent& rMEvt)
+{
+ mpView->SetActualWin( mpWindow );
+
+ FuDraw::MouseMove(rMEvt);
+
+ if (mpView->IsAction())
+ {
+ Point aPix(rMEvt.GetPosPixel());
+ Point aPnt( mpWindow->PixelToLogic(aPix) );
+ ForceScroll(aPix);
+ mpView->MovAction(aPnt);
+ }
+
+ ForcePointer(&rMEvt);
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL FuEditGluePoints::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ mpView->SetActualWin( mpWindow );
+
+ BOOL bReturn = FALSE;
+
+ if (mpView->IsAction())
+ {
+ bReturn = TRUE;
+ mpView->EndAction();
+ }
+
+ FuDraw::MouseButtonUp(rMEvt);
+
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
+
+ if (Abs(aMDPos.X() - aPos.X()) < nDrgLog &&
+ Abs(aMDPos.Y() - aPos.Y()) < nDrgLog &&
+ !rMEvt.IsShift() && !rMEvt.IsMod2())
+ {
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_NONE)
+ {
+ // Klick auf der Stelle: deselektieren
+ mpView->UnmarkAllObj();
+ }
+ }
+
+ mpWindow->ReleaseMouse();
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+BOOL FuEditGluePoints::KeyInput(const KeyEvent& rKEvt)
+{
+ mpView->SetActualWin( mpWindow );
+
+ BOOL bReturn = FuDraw::KeyInput(rKEvt);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* Command-event
+|*
+\************************************************************************/
+
+BOOL FuEditGluePoints::Command(const CommandEvent& rCEvt)
+{
+ mpView->SetActualWin( mpWindow );
+ return FuPoor::Command( rCEvt );
+}
+
+/*************************************************************************
+|*
+|* Funktion aktivieren
+|*
+\************************************************************************/
+
+void FuEditGluePoints::Activate()
+{
+ mpView->SetGluePointEditMode();
+ FuDraw::Activate();
+}
+
+/*************************************************************************
+|*
+|* Funktion deaktivieren
+|*
+\************************************************************************/
+
+void FuEditGluePoints::Deactivate()
+{
+ mpView->SetGluePointEditMode( FALSE );
+ FuDraw::Deactivate();
+}
+
+/*************************************************************************
+|*
+|* Request verarbeiten
+|*
+\************************************************************************/
+
+void FuEditGluePoints::ReceiveRequest(SfxRequest& rReq)
+{
+ switch (rReq.GetSlot())
+ {
+ case SID_GLUE_INSERT_POINT:
+ {
+ mpView->SetInsGluePointMode(!mpView->IsInsGluePointMode());
+ }
+ break;
+
+ case SID_GLUE_ESCDIR_LEFT:
+ {
+ mpView->SetMarkedGluePointsEscDir( SDRESC_LEFT,
+ !mpView->IsMarkedGluePointsEscDir( SDRESC_LEFT ) );
+ }
+ break;
+
+ case SID_GLUE_ESCDIR_RIGHT:
+ {
+ mpView->SetMarkedGluePointsEscDir( SDRESC_RIGHT,
+ !mpView->IsMarkedGluePointsEscDir( SDRESC_RIGHT ) );
+ }
+ break;
+
+ case SID_GLUE_ESCDIR_TOP:
+ {
+ mpView->SetMarkedGluePointsEscDir( SDRESC_TOP,
+ !mpView->IsMarkedGluePointsEscDir( SDRESC_TOP ) );
+ }
+ break;
+
+ case SID_GLUE_ESCDIR_BOTTOM:
+ {
+ mpView->SetMarkedGluePointsEscDir( SDRESC_BOTTOM,
+ !mpView->IsMarkedGluePointsEscDir( SDRESC_BOTTOM ) );
+ }
+ break;
+
+ case SID_GLUE_PERCENT:
+ {
+ const SfxItemSet* pSet = rReq.GetArgs();
+ const SfxPoolItem& rItem = pSet->Get(SID_GLUE_PERCENT);
+ BOOL bPercent = ((const SfxBoolItem&) rItem).GetValue();
+ mpView->SetMarkedGluePointsPercent(bPercent);
+ }
+ break;
+
+ case SID_GLUE_HORZALIGN_CENTER:
+ {
+ mpView->SetMarkedGluePointsAlign(FALSE, SDRHORZALIGN_CENTER);
+ }
+ break;
+
+ case SID_GLUE_HORZALIGN_LEFT:
+ {
+ mpView->SetMarkedGluePointsAlign(FALSE, SDRHORZALIGN_LEFT);
+ }
+ break;
+
+ case SID_GLUE_HORZALIGN_RIGHT:
+ {
+ mpView->SetMarkedGluePointsAlign(FALSE, SDRHORZALIGN_RIGHT);
+ }
+ break;
+
+ case SID_GLUE_VERTALIGN_CENTER:
+ {
+ mpView->SetMarkedGluePointsAlign(TRUE, SDRVERTALIGN_CENTER);
+ }
+ break;
+
+ case SID_GLUE_VERTALIGN_TOP:
+ {
+ mpView->SetMarkedGluePointsAlign(TRUE, SDRVERTALIGN_TOP);
+ }
+ break;
+
+ case SID_GLUE_VERTALIGN_BOTTOM:
+ {
+ mpView->SetMarkedGluePointsAlign(TRUE, SDRVERTALIGN_BOTTOM);
+ }
+ break;
+ }
+
+ // Zum Schluss Basisklasse rufen
+ FuPoor::ReceiveRequest(rReq);
+}
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuexpand.cxx b/sd/source/ui/func/fuexpand.cxx
new file mode 100644
index 000000000000..281e4c692228
--- /dev/null
+++ b/sd/source/ui/func/fuexpand.cxx
@@ -0,0 +1,275 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuexpand.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/svdundo.hxx>
+#include <sfx2/printer.hxx>
+#include <editeng/outlobj.hxx>
+#include <svx/svdetc.hxx>
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "pres.hxx"
+#include "View.hxx"
+#include "sdpage.hxx"
+#include "Outliner.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "ViewShell.hxx"
+#include "DrawDocShell.hxx"
+#include "sdresid.hxx"
+#include "optsitem.hxx"
+#include "sdmod.hxx"
+#include <sfx2/dispatch.hxx>
+#include <editeng/eeitem.hxx>
+
+namespace sd {
+
+TYPEINIT1( FuExpandPage, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuExpandPage::FuExpandPage (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuExpandPage::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuExpandPage( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuExpandPage::DoExecute( SfxRequest& )
+{
+ // Selektierte Seite finden (nur Standard-Seiten)
+ SdPage* pActualPage = NULL;
+ USHORT i = 0;
+ USHORT nCount = mpDoc->GetSdPageCount(PK_STANDARD);
+
+ while (!pActualPage && i < nCount)
+ {
+ if (mpDoc->GetSdPage(i, PK_STANDARD)->IsSelected())
+ {
+ pActualPage = mpDoc->GetSdPage(i, PK_STANDARD);
+ }
+
+ i++;
+ }
+
+ if (pActualPage)
+ {
+ ::sd::Outliner* pOutl =
+ new ::sd::Outliner( mpDoc, OUTLINERMODE_OUTLINEOBJECT );
+ pOutl->SetUpdateMode(FALSE);
+ pOutl->EnableUndo(FALSE);
+
+ if (mpDocSh)
+ pOutl->SetRefDevice( SD_MOD()->GetRefDevice( *mpDocSh ) );
+
+ pOutl->SetDefTab( mpDoc->GetDefaultTabulator() );
+ pOutl->SetStyleSheetPool((SfxStyleSheetPool*) mpDoc->GetStyleSheetPool());
+
+ SetOfByte aVisibleLayers = pActualPage->TRG_GetMasterPageVisibleLayers();
+ USHORT nActualPageNum = pActualPage->GetPageNum();
+ SdPage* pActualNotesPage = (SdPage*) mpDoc->GetPage(nActualPageNum + 1);
+ SdrTextObj* pActualOutline = (SdrTextObj*) pActualPage->GetPresObj(PRESOBJ_OUTLINE);
+
+ if (pActualOutline)
+ {
+ const bool bUndo = mpView->IsUndoEnabled();
+
+ if( bUndo )
+ mpView->BegUndo(String(SdResId(STR_UNDO_EXPAND_PAGE)));
+
+ // Aktuelles Gliederungsobjekt in Outliner setzen
+ OutlinerParaObject* pParaObj = pActualOutline->GetOutlinerParaObject();
+ pOutl->SetText(*pParaObj);
+
+ // Harte Absatz- und Zeichenattribute entfernen
+ SfxItemSet aEmptyEEAttr(mpDoc->GetPool(), EE_ITEMS_START, EE_ITEMS_END);
+ ULONG nParaCount1 = pOutl->GetParagraphCount();
+
+ for (USHORT nPara = 0; nPara < nParaCount1; nPara++)
+ {
+ pOutl->QuickRemoveCharAttribs(nPara);
+ pOutl->SetParaAttribs(nPara, aEmptyEEAttr);
+ }
+
+ USHORT nPos = 2;
+ Paragraph* pPara = pOutl->GetParagraph( 0 );
+
+ while (pPara)
+ {
+ ULONG nParaPos = pOutl->GetAbsPos( pPara );
+ sal_Int16 nDepth = pOutl->GetDepth( (USHORT) nParaPos );
+ if ( nDepth == 0 )
+ {
+ // Seite mit Titel & Gliederung!
+ SdPage* pPage = (SdPage*) mpDoc->AllocPage(FALSE);
+ pPage->SetSize(pActualPage->GetSize() );
+ pPage->SetBorder(pActualPage->GetLftBorder(),
+ pActualPage->GetUppBorder(),
+ pActualPage->GetRgtBorder(),
+ pActualPage->GetLwrBorder() );
+ pPage->SetName(String());
+
+ // Seite hinter aktueller Seite einfuegen
+ mpDoc->InsertPage(pPage, nActualPageNum + nPos);
+ nPos++;
+
+ if( bUndo )
+ mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewPage(*pPage));
+
+ // MasterPage der aktuellen Seite verwenden
+ pPage->TRG_SetMasterPage(pActualPage->TRG_GetMasterPage());
+ pPage->SetLayoutName(pActualPage->GetLayoutName());
+ pPage->SetAutoLayout(AUTOLAYOUT_ENUM, TRUE);
+ pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+
+ // Notiz-Seite
+ SdPage* pNotesPage = (SdPage*) mpDoc->AllocPage(FALSE);
+ pNotesPage->SetSize(pActualNotesPage->GetSize());
+ pNotesPage->SetBorder(pActualNotesPage->GetLftBorder(),
+ pActualNotesPage->GetUppBorder(),
+ pActualNotesPage->GetRgtBorder(),
+ pActualNotesPage->GetLwrBorder() );
+ pNotesPage->SetPageKind(PK_NOTES);
+ pNotesPage->SetName(String());
+
+ // Seite hinter aktueller Seite einfuegen
+ mpDoc->InsertPage(pNotesPage, nActualPageNum + nPos);
+ nPos++;
+
+ if( bUndo )
+ mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewPage(*pNotesPage));
+
+ // MasterPage der aktuellen Seite verwenden
+ pNotesPage->TRG_SetMasterPage(pActualNotesPage->TRG_GetMasterPage());
+ pNotesPage->SetLayoutName(pActualNotesPage->GetLayoutName());
+ pNotesPage->SetAutoLayout(pActualNotesPage->GetAutoLayout(), TRUE);
+ pNotesPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+
+ // Title-Textobjekt erstellen
+ SdrTextObj* pTextObj = (SdrTextObj*) pPage->GetPresObj(PRESOBJ_TITLE);
+
+//
+ OutlinerParaObject* pOutlinerParaObject = pOutl->CreateParaObject( (USHORT) nParaPos, 1);
+ pOutlinerParaObject->SetOutlinerMode(OUTLINERMODE_TITLEOBJECT);
+
+ if( pOutlinerParaObject->GetDepth(0) != -1 )
+ {
+ SdrOutliner* pTempOutl = SdrMakeOutliner( OUTLINERMODE_TITLEOBJECT, mpDoc );
+
+ pTempOutl->SetText( *pOutlinerParaObject );
+
+ delete pOutlinerParaObject;
+
+ pTempOutl->SetDepth( pTempOutl->GetParagraph( 0 ), -1 );
+
+ pOutlinerParaObject = pTempOutl->CreateParaObject();
+ delete pTempOutl;
+ }
+
+ pTextObj->SetOutlinerParaObject(pOutlinerParaObject);
+
+ pTextObj->SetEmptyPresObj(FALSE);
+
+ SfxStyleSheet* pSheet = pPage->GetStyleSheetForPresObj(PRESOBJ_TITLE);
+ pTextObj->NbcSetStyleSheet(pSheet, FALSE);
+
+ ULONG nChildCount = pOutl->GetChildCount(pPara);
+
+ if (nChildCount > 0)
+ {
+ // Gliederungs-Textobjekt erstellen
+ SdrTextObj* pOutlineObj = (SdrTextObj*) pPage->GetPresObj(PRESOBJ_OUTLINE);
+ pPara = pOutl->GetParagraph( ++nParaPos );
+
+ OutlinerParaObject* pOPO = pOutl->CreateParaObject( (USHORT) nParaPos, (USHORT) nChildCount);
+
+// --
+ SdrOutliner* pTempOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpDoc );
+ pTempOutl->SetText( *pOPO );
+
+ ULONG nParaCount2 = pTempOutl->GetParagraphCount();
+ ULONG nPara;
+ for( nPara = 0; nPara < nParaCount2; nPara++ )
+ {
+ pTempOutl->SetDepth (
+ pTempOutl->GetParagraph( nPara ),
+ pTempOutl->GetDepth((USHORT) nPara ) - 1);
+ }
+
+ delete pOPO;
+ pOPO = pTempOutl->CreateParaObject();
+ delete pTempOutl;
+
+// --
+ pOutlineObj->SetOutlinerParaObject( pOPO );
+ pOutlineObj->SetEmptyPresObj(FALSE);
+
+ // Harte Attribute entfernen (Flag auf TRUE)
+ SfxItemSet aAttr(mpDoc->GetPool());
+ aAttr.Put(XLineStyleItem(XLINE_NONE));
+ aAttr.Put(XFillStyleItem(XFILL_NONE));
+ pOutlineObj->SetMergedItemSet(aAttr);
+ }
+ }
+
+ pPara = pOutl->GetParagraph( ++nParaPos );
+ }
+
+ if( bUndo )
+ mpView->EndUndo();
+ }
+
+ delete pOutl;
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_DELETE_PAGE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
+ }
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuformatpaintbrush.cxx b/sd/source/ui/func/fuformatpaintbrush.cxx
new file mode 100644
index 000000000000..0d43ea73c964
--- /dev/null
+++ b/sd/source/ui/func/fuformatpaintbrush.cxx
@@ -0,0 +1,295 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include <sfx2/request.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <svl/itemiter.hxx>
+
+#include <svx/globl3d.hxx>
+#include <svx/svxids.hrc>
+#include <svx/svdotable.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editeng.hxx>
+
+#define _SD_DLL // fuer SD_MOD()
+#include "sdmod.hxx"
+
+#include "fuformatpaintbrush.hxx"
+#include "drawview.hxx"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "FrameView.hxx"
+#include "drawdoc.hxx"
+#include "Outliner.hxx"
+#include "ViewShellBase.hxx"
+
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+
+namespace sd {
+
+TYPEINIT1( FuFormatPaintBrush, FuText );
+
+FuFormatPaintBrush::FuFormatPaintBrush( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+: FuText(pViewSh, pWin, pView, pDoc, rReq)
+, mbPermanent( false )
+, mbOldIsQuickTextEditMode( true )
+{
+}
+
+FunctionReference FuFormatPaintBrush::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuFormatPaintBrush( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute( rReq );
+ return xFunc;
+}
+
+void FuFormatPaintBrush::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ if( pArgs && pArgs->Count() >= 1 )
+ {
+ mbPermanent = static_cast<bool>(((SfxBoolItem &)pArgs->Get(SID_FORMATPAINTBRUSH)).GetValue());
+ }
+
+ if( mpView )
+ {
+ mpView->TakeFormatPaintBrush( mpItemSet );
+ }
+}
+
+void FuFormatPaintBrush::implcancel()
+{
+ if( mpViewShell && mpViewShell->GetViewFrame() )
+ {
+ SfxViewFrame* pViewFrame = mpViewShell->GetViewFrame();
+ pViewFrame->GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
+ pViewFrame->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ }
+}
+
+static void unmarkimpl( SdrView* pView )
+{
+ pView->SdrEndTextEdit();
+ pView->UnMarkAll();
+}
+
+BOOL FuFormatPaintBrush::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ if(mpView&&mpWindow)
+ {
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if( (eHit == SDRHIT_TEXTEDIT) || (eHit == SDRHIT_TEXTEDITOBJ && ( mpViewShell->GetFrameView()->IsQuickEdit() || dynamic_cast< sdr::table::SdrTableObj* >( aVEvt.pObj ) != NULL ) ))
+ {
+ SdrObject* pPickObj=0;
+ SdrPageView* pPV=0;
+ USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ mpView->PickObj( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ),nHitLog, pPickObj, pPV, SDRSEARCH_PICKMARKABLE);
+
+ if( (pPickObj != 0) && !pPickObj->IsEmptyPresObj() )
+ {
+ // if we text hit another shape than the one currently selected, unselect the old one now
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() >= 1 )
+ {
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ if( rMarkList.GetMark(0)->GetMarkedSdrObj() != pPickObj )
+ {
+
+ // if current selected shape is not that of the hit text edit, deselect it
+ unmarkimpl( mpView );
+ }
+ }
+ else
+ {
+ // more than one shape selected, deselect all of them
+ unmarkimpl( mpView );
+ }
+ }
+ MouseEvent aMEvt( rMEvt.GetPosPixel(), rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), 0 );
+ return FuText::MouseButtonDown(aMEvt);
+ }
+
+ if( aVEvt.pObj == 0 )
+ aVEvt.pObj = pPickObj;
+ }
+
+ unmarkimpl( mpView );
+
+ if( aVEvt.pObj )
+ {
+ USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ BOOL bToggle = FALSE;
+ mpView->MarkObj(mpWindow->PixelToLogic( rMEvt.GetPosPixel() ), nHitLog, bToggle, FALSE);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+BOOL FuFormatPaintBrush::MouseMove(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+ if( mpWindow && mpView )
+ {
+ if ( mpView->IsTextEdit() )
+ {
+ bReturn = FuText::MouseMove( rMEvt );
+ mpWindow->SetPointer(Pointer(POINTER_FILL));
+ }
+ else
+ {
+ USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ SdrObject* pObj=0;
+ SdrPageView* pPV=0;
+ BOOL bOverMarkableObject = mpView->PickObj( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ),nHitLog, pObj, pPV, SDRSEARCH_PICKMARKABLE);
+
+ if(bOverMarkableObject && HasContentForThisType(pObj->GetObjInventor(),pObj->GetObjIdentifier()) )
+ mpWindow->SetPointer(Pointer(POINTER_FILL));
+ else
+ mpWindow->SetPointer(Pointer(POINTER_ARROW));
+ }
+ }
+ return bReturn;
+}
+
+BOOL FuFormatPaintBrush::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ if( mpItemSet.get() && mpView && mpView->AreObjectsMarked() )
+ {
+ bool bNoCharacterFormats = false;
+ bool bNoParagraphFormats = false;
+ {
+ if( (rMEvt.GetModifier()&KEY_MOD1) && (rMEvt.GetModifier()&KEY_SHIFT) )
+ bNoCharacterFormats = true;
+ else if( rMEvt.GetModifier() & KEY_MOD1 )
+ bNoParagraphFormats = true;
+ }
+
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+ if( pOLV )
+ pOLV->MouseButtonUp(rMEvt);
+
+ Paste( bNoCharacterFormats, bNoParagraphFormats );
+ if(mpViewShell)
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
+
+ if( mbPermanent )
+ return TRUE;
+ }
+
+ implcancel();
+ return TRUE;
+}
+
+BOOL FuFormatPaintBrush::KeyInput(const KeyEvent& rKEvt)
+{
+ if( (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE) && mpViewShell )
+ {
+ implcancel();
+ return TRUE;
+ }
+ return FuPoor::KeyInput(rKEvt);
+}
+
+void FuFormatPaintBrush::Activate()
+{
+ mbOldIsQuickTextEditMode = mpViewShell->GetFrameView()->IsQuickEdit();
+ if( !mbOldIsQuickTextEditMode )
+ {
+ mpViewShell->GetFrameView()->SetQuickEdit(TRUE);
+ mpView->SetQuickTextEditMode(TRUE);
+ }
+}
+
+void FuFormatPaintBrush::Deactivate()
+{
+ if( !mbOldIsQuickTextEditMode )
+ {
+ mpViewShell->GetFrameView()->SetQuickEdit(FALSE);
+ mpView->SetQuickTextEditMode(FALSE);
+ }
+}
+
+bool FuFormatPaintBrush::HasContentForThisType( UINT32 nObjectInventor, UINT16 nObjectIdentifier ) const
+{
+ if( mpItemSet.get() == 0 )
+ return false;
+ if( !mpView || (!mpView->SupportsFormatPaintbrush( nObjectInventor, nObjectIdentifier) ) )
+ return false;
+ return true;
+}
+
+void FuFormatPaintBrush::Paste( bool bNoCharacterFormats, bool bNoParagraphFormats )
+{
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ if(mpItemSet.get() && (rMarkList.GetMarkCount() == 1) )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ if( mpDoc->IsUndoEnabled() )
+ {
+ String sLabel( mpViewShell->GetViewShellBase().RetrieveLabelFromCommand( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatPaintbrush" ) ) ) );
+ mpDoc->BegUndo( sLabel );
+ mpDoc->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoAttrObject(*pObj,FALSE,TRUE));
+ }
+
+ mpView->ApplyFormatPaintBrush( *mpItemSet.get(), bNoCharacterFormats, bNoParagraphFormats );
+
+ if( mpDoc->IsUndoEnabled() )
+ {
+ mpDoc->EndUndo();
+ }
+ }
+}
+
+/* static */ void FuFormatPaintBrush::GetMenuState( DrawViewShell& rDrawViewShell, SfxItemSet &rSet )
+{
+ const SdrMarkList& rMarkList = rDrawViewShell.GetDrawView()->GetMarkedObjectList();
+ const ULONG nMarkCount = rMarkList.GetMarkCount();
+
+ if( nMarkCount == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if( pObj && rDrawViewShell.GetDrawView()->SupportsFormatPaintbrush(pObj->GetObjInventor(),pObj->GetObjIdentifier()) )
+ return;
+ }
+ rSet.DisableItem( SID_FORMATPAINTBRUSH );
+}
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuhhconv.cxx b/sd/source/ui/func/fuhhconv.cxx
new file mode 100644
index 000000000000..a7f96a5b50d2
--- /dev/null
+++ b/sd/source/ui/func/fuhhconv.cxx
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+#include <com/sun/star/i18n/TextConversionOption.hpp>
+
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <cppuhelper/bootstrap.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/style.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/fontitem.hxx>
+
+#include <fuhhconv.hxx>
+#include "drawdoc.hxx"
+#include "Outliner.hxx"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "Window.hxx"
+#include "ViewShellBase.hxx"
+
+#include "sdresid.hxx"
+#include "strings.hrc"
+
+class SfxRequest;
+
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+
+namespace sd {
+
+class ViewShell;
+
+TYPEINIT1( FuHangulHanjaConversion, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuHangulHanjaConversion::FuHangulHanjaConversion (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDocument,
+ SfxRequest& rReq )
+ : FuPoor(pViewSh, pWin, pView, pDocument, rReq),
+ pSdOutliner(NULL),
+ bOwnOutliner(FALSE)
+{
+ if ( mpViewShell->ISA(DrawViewShell) )
+ {
+ bOwnOutliner = TRUE;
+ pSdOutliner = new Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
+ }
+ else if ( mpViewShell->ISA(OutlineViewShell) )
+ {
+ bOwnOutliner = FALSE;
+ pSdOutliner = mpDoc->GetOutliner();
+ }
+
+ if (pSdOutliner)
+ pSdOutliner->PrepareSpelling();
+}
+
+
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuHangulHanjaConversion::~FuHangulHanjaConversion()
+{
+ if (pSdOutliner)
+ pSdOutliner->EndConversion();
+
+ if (bOwnOutliner)
+ delete pSdOutliner;
+}
+
+FunctionReference FuHangulHanjaConversion::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuHangulHanjaConversion( pViewSh, pWin, pView, pDoc, rReq ) );
+ return xFunc;
+}
+
+/*************************************************************************
+|*
+|* Suchen&Ersetzen
+|*
+\************************************************************************/
+
+void FuHangulHanjaConversion::StartConversion( INT16 nSourceLanguage, INT16 nTargetLanguage,
+ const Font *pTargetFont, INT32 nOptions, BOOL bIsInteractive )
+{
+
+ String aString( SdResId(STR_UNDO_HANGULHANJACONVERSION) );
+ mpView->BegUndo( aString );
+
+ ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current());
+ if (pBase != NULL)
+ mpViewShell = pBase->GetMainViewShell().get();
+
+ if( mpViewShell )
+ {
+ if ( pSdOutliner && mpViewShell->ISA(DrawViewShell) && !bOwnOutliner )
+ {
+ pSdOutliner->EndConversion();
+
+ bOwnOutliner = TRUE;
+ pSdOutliner = new Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
+ pSdOutliner->BeginConversion();
+ }
+ else if ( pSdOutliner && mpViewShell->ISA(OutlineViewShell) && bOwnOutliner )
+ {
+ pSdOutliner->EndConversion();
+ delete pSdOutliner;
+
+ bOwnOutliner = FALSE;
+ pSdOutliner = mpDoc->GetOutliner();
+ pSdOutliner->BeginConversion();
+ }
+
+ if (pSdOutliner)
+ pSdOutliner->StartConversion(nSourceLanguage, nTargetLanguage, pTargetFont, nOptions, bIsInteractive );
+ }
+
+ // Due to changing between edit mode, notes mode, and handout mode the
+ // view has most likely changed. Get the new one.
+ mpViewShell = pBase->GetMainViewShell().get();
+ if (mpViewShell != NULL)
+ {
+ mpView = mpViewShell->GetView();
+ mpWindow = mpViewShell->GetActiveWindow();
+ }
+ else
+ {
+ mpView = 0;
+ mpWindow = NULL;
+ }
+
+ if (mpView != NULL)
+ mpView->EndUndo();
+}
+
+
+void FuHangulHanjaConversion::ConvertStyles( INT16 nTargetLanguage, const Font *pTargetFont )
+{
+ if( !mpDoc )
+ return;
+
+ SfxStyleSheetBasePool* pStyleSheetPool = mpDoc->GetStyleSheetPool();
+ if( !pStyleSheetPool )
+ return;
+
+ SfxStyleSheetBase* pStyle = pStyleSheetPool->First();
+ while( pStyle )
+ {
+ SfxItemSet& rSet = pStyle->GetItemSet();
+
+ const bool bHasParent = pStyle->GetParent().Len() != 0;
+
+ if( !bHasParent || rSet.GetItemState( EE_CHAR_LANGUAGE_CJK, FALSE ) == SFX_ITEM_SET )
+ rSet.Put( SvxLanguageItem( nTargetLanguage, EE_CHAR_LANGUAGE_CJK ) );
+
+ if( pTargetFont &&
+ ( !bHasParent || rSet.GetItemState( EE_CHAR_FONTINFO_CJK, FALSE ) == SFX_ITEM_SET ) )
+ {
+ // set new font attribute
+ SvxFontItem aFontItem( (SvxFontItem&) rSet.Get( EE_CHAR_FONTINFO_CJK ) );
+ aFontItem.GetFamilyName() = pTargetFont->GetName();
+ aFontItem.GetFamily() = pTargetFont->GetFamily();
+ aFontItem.GetStyleName() = pTargetFont->GetStyleName();
+ aFontItem.GetPitch() = pTargetFont->GetPitch();
+ aFontItem.GetCharSet() = pTargetFont->GetCharSet();
+ rSet.Put( aFontItem );
+ }
+
+ pStyle = pStyleSheetPool->Next();
+ }
+
+ mpDoc->SetLanguage( EE_CHAR_LANGUAGE_CJK, nTargetLanguage );
+}
+
+void FuHangulHanjaConversion::StartChineseConversion()
+{
+ //open ChineseTranslationDialog
+ Reference< XComponentContext > xContext(
+ ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
+ if(xContext.is())
+ {
+ Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
+ if(xMCF.is())
+ {
+ Reference< ui::dialogs::XExecutableDialog > xDialog(
+ xMCF->createInstanceWithContext(
+ rtl::OUString::createFromAscii("com.sun.star.linguistic2.ChineseTranslationDialog")
+ , xContext), UNO_QUERY);
+ Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
+ if( xInit.is() )
+ {
+ // initialize dialog
+ Reference< awt::XWindow > xDialogParentWindow(0);
+ Sequence<Any> aSeq(1);
+ Any* pArray = aSeq.getArray();
+ PropertyValue aParam;
+ aParam.Name = rtl::OUString::createFromAscii("ParentWindow");
+ aParam.Value <<= makeAny(xDialogParentWindow);
+ pArray[0] <<= makeAny(aParam);
+ xInit->initialize( aSeq );
+
+ //execute dialog
+ sal_Int16 nDialogRet = xDialog->execute();
+ if( RET_OK == nDialogRet )
+ {
+ //get some parameters from the dialog
+ sal_Bool bToSimplified = sal_True;
+ sal_Bool bUseVariants = sal_True;
+ sal_Bool bCommonTerms = sal_True;
+ Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY );
+ if( xProp.is() )
+ {
+ try
+ {
+ xProp->getPropertyValue( C2U("IsDirectionToSimplified") ) >>= bToSimplified;
+ xProp->getPropertyValue( C2U("IsUseCharacterVariants") ) >>= bUseVariants;
+ xProp->getPropertyValue( C2U("IsTranslateCommonTerms") ) >>= bCommonTerms;
+ }
+ catch( Exception& )
+ {
+ }
+ }
+
+ //execute translation
+ sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
+ sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
+ sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
+ if( !bCommonTerms )
+ nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
+
+ Font aTargetFont = mpWindow->GetDefaultFont(
+ DEFAULTFONT_CJK_PRESENTATION,
+ nTargetLang, DEFAULTFONT_FLAGS_ONLYONE );
+
+ StartConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, sal_False );
+ ConvertStyles( nTargetLang, &aTargetFont );
+ }
+ }
+ Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
+ if( xComponent.is() )
+ xComponent->dispose();
+ }
+ }
+}
+} // end of namespace
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
new file mode 100755
index 000000000000..2db29c725718
--- /dev/null
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -0,0 +1,780 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuinsert.hxx"
+
+#include <comphelper/storagehelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <svx/svxdlg.hxx>
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+#include <tools/urlobj.hxx>
+#include <svl/urihelper.hxx>
+
+#include <svtools/sores.hxx>
+#include <svtools/insdlg.hxx>
+#include <sfx2/request.hxx>
+#include <svl/globalnameitem.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svx/pfiledlg.hxx>
+#include <svx/dialogs.hrc>
+#include <sfx2/linkmgr.hxx>
+#include <svx/svdetc.hxx>
+#include <avmedia/mediawindow.hxx>
+#ifndef _UNOTOOLS_UCBSTREAMHELPER_HXX
+#include <unotools/ucbstreamhelper.hxx>
+#endif
+#include <sfx2/printer.hxx>
+#include <sot/clsids.hxx>
+#include <svtools/sfxecode.hxx>
+#include <svtools/transfer.hxx>
+#include <svl/urlbmk.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdomedia.hxx>
+#ifndef _EDITENG_HXX //autogen
+#include <editeng/editeng.hxx>
+#endif
+#include <sot/storage.hxx>
+#include <sot/formats.hxx>
+#include <svx/svdpagv.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <sfx2/opengrf.hxx>
+
+#include <sfx2/viewfrm.hxx>
+
+#include "app.hrc"
+#include "misc.hxx"
+#include "sdresid.hxx"
+#include "View.hxx"
+#include "app.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "DrawViewShell.hxx"
+#include "DrawDocShell.hxx"
+#include "GraphicDocShell.hxx"
+#include "strings.hrc"
+#include "drawdoc.hxx"
+#include "sdgrffilter.hxx"
+#include "sdxfer.hxx"
+#include <vcl/svapp.hxx>
+#include "undo/undoobjects.hxx"
+
+using namespace com::sun::star;
+
+namespace sd {
+
+TYPEINIT1( FuInsertGraphic, FuPoor );
+TYPEINIT1( FuInsertClipboard, FuPoor );
+TYPEINIT1( FuInsertOLE, FuPoor );
+TYPEINIT1( FuInsertAVMedia, FuPoor );
+
+/*************************************************************************
+|*
+|* FuInsertGraphic::Konstruktor
+|*
+\************************************************************************/
+
+FuInsertGraphic::FuInsertGraphic (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuInsertGraphic::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuInsertGraphic( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+#ifdef _MSC_VER
+#pragma optimize ( "", off )
+#endif
+
+void FuInsertGraphic::DoExecute( SfxRequest& )
+{
+ SvxOpenGraphicDialog aDlg(SdResId(STR_INSERTGRAPHIC));
+
+ if( aDlg.Execute() == GRFILTER_OK )
+ {
+ Graphic aGraphic;
+ int nError = aDlg.GetGraphic(aGraphic);
+ if( nError == GRFILTER_OK )
+ {
+ if( mpViewShell && mpViewShell->ISA(DrawViewShell))
+ {
+ sal_Int8 nAction = DND_ACTION_COPY;
+ SdrObject* pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_GRAPHIC );
+ if( pPickObj )
+ nAction = DND_ACTION_LINK;
+
+ Point aPos;
+ Rectangle aRect(aPos, mpWindow->GetOutputSizePixel() );
+ aPos = aRect.Center();
+ aPos = mpWindow->PixelToLogic(aPos);
+ SdrGrafObj* pGrafObj = mpView->InsertGraphic(aGraphic, nAction, aPos, pPickObj, NULL);
+
+ if(pGrafObj && aDlg.IsAsLink())
+ {
+ // store link only?
+ String aFltName(aDlg.GetCurrentFilter());
+ String aPath(aDlg.GetPath());
+ pGrafObj->SetGraphicLink(aPath, aFltName);
+ }
+ }
+ }
+ else
+ {
+ SdGRFFilter::HandleGraphicFilterError( (USHORT)nError, GraphicFilter::GetGraphicFilter()->GetLastError().nStreamError );
+ }
+ }
+}
+
+#ifdef _MSC_VER
+#pragma optimize ( "", on )
+#endif
+
+/*************************************************************************
+|*
+|* FuInsertClipboard::Konstruktor
+|*
+\************************************************************************/
+
+FuInsertClipboard::FuInsertClipboard (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuInsertClipboard::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuInsertClipboard( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuInsertClipboard::DoExecute( SfxRequest& )
+{
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( mpWindow ) );
+ ULONG nFormatId;
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( mpViewShell->GetActiveWindow() );
+ if ( pDlg )
+ {
+ const String aEmptyString;
+ ::com::sun::star::datatransfer::DataFlavor aFlavor;
+
+ pDlg->Insert( SOT_FORMATSTR_ID_EMBED_SOURCE, aEmptyString );
+ pDlg->Insert( SOT_FORMATSTR_ID_LINK_SOURCE, aEmptyString );
+ pDlg->Insert( SOT_FORMATSTR_ID_DRAWING, aEmptyString );
+ pDlg->Insert( SOT_FORMATSTR_ID_SVXB, aEmptyString );
+ pDlg->Insert( FORMAT_GDIMETAFILE, aEmptyString );
+ pDlg->Insert( FORMAT_BITMAP, aEmptyString );
+ pDlg->Insert( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aEmptyString );
+ pDlg->Insert( FORMAT_STRING, aEmptyString );
+ pDlg->Insert( SOT_FORMATSTR_ID_HTML, aEmptyString );
+ pDlg->Insert( FORMAT_RTF, aEmptyString );
+ pDlg->Insert( SOT_FORMATSTR_ID_EDITENGINE, aEmptyString );
+
+ //TODO/MBA: testing
+ nFormatId = pDlg->GetFormat( aDataHelper );
+ if( nFormatId && aDataHelper.GetTransferable().is() )
+ {
+ sal_Int8 nAction = DND_ACTION_COPY;
+
+ if( !mpView->InsertData( aDataHelper,
+ mpWindow->PixelToLogic( Rectangle( Point(), mpWindow->GetOutputSizePixel() ).Center() ),
+ nAction, FALSE, nFormatId ) &&
+ ( mpViewShell && mpViewShell->ISA( DrawViewShell ) ) )
+ {
+ DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>(mpViewShell);
+ INetBookmark aINetBookmark( aEmptyStr, aEmptyStr );
+
+ if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) ||
+ ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) ||
+ ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) &&
+ aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) )
+ {
+ pDrViewSh->InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL );
+ }
+ }
+ }
+
+ delete pDlg;
+ }
+}
+
+
+/*************************************************************************
+|*
+|* FuInsertOLE::Konstruktor
+|*
+\************************************************************************/
+
+FuInsertOLE::FuInsertOLE (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuInsertOLE::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuInsertOLE( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuInsertOLE::DoExecute( SfxRequest& rReq )
+{
+ if ( nSlotId == SID_ATTR_TABLE ||
+ nSlotId == SID_INSERT_DIAGRAM ||
+ nSlotId == SID_INSERT_MATH )
+ {
+ PresObjKind ePresObjKind = (nSlotId == SID_INSERT_DIAGRAM) ? PRESOBJ_CHART : PRESOBJ_OBJECT;
+
+ SdrObject* pPickObj = mpView->GetEmptyPresentationObject( ePresObjKind );
+
+ /**********************************************************************
+ * Diagramm oder StarCalc-Tabelle einfuegen
+ **********************************************************************/
+
+ ::rtl::OUString aObjName;
+ SvGlobalName aName;
+ if (nSlotId == SID_INSERT_DIAGRAM)
+ aName = SvGlobalName( SO3_SCH_CLASSID);
+ else if (nSlotId == SID_ATTR_TABLE)
+ aName = SvGlobalName(SO3_SC_CLASSID);
+ else if (nSlotId == SID_INSERT_MATH)
+ aName = SvGlobalName(SO3_SM_CLASSID);
+
+ uno::Reference < embed::XEmbeddedObject > xObj = mpViewShell->GetViewFrame()->GetObjectShell()->
+ GetEmbeddedObjectContainer().CreateEmbeddedObject( aName.GetByteSequence(), aObjName );
+ if ( xObj.is() )
+ {
+ sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
+
+ MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
+
+ Rectangle aRect;
+ if( pPickObj )
+ {
+ aRect = pPickObj->GetLogicRect();
+
+ awt::Size aSz;
+ aSz.Width = aRect.GetWidth();
+ aSz.Height = aRect.GetHeight();
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+ else
+ {
+ awt::Size aSz;
+ try
+ {
+ aSz = xObj->getVisualAreaSize( nAspect );
+ }
+ catch ( embed::NoVisualAreaSizeException& )
+ {
+ // the default size will be set later
+ }
+
+ Size aSize( aSz.Width, aSz.Height );
+
+ if (aSize.Height() == 0 || aSize.Width() == 0)
+ {
+ // Rechteck mit ausgewogenem Kantenverhaeltnis
+ aSize.Width() = 14100;
+ aSize.Height() = 10000;
+ Size aTmp = OutputDevice::LogicToLogic( aSize, MAP_100TH_MM, aUnit );
+ aSz.Width = aTmp.Width();
+ aSz.Height = aTmp.Height();
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+ else
+ {
+ aSize = OutputDevice::LogicToLogic(aSize, aUnit, MAP_100TH_MM);
+ }
+
+ Point aPos;
+ Rectangle aWinRect(aPos, mpWindow->GetOutputSizePixel() );
+ aPos = aWinRect.Center();
+ aPos = mpWindow->PixelToLogic(aPos);
+ aPos.X() -= aSize.Width() / 2;
+ aPos.Y() -= aSize.Height() / 2;
+ aRect = Rectangle(aPos, aSize);
+ }
+
+ SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aObjName, aRect );
+ SdrPageView* pPV = mpView->GetSdrPageView();
+
+ // if we have a pick obj we need to make this new ole a pres obj replacing the current pick obj
+ if( pPickObj )
+ {
+ SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage());
+ if(pPage && pPage->IsPresObj(pPickObj))
+ {
+ pPage->InsertPresObj( pOleObj, ePresObjKind );
+ pOleObj->SetUserCall(pPickObj->GetUserCall());
+ }
+ }
+
+ bool bRet = true;
+ if( pPickObj )
+ mpView->ReplaceObjectAtView(pPickObj, *pPV, pOleObj, TRUE );
+ else
+ bRet = mpView->InsertObjectAtView(pOleObj, *pPV, SDRINSERT_SETDEFLAYER);
+
+ if( bRet )
+ {
+ if (nSlotId == SID_INSERT_DIAGRAM)
+ {
+ pOleObj->SetProgName( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarChart" ) ) );
+ }
+ else if (nSlotId == SID_ATTR_TABLE)
+ {
+ pOleObj->SetProgName( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarCalc" ) ) );
+ }
+ else if (nSlotId == SID_INSERT_MATH)
+ {
+ pOleObj->SetProgName( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "StarMath" ) ) );
+ }
+
+ //HMHmpView->HideMarkHdl();
+ pOleObj->SetLogicRect(aRect);
+ Size aTmp( OutputDevice::LogicToLogic( aRect.GetSize(), MAP_100TH_MM, aUnit ) );
+ awt::Size aVisualSize;
+ aVisualSize.Width = aTmp.Width();
+ aVisualSize.Height = aTmp.Height();
+ xObj->setVisualAreaSize( nAspect, aVisualSize );
+ mpViewShell->ActivateObject(pOleObj, SVVERB_SHOW);
+
+ if (nSlotId == SID_INSERT_DIAGRAM)
+ {
+ // note, that this call modified the chart model which
+ // results in a change notification. So call this after
+ // everything else is finished.
+ mpViewShell->AdaptDefaultsForChart( xObj );
+ }
+ }
+ }
+ else
+ {
+ ErrorHandler::HandleError(* new StringErrorInfo(ERRCODE_SFX_OLEGENERAL,
+ aEmptyStr ) );
+ }
+ }
+ else
+ {
+ /**********************************************************************
+ * Objekt einfuegen
+ **********************************************************************/
+ sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
+ BOOL bCreateNew = FALSE;
+ uno::Reference < embed::XEmbeddedObject > xObj;
+ uno::Reference < embed::XStorage > xStorage = comphelper::OStorageHelper::GetTemporaryStorage();
+ SvObjectServerList aServerLst;
+ ::rtl::OUString aName;
+
+ ::rtl::OUString aIconMediaType;
+ uno::Reference< io::XInputStream > xIconMetaFile;
+
+ SFX_REQUEST_ARG( rReq, pNameItem, SfxGlobalNameItem, SID_INSERT_OBJECT, sal_False );
+ if ( nSlotId == SID_INSERT_OBJECT && pNameItem )
+ {
+ SvGlobalName aClassName = pNameItem->GetValue();
+ xObj = mpViewShell->GetViewFrame()->GetObjectShell()->
+ GetEmbeddedObjectContainer().CreateEmbeddedObject( aClassName.GetByteSequence(), aName );
+ }
+ else
+ {
+ switch ( nSlotId )
+ {
+ case SID_INSERT_OBJECT :
+ {
+ aServerLst.FillInsertObjects();
+ if (mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW)
+ {
+ aServerLst.Remove( GraphicDocShell::Factory().GetClassId() );
+ }
+ else
+ {
+ aServerLst.Remove( DrawDocShell::Factory().GetClassId() );
+ }
+
+ // intentionally no break!
+ }
+ case SID_INSERT_PLUGIN :
+ case SID_INSERT_APPLET :
+ case SID_INSERT_FLOATINGFRAME :
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractInsertObjectDialog* pDlg =
+ pFact->CreateInsertObjectDialog( mpViewShell->GetActiveWindow(), nSlotId,
+ xStorage, &aServerLst );
+ if ( pDlg )
+ {
+ pDlg->Execute();
+ bCreateNew = pDlg->IsCreateNew();
+ xObj = pDlg->GetObject();
+
+ xIconMetaFile = pDlg->GetIconIfIconified( &aIconMediaType );
+ if ( xIconMetaFile.is() )
+ nAspect = embed::Aspects::MSOLE_ICON;
+
+ if ( xObj.is() )
+ mpViewShell->GetObjectShell()->GetEmbeddedObjectContainer().InsertEmbeddedObject( xObj, aName );
+ DELETEZ( pDlg );
+ }
+
+ break;
+ }
+ case SID_INSERT_SOUND :
+ case SID_INSERT_VIDEO :
+ {
+ // create special filedialog for plugins
+ SvxPluginFileDlg aPluginFileDialog (mpWindow, nSlotId);
+ if( ERRCODE_NONE == aPluginFileDialog.Execute () )
+ {
+ // get URL
+ String aStrURL(aPluginFileDialog.GetPath());
+ INetURLObject aURL( aStrURL, INET_PROT_FILE );
+ if( aURL.GetProtocol() != INET_PROT_NOT_VALID )
+ {
+ // create a plugin object
+ xObj = mpViewShell->GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence(), aName );
+ }
+
+ if ( xObj.is() && svt::EmbeddedObjectRef::TryRunningState( xObj ) )
+ {
+ // set properties from dialog
+ uno::Reference < embed::XComponentSupplier > xSup( xObj, uno::UNO_QUERY );
+ if ( xSup.is() )
+ {
+ uno::Reference < beans::XPropertySet > xSet( xSup->getComponent(), uno::UNO_QUERY );
+ if ( xSet.is() )
+ {
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("PluginURL"),
+ uno::makeAny( ::rtl::OUString( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) );
+ }
+ }
+ }
+ else
+ {
+ // PlugIn konnte nicht erzeugt werden
+ String aStrErr( SdResId( STR_ERROR_OBJNOCREATE_PLUGIN ) );
+ String aMask;
+ aMask += sal_Unicode('%');
+ aStrErr.SearchAndReplace( aMask, aStrURL );
+ ErrorBox( mpWindow, WB_3DLOOK | WB_OK, aStrErr ).Execute();
+ }
+ }
+ }
+ }
+ }
+
+ try
+ {
+ if (xObj.is())
+ {
+ //TODO/LATER: needs status for RESIZEONPRINTERCHANGE
+ //if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xObj->getStatus( nAspect ) )
+ // aIPObj->OnDocumentPrinterChanged( mpDocSh->GetPrinter(FALSE) );
+
+ BOOL bInsertNewObject = TRUE;
+
+ Size aSize;
+ MapUnit aMapUnit = MAP_100TH_MM;
+ if ( nAspect != embed::Aspects::MSOLE_ICON )
+ {
+ awt::Size aSz;
+ try
+ {
+ aSz = xObj->getVisualAreaSize( nAspect );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ // the default size will be set later
+ }
+
+ aSize =Size( aSz.Width, aSz.Height );
+
+ aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
+ if (aSize.Height() == 0 || aSize.Width() == 0)
+ {
+ // Rechteck mit ausgewogenem Kantenverhaeltnis
+ aSize.Width() = 14100;
+ aSize.Height() = 10000;
+ Size aTmp = OutputDevice::LogicToLogic( aSize, MAP_100TH_MM, aMapUnit );
+ aSz.Width = aTmp.Width();
+ aSz.Height = aTmp.Height();
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+ else
+ {
+ aSize = OutputDevice::LogicToLogic(aSize, aMapUnit, MAP_100TH_MM);
+ }
+ }
+
+ if ( mpView->AreObjectsMarked() )
+ {
+ /**********************************************************
+ * Ist ein leeres OLE-Objekt vorhanden?
+ **********************************************************/
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ if (pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() == OBJ_OLE2)
+ {
+ if ( !( (SdrOle2Obj*) pObj)->GetObjRef().is() )
+ {
+ /**************************************************
+ * Das leere OLE-Objekt bekommt ein neues IPObj
+ **************************************************/
+ bInsertNewObject = FALSE;
+ pObj->SetEmptyPresObj(FALSE);
+ ( (SdrOle2Obj*) pObj)->SetOutlinerParaObject(NULL);
+ ( (SdrOle2Obj*) pObj)->SetObjRef(xObj);
+ ( (SdrOle2Obj*) pObj)->SetPersistName(aName);
+ ( (SdrOle2Obj*) pObj)->SetName(aName);
+ ( (SdrOle2Obj*) pObj)->SetAspect(nAspect);
+ Rectangle aRect = ( (SdrOle2Obj*) pObj)->GetLogicRect();
+
+ //HMHmpView->HideMarkHdl();
+
+ if ( nAspect == embed::Aspects::MSOLE_ICON )
+ {
+ if( xIconMetaFile.is() )
+ ( (SdrOle2Obj*) pObj)->SetGraphicToObj( xIconMetaFile, aIconMediaType );
+ }
+ else
+ {
+ Size aTmp = OutputDevice::LogicToLogic( aRect.GetSize(), MAP_100TH_MM, aMapUnit );
+ awt::Size aSz( aTmp.Width(), aTmp.Height() );
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+ }
+ }
+ }
+ }
+
+ if (bInsertNewObject)
+ {
+ /**************************************************************
+ * Ein neues OLE-Objekt wird erzeugt
+ **************************************************************/
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ Size aPageSize = pPV->GetPage()->GetSize();
+
+ // get the size from the iconified object
+ ::svt::EmbeddedObjectRef aObjRef( xObj, nAspect );
+ if ( nAspect == embed::Aspects::MSOLE_ICON )
+ {
+ aObjRef.SetGraphicStream( xIconMetaFile, aIconMediaType );
+ MapMode aMapMode( MAP_100TH_MM );
+ aSize = aObjRef.GetSize( &aMapMode );
+ }
+
+ Point aPnt ((aPageSize.Width() - aSize.Width()) / 2,
+ (aPageSize.Height() - aSize.Height()) / 2);
+ Rectangle aRect (aPnt, aSize);
+
+ SdrOle2Obj* pObj = new SdrOle2Obj( aObjRef, aName, aRect);
+
+ if( mpView->InsertObjectAtView(pObj, *pPV, SDRINSERT_SETDEFLAYER) )
+ {
+ // #73279# Math objects change their object size during InsertObject.
+ // New size must be set in SdrObject, or a wrong scale will be set at
+ // ActivateObject.
+
+ if ( nAspect != embed::Aspects::MSOLE_ICON )
+ {
+ try
+ {
+ awt::Size aSz = xObj->getVisualAreaSize( nAspect );
+
+ Size aNewSize = Window::LogicToLogic( Size( aSz.Width, aSz.Height ),
+ MapMode( aMapUnit ), MapMode( MAP_100TH_MM ) );
+ if ( aNewSize != aSize )
+ {
+ aRect.SetSize( aNewSize );
+ pObj->SetLogicRect( aRect );
+ }
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {}
+ }
+
+ if (bCreateNew)
+ {
+ //HMHmpView->HideMarkHdl();
+ pObj->SetLogicRect(aRect);
+
+ if ( nAspect != embed::Aspects::MSOLE_ICON )
+ {
+ Size aTmp = OutputDevice::LogicToLogic( aRect.GetSize(), MAP_100TH_MM, aMapUnit );
+ awt::Size aSz( aTmp.Width(), aTmp.Height() );
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+
+ mpViewShell->ActivateObject(pObj, SVVERB_SHOW);
+ }
+
+ Size aVisSizePixel = mpWindow->GetOutputSizePixel();
+ Rectangle aVisAreaWin = mpWindow->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
+ mpViewShell->VisAreaChanged(aVisAreaWin);
+ mpDocSh->SetVisArea(aVisAreaWin);
+ }
+ }
+ }
+ }
+ catch (uno::Exception&)
+ {
+ // For some reason the object can not be inserted. For example
+ // because it is password protected and is not properly unlocked.
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* FuInsertAVMedia::Konstruktor
+|*
+\************************************************************************/
+
+FuInsertAVMedia::FuInsertAVMedia(
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuInsertAVMedia::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuInsertAVMedia( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuInsertAVMedia::DoExecute( SfxRequest& rReq )
+{
+ ::rtl::OUString aURL;
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+ bool bAPI = false;
+
+ if( pReqArgs )
+ {
+ const SfxStringItem* pStringItem = PTR_CAST( SfxStringItem, &pReqArgs->Get( rReq.GetSlot() ) );
+
+ if( pStringItem )
+ {
+ aURL = pStringItem->GetValue();
+ bAPI = aURL.getLength();
+ }
+ }
+
+ if( bAPI || ::avmedia::MediaWindow::executeMediaURLDialog( mpWindow, aURL ) )
+ {
+ Size aPrefSize;
+
+ if( mpWindow )
+ mpWindow->EnterWait();
+
+ if( !::avmedia::MediaWindow::isMediaURL( aURL, true, &aPrefSize ) )
+ {
+ if( mpWindow )
+ mpWindow->LeaveWait();
+
+ if( !bAPI )
+ ::avmedia::MediaWindow::executeFormatErrorBox( mpWindow );
+ }
+ else
+ {
+ Point aPos;
+ Size aSize;
+ sal_Int8 nAction = DND_ACTION_COPY;
+
+ if( aPrefSize.Width() && aPrefSize.Height() )
+ {
+ if( mpWindow )
+ aSize = mpWindow->PixelToLogic( aPrefSize, MAP_100TH_MM );
+ else
+ aSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MAP_100TH_MM );
+ }
+ else
+ aSize = Size( 5000, 5000 );
+
+ if( mpWindow )
+ {
+ aPos = mpWindow->PixelToLogic( Rectangle( aPos, mpWindow->GetOutputSizePixel() ).Center() );
+ aPos.X() -= aSize.Width() >> 1;
+ aPos.Y() -= aSize.Height() >> 1;
+ }
+
+ mpView->InsertMediaURL( aURL, nAction, aPos, aSize ) ;
+
+ if( mpWindow )
+ mpWindow->LeaveWait();
+ }
+ }
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
new file mode 100644
index 000000000000..d14a5859d47b
--- /dev/null
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -0,0 +1,824 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuinsfil.hxx"
+#include <vcl/wrkwin.hxx>
+#include <sfx2/progress.hxx>
+#include <editeng/outliner.hxx>
+#ifndef _EDITENG_HXX
+#include <editeng/editeng.hxx>
+#endif
+#include <svl/stritem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/app.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/printer.hxx>
+#include <svx/svdorect.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/svdoutl.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sot/formats.hxx>
+#include <svl/urihelper.hxx>
+#include <editeng/forbiddencharacterstable.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/dialogs.hrc>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "Window.hxx"
+#include "View.hxx"
+#include "strings.hrc"
+#include "stlpool.hxx"
+#include "glob.hrc"
+#include "sdpage.hxx"
+#include "strmname.h"
+#include "strings.hrc"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "DrawDocShell.hxx"
+#include "GraphicDocShell.hxx"
+#include "app.hrc"
+#include "unmovss.hxx"
+#include "Outliner.hxx"
+#include "sdabstdlg.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star;
+
+namespace sd {
+
+TYPEINIT1( FuInsertFile, FuPoor );
+
+#define POOL_BUFFER_SIZE (USHORT)32768
+#define BASIC_BUFFER_SIZE (USHORT)8192
+#define DOCUMENT_BUFFER_SIZE (USHORT)32768
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuInsertFile::FuInsertFile (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuInsertFile::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuInsertFile( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuInsertFile::DoExecute( SfxRequest& rReq )
+{
+ SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher();
+ ::std::vector< String > aFilterVector;
+ const SfxItemSet* pArgs = rReq.GetArgs ();
+
+ FuInsertFile::GetSupportedFilterVector( aFilterVector );
+
+ if (!pArgs)
+ {
+ sfx2::FileDialogHelper aFileDialog( WB_OPEN | SFXWB_INSERT | WB_STDMODAL );
+ Reference< XFilePicker > xFilePicker( aFileDialog.GetFilePicker(), UNO_QUERY );
+ Reference< XFilterManager > xFilterManager( xFilePicker, UNO_QUERY );
+ String aOwnCont;
+ String aOtherCont;
+ const SfxFilter* pFilter = NULL;
+
+ aFileDialog.SetTitle( String( SdResId(STR_DLG_INSERT_PAGES_FROM_FILE ) ) );
+
+ if( mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
+ {
+ aOwnCont = String( RTL_CONSTASCII_USTRINGPARAM( "simpress" ) );
+ aOtherCont = String( RTL_CONSTASCII_USTRINGPARAM( "sdraw" ) ) ;
+ }
+ else
+ {
+ aOtherCont = String( RTL_CONSTASCII_USTRINGPARAM( "simpress" ) );
+ aOwnCont = String( RTL_CONSTASCII_USTRINGPARAM( "sdraw" ) ) ;
+ }
+
+ SfxFilterMatcher aMatch( aOwnCont );
+
+ if( xFilterManager.is() )
+ {
+ // Get filter for current format
+ try
+ {
+ String aExt;
+ String aAllSpec( SdResId( STR_ALL_FILES ) );
+
+ xFilterManager->appendFilter( aAllSpec, UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "*.*" ) ) );
+ xFilterManager->setCurrentFilter( aAllSpec ); // set default-filter (<All>)
+
+ // Get main filter
+ pFilter = SfxFilter::GetDefaultFilterFromFactory( aOwnCont );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ // get cross filter
+ pFilter = SfxFilter::GetDefaultFilterFromFactory( aOtherCont );
+ if( pFilter )
+ {
+ pFilter = aMatch.GetFilter4Extension( pFilter->GetDefaultExtension() );
+ if ( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+ }
+
+ // get femplate filter
+ if( mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
+ pFilter = DrawDocShell::Factory().GetTemplateFilter();
+ else
+ pFilter = GraphicDocShell::Factory().GetTemplateFilter();
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ // get Powerpoint filter
+ aExt = UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( ".ppt" ) );
+ pFilter = aMatch.GetFilter4Extension( aExt );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ // Get other draw/impress filters
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARIMPRESS_60, SFX_FILTER_IMPORT, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARIMPRESS_60, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW_60, SFX_FILTER_IMPORT, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW_60, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARIMPRESS_50, SFX_FILTER_IMPORT, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARIMPRESS_50, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW_50, SFX_FILTER_IMPORT, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW_50, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW_40, SFX_FILTER_IMPORT, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW_40, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW, SFX_FILTER_IMPORT, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ pFilter = aMatch.GetFilter4ClipBoardId( SOT_FORMATSTR_ID_STARDRAW, SFX_FILTER_TEMPLATEPATH );
+ if( pFilter )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ // add additional supported filters
+ ::std::vector< String >::const_iterator aIter( aFilterVector.begin() );
+
+ while( aIter != aFilterVector.end() )
+ {
+ if( ( pFilter = rMatcher.GetFilter4Mime( *aIter ) ) != NULL )
+ xFilterManager->appendFilter( pFilter->GetUIName(), pFilter->GetDefaultExtension() );
+
+ ++aIter;
+ }
+ }
+ catch(IllegalArgumentException)
+ {
+ }
+ }
+
+ if( aFileDialog.Execute() != ERRCODE_NONE )
+ return;
+ else
+ {
+ aFilterName = aFileDialog.GetCurrentFilter();
+ aFile = aFileDialog.GetPath();
+ }
+ }
+ else
+ {
+ SFX_REQUEST_ARG (rReq, pFileName, SfxStringItem, ID_VAL_DUMMY0, FALSE);
+ SFX_REQUEST_ARG (rReq, pFilterName, SfxStringItem, ID_VAL_DUMMY1, FALSE);
+
+ aFile = pFileName->GetValue ();
+
+ if( pFilterName )
+ aFilterName = pFilterName->GetValue ();
+ }
+
+ mpDocSh->SetWaitCursor( TRUE );
+
+ SfxMedium* pMedium = new SfxMedium( aFile, STREAM_READ | STREAM_NOCREATE, FALSE );
+ const SfxFilter* pFilter = NULL;
+
+ SFX_APP()->GetFilterMatcher().GuessFilter( *pMedium, &pFilter, SFX_FILTER_IMPORT, SFX_FILTER_NOTINSTALLED | SFX_FILTER_EXECUTABLE );
+
+ BOOL bDrawMode = mpViewShell && mpViewShell->ISA(DrawViewShell);
+ BOOL bInserted = FALSE;
+
+ if( pFilter )
+ {
+ pMedium->SetFilter( pFilter );
+ aFilterName = pFilter->GetFilterName();
+
+ if( pMedium->IsStorage() || ( pMedium->GetInStream() && SotStorage::IsStorageFile( pMedium->GetInStream() ) ) )
+ {
+ if ( pFilter->GetServiceName().EqualsAscii( "com.sun.star.presentation.PresentationDocument" ) ||
+ pFilter->GetServiceName().EqualsAscii( "com.sun.star.drawing.DrawingDocument" ) )
+ {
+ // Draw, Impress or PowerPoint document
+ // the ownership of the Medium is transferred
+ if( bDrawMode )
+ InsSDDinDrMode( pMedium );
+ else
+ InsSDDinOlMode( pMedium );
+
+ // don't delete Medium here, ownership of pMedium has changed in this case
+ bInserted = TRUE;
+ }
+ }
+ else
+ {
+ BOOL bFound = ( ::std::find( aFilterVector.begin(), aFilterVector.end(), pFilter->GetMimeType() ) != aFilterVector.end() );
+ if( !bFound &&
+ ( aFilterName.SearchAscii( "Text" ) != STRING_NOTFOUND ||
+ aFilterName.SearchAscii( "Rich" ) != STRING_NOTFOUND ||
+ aFilterName.SearchAscii( "RTF" ) != STRING_NOTFOUND ||
+ aFilterName.SearchAscii( "HTML" ) != STRING_NOTFOUND ) )
+ {
+ bFound = TRUE;
+ }
+
+ if( bFound )
+ {
+ if( bDrawMode )
+ InsTextOrRTFinDrMode(pMedium);
+ else
+ InsTextOrRTFinOlMode(pMedium);
+
+ bInserted = TRUE;
+ delete pMedium;
+ }
+ }
+ }
+
+ mpDocSh->SetWaitCursor( FALSE );
+
+ if( !bInserted )
+ {
+ ErrorBox aErrorBox( mpWindow, WB_OK, String( SdResId( STR_READ_DATA_ERROR ) ) );
+ aErrorBox.Execute();
+ delete pMedium;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium)
+{
+ BOOL bOK = FALSE;
+
+ // Liste mit Seitennamen (wenn NULL, dann alle Seiten)
+ List* pBookmarkList = NULL;
+
+ mpDocSh->SetWaitCursor( FALSE );
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdInsertPagesObjsDlg* pDlg = pFact ? pFact->CreateSdInsertPagesObjsDlg( NULL, mpDoc, pMedium, aFile ) : 0;
+
+ if( !pDlg )
+ return FALSE;
+
+ // Ev. wird eine QueryBox geoeffnet ("Links aktualisieren?"),
+ // daher wird der Dialog der aktuelle DefModalDialogParent
+ ::Window* pDefParent = GetpApp()->GetDefDialogParent();
+ GetpApp()->SetDefDialogParent(pDlg->GetWindow());
+
+ USHORT nRet = pDlg->Execute();
+
+ GetpApp()->SetDefDialogParent(pDefParent);
+
+ mpDocSh->SetWaitCursor( TRUE );
+
+ if( nRet == RET_OK )
+ {
+ // Zuerst Seiten einfuegen
+ pBookmarkList = pDlg->GetList( 1 ); // Seiten
+ BOOL bLink = pDlg->IsLink();
+ BOOL bReplace = FALSE;
+ SdPage* pPage = NULL;
+ ::sd::View* pView = mpViewShell->GetView();
+
+ if (pView->ISA(OutlineView))
+ {
+ pPage = static_cast<OutlineView*>(pView)->GetActualPage();
+ }
+ else
+ {
+ pPage = static_cast<SdPage*>(pView->GetSdrPageView()->GetPage());
+ }
+
+ USHORT nPos = 0xFFFF;
+
+ if (pPage && !pPage->IsMasterPage())
+ {
+ if (pPage->GetPageKind() == PK_STANDARD)
+ {
+ nPos = pPage->GetPageNum() + 2;
+ }
+ else if (pPage->GetPageKind() == PK_NOTES)
+ {
+ nPos = pPage->GetPageNum() + 1;
+ }
+ }
+
+ BOOL bNameOK;
+ List* pObjectBookmarkList = pDlg->GetList( 2 ); // Objekte
+ List* pExchangeList = NULL;
+
+ // Es werden ausgewaehlte Seiten und/oder ausgewaehlte Objekte oder
+ // alles eingefuegt, wenn pBookmarkList NULL ist!
+ if( pBookmarkList || !pObjectBookmarkList )
+ {
+ // Um zu gewaehrleisten, dass alle Seitennamen eindeutig sind, werden
+ // die einzufuegenden geprueft und gegebenenfalls in einer Ersatzliste
+ // aufgenommen
+ // bNameOK == FALSE -> Benutzer hat abgebrochen
+ bNameOK = mpView->GetExchangeList( pExchangeList, pBookmarkList, 0 );
+
+ if( bNameOK )
+ bOK = mpDoc->InsertBookmarkAsPage( pBookmarkList, pExchangeList,
+ bLink, bReplace, nPos,
+ FALSE, NULL, TRUE, TRUE, FALSE );
+
+ // Loeschen der BookmarkList
+ if( pBookmarkList )
+ {
+ String* pString = (String*) pBookmarkList->First();
+ while( pString )
+ {
+ delete pString;
+ pString = (String*) pBookmarkList->Next();
+ }
+ delete pBookmarkList;
+ pBookmarkList = NULL;
+ }
+ // Loeschen der ExchangeList
+ if( pExchangeList )
+ {
+ String* pString = (String*) pExchangeList->First();
+ while( pString )
+ {
+ delete pString;
+ pString = (String*) pExchangeList->Next();
+ }
+ delete pExchangeList;
+ pExchangeList = NULL;
+ }
+ }
+ // Dann Objekte einfuegen
+ //pBookmarkList = pDlg->GetList( 2 ); // Objekte
+ pBookmarkList = pObjectBookmarkList;
+
+ // Um zu gewaehrleisten... (s.o.)
+ bNameOK = mpView->GetExchangeList( pExchangeList, pBookmarkList, 1 );
+
+ if( bNameOK )
+ bOK = mpDoc->InsertBookmarkAsObject( pBookmarkList, pExchangeList,
+ bLink, NULL, NULL);
+
+ // Loeschen der BookmarkList
+ if( pBookmarkList )
+ {
+ String* pString = (String*) pBookmarkList->First();
+ while( pString )
+ {
+ delete pString;
+ pString = (String*) pBookmarkList->Next();
+ }
+ delete pBookmarkList;
+ pBookmarkList = NULL;
+ }
+ // Loeschen der ExchangeList
+ if( pExchangeList )
+ {
+ String* pString = (String*) pExchangeList->First();
+ while( pString )
+ {
+ delete pString;
+ pString = (String*) pExchangeList->Next();
+ }
+ delete pExchangeList;
+ pExchangeList = NULL;
+ }
+
+ if( pDlg->IsRemoveUnnessesaryMasterPages() )
+ mpDoc->RemoveUnnecessaryMasterPages();
+ }
+
+ delete pDlg;
+
+ return (bOK);
+}
+
+// -----------------------------------------------------------------------------
+
+void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
+{
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdInsertPagesObjsDlg* pDlg = pFact ? pFact->CreateSdInsertPagesObjsDlg(NULL, mpDoc, NULL, aFile ) : 0;
+ if( !pDlg )
+ return;
+
+ mpDocSh->SetWaitCursor( FALSE );
+
+ USHORT nRet = pDlg->Execute();
+ mpDocSh->SetWaitCursor( TRUE );
+
+ if( nRet == RET_OK )
+ {
+ // gewaehltes Dateiformat: Text oder RTF oder HTML (Default ist Text)
+ USHORT nFormat = EE_FORMAT_TEXT;
+
+ if( aFilterName.SearchAscii( "Rich") != STRING_NOTFOUND )
+ nFormat = EE_FORMAT_RTF;
+ else if( aFilterName.SearchAscii( "HTML" ) != STRING_NOTFOUND )
+ nFormat = EE_FORMAT_HTML;
+
+ // einen eigenen Outliner erzeugen, denn:
+ // der Dokument-Outliner koennte gerade vom Gliederungsmodus
+ // benutzt werden;
+ // der Draw-Outliner der Drawing Engine koennte zwischendurch
+ // was zeichnen muessen;
+ // der globale Outliner koennte in SdPage::CreatePresObj
+ // benutzt werden
+// SfxItemPool* pPool = mpDoc->GetDrawOutliner().GetEmptyItemSet().GetPool();
+ SdrOutliner* pOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
+// pOutliner->SetStyleSheetPool((SfxStyleSheetPool*)mpDoc->GetStyleSheetPool());
+// pOutliner->SetEditTextObjectPool(pPool);
+// pOutliner->SetForbiddenCharsTable( mpDoc->GetForbiddenCharsTable() );
+
+ // Referenz-Device setzen
+ pOutliner->SetRefDevice( SD_MOD()->GetRefDevice( *mpDocSh ) );
+
+ SdPage* pPage = static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
+ aLayoutName = pPage->GetLayoutName();
+ aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
+
+ pOutliner->SetPaperSize(pPage->GetSize());
+
+ SvStream* pStream = pMedium->GetInStream();
+ DBG_ASSERT( pStream, "Kein InStream!" );
+ pStream->Seek( 0 );
+
+ ULONG nErr = pOutliner->Read( *pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes() );
+
+ if (nErr || !pOutliner->GetEditEngine().GetText().Len())
+ {
+ ErrorBox aErrorBox( mpWindow, (WinBits)WB_OK,
+ String(SdResId(STR_READ_DATA_ERROR)));
+ aErrorBox.Execute();
+ }
+ else
+ {
+ // ist es eine Masterpage?
+ if (static_cast<DrawViewShell*>(mpViewShell)->GetEditMode() == EM_MASTERPAGE &&
+ !pPage->IsMasterPage())
+ {
+ pPage = (SdPage*)(&(pPage->TRG_GetMasterPage()));
+ }
+
+ DBG_ASSERT(pPage, "Seite nicht gefunden");
+
+ // wenn gerade editiert wird, in dieses Textobjekt einfliessen lassen
+ OutlinerView* pOutlinerView = mpView->GetTextEditOutlinerView();
+ if( pOutlinerView )
+ {
+ SdrObject* pObj = mpView->GetTextEditObject();
+ if( pObj &&
+ pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() == OBJ_TITLETEXT &&
+ pOutliner->GetParagraphCount() > 1 )
+ {
+ // In Titelobjekten darf nur ein Absatz vorhanden sein
+ while ( pOutliner->GetParagraphCount() > 1 )
+ {
+ Paragraph* pPara = pOutliner->GetParagraph( 0 );
+ ULONG nLen = pOutliner->GetText( pPara, 1 ).Len();
+ pOutliner->QuickDelete( ESelection( 0, (USHORT) nLen, 1, 0 ) );
+ pOutliner->QuickInsertLineBreak( ESelection( 0, (USHORT) nLen, 0, (USHORT) nLen ) );
+ }
+ }
+ }
+
+ OutlinerParaObject* pOPO = pOutliner->CreateParaObject();
+
+ if (pOutlinerView)
+ {
+ pOutlinerView->InsertText(*pOPO);
+ }
+ else
+ {
+ SdrRectObj* pTO = new SdrRectObj(OBJ_TEXT);
+ pTO->SetOutlinerParaObject(pOPO);
+
+ const bool bUndo = mpView->IsUndoEnabled();
+ if( bUndo )
+ mpView->BegUndo(String(SdResId(STR_UNDO_INSERT_TEXTFRAME)));
+ pPage->InsertObject(pTO);
+
+ // koennte groesser sein als die max. erlaubte Groesse:
+ // falls noetig, die Objektgroesse begrenzen
+ Size aSize(pOutliner->CalcTextSize());
+ Size aMaxSize = mpDoc->GetMaxObjSize();
+ aSize.Height() = Min(aSize.Height(), aMaxSize.Height());
+ aSize.Width() = Min(aSize.Width(), aMaxSize.Width());
+ aSize = mpWindow->LogicToPixel(aSize);
+
+ // in der Mitte des Fensters absetzen
+ Size aTemp(mpWindow->GetOutputSizePixel());
+ Point aPos(aTemp.Width() / 2, aTemp.Height() / 2);
+ aPos.X() -= aSize.Width() / 2;
+ aPos.Y() -= aSize.Height() / 2;
+ aSize = mpWindow->PixelToLogic(aSize);
+ aPos = mpWindow->PixelToLogic(aPos);
+ pTO->SetLogicRect(Rectangle(aPos, aSize));
+
+ if (pDlg->IsLink())
+ {
+ pTO->SetTextLink(aFile, aFilterName, gsl_getSystemTextEncoding() );
+ }
+
+ if( bUndo )
+ {
+ mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoInsertObject(*pTO));
+ mpView->EndUndo();
+ }
+ }
+ }
+ delete pOutliner;
+ }
+
+ delete pDlg;
+}
+
+// -----------------------------------------------------------------------------
+
+void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
+{
+ // gewaehltes Dateiformat: Text oder RTF oder HTML (Default ist Text)
+ USHORT nFormat = EE_FORMAT_TEXT;
+
+ if( aFilterName.SearchAscii( "Rich") != STRING_NOTFOUND )
+ nFormat = EE_FORMAT_RTF;
+ else if( aFilterName.SearchAscii( "HTML" ) != STRING_NOTFOUND )
+ nFormat = EE_FORMAT_HTML;
+
+ ::Outliner* pDocliner = static_cast<OutlineView*>(mpView)->GetOutliner();
+ List* pList = pDocliner->GetView(0)->CreateSelectionList();
+ Paragraph* pPara = (Paragraph*)pList->First();
+
+ // wo soll eingefuegt werden?
+ while( !pDocliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
+ {
+ pPara = pDocliner->GetParent(pPara);
+ }
+ ULONG nTargetPos = pDocliner->GetAbsPos(pPara) + 1;
+
+ // Layout der Vorgaengerseite uebernehmen
+ USHORT nPage = 0;
+ pPara = pDocliner->GetParagraph( pDocliner->GetAbsPos( pPara ) - 1 );
+ while (pPara)
+ {
+ ULONG nPos = pDocliner->GetAbsPos( pPara );
+ if ( pDocliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
+ nPage++;
+ pPara = pDocliner->GetParagraph( nPos - 1 );
+ }
+ SdPage* pPage = mpDoc->GetSdPage(nPage, PK_STANDARD);
+ aLayoutName = pPage->GetLayoutName();
+ aLayoutName.Erase(aLayoutName.SearchAscii(SD_LT_SEPARATOR));
+
+ // einen eigenen Outliner erzeugen, denn:
+ // der Dokument-Outliner koennte gerade vom Gliederungsmodus
+ // benutzt werden;
+ // der Draw-Outliner der Drawing Engine koennte zwischendurch
+ // was zeichnen muessen;
+ // der globale Outliner koennte in SdPage::CreatePresObj
+ // benutzt werden
+ ::Outliner* pOutliner = new ::Outliner( &mpDoc->GetItemPool(), OUTLINERMODE_OUTLINEOBJECT );
+ pOutliner->SetStyleSheetPool((SfxStyleSheetPool*)mpDoc->GetStyleSheetPool());
+
+ // Referenz-Device setzen
+ pOutliner->SetRefDevice(SD_MOD()->GetRefDevice( *mpDocSh ));
+ pOutliner->SetPaperSize(Size(0x7fffffff, 0x7fffffff));
+
+ SvStream* pStream = pMedium->GetInStream();
+ DBG_ASSERT( pStream, "Kein InStream!" );
+ pStream->Seek( 0 );
+
+ ULONG nErr = pOutliner->Read(*pStream, pMedium->GetBaseURL(), nFormat, mpDocSh->GetHeaderAttributes());
+
+ if (nErr || !pOutliner->GetEditEngine().GetText().Len())
+ {
+ ErrorBox aErrorBox( mpWindow, (WinBits)WB_OK,
+ String(SdResId(STR_READ_DATA_ERROR)));
+ aErrorBox.Execute();
+ }
+ else
+ {
+ ULONG nParaCount = pOutliner->GetParagraphCount();
+
+ // fuer Fortschrittsanzeige: Anzahl der Ebene-0-Absaetze
+ USHORT nNewPages = 0;
+ pPara = pOutliner->GetParagraph( 0 );
+ while (pPara)
+ {
+ ULONG nPos = pOutliner->GetAbsPos( pPara );
+ if( pOutliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
+ nNewPages++;
+ pPara = pOutliner->GetParagraph( ++nPos );
+ }
+
+ mpDocSh->SetWaitCursor( FALSE );
+
+ SfxProgress* pProgress = new SfxProgress( mpDocSh, String( SdResId(STR_CREATE_PAGES)), nNewPages);
+ if( pProgress )
+ pProgress->SetState( 0, 100 );
+
+ nNewPages = 0;
+
+ pDocliner->GetUndoManager().EnterListAction(
+ String(SdResId(STR_UNDO_INSERT_FILE)), String() );
+
+ ULONG nSourcePos = 0;
+ SfxStyleSheet* pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
+ Paragraph* pSourcePara = pOutliner->GetParagraph( 0 );
+ while (pSourcePara)
+ {
+ ULONG nPos = pOutliner->GetAbsPos( pSourcePara );
+ sal_Int16 nDepth = pOutliner->GetDepth( (USHORT) nPos );
+
+ // den letzte Absatz nur uebernehmen, wenn er gefuellt ist
+ if (nSourcePos < nParaCount - 1 ||
+ pOutliner->GetText(pSourcePara).Len() > 0)
+ {
+ pDocliner->Insert( pOutliner->GetText(pSourcePara), nTargetPos, nDepth );
+ String aStyleSheetName( pStyleSheet->GetName() );
+ aStyleSheetName.Erase( aStyleSheetName.Len()-1, 1 );
+ aStyleSheetName += String::CreateFromInt32( nDepth <= 0 ? 1 : nDepth+1 );
+ SfxStyleSheetBasePool* pStylePool = mpDoc->GetStyleSheetPool();
+ SfxStyleSheet* pOutlStyle = (SfxStyleSheet*) pStylePool->Find( aStyleSheetName, pStyleSheet->GetFamily() );
+ pDocliner->SetStyleSheet( nTargetPos, pOutlStyle );
+ }
+
+ if( pDocliner->HasParaFlag( pSourcePara, PARAFLAG_ISPAGE ) )
+ {
+ nNewPages++;
+ if( pProgress )
+ pProgress->SetState( nNewPages );
+ }
+
+ pSourcePara = pOutliner->GetParagraph( ++nPos );
+ nTargetPos++;
+ nSourcePos++;
+ }
+
+ pDocliner->GetUndoManager().LeaveListAction();
+
+ if( pProgress )
+ delete pProgress;
+
+ mpDocSh->SetWaitCursor( TRUE );
+ }
+
+ delete pOutliner;
+}
+
+// -----------------------------------------------------------------------------
+
+BOOL FuInsertFile::InsSDDinOlMode(SfxMedium* pMedium)
+{
+ OutlineView* pOlView = static_cast<OutlineView*>(mpView);
+
+ // Outliner-Inhalte ins SdDrawDocument uebertragen
+ pOlView->PrepareClose();
+
+ // einlesen wie im Zeichenmodus
+ if (InsSDDinDrMode(pMedium))
+ {
+ ::Outliner* pOutliner = pOlView->GetViewByWindow(mpWindow)->GetOutliner();
+
+ // Benachrichtigungs-Links temporaer trennen
+ Link aOldParagraphInsertedHdl = pOutliner->GetParaInsertedHdl();
+ pOutliner->SetParaInsertedHdl( Link(NULL, NULL));
+ Link aOldParagraphRemovingHdl = pOutliner->GetParaRemovingHdl();
+ pOutliner->SetParaRemovingHdl( Link(NULL, NULL));
+ Link aOldDepthChangedHdl = pOutliner->GetDepthChangedHdl();
+ pOutliner->SetDepthChangedHdl( Link(NULL, NULL));
+ Link aOldBeginMovingHdl = pOutliner->GetBeginMovingHdl();
+ pOutliner->SetBeginMovingHdl( Link(NULL, NULL));
+ Link aOldEndMovingHdl = pOutliner->GetEndMovingHdl();
+ pOutliner->SetEndMovingHdl( Link(NULL, NULL));
+
+ Link aOldStatusEventHdl = pOutliner->GetStatusEventHdl();
+ pOutliner->SetStatusEventHdl(Link(NULL, NULL));
+
+ pOutliner->Clear();
+ pOlView->FillOutliner();
+
+ // Links wieder setzen
+ pOutliner->SetParaInsertedHdl(aOldParagraphInsertedHdl);
+ pOutliner->SetParaRemovingHdl(aOldParagraphRemovingHdl);
+ pOutliner->SetDepthChangedHdl(aOldDepthChangedHdl);
+ pOutliner->SetBeginMovingHdl(aOldBeginMovingHdl);
+ pOutliner->SetEndMovingHdl(aOldEndMovingHdl);
+ pOutliner->SetStatusEventHdl(aOldStatusEventHdl);
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------------
+
+void FuInsertFile::GetSupportedFilterVector( ::std::vector< String >& rFilterVector )
+{
+ SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher();
+ const SfxFilter* pSearchFilter = NULL;
+
+ rFilterVector.clear();
+
+ if( ( pSearchFilter = rMatcher.GetFilter4Mime( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "text/plain" ) ) ) ) != NULL )
+ rFilterVector.push_back( pSearchFilter->GetMimeType() );
+
+ if( ( pSearchFilter = rMatcher.GetFilter4Mime( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "application/rtf" ) ) ) ) != NULL )
+ rFilterVector.push_back( pSearchFilter->GetMimeType() );
+
+ if( ( pSearchFilter = rMatcher.GetFilter4Mime( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "text/html" ) ) ) ) != NULL )
+ rFilterVector.push_back( pSearchFilter->GetMimeType() );
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuline.cxx b/sd/source/ui/func/fuline.cxx
new file mode 100644
index 000000000000..b14d5f6acc08
--- /dev/null
+++ b/sd/source/ui/func/fuline.cxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuline.hxx"
+
+#include <svx/svxids.hrc>
+#include <svx/tabline.hxx>
+#include <svx/xenum.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/request.hxx>
+#include <svx/xdef.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/viewfrm.hxx>
+#include "ViewShell.hxx"
+#include "View.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "drawdoc.hxx"
+#include "app.hrc"
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+namespace sd {
+
+TYPEINIT1( FuLine, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuLine::FuLine (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuLine::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuLine( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuLine::DoExecute( SfxRequest& rReq )
+{
+ BOOL bHasMarked = mpView->AreObjectsMarked();
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ const SdrObject* pObj = NULL;
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ SfxItemSet* pNewAttr = new SfxItemSet( mpDoc->GetPool() );
+ mpView->GetAttributes( *pNewAttr );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractTabDialog * pDlg = pFact ? pFact->CreateSvxLineTabDialog(NULL,pNewAttr,mpDoc,pObj,bHasMarked) : 0;
+ if( pDlg && (pDlg->Execute() == RET_OK) )
+ {
+ mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
+ }
+
+ // Attribute wurden geaendert, Listboxes in Objectbars muessen aktualisiert werden
+ static USHORT SidArray[] = {
+ SID_ATTR_LINE_STYLE,
+ SID_ATTR_LINE_DASH,
+ SID_ATTR_LINE_WIDTH,
+ SID_ATTR_LINE_COLOR,
+ 0 };
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+
+ delete pDlg;
+ delete pNewAttr;
+ }
+
+ rReq.Ignore ();
+}
+
+void FuLine::Activate()
+{
+}
+
+void FuLine::Deactivate()
+{
+}
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fulinend.cxx b/sd/source/ui/func/fulinend.cxx
new file mode 100644
index 000000000000..9c53518507f3
--- /dev/null
+++ b/sd/source/ui/func/fulinend.cxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fulinend.hxx"
+#include <svx/xtable.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svdobj.hxx>
+#include <svx/svdopath.hxx>
+#include <vcl/msgbox.hxx>
+
+#include "strings.hrc"
+#include "ViewShell.hxx"
+#include "helpids.h"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include "View.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+
+namespace sd {
+
+#define BITMAP_WIDTH 32
+#define BITMAP_HEIGHT 12
+
+TYPEINIT1( FuLineEnd, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuLineEnd::FuLineEnd(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuLineEnd::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuLineEnd( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuLineEnd::DoExecute( SfxRequest& )
+{
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ const SdrObject* pNewObj;
+ SdrObject* pConvPolyObj = NULL;
+
+ if( pObj->ISA( SdrPathObj ) )
+ {
+ pNewObj = pObj;
+ }
+ else
+ {
+ SdrObjTransformInfoRec aInfoRec;
+ pObj->TakeObjInfo( aInfoRec );
+
+ if( aInfoRec.bCanConvToPath &&
+ pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() != OBJ_GRUP )
+ // bCanConvToPath ist bei Gruppenobjekten TRUE,
+ // stuerzt aber bei ConvertToPathObj() ab !
+ {
+ pNewObj = pConvPolyObj = pObj->ConvertToPolyObj( TRUE, FALSE );
+
+ if( !pNewObj || !pNewObj->ISA( SdrPathObj ) )
+ return; // Abbruch, zusaetzliche Sicherheit, die bei
+ // Gruppenobjekten aber nichts bringt.
+ }
+ else return; // Abbruch
+ }
+
+ const ::basegfx::B2DPolyPolygon aPolyPolygon = ( (SdrPathObj*) pNewObj )->GetPathPoly();
+
+ // Loeschen des angelegten PolyObjektes
+ SdrObject::Free( pConvPolyObj );
+
+ XLineEndList* pLineEndList = mpDoc->GetLineEndList();
+ XLineEndEntry* pEntry;
+
+ String aNewName( SdResId( STR_LINEEND ) );
+ String aDesc( SdResId( STR_DESC_LINEEND ) );
+ String aName;
+
+ long nCount = pLineEndList->Count();
+ long j = 1;
+ BOOL bDifferent = FALSE;
+
+ while( !bDifferent )
+ {
+ aName = aNewName;
+ aName.Append( sal_Unicode(' ') );
+ aName.Append( UniString::CreateFromInt32( j++ ) );
+ bDifferent = TRUE;
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ {
+ if( aName == pLineEndList->GetLineEnd( i )->GetName() )
+ bDifferent = FALSE;
+ }
+ }
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ AbstractSvxNameDialog* pDlg = pFact ? pFact->CreateSvxNameDialog( NULL, aName, aDesc ) : 0;
+
+ if( pDlg )
+ {
+ pDlg->SetEditHelpId( HID_SD_NAMEDIALOG_LINEEND );
+
+ if( pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetName( aName );
+ bDifferent = TRUE;
+
+ for( long i = 0; i < nCount && bDifferent; i++ )
+ {
+ if( aName == pLineEndList->GetLineEnd( i )->GetName() )
+ bDifferent = FALSE;
+ }
+
+ if( bDifferent )
+ {
+ pEntry = new XLineEndEntry( aPolyPolygon, aName );
+ pLineEndList->Insert( pEntry, LIST_APPEND);
+ }
+ else
+ {
+ String aStr(SdResId( STR_WARN_NAME_DUPLICATE ));
+ WarningBox aWarningBox( mpWindow, WinBits( WB_OK ),
+ aStr );
+ aWarningBox.Execute();
+ }
+ }
+ }
+ delete pDlg;
+ }
+}
+
+void FuLineEnd::Activate()
+{
+}
+
+void FuLineEnd::Deactivate()
+{
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fulink.cxx b/sd/source/ui/func/fulink.cxx
new file mode 100644
index 000000000000..a87cb63883e7
--- /dev/null
+++ b/sd/source/ui/func/fulink.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fulink.hxx"
+
+#include <sfx2/linkmgr.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include <svx/svxdlg.hxx>
+
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "drawdoc.hxx"
+#include "ViewShell.hxx"
+#include "app.hrc"
+
+
+class SfxRequest;
+
+namespace sd {
+
+TYPEINIT1( FuLink, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuLink::FuLink (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq )
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuLink::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuLink( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuLink::DoExecute( SfxRequest& )
+{
+ sfx2::LinkManager* pLinkManager = mpDoc->GetLinkManager();
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractLinksDialog* pDlg = pFact->CreateLinksDialog( mpViewShell->GetActiveWindow(), pLinkManager );
+ if ( pDlg )
+ {
+ pDlg->Execute();
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_MANAGE_LINKS );
+ delete pDlg;
+ }
+}
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fumeasur.cxx b/sd/source/ui/func/fumeasur.cxx
new file mode 100644
index 000000000000..55344a46acc2
--- /dev/null
+++ b/sd/source/ui/func/fumeasur.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fumeasur.hxx"
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+namespace sd {
+
+TYPEINIT1( FuMeasureDlg, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuMeasureDlg::FuMeasureDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuMeasureDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuMeasureDlg( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuMeasureDlg::DoExecute( SfxRequest& rReq )
+{
+ SfxItemSet aNewAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aNewAttr );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ::std::auto_ptr<SfxAbstractDialog> pDlg( pFact ? pFact->CreateSfxDialog( NULL, aNewAttr, mpView, RID_SVXPAGE_MEASURE) : 0 );
+
+ if( pDlg.get() && (pDlg->Execute() == RET_OK) )
+ {
+ rReq.Done( *pDlg->GetOutputItemSet() );
+ pArgs = rReq.GetArgs();
+ }
+ }
+
+ if( pArgs )
+ mpView->SetAttributes( *pArgs );
+}
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx
new file mode 100644
index 000000000000..1dc2d40fefd3
--- /dev/null
+++ b/sd/source/ui/func/fumorph.cxx
@@ -0,0 +1,513 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+//#define _FUMORPH_PRIVATE
+#include "fumorph.hxx"
+#include <svx/xfillit.hxx>
+#include <svx/xlineit.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/svdpool.hxx>
+#include <tools/poly.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/svdogrp.hxx>
+#include <editeng/eeitem.hxx>
+
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+#include "strings.hrc"
+#include "sdresid.hxx"
+
+#include "sdabstdlg.hxx"
+
+// #i48168#
+#include <svx/svditer.hxx>
+
+#include <basegfx/color/bcolor.hxx>
+
+namespace sd {
+
+#define ITEMVALUE( ItemSet, Id, Cast ) ( ( (const Cast&) (ItemSet).Get( (Id) ) ).GetValue() )
+TYPEINIT1( FuMorph, FuPoor );
+
+//////////////////////////////////////////////////////////////////////////////
+// constructor
+//
+FuMorph::FuMorph (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq )
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuMorph::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuMorph( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuMorph::DoExecute( SfxRequest& )
+{
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if(rMarkList.GetMarkCount() == 2)
+ {
+ // Clones erzeugen
+ SdrObject* pObj1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ SdrObject* pObj2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
+ SdrObject* pCloneObj1 = pObj1->Clone();
+ SdrObject* pCloneObj2 = pObj2->Clone();
+
+ // Text am Clone loeschen, da wir sonst kein richtiges PathObj bekommen
+ pCloneObj1->SetOutlinerParaObject(NULL);
+ pCloneObj2->SetOutlinerParaObject(NULL);
+
+ // Path-Objekte erzeugen
+ SdrObject* pPolyObj1 = pCloneObj1->ConvertToPolyObj(FALSE, FALSE);
+ SdrObject* pPolyObj2 = pCloneObj2->ConvertToPolyObj(FALSE, FALSE);
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractMorphDlg* pDlg = pFact ? pFact->CreateMorphDlg( static_cast< ::Window*>(mpWindow), pObj1, pObj2 ) : 0;
+ if(pPolyObj1 && pPolyObj2 && pDlg && (pDlg->Execute() == RET_OK))
+ {
+ List aPolyPolyList;
+ ::basegfx::B2DPolyPolygon aPolyPoly1;
+ ::basegfx::B2DPolyPolygon aPolyPoly2;
+ ::basegfx::B2DPolyPolygon* pPolyPoly;
+
+ pDlg->SaveSettings();
+
+ // #i48168# Not always is the pPolyObj1/pPolyObj2 a SdrPathObj, it may also be a group object
+ // containing SdrPathObjs. To get the polygons, i add two iters here
+ SdrObjListIter aIter1(*pPolyObj1);
+ SdrObjListIter aIter2(*pPolyObj2);
+
+ while(aIter1.IsMore())
+ {
+ SdrObject* pObj = aIter1.Next();
+ if(pObj && pObj->ISA(SdrPathObj))
+ aPolyPoly1.append(((SdrPathObj*)pObj)->GetPathPoly());
+ }
+
+ while(aIter2.IsMore())
+ {
+ SdrObject* pObj = aIter2.Next();
+ if(pObj && pObj->ISA(SdrPathObj))
+ aPolyPoly2.append(((SdrPathObj*)pObj)->GetPathPoly());
+ }
+
+ // Morphing durchfuehren
+ if(aPolyPoly1.count() && aPolyPoly2.count())
+ {
+ aPolyPoly1 = ::basegfx::tools::correctOrientations(aPolyPoly1);
+ aPolyPoly1.removeDoublePoints();
+ ::basegfx::B2VectorOrientation eIsClockwise1(::basegfx::tools::getOrientation(aPolyPoly1.getB2DPolygon(0L)));
+
+ aPolyPoly2 = ::basegfx::tools::correctOrientations(aPolyPoly2);
+ aPolyPoly2.removeDoublePoints();
+ ::basegfx::B2VectorOrientation eIsClockwise2(::basegfx::tools::getOrientation(aPolyPoly2.getB2DPolygon(0L)));
+
+ // set same orientation
+ if(eIsClockwise1 != eIsClockwise2)
+ aPolyPoly2.flip();
+
+ // force same poly count
+ if(aPolyPoly1.count() < aPolyPoly2.count())
+ ImpAddPolys(aPolyPoly1, aPolyPoly2);
+ else if(aPolyPoly2.count() < aPolyPoly1.count())
+ ImpAddPolys(aPolyPoly2, aPolyPoly1);
+
+ // use orientation flag from dialog
+ if(!pDlg->IsOrientationFade())
+ aPolyPoly2.flip();
+
+ // force same point counts
+ for( sal_uInt32 a(0L); a < aPolyPoly1.count(); a++ )
+ {
+ ::basegfx::B2DPolygon aSub1(aPolyPoly1.getB2DPolygon(a));
+ ::basegfx::B2DPolygon aSub2(aPolyPoly2.getB2DPolygon(a));
+
+ if(aSub1.count() < aSub2.count())
+ ImpEqualizePolyPointCount(aSub1, aSub2);
+ else if(aSub2.count() < aSub1.count())
+ ImpEqualizePolyPointCount(aSub2, aSub1);
+
+ aPolyPoly1.setB2DPolygon(a, aSub1);
+ aPolyPoly2.setB2DPolygon(a, aSub2);
+ }
+
+ if(ImpMorphPolygons(aPolyPoly1, aPolyPoly2, pDlg->GetFadeSteps(), aPolyPolyList))
+ {
+ String aString(mpView->GetDescriptionOfMarkedObjects());
+
+ aString.Append(sal_Unicode(' '));
+ aString.Append(String(SdResId(STR_UNDO_MORPHING)));
+
+ mpView->BegUndo(aString);
+ ImpInsertPolygons(aPolyPolyList, pDlg->IsAttributeFade(), pObj1, pObj2);
+ mpView->EndUndo();
+ }
+
+ // erzeugte Polygone wieder loeschen
+ for(pPolyPoly = (::basegfx::B2DPolyPolygon*)aPolyPolyList.First(); pPolyPoly; pPolyPoly = (::basegfx::B2DPolyPolygon *)aPolyPolyList.Next())
+ {
+ delete pPolyPoly;
+ }
+ }
+ }
+ delete pDlg;
+ SdrObject::Free( pCloneObj1 );
+ SdrObject::Free( pCloneObj2 );
+
+ SdrObject::Free( pPolyObj1 );
+ SdrObject::Free( pPolyObj2 );
+ }
+}
+
+::basegfx::B2DPolygon ImpGetExpandedPolygon(const ::basegfx::B2DPolygon& rCandidate, sal_uInt32 nNum)
+{
+ if(rCandidate.count() && nNum && rCandidate.count() != nNum)
+ {
+ // length of step in dest poly
+ ::basegfx::B2DPolygon aRetval;
+ const double fStep(::basegfx::tools::getLength(rCandidate) / (double)(rCandidate.isClosed() ? nNum : nNum - 1L));
+ double fDestPos(0.0);
+ double fSrcPos(0.0);
+ sal_uInt32 nSrcPos(0L);
+ sal_uInt32 nSrcPosNext((nSrcPos + 1L == rCandidate.count()) ? 0L : nSrcPos + 1L);
+ double fNextSrcLen(::basegfx::B2DVector(rCandidate.getB2DPoint(nSrcPos) - rCandidate.getB2DPoint(nSrcPosNext)).getLength());
+
+ for(sal_uInt32 b(0L); b < nNum; b++)
+ {
+ // calc fDestPos in source
+ while(fSrcPos + fNextSrcLen < fDestPos)
+ {
+ fSrcPos += fNextSrcLen;
+ nSrcPos++;
+ nSrcPosNext = (nSrcPos + 1L == rCandidate.count()) ? 0L : nSrcPos + 1L;
+ fNextSrcLen = ::basegfx::B2DVector(rCandidate.getB2DPoint(nSrcPos) - rCandidate.getB2DPoint(nSrcPosNext)).getLength();
+ }
+
+ // fDestPos is between fSrcPos and (fSrcPos + fNextSrcLen)
+ const double fLenA((fDestPos - fSrcPos) / fNextSrcLen);
+ const ::basegfx::B2DPoint aOld1(rCandidate.getB2DPoint(nSrcPos));
+ const ::basegfx::B2DPoint aOld2(rCandidate.getB2DPoint(nSrcPosNext));
+ ::basegfx::B2DPoint aNewPoint(basegfx::interpolate(aOld1, aOld2, fLenA));
+ aRetval.append(aNewPoint);
+
+ // next step
+ fDestPos += fStep;
+ }
+
+ if(aRetval.count() >= 3L)
+ {
+ aRetval.setClosed(rCandidate.isClosed());
+ }
+
+ return aRetval;
+ }
+ else
+ {
+ return rCandidate;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// make the point count of the polygons equal in adding points
+//
+void FuMorph::ImpEqualizePolyPointCount(::basegfx::B2DPolygon& rSmall, const ::basegfx::B2DPolygon& rBig)
+{
+ // create poly with equal point count
+ const sal_uInt32 nCnt(rBig.count());
+ ::basegfx::B2DPolygon aPoly1(ImpGetExpandedPolygon(rSmall, nCnt));
+
+ // create transformation for rBig to do the compare
+ const ::basegfx::B2DRange aSrcSize(::basegfx::tools::getRange(rBig));
+ const ::basegfx::B2DPoint aSrcPos(aSrcSize.getCenter());
+ const ::basegfx::B2DRange aDstSize(::basegfx::tools::getRange(rSmall));
+ const ::basegfx::B2DPoint aDstPos(aDstSize.getCenter());
+
+ basegfx::B2DHomMatrix aTrans(basegfx::tools::createTranslateB2DHomMatrix(-aSrcPos.getX(), -aSrcPos.getY()));
+ aTrans.scale(aDstSize.getWidth() / aSrcSize.getWidth(), aDstSize.getHeight() / aSrcSize.getHeight());
+ aTrans.translate(aDstPos.getX(), aDstPos.getY());
+
+ // transpose points to have smooth linear blending
+ ::basegfx::B2DPolygon aPoly2;
+ aPoly2.append(::basegfx::B2DPoint(), nCnt);
+ sal_uInt32 nInd(ImpGetNearestIndex(aPoly1, aTrans * rBig.getB2DPoint(0L)));
+
+ for(sal_uInt32 a(0L); a < nCnt; a++)
+ {
+ aPoly2.setB2DPoint((a + nCnt - nInd) % nCnt, aPoly1.getB2DPoint(a));
+ }
+
+ aPoly2.setClosed(rBig.isClosed());
+ rSmall = aPoly2;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+sal_uInt32 FuMorph::ImpGetNearestIndex(const ::basegfx::B2DPolygon& rPoly, const ::basegfx::B2DPoint& rPos)
+{
+ double fMinDist = 0.0;
+ sal_uInt32 nActInd = 0;
+
+ for(sal_uInt32 a(0L); a < rPoly.count(); a++)
+ {
+ double fNewDist(::basegfx::B2DVector(rPoly.getB2DPoint(a) - rPos).getLength());
+
+ if(!a || fNewDist < fMinDist)
+ {
+ fMinDist = fNewDist;
+ nActInd = a;
+ }
+ }
+
+ return nActInd;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// add to a point reduced polys until count is same
+//
+void FuMorph::ImpAddPolys(::basegfx::B2DPolyPolygon& rSmaller, const ::basegfx::B2DPolyPolygon& rBigger)
+{
+ while(rSmaller.count() < rBigger.count())
+ {
+ const ::basegfx::B2DPolygon aToBeCopied(rBigger.getB2DPolygon(rSmaller.count()));
+ const ::basegfx::B2DRange aToBeCopiedPolySize(::basegfx::tools::getRange(aToBeCopied));
+ ::basegfx::B2DPoint aNewPoint(aToBeCopiedPolySize.getCenter());
+ ::basegfx::B2DPolygon aNewPoly;
+
+ const ::basegfx::B2DRange aSrcSize(::basegfx::tools::getRange(rBigger.getB2DPolygon(0L)));
+ const ::basegfx::B2DPoint aSrcPos(aSrcSize.getCenter());
+ const ::basegfx::B2DRange aDstSize(::basegfx::tools::getRange(rSmaller.getB2DPolygon(0L)));
+ const ::basegfx::B2DPoint aDstPos(aDstSize.getCenter());
+ aNewPoint = aNewPoint - aSrcPos + aDstPos;
+
+ for(sal_uInt32 a(0L); a < aToBeCopied.count(); a++)
+ {
+ aNewPoly.append(aNewPoint);
+ }
+
+ rSmaller.append(aNewPoly);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// create group object with morphed polygons
+//
+void FuMorph::ImpInsertPolygons(List& rPolyPolyList3D, BOOL bAttributeFade,
+ const SdrObject* pObj1, const SdrObject* pObj2)
+{
+ Color aStartFillCol;
+ Color aEndFillCol;
+ Color aStartLineCol;
+ Color aEndLineCol;
+ long nStartLineWidth = 0;
+ long nEndLineWidth = 0;
+ SdrPageView* pPageView = mpView->GetSdrPageView();
+ SfxItemPool* pPool = pObj1->GetObjectItemPool();
+ SfxItemSet aSet1( *pPool,SDRATTR_START,SDRATTR_NOTPERSIST_FIRST-1,EE_ITEMS_START,EE_ITEMS_END,0 );
+ SfxItemSet aSet2( aSet1 );
+ BOOL bLineColor = FALSE;
+ BOOL bFillColor = FALSE;
+ BOOL bLineWidth = FALSE;
+ BOOL bIgnoreLine = FALSE;
+ BOOL bIgnoreFill = FALSE;
+
+ aSet1.Put(pObj1->GetMergedItemSet());
+ aSet2.Put(pObj2->GetMergedItemSet());
+
+ const XLineStyle eLineStyle1 = ITEMVALUE( aSet1, XATTR_LINESTYLE, XLineStyleItem );
+ const XLineStyle eLineStyle2 = ITEMVALUE( aSet2, XATTR_LINESTYLE, XLineStyleItem );
+ const XFillStyle eFillStyle1 = ITEMVALUE( aSet1, XATTR_FILLSTYLE, XFillStyleItem );
+ const XFillStyle eFillStyle2 = ITEMVALUE( aSet2, XATTR_FILLSTYLE, XFillStyleItem );
+
+ if ( bAttributeFade )
+ {
+ if ( ( eLineStyle1 != XLINE_NONE ) && ( eLineStyle2 != XLINE_NONE ) )
+ {
+ bLineWidth = bLineColor = TRUE;
+
+ aStartLineCol = static_cast< XLineColorItem const & >(
+ aSet1.Get(XATTR_LINECOLOR)).GetColorValue();
+ aEndLineCol = static_cast< XLineColorItem const & >(
+ aSet2.Get(XATTR_LINECOLOR)).GetColorValue();
+
+ nStartLineWidth = ITEMVALUE( aSet1, XATTR_LINEWIDTH, XLineWidthItem );
+ nEndLineWidth = ITEMVALUE( aSet2, XATTR_LINEWIDTH, XLineWidthItem );
+ }
+ else if ( ( eLineStyle1 == XLINE_NONE ) && ( eLineStyle2 == XLINE_NONE ) )
+ bIgnoreLine = TRUE;
+
+ if ( ( eFillStyle1 == XFILL_SOLID ) && ( eFillStyle2 == XFILL_SOLID ) )
+ {
+ bFillColor = TRUE;
+ aStartFillCol = static_cast< XFillColorItem const & >(
+ aSet1.Get(XATTR_FILLCOLOR)).GetColorValue();
+ aEndFillCol = static_cast< XFillColorItem const & >(
+ aSet2.Get(XATTR_FILLCOLOR)).GetColorValue();
+ }
+ else if ( ( eFillStyle1 == XFILL_NONE ) && ( eFillStyle2 == XFILL_NONE ) )
+ bIgnoreFill = TRUE;
+ }
+
+ if ( pPageView )
+ {
+ SfxItemSet aSet( aSet1 );
+ SdrObjGroup* pObjGroup = new SdrObjGroup;
+ SdrObjList* pObjList = pObjGroup->GetSubList();
+ const ULONG nCount = rPolyPolyList3D.Count();
+ const double fStep = 1. / ( nCount + 1 );
+ const double fDelta = nEndLineWidth - nStartLineWidth;
+ double fFactor = fStep;
+
+ aSet.Put( XLineStyleItem( XLINE_SOLID ) );
+ aSet.Put( XFillStyleItem( XFILL_SOLID ) );
+
+ for ( ULONG i = 0; i < nCount; i++, fFactor += fStep )
+ {
+ const ::basegfx::B2DPolyPolygon& rPolyPoly3D = *(::basegfx::B2DPolyPolygon*)rPolyPolyList3D.GetObject(i);
+ SdrPathObj* pNewObj = new SdrPathObj(OBJ_POLY, rPolyPoly3D);
+
+ // Linienfarbe
+ if ( bLineColor )
+ {
+ const basegfx::BColor aLineColor(basegfx::interpolate(aStartLineCol.getBColor(), aEndLineCol.getBColor(), fFactor));
+ aSet.Put( XLineColorItem( aEmptyStr, Color(aLineColor)));
+ }
+ else if ( bIgnoreLine )
+ aSet.Put( XLineStyleItem( XLINE_NONE ) );
+
+ // Fuellfarbe
+ if ( bFillColor )
+ {
+ const basegfx::BColor aFillColor(basegfx::interpolate(aStartFillCol.getBColor(), aEndFillCol.getBColor(), fFactor));
+ aSet.Put( XFillColorItem( aEmptyStr, Color(aFillColor)));
+ }
+ else if ( bIgnoreFill )
+ aSet.Put( XFillStyleItem( XFILL_NONE ) );
+
+ // Linienstaerke
+ if ( bLineWidth )
+ aSet.Put( XLineWidthItem( nStartLineWidth + (long) ( fFactor * fDelta + 0.5 ) ) );
+
+ pNewObj->SetMergedItemSetAndBroadcast(aSet);
+
+ pObjList->InsertObject( pNewObj, LIST_APPEND );
+ }
+
+ if ( nCount )
+ {
+ pObjList->InsertObject( pObj1->Clone(), 0 );
+ pObjList->InsertObject( pObj2->Clone(), LIST_APPEND );
+ mpView->DeleteMarked();
+ mpView->InsertObjectAtView( pObjGroup, *pPageView, SDRINSERT_SETDEFLAYER );
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// create single morphed PolyPolygon
+//
+::basegfx::B2DPolyPolygon* FuMorph::ImpCreateMorphedPolygon(
+ const ::basegfx::B2DPolyPolygon& rPolyPolyStart,
+ const ::basegfx::B2DPolyPolygon& rPolyPolyEnd,
+ double fMorphingFactor)
+{
+ ::basegfx::B2DPolyPolygon* pNewPolyPolygon = new ::basegfx::B2DPolyPolygon();
+ const double fFactor = 1.0 - fMorphingFactor;
+
+ for(sal_uInt32 a(0L); a < rPolyPolyStart.count(); a++)
+ {
+ const ::basegfx::B2DPolygon aPolyStart(rPolyPolyStart.getB2DPolygon(a));
+ const ::basegfx::B2DPolygon aPolyEnd(rPolyPolyEnd.getB2DPolygon(a));
+ const sal_uInt32 nCount(aPolyStart.count());
+ ::basegfx::B2DPolygon aNewPolygon;
+
+ for(sal_uInt32 b(0L); b < nCount; b++)
+ {
+ const ::basegfx::B2DPoint& aPtStart(aPolyStart.getB2DPoint(b));
+ const ::basegfx::B2DPoint& aPtEnd(aPolyEnd.getB2DPoint(b));
+ aNewPolygon.append(aPtEnd + ((aPtStart - aPtEnd) * fFactor));
+ }
+
+ aNewPolygon.setClosed(aPolyStart.isClosed() && aPolyEnd.isClosed());
+ pNewPolyPolygon->append(aNewPolygon);
+ }
+
+ return pNewPolyPolygon;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// create morphed PolyPolygons
+//
+sal_Bool FuMorph::ImpMorphPolygons(
+ const ::basegfx::B2DPolyPolygon& rPolyPoly1,
+ const ::basegfx::B2DPolyPolygon& rPolyPoly2,
+ const sal_uInt16 nSteps, List& rPolyPolyList3D)
+{
+ if(nSteps)
+ {
+ const ::basegfx::B2DRange aStartPolySize(::basegfx::tools::getRange(rPolyPoly1));
+ const ::basegfx::B2DPoint aStartCenter(aStartPolySize.getCenter());
+ const ::basegfx::B2DRange aEndPolySize(::basegfx::tools::getRange(rPolyPoly2));
+ const ::basegfx::B2DPoint aEndCenter(aEndPolySize.getCenter());
+ const ::basegfx::B2DPoint aDelta(aEndCenter - aStartCenter);
+ const double fFactor(1.0 / (nSteps + 1));
+ double fValue(0.0);
+
+ for(sal_uInt16 i(0); i < nSteps; i++)
+ {
+ fValue += fFactor;
+ ::basegfx::B2DPolyPolygon* pNewPolyPoly2D = ImpCreateMorphedPolygon(rPolyPoly1, rPolyPoly2, fValue);
+
+ const ::basegfx::B2DRange aNewPolySize(::basegfx::tools::getRange(*pNewPolyPoly2D));
+ const ::basegfx::B2DPoint aNewS(aNewPolySize.getCenter());
+ const ::basegfx::B2DPoint aRealS(aStartCenter + (aDelta * fValue));
+ const ::basegfx::B2DPoint aDiff(aRealS - aNewS);
+
+ pNewPolyPoly2D->transform(basegfx::tools::createTranslateB2DHomMatrix(aDiff));
+ rPolyPolyList3D.Insert(pNewPolyPoly2D, LIST_APPEND);
+ }
+ }
+ return TRUE;
+}
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuoaprms.cxx b/sd/source/ui/func/fuoaprms.cxx
new file mode 100644
index 000000000000..b348d6533930
--- /dev/null
+++ b/sd/source/ui/func/fuoaprms.cxx
@@ -0,0 +1,839 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuoaprms.hxx"
+
+#include "sdattr.hxx"
+#include <svx/svdpagv.hxx>
+#include <editeng/colritem.hxx>
+#include <svx/svdundo.hxx>
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <svl/aeitem.hxx>
+#include "svx/xtable.hxx"
+
+#include "strings.hrc"
+#include "glob.hrc"
+#include "drawdoc.hxx"
+#include "ViewShell.hxx"
+#include "anminfo.hxx"
+#include "unoaprms.hxx" // Undo-Action
+#include "sdundogr.hxx" // Undo Gruppe
+#include "View.hxx"
+#include "sdabstdlg.hxx"
+#include "sdresid.hxx"
+#include <vcl/salbtype.hxx> // FRound
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+using namespace ::com::sun::star;
+
+namespace sd {
+
+TYPEINIT1( FuObjectAnimationParameters, FuPoor );
+
+#define ATTR_MISSING 0 // Attribut nicht verfuegbar
+#define ATTR_MIXED 1 // Attribut uneindeutig (bei Mehrfachselektion)
+#define ATTR_SET 2 // Attribut eindeutig
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuObjectAnimationParameters::FuObjectAnimationParameters (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuObjectAnimationParameters::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuObjectAnimationParameters( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuObjectAnimationParameters::DoExecute( SfxRequest& rReq )
+{
+ SfxUndoManager* pUndoMgr = mpViewShell->GetViewFrame()->GetObjectShell()->GetUndoManager();
+
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ ULONG nCount = rMarkList.GetMarkCount();
+ ULONG nObject = 0;
+
+ short nAnimationSet = ATTR_MISSING;
+ short nEffectSet = ATTR_MISSING;
+ short nTextEffectSet = ATTR_MISSING;
+ short nSpeedSet = ATTR_MISSING;
+ short nFadeColorSet = ATTR_MISSING;
+ short nFadeOutSet = ATTR_MISSING;
+ short nInvisibleSet = ATTR_MISSING;
+ short nSoundOnSet = ATTR_MISSING;
+ short nSoundFileSet = ATTR_MISSING;
+ short nPlayFullSet = ATTR_MISSING;
+ short nClickActionSet = ATTR_MISSING;
+ short nBookmarkSet = ATTR_MISSING;
+
+ short nSecondEffectSet = ATTR_MISSING;
+ short nSecondSpeedSet = ATTR_MISSING;
+ short nSecondSoundOnSet = ATTR_MISSING;
+ short nSecondPlayFullSet = ATTR_MISSING;
+
+
+
+// BOOL bDontKnow = FALSE;
+
+ // defaulten (fuer Undo-Aktion)
+ presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
+ presentation::AnimationEffect eTextEffect = presentation::AnimationEffect_NONE;
+ presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_MEDIUM;
+ BOOL bActive = FALSE;
+ BOOL bFadeOut = FALSE;
+ Color aFadeColor = COL_LIGHTGRAY;
+ BOOL bInvisible = FALSE;
+ BOOL bSoundOn = FALSE;
+ String aSound;
+ BOOL bPlayFull = FALSE;
+ presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
+ String aBookmark;
+
+ presentation::AnimationEffect eSecondEffect = presentation::AnimationEffect_NONE;
+ presentation::AnimationSpeed eSecondSpeed = presentation::AnimationSpeed_MEDIUM;
+ BOOL bSecondSoundOn = FALSE;
+ BOOL bSecondPlayFull = FALSE;
+
+
+ SdAnimationInfo* pInfo;
+ SdrMark* pMark;
+
+ // das erste Objekt untersuchen
+ pMark = rMarkList.GetMark(0);
+ pInfo = mpDoc->GetAnimationInfo(pMark->GetMarkedSdrObj());
+ if( pInfo )
+ {
+ bActive = pInfo->mbActive;
+ nAnimationSet = ATTR_SET;
+
+ eEffect = pInfo->meEffect;
+ nEffectSet = ATTR_SET;
+
+ eTextEffect = pInfo->meTextEffect;
+ nTextEffectSet = ATTR_SET;
+
+ eSpeed = pInfo->meSpeed;
+ nSpeedSet = ATTR_SET;
+
+ bFadeOut = pInfo->mbDimPrevious;
+ nFadeOutSet = ATTR_SET;
+
+ aFadeColor = pInfo->maDimColor;
+ nFadeColorSet = ATTR_SET;
+
+ bInvisible = pInfo->mbDimHide;
+ nInvisibleSet = ATTR_SET;
+
+ bSoundOn = pInfo->mbSoundOn;
+ nSoundOnSet = ATTR_SET;
+
+ aSound = pInfo->maSoundFile;
+ nSoundFileSet = ATTR_SET;
+
+ bPlayFull = pInfo->mbPlayFull;
+ nPlayFullSet = ATTR_SET;
+
+ eClickAction = pInfo->meClickAction;
+ nClickActionSet = ATTR_SET;
+
+ aBookmark = pInfo->GetBookmark();
+ nBookmarkSet = ATTR_SET;
+
+ eSecondEffect = pInfo->meSecondEffect;
+ nSecondEffectSet = ATTR_SET;
+
+ eSecondSpeed = pInfo->meSecondSpeed;
+ nSecondSpeedSet = ATTR_SET;
+
+ bSecondSoundOn = pInfo->mbSecondSoundOn;
+ nSecondSoundOnSet = ATTR_SET;
+
+ bSecondPlayFull = pInfo->mbSecondPlayFull;
+ nSecondPlayFullSet = ATTR_SET;
+ }
+
+ // ggfs. weitere Objekte untersuchen
+ for( nObject = 1; nObject < nCount; nObject++ )
+ {
+ pMark = rMarkList.GetMark( nObject );
+ SdrObject* pObject = pMark->GetMarkedSdrObj();
+ pInfo = mpDoc->GetAnimationInfo(pObject);
+ if( pInfo )
+ {
+ if( bActive != pInfo->mbActive )
+ nAnimationSet = ATTR_MIXED;
+
+ if( eEffect != pInfo->meEffect )
+ nEffectSet = ATTR_MIXED;
+
+ if( eTextEffect != pInfo->meTextEffect )
+ nTextEffectSet = ATTR_MIXED;
+
+ if( eSpeed != pInfo->meSpeed )
+ nSpeedSet = ATTR_MIXED;
+
+ if( bFadeOut != pInfo->mbDimPrevious )
+ nFadeOutSet = ATTR_MIXED;
+
+ if( aFadeColor != pInfo->maDimColor )
+ nFadeColorSet = ATTR_MIXED;
+
+ if( bInvisible != pInfo->mbDimHide )
+ nInvisibleSet = ATTR_MIXED;
+
+ if( bSoundOn != pInfo->mbSoundOn )
+ nSoundOnSet = ATTR_MIXED;
+
+ if( aSound != pInfo->maSoundFile )
+ nSoundFileSet = ATTR_MIXED;
+
+ if( bPlayFull != pInfo->mbPlayFull )
+ nPlayFullSet = ATTR_MIXED;
+
+ if( eClickAction != pInfo->meClickAction )
+ nClickActionSet = ATTR_MIXED;
+
+ if( aBookmark != pInfo->GetBookmark() )
+ nBookmarkSet = ATTR_MIXED;
+
+ if( eSecondEffect != pInfo->meSecondEffect )
+ nSecondEffectSet = ATTR_MIXED;
+
+ if( eSecondSpeed != pInfo->meSecondSpeed )
+ nSecondSpeedSet = ATTR_MIXED;
+
+ if( bSecondSoundOn != pInfo->mbSecondSoundOn )
+ nSecondSoundOnSet = ATTR_MIXED;
+
+ if( bSecondPlayFull != pInfo->mbSecondPlayFull )
+ nSecondPlayFullSet = ATTR_MIXED;
+ }
+ else
+ {
+ if (nAnimationSet == ATTR_SET && bActive == TRUE)
+ nAnimationSet = ATTR_MIXED;
+
+ if (nEffectSet == ATTR_SET && eEffect != presentation::AnimationEffect_NONE)
+ nEffectSet = ATTR_MIXED;
+
+ if (nTextEffectSet == ATTR_SET && eTextEffect != presentation::AnimationEffect_NONE)
+ nTextEffectSet = ATTR_MIXED;
+
+ if (nSpeedSet == ATTR_SET)
+ nSpeedSet = ATTR_MIXED;
+
+ if (nFadeOutSet == ATTR_SET && bFadeOut == TRUE)
+ nFadeOutSet = ATTR_MIXED;
+
+ if (nFadeColorSet == ATTR_SET)
+ nFadeColorSet = ATTR_MIXED;
+
+ if (nInvisibleSet == ATTR_SET && bInvisible == TRUE)
+ nInvisibleSet = ATTR_MIXED;
+
+ if (nSoundOnSet == ATTR_SET && bSoundOn == TRUE)
+ nSoundOnSet = ATTR_MIXED;
+
+ if (nSoundFileSet == ATTR_SET)
+ nSoundFileSet = ATTR_MIXED;
+
+ if (nPlayFullSet == ATTR_SET && bPlayFull == TRUE)
+ nPlayFullSet = ATTR_MIXED;
+
+ if (nClickActionSet == ATTR_SET && eClickAction != presentation::ClickAction_NONE)
+ nClickActionSet = ATTR_MIXED;
+
+ if (nBookmarkSet == ATTR_SET)
+ nBookmarkSet = ATTR_MIXED;
+
+ if (nSecondEffectSet == ATTR_SET && eSecondEffect != presentation::AnimationEffect_NONE)
+ nSecondEffectSet = ATTR_MIXED;
+
+ if (nSecondSpeedSet == ATTR_SET)
+ nSecondSpeedSet = ATTR_MIXED;
+
+ if (nSecondSoundOnSet == ATTR_SET && bSecondSoundOn == TRUE)
+ nSecondSoundOnSet = ATTR_MIXED;
+
+ if (nSecondPlayFullSet == ATTR_SET && bSecondPlayFull == TRUE)
+ nSecondPlayFullSet = ATTR_MIXED;
+ }
+ }
+
+ // Genau zwei Objekte mit Pfadeffekt? Dann gilt nur die Animationsinfo
+ // am bewegten Objekt.
+ if (nCount == 2)
+ {
+ SdrObject* pObject1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
+ SdrObjKind eKind1 = (SdrObjKind)pObject1->GetObjIdentifier();
+ SdrObjKind eKind2 = (SdrObjKind)pObject2->GetObjIdentifier();
+ SdAnimationInfo* pInfo1 = mpDoc->GetAnimationInfo(pObject1);
+ SdAnimationInfo* pInfo2 = mpDoc->GetAnimationInfo(pObject2);
+ pInfo = NULL;
+
+ if (pObject1->GetObjInventor() == SdrInventor &&
+ ((eKind1 == OBJ_LINE) || // 2-Punkt-Linie
+ (eKind1 == OBJ_PLIN) || // Polygon
+ (eKind1 == OBJ_PATHLINE)) && // Bezier-Kurve
+ (pInfo2 && pInfo2->meEffect == presentation::AnimationEffect_PATH))
+ {
+ pInfo = pInfo2;
+ }
+
+ if (pObject2->GetObjInventor() == SdrInventor &&
+ ((eKind2 == OBJ_LINE) || // 2-Punkt-Linie
+ (eKind2 == OBJ_PLIN) || // Polygon
+ (eKind2 == OBJ_PATHLINE)) && // Bezier-Kurve
+ (pInfo1 && pInfo1->meEffect == presentation::AnimationEffect_PATH))
+ {
+ pInfo = pInfo1;
+ }
+
+ if (pInfo)
+ {
+ bActive = pInfo->mbActive; nAnimationSet = ATTR_SET;
+ eEffect = pInfo->meEffect; nEffectSet = ATTR_SET;
+ eTextEffect = pInfo->meTextEffect; nTextEffectSet = ATTR_SET;
+ eSpeed = pInfo->meSpeed; nSpeedSet = ATTR_SET;
+ bFadeOut = pInfo->mbDimPrevious; nFadeOutSet = ATTR_SET;
+ aFadeColor = pInfo->maDimColor; nFadeColorSet = ATTR_SET;
+ bInvisible = pInfo->mbDimHide; nInvisibleSet = ATTR_SET;
+ bSoundOn = pInfo->mbSoundOn; nSoundOnSet = ATTR_SET;
+ aSound = pInfo->maSoundFile; nSoundFileSet = ATTR_SET;
+ bPlayFull = pInfo->mbPlayFull; nPlayFullSet = ATTR_SET;
+ eClickAction = pInfo->meClickAction; nClickActionSet = ATTR_SET;
+ aBookmark = pInfo->GetBookmark(); nBookmarkSet = ATTR_SET;
+ eSecondEffect = pInfo->meSecondEffect; nSecondEffectSet = ATTR_SET;
+ eSecondSpeed = pInfo->meSecondSpeed; nSecondSpeedSet = ATTR_SET;
+ bSecondSoundOn = pInfo->mbSecondSoundOn; nSecondSoundOnSet = ATTR_SET;
+ bSecondPlayFull = pInfo->mbSecondPlayFull; nSecondPlayFullSet = ATTR_SET;
+ }
+ }
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if(!pArgs)
+ {
+ // ItemSet fuer Dialog fuellen
+ SfxItemSet aSet(mpDoc->GetPool(), ATTR_ANIMATION_START, ATTR_ACTION_END);
+
+ // das Set besetzen
+ if (nAnimationSet == ATTR_SET)
+ aSet.Put( SfxBoolItem( ATTR_ANIMATION_ACTIVE, bActive));
+ else if (nAnimationSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ANIMATION_ACTIVE);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_ACTIVE, FALSE));
+
+ if (nEffectSet == ATTR_SET)
+ aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_EFFECT, (USHORT)eEffect));
+ else if (nEffectSet == ATTR_MIXED)
+ aSet.InvalidateItem( ATTR_ANIMATION_EFFECT );
+ else
+ aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_EFFECT, presentation::AnimationEffect_NONE));
+
+ if (nTextEffectSet == ATTR_SET)
+ aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_TEXTEFFECT, (USHORT)eTextEffect));
+ else if (nTextEffectSet == ATTR_MIXED)
+ aSet.InvalidateItem( ATTR_ANIMATION_TEXTEFFECT );
+ else
+ aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_TEXTEFFECT, presentation::AnimationEffect_NONE));
+
+ if (nSpeedSet == ATTR_SET)
+ aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_SPEED, (USHORT)eSpeed));
+ else
+ aSet.InvalidateItem(ATTR_ANIMATION_SPEED);
+
+ if (nFadeOutSet == ATTR_SET)
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT, bFadeOut));
+ else if (nFadeOutSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ANIMATION_FADEOUT);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT, FALSE));
+
+ if (nFadeColorSet == ATTR_SET)
+ aSet.Put(SvxColorItem(aFadeColor, ATTR_ANIMATION_COLOR));
+ else if (nFadeColorSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ANIMATION_COLOR);
+ else
+ aSet.Put(SvxColorItem(RGB_Color(COL_LIGHTGRAY), ATTR_ANIMATION_COLOR));
+
+ if (nInvisibleSet == ATTR_SET)
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE, bInvisible));
+ else if (nInvisibleSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ANIMATION_INVISIBLE);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE, FALSE));
+
+ if (nSoundOnSet == ATTR_SET)
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON, bSoundOn));
+ else if (nSoundOnSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ANIMATION_SOUNDON);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON, FALSE));
+
+ if (nSoundFileSet == ATTR_SET)
+ aSet.Put(SfxStringItem(ATTR_ANIMATION_SOUNDFILE, aSound));
+ else
+ aSet.InvalidateItem(ATTR_ANIMATION_SOUNDFILE);
+
+ if (nPlayFullSet == ATTR_SET)
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL, bPlayFull));
+ else if (nPlayFullSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ANIMATION_PLAYFULL);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL, FALSE));
+
+ if (nClickActionSet == ATTR_SET)
+ aSet.Put(SfxAllEnumItem(ATTR_ACTION, (USHORT)eClickAction));
+ else if (nClickActionSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ACTION);
+ else
+ aSet.Put(SfxAllEnumItem(ATTR_ACTION, presentation::ClickAction_NONE));
+
+ if (nBookmarkSet == ATTR_SET)
+ aSet.Put(SfxStringItem(ATTR_ACTION_FILENAME, aBookmark));
+ else
+ aSet.InvalidateItem(ATTR_ACTION_FILENAME);
+
+ if (nSecondEffectSet == ATTR_SET)
+ aSet.Put(SfxAllEnumItem(ATTR_ACTION_EFFECT, (USHORT)eSecondEffect));
+ else if (nSecondEffectSet == ATTR_MIXED)
+ aSet.InvalidateItem( ATTR_ACTION_EFFECT );
+ else
+ aSet.Put(SfxAllEnumItem(ATTR_ACTION_EFFECT, presentation::AnimationEffect_NONE));
+
+ if (nSecondSpeedSet == ATTR_SET)
+ aSet.Put(SfxAllEnumItem(ATTR_ACTION_EFFECTSPEED, (USHORT)eSecondSpeed));
+ else
+ aSet.InvalidateItem(ATTR_ACTION_EFFECTSPEED);
+
+ if (nSecondSoundOnSet == ATTR_SET)
+ aSet.Put(SfxBoolItem(ATTR_ACTION_SOUNDON, bSecondSoundOn));
+ else if (nSecondSoundOnSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ACTION_SOUNDON);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ACTION_SOUNDON, FALSE));
+
+ if (nSecondPlayFullSet == ATTR_SET)
+ aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, bSecondPlayFull));
+ else if (nPlayFullSet == ATTR_MIXED)
+ aSet.InvalidateItem(ATTR_ACTION_PLAYFULL);
+ else
+ aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, FALSE));
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ SfxAbstractDialog* pDlg = pFact ? pFact->CreatSdActionDialog( NULL, &aSet, mpView ) : 0;
+
+ USHORT nResult = pDlg ? pDlg->Execute() : RET_CANCEL;
+
+ if( nResult == RET_OK )
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ pArgs = rReq.GetArgs();
+ }
+
+ delete pDlg;
+
+ if( nResult != RET_OK )
+ return;
+ }
+
+ // Auswertung des ItemSets
+ if (pArgs->GetItemState(ATTR_ANIMATION_ACTIVE) == SFX_ITEM_SET)
+ {
+ bActive = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_ACTIVE)).GetValue();
+ nAnimationSet = ATTR_SET;
+ }
+ else
+ nAnimationSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_EFFECT) == SFX_ITEM_SET)
+ {
+ eEffect = (presentation::AnimationEffect)((SfxAllEnumItem&) pArgs->
+ Get(ATTR_ANIMATION_EFFECT)).GetValue();
+ nEffectSet = ATTR_SET;
+ }
+ else
+ nEffectSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_TEXTEFFECT) == SFX_ITEM_SET)
+ {
+ eTextEffect = (presentation::AnimationEffect)((SfxAllEnumItem&) pArgs->
+ Get(ATTR_ANIMATION_TEXTEFFECT)).GetValue();
+ nTextEffectSet = ATTR_SET;
+ }
+ else
+ nTextEffectSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_SPEED) == SFX_ITEM_SET)
+ {
+ eSpeed = (presentation::AnimationSpeed)((SfxAllEnumItem&) pArgs->
+ Get(ATTR_ANIMATION_SPEED)).GetValue();
+ nSpeedSet = ATTR_SET;
+ }
+ else
+ nSpeedSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_FADEOUT) == SFX_ITEM_SET)
+ {
+ bFadeOut = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_FADEOUT)).GetValue();
+ nFadeOutSet = ATTR_SET;
+ }
+ else
+ nFadeOutSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_INVISIBLE) == SFX_ITEM_SET)
+ {
+ bInvisible = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_INVISIBLE)).GetValue();
+ nInvisibleSet = ATTR_SET;
+ }
+ else
+ nInvisibleSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_SOUNDON) == SFX_ITEM_SET)
+ {
+ bSoundOn = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_SOUNDON)).GetValue();
+ nSoundOnSet = ATTR_SET;
+ }
+ else
+ nSoundOnSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_SOUNDFILE) == SFX_ITEM_SET)
+ {
+ aSound = ((SfxStringItem&)pArgs->Get(ATTR_ANIMATION_SOUNDFILE)).GetValue();
+ nSoundFileSet = ATTR_SET;
+ }
+ else
+ nSoundFileSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_COLOR) == SFX_ITEM_SET)
+ {
+ aFadeColor = ((SvxColorItem&)pArgs->Get(ATTR_ANIMATION_COLOR)).GetValue();
+ nFadeColorSet = ATTR_SET;
+ }
+ else
+ nFadeColorSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ANIMATION_PLAYFULL) == SFX_ITEM_SET)
+ {
+ bPlayFull = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_PLAYFULL)).GetValue();
+ nPlayFullSet = ATTR_SET;
+ }
+ else
+ nPlayFullSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ACTION) == SFX_ITEM_SET)
+ {
+ eClickAction = (presentation::ClickAction)((SfxAllEnumItem&)pArgs->
+ Get(ATTR_ACTION)).GetValue();
+ nClickActionSet = ATTR_SET;
+ }
+ else
+ nClickActionSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ACTION_FILENAME) == SFX_ITEM_SET)
+ {
+ aBookmark = ((SfxStringItem&)pArgs->
+ Get(ATTR_ACTION_FILENAME)).GetValue();
+ nBookmarkSet = ATTR_SET;
+ }
+ else
+ nBookmarkSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ACTION_EFFECT) == SFX_ITEM_SET)
+ {
+ eSecondEffect = (presentation::AnimationEffect)((SfxAllEnumItem&) pArgs->
+ Get(ATTR_ACTION_EFFECT)).GetValue();
+ nSecondEffectSet = ATTR_SET;
+ }
+ else
+ nSecondEffectSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ACTION_EFFECTSPEED) == SFX_ITEM_SET)
+ {
+ eSecondSpeed = (presentation::AnimationSpeed)((SfxAllEnumItem&) pArgs->
+ Get(ATTR_ACTION_EFFECTSPEED)).GetValue();
+ nSecondSpeedSet = ATTR_SET;
+ }
+ else
+ nSecondSpeedSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ACTION_SOUNDON) == SFX_ITEM_SET)
+ {
+ bSecondSoundOn = ((SfxBoolItem&)pArgs->Get(ATTR_ACTION_SOUNDON)).GetValue();
+ nSecondSoundOnSet = ATTR_SET;
+ }
+ else
+ nSecondSoundOnSet = ATTR_MISSING;
+
+ if (pArgs->GetItemState(ATTR_ACTION_PLAYFULL) == SFX_ITEM_SET)
+ {
+ bSecondPlayFull = ((SfxBoolItem&)pArgs->Get(ATTR_ACTION_PLAYFULL)).GetValue();
+ nSecondPlayFullSet = ATTR_SET;
+ }
+ else
+ nSecondPlayFullSet = ATTR_MISSING;
+
+ // Wenn irgendwelche Attribute ausgewaehlt wurden
+ if (nEffectSet == ATTR_SET ||
+ nTextEffectSet == ATTR_SET ||
+ nSpeedSet == ATTR_SET ||
+ nAnimationSet == ATTR_SET ||
+ nFadeOutSet == ATTR_SET ||
+ nFadeColorSet == ATTR_SET ||
+ nInvisibleSet == ATTR_SET ||
+ nSoundOnSet == ATTR_SET ||
+ nSoundFileSet == ATTR_SET ||
+ nPlayFullSet == ATTR_SET ||
+ nClickActionSet == ATTR_SET ||
+ nBookmarkSet == ATTR_SET ||
+ nSecondEffectSet == ATTR_SET ||
+ nSecondSpeedSet == ATTR_SET ||
+ nSecondSoundOnSet == ATTR_SET ||
+ nSecondPlayFullSet == ATTR_SET)
+ {
+ // String fuer Undo-Group und List-Action
+ String aComment(SdResId(STR_UNDO_ANIMATION));
+
+ // bei 'an Kurve entlang' gibt's noch eine extra UndoAction, darum
+ // hier klammern
+ pUndoMgr->EnterListAction(aComment, aComment);
+
+ // Undo Gruppe erzeugen
+ SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc);
+ pUndoGroup->SetComment(aComment);
+
+
+ // fuer den Pfad-Effekt einige Dinge merken
+ SdrObject* pRunningObj = NULL;
+ SdrPathObj* pPath = NULL;
+ if (eEffect == presentation::AnimationEffect_PATH && nEffectSet == ATTR_SET)
+ {
+ DBG_ASSERT(nCount == 2, "dieser Effekt braucht genau 2 selektierte Objekte");
+ SdrObject* pObject1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
+ SdrObjKind eKind1 = (SdrObjKind)pObject1->GetObjIdentifier();
+ SdrObjKind eKind2 = (SdrObjKind)pObject2->GetObjIdentifier();
+
+ if (pObject1->GetObjInventor() == SdrInventor &&
+ ((eKind1 == OBJ_LINE) || // 2-Punkt-Linie
+ (eKind1 == OBJ_PLIN) || // Polygon
+ (eKind1 == OBJ_PATHLINE))) // Bezier-Kurve
+ {
+ pPath = (SdrPathObj*)pObject1;
+ pRunningObj = pObject2;
+ }
+
+ if (pObject2->GetObjInventor() == SdrInventor &&
+ ((eKind2 == OBJ_LINE) || // 2-Punkt-Linie
+ (eKind2 == OBJ_PLIN) || // Polygon
+ (eKind2 == OBJ_PATHLINE))) // Bezier-Kurve
+ {
+ pPath = (SdrPathObj*)pObject2;
+ pRunningObj = pObject1;
+ }
+
+ DBG_ASSERT(pPath, "keine Kurve gefunden");
+
+
+ // das laufende Objekt auf das Kurvenende schieben
+ Rectangle aCurRect(pRunningObj->GetLogicRect());
+ Point aCurCenter(aCurRect.Center());
+ const ::basegfx::B2DPolyPolygon& rPolyPolygon = pPath->GetPathPoly();
+ sal_uInt32 nNoOfPolygons(rPolyPolygon.count());
+ const ::basegfx::B2DPolygon aPolygon(rPolyPolygon.getB2DPolygon(nNoOfPolygons - 1L));
+ sal_uInt32 nPoints(aPolygon.count());
+ const ::basegfx::B2DPoint aNewB2DCenter(aPolygon.getB2DPoint(nPoints - 1L));
+ const Point aNewCenter(FRound(aNewB2DCenter.getX()), FRound(aNewB2DCenter.getY()));
+ Size aDistance(aNewCenter.X() - aCurCenter.X(), aNewCenter.Y() - aCurCenter.Y());
+ pRunningObj->Move(aDistance);
+
+ pUndoMgr->AddUndoAction(mpDoc->GetSdrUndoFactory().CreateUndoMoveObject( *pRunningObj, aDistance));
+ }
+
+ for (nObject = 0; nObject < nCount; nObject++)
+ {
+ SdrObject* pObject = rMarkList.GetMark(nObject)->GetMarkedSdrObj();
+
+ pInfo = mpDoc->GetAnimationInfo(pObject);
+
+ BOOL bCreated = FALSE;
+ if( !pInfo )
+ {
+ pInfo = SdDrawDocument::GetShapeUserData(*pObject,true);
+ bCreated = TRUE;
+ }
+
+ // das Pfadobjekt fuer 'an Kurve entlang'?
+ if (eEffect == presentation::AnimationEffect_PATH && pObject == pPath)
+ {
+ SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction
+ (mpDoc, pObject, bCreated);
+ pAction->SetActive(pInfo->mbActive, pInfo->mbActive);
+ pAction->SetEffect(pInfo->meEffect, pInfo->meEffect);
+ pAction->SetTextEffect(pInfo->meTextEffect, pInfo->meTextEffect);
+ pAction->SetSpeed(pInfo->meSpeed, pInfo->meSpeed);
+ pAction->SetDim(pInfo->mbDimPrevious, pInfo->mbDimPrevious);
+ pAction->SetDimColor(pInfo->maDimColor, pInfo->maDimColor);
+ pAction->SetDimHide(pInfo->mbDimHide, pInfo->mbDimHide);
+ pAction->SetSoundOn(pInfo->mbSoundOn, pInfo->mbSoundOn);
+ pAction->SetSound(pInfo->maSoundFile, pInfo->maSoundFile);
+ pAction->SetPlayFull(pInfo->mbPlayFull, pInfo->mbPlayFull);
+// pAction->SetPathObj(pInfo->mpPathObj, pInfo->mpPathObj);
+ pAction->SetClickAction(pInfo->meClickAction, pInfo->meClickAction);
+ pAction->SetBookmark(pInfo->GetBookmark(), pInfo->GetBookmark());
+// pAction->SetInvisibleInPres(pInfo->mbInvisibleInPresentation, TRUE);
+ pAction->SetVerb(pInfo->mnVerb, pInfo->mnVerb);
+ pAction->SetSecondEffect(pInfo->meSecondEffect, pInfo->meSecondEffect);
+ pAction->SetSecondSpeed(pInfo->meSecondSpeed, pInfo->meSecondSpeed);
+ pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, pInfo->mbSecondSoundOn);
+ pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull, pInfo->mbSecondPlayFull);
+ pUndoGroup->AddAction(pAction);
+
+// pInfo->mbInvisibleInPresentation = TRUE;
+ }
+ else
+ {
+
+ // Undo-Action mit alten und neuen Groessen erzeugen
+ SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction
+ (mpDoc, pObject, bCreated);
+ pAction->SetActive(pInfo->mbActive, bActive);
+ pAction->SetEffect(pInfo->meEffect, eEffect);
+ pAction->SetTextEffect(pInfo->meTextEffect, eTextEffect);
+ pAction->SetSpeed(pInfo->meSpeed, eSpeed);
+ pAction->SetDim(pInfo->mbDimPrevious, bFadeOut);
+ pAction->SetDimColor(pInfo->maDimColor, aFadeColor);
+ pAction->SetDimHide(pInfo->mbDimHide, bInvisible);
+ pAction->SetSoundOn(pInfo->mbSoundOn, bSoundOn);
+ pAction->SetSound(pInfo->maSoundFile, aSound);
+ pAction->SetPlayFull(pInfo->mbPlayFull, bPlayFull);
+ pAction->SetPathObj(pInfo->mpPathObj, pPath);
+ pAction->SetClickAction(pInfo->meClickAction, eClickAction);
+ pAction->SetBookmark(pInfo->GetBookmark(), aBookmark);
+// pAction->SetInvisibleInPres(pInfo->mbInvisibleInPresentation,
+// pInfo->mbInvisibleInPresentation);
+ pAction->SetVerb(pInfo->mnVerb, (USHORT)pInfo->GetBookmark().ToInt32() );
+ pAction->SetSecondEffect(pInfo->meSecondEffect, eSecondEffect);
+ pAction->SetSecondSpeed(pInfo->meSecondSpeed, eSecondSpeed);
+ pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, bSecondSoundOn);
+ pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull,bSecondPlayFull);
+ pUndoGroup->AddAction(pAction);
+
+ // neue Werte am Infoblock des Objekts eintragen
+ if (nAnimationSet == ATTR_SET)
+ pInfo->mbActive = bActive;
+
+ if (nEffectSet == ATTR_SET)
+ pInfo->meEffect = eEffect;
+
+ if (nTextEffectSet == ATTR_SET)
+ pInfo->meTextEffect = eTextEffect;
+
+ if (nSpeedSet == ATTR_SET)
+ pInfo->meSpeed = eSpeed;
+
+ if (nFadeOutSet == ATTR_SET)
+ pInfo->mbDimPrevious = bFadeOut;
+
+ if (nFadeColorSet == ATTR_SET)
+ pInfo->maDimColor = aFadeColor;
+
+ if (nInvisibleSet == ATTR_SET)
+ pInfo->mbDimHide = bInvisible;
+
+ if (nSoundOnSet == ATTR_SET)
+ pInfo->mbSoundOn = bSoundOn;
+
+ if (nSoundFileSet == ATTR_SET)
+ pInfo->maSoundFile = aSound;
+
+ if (nPlayFullSet == ATTR_SET)
+ pInfo->mbPlayFull = bPlayFull;
+
+ if (nClickActionSet == ATTR_SET)
+ pInfo->meClickAction = eClickAction;
+
+ if (nBookmarkSet == ATTR_SET)
+ pInfo->SetBookmark( aBookmark );
+
+ if (nSecondEffectSet == ATTR_SET)
+ pInfo->meSecondEffect = eSecondEffect;
+
+ if (nSecondSpeedSet == ATTR_SET)
+ pInfo->meSecondSpeed = eSecondSpeed;
+
+ if (nSecondSoundOnSet == ATTR_SET)
+ pInfo->mbSecondSoundOn = bSecondSoundOn;
+
+ if (nSecondPlayFullSet == ATTR_SET)
+ pInfo->mbSecondPlayFull = bSecondPlayFull;
+
+ // noch ein paar Spezialitaeten
+// if (eEffect == presentation::AnimationEffect_PATH && nEffectSet == ATTR_SET)
+// pInfo->mSetPath(pPath);
+
+ if (eClickAction == presentation::ClickAction_VERB)
+ pInfo->mnVerb = (USHORT)aBookmark.ToInt32();
+ }
+ }
+ // Undo Gruppe dem Undo Manager uebergeben
+ pUndoMgr->AddUndoAction(pUndoGroup);
+ pUndoMgr->LeaveListAction();
+
+ // Model geaendert
+ mpDoc->SetChanged();
+ }
+ // sieht man nicht, also muss an den Bindings nicht invalidiert werden
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
new file mode 100644
index 000000000000..32ca9d3278b3
--- /dev/null
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuolbull.hxx"
+#include <vcl/msgbox.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/eeitem.hxx>
+#include <sfx2/request.hxx>
+#include <svl/intitem.hxx>
+
+#include <editeng/editdata.hxx>
+#include <svx/svxids.hrc>
+#include "OutlineView.hxx"
+#include "OutlineViewShell.hxx"
+#include "DrawViewShell.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "drawdoc.hxx"
+#include "sdabstdlg.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuOutlineBullet, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuOutlineBullet::FuOutlineBullet(ViewShell* pViewShell, ::sd::Window* pWindow,
+ ::sd::View* pView, SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewShell, pWindow, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuOutlineBullet::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuOutlineBullet( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuOutlineBullet::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ // ItemSet fuer Dialog fuellen
+ SfxItemSet aEditAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aEditAttr );
+
+ SfxItemSet aNewAttr( mpViewShell->GetPool(),
+ EE_ITEMS_START, EE_ITEMS_END );
+ aNewAttr.Put( aEditAttr, FALSE );
+
+ // Dialog hochfahren und ausfuehren
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdOutlineBulletTabDlg( NULL, &aNewAttr, mpView ) : 0;
+ if( pDlg )
+ {
+ USHORT nResult = pDlg->Execute();
+
+ switch( nResult )
+ {
+ case RET_OK:
+ {
+ SfxItemSet aSet( *pDlg->GetOutputItemSet() );
+
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
+
+ if (mpView->ISA(OutlineView))
+ {
+ pOLV = static_cast<OutlineView*>(mpView)
+ ->GetViewByWindow(mpViewShell->GetActiveWindow());
+
+ aGuard.reset( new OutlineViewModelChangeGuard( static_cast<OutlineView&>(*mpView) ) );
+ }
+
+ if( pOLV )
+ pOLV->EnableBullets();
+
+ rReq.Done( aSet );
+ pArgs = rReq.GetArgs();
+ }
+ break;
+
+ default:
+ {
+ delete pDlg;
+ return;
+ }
+ }
+
+ delete pDlg;
+ }
+ }
+
+ // nicht direkt an pOlView, damit SdDrawView::SetAttributes
+ // Aenderungen auf der Masterpage abfangen und in eine
+ // Vorlage umleiten kann
+ mpView->SetAttributes(*pArgs);
+
+/* #i35937#
+ // evtl. Betroffene Felder invalidieren
+ mpViewShell->Invalidate( FN_NUM_BULLET_ON );
+*/
+}
+
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuoltext.cxx b/sd/source/ui/func/fuoltext.cxx
new file mode 100644
index 000000000000..2797631d12db
--- /dev/null
+++ b/sd/source/ui/func/fuoltext.cxx
@@ -0,0 +1,361 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuoltext.hxx"
+
+#include <sfx2/viewfrm.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <svx/svxids.hrc>
+#include "app.hrc"
+#include "OutlineView.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "OutlineViewShell.hxx"
+
+#include <stdio.h> // Fuer SlotFilter-Listing
+
+namespace sd {
+
+static USHORT SidArray[] = {
+ SID_STYLE_FAMILY2,
+ SID_STYLE_FAMILY3,
+ SID_STYLE_FAMILY5,
+ SID_STYLE_UPDATE_BY_EXAMPLE,
+ SID_CUT,
+ SID_COPY,
+ SID_PASTE,
+ SID_SELECTALL,
+ SID_ATTR_CHAR_FONT,
+ SID_ATTR_CHAR_POSTURE,
+ SID_ATTR_CHAR_WEIGHT,
+ SID_ATTR_CHAR_UNDERLINE,
+ SID_ATTR_CHAR_FONTHEIGHT,
+ SID_ATTR_CHAR_COLOR,
+ SID_OUTLINE_UP,
+ SID_OUTLINE_DOWN,
+ SID_OUTLINE_LEFT,
+ SID_OUTLINE_RIGHT,
+ //SID_OUTLINE_FORMAT,
+ SID_OUTLINE_COLLAPSE_ALL,
+ //SID_OUTLINE_BULLET,
+ SID_OUTLINE_COLLAPSE,
+ SID_OUTLINE_EXPAND_ALL,
+ SID_OUTLINE_EXPAND,
+ SID_SET_SUPER_SCRIPT,
+ SID_SET_SUB_SCRIPT,
+ SID_HYPERLINK_GETLINK,
+ SID_PRESENTATION_TEMPLATES,
+ SID_STATUS_PAGE,
+ SID_STATUS_LAYOUT,
+ SID_EXPAND_PAGE,
+ SID_SUMMARY_PAGE,
+ SID_PARASPACE_INCREASE,
+ SID_PARASPACE_DECREASE,
+ 0 };
+
+TYPEINIT1( FuOutlineText, FuOutline );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuOutlineText::FuOutlineText(ViewShell* pViewShell, ::sd::Window* pWindow,
+ ::sd::View* pView, SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuOutline(pViewShell, pWindow, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuOutlineText::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuOutlineText( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute( rReq );
+ return xFunc;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL FuOutlineText::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+
+ mpWindow->GrabFocus();
+
+ bReturn = pOutlineView->GetViewByWindow(mpWindow)->MouseButtonDown(rMEvt);
+
+ if (bReturn)
+ {
+ // Attributierung der akt. Textstelle kann jetzt anders sein
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+ }
+ else
+ {
+ bReturn = FuOutline::MouseButtonDown(rMEvt);
+ }
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuOutlineText::MouseMove(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+
+ bReturn = pOutlineView->GetViewByWindow(mpWindow)->MouseMove(rMEvt);
+
+ if (!bReturn)
+ {
+ bReturn = FuOutline::MouseMove(rMEvt);
+ }
+
+ // MT 07/2002: Done in OutlinerView::MouseMove
+ /*
+ const SvxFieldItem* pFieldItem = pOutlineView->GetViewByWindow( mpWindow )->
+ GetFieldUnderMousePointer();
+ const SvxFieldData* pField = NULL;
+ if( pFieldItem )
+ pField = pFieldItem->GetField();
+
+ if( pField && pField->ISA( SvxURLField ) )
+ {
+ mpWindow->SetPointer( Pointer( POINTER_REFHAND ) );
+ }
+ else
+ mpWindow->SetPointer( Pointer( POINTER_TEXT ) );
+ */
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL FuOutlineText::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+
+ bReturn = pOutlineView->GetViewByWindow(mpWindow)->MouseButtonUp(rMEvt);
+
+ if (bReturn)
+ {
+ // Attributierung der akt. Textstelle kann jetzt anders sein
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+ }
+ else
+ {
+ const SvxFieldItem* pFieldItem = pOutlineView->GetViewByWindow( mpWindow )->GetFieldUnderMousePointer();
+ if( pFieldItem )
+ {
+ const SvxFieldData* pField = pFieldItem->GetField();
+
+ if( pField && pField->ISA( SvxURLField ) )
+ {
+ bReturn = TRUE;
+ mpWindow->ReleaseMouse();
+ SfxStringItem aStrItem( SID_FILE_NAME, ( (SvxURLField*) pField)->GetURL() );
+ SfxStringItem aReferer( SID_REFERER, mpDocSh->GetMedium()->GetName() );
+ SfxBoolItem aBrowseItem( SID_BROWSE, TRUE );
+ SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
+
+ if ( rMEvt.IsMod1() )
+ {
+ // Im neuen Frame oeffnen
+ pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aBrowseItem, &aReferer, 0L);
+ }
+ else
+ {
+ // Im aktuellen Frame oeffnen
+ SfxFrameItem aFrameItem( SID_DOCFRAME, pFrame );
+ pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
+ }
+ }
+ }
+ }
+
+ if( !bReturn )
+ bReturn = FuOutline::MouseButtonUp(rMEvt);
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+BOOL FuOutlineText::KeyInput(const KeyEvent& rKEvt)
+{
+ BOOL bReturn = FALSE;
+
+ USHORT nKeyGroup = rKEvt.GetKeyCode().GetGroup();
+ if( !mpDocSh->IsReadOnly() || nKeyGroup == KEYGROUP_CURSOR )
+ {
+ mpWindow->GrabFocus();
+
+ std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
+
+ if( (nKeyGroup != KEYGROUP_CURSOR) && (nKeyGroup != KEYGROUP_FKEYS) )
+ aGuard.reset( new OutlineViewModelChangeGuard( *pOutlineView ) );
+
+ bReturn = pOutlineView->GetViewByWindow(mpWindow)->PostKeyEvent(rKEvt);
+
+ if (bReturn)
+ {
+ UpdateForKeyPress (rKEvt);
+ }
+ else
+ {
+ bReturn = FuOutline::KeyInput(rKEvt);
+ }
+ }
+
+ return (bReturn);
+}
+
+void FuOutlineText::UpdateForKeyPress (const KeyEvent& rEvent)
+{
+ // Attributes at the current text position may have changed.
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate(SidArray);
+
+ bool bUpdatePreview = true;
+ switch (rEvent.GetKeyCode().GetCode())
+ {
+ // When just the cursor has been moved the preview only changes when
+ // it moved to entries of another page. To prevent unnecessary
+ // updates we check this here. This is an early rejection test, so
+ // missing a key is not a problem.
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ case KEY_HOME:
+ case KEY_END:
+ case KEY_PAGEUP:
+ case KEY_PAGEDOWN:
+ {
+ SdPage* pCurrentPage = pOutlineViewShell->GetActualPage();
+ bUpdatePreview = (pCurrentPage != pOutlineViewShell->GetActualPage());
+ }
+ break;
+ }
+ if (bUpdatePreview)
+ pOutlineViewShell->UpdatePreview (pOutlineViewShell->GetActualPage());
+}
+
+
+
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuOutlineText::Activate()
+{
+ FuOutline::Activate();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuOutlineText::Deactivate()
+{
+ FuOutline::Deactivate();
+}
+
+/*************************************************************************
+|*
+|* Cut object to clipboard
+|*
+\************************************************************************/
+
+void FuOutlineText::DoCut()
+{
+ pOutlineView->GetViewByWindow(mpWindow)->Cut();
+}
+
+/*************************************************************************
+|*
+|* Copy object to clipboard
+|*
+\************************************************************************/
+
+void FuOutlineText::DoCopy()
+{
+ pOutlineView->GetViewByWindow(mpWindow)->Copy();
+}
+
+/*************************************************************************
+|*
+|* Paste object from clipboard
+|*
+\************************************************************************/
+
+void FuOutlineText::DoPaste()
+{
+ pOutlineView->GetViewByWindow(mpWindow)->PasteSpecial();
+}
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuoutl.cxx b/sd/source/ui/func/fuoutl.cxx
new file mode 100755
index 000000000000..c0ef53f144b3
--- /dev/null
+++ b/sd/source/ui/func/fuoutl.cxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuoutl.hxx"
+
+#include <editeng/outliner.hxx>
+#include "OutlineView.hxx"
+#include "OutlineViewShell.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+
+namespace sd {
+
+TYPEINIT1( FuOutline, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuOutline::FuOutline (
+ ViewShell* pViewShell,
+ ::sd::Window* pWindow,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewShell, pWindow, pView, pDoc, rReq),
+ pOutlineViewShell (static_cast<OutlineViewShell*>(pViewShell)),
+ pOutlineView (static_cast<OutlineView*>(pView))
+{
+}
+
+/*************************************************************************
+|*
+|* Command, weiterleiten an OutlinerView
+|*
+\************************************************************************/
+
+BOOL FuOutline::Command(const CommandEvent& rCEvt)
+{
+ BOOL bResult = FALSE;
+
+ OutlinerView* pOlView =
+ static_cast<OutlineView*>(mpView)->GetViewByWindow(mpWindow);
+ DBG_ASSERT (pOlView, "keine OutlinerView gefunden");
+
+ if (pOlView)
+ {
+ pOlView->Command(rCEvt); // liefert leider keinen Returnwert
+ bResult = TRUE;
+ }
+ return bResult;
+}
+
+void FuOutline::ScrollStart()
+{
+}
+
+void FuOutline::ScrollEnd()
+{
+}
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
new file mode 100644
index 000000000000..9fb0007cc72c
--- /dev/null
+++ b/sd/source/ui/func/fupage.cxx
@@ -0,0 +1,622 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fupage.hxx"
+
+#include <sfx2/viewfrm.hxx>
+
+// Seite einrichten Tab-Page
+
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <svl/itempool.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <sfx2/request.hxx>
+#include <svl/stritem.hxx>
+#include <vcl/prntypes.hxx>
+#include <svl/style.hxx>
+#include <stlsheet.hxx>
+#ifndef _SVX_SVDORECT_HXX
+#include <svx/svdorect.hxx>
+#endif
+#ifndef _SVX_SVDUNDO_HXX
+#include <svx/svdundo.hxx>
+#endif
+#include <editeng/eeitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xsetit.hxx>
+#include <svl/itempool.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+
+#include "glob.hrc"
+#include <editeng/shaditem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/pbinitem.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/opengrf.hxx>
+
+#include "strings.hrc"
+#include "sdpage.hxx"
+#include "View.hxx"
+#include "Window.hxx"
+#include "pres.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "ViewShell.hxx"
+#include "DrawViewShell.hxx"
+#include "app.hrc"
+#include "unchss.hxx"
+#include "undoback.hxx"
+#include "sdabstdlg.hxx"
+#include "sdresid.hxx"
+#include "sdundogr.hxx"
+#include "helpids.h"
+
+namespace sd {
+
+class Window;
+
+// 50 cm 28350
+// erstmal vom Writer uebernommen
+#define MAXHEIGHT 28350
+#define MAXWIDTH 28350
+
+
+TYPEINIT1( FuPage, FuPoor );
+
+void mergeItemSetsImpl( SfxItemSet& rTarget, const SfxItemSet& rSource )
+{
+ const USHORT* pPtr = rSource.GetRanges();
+ USHORT p1, p2;
+ while( *pPtr )
+ {
+ p1 = pPtr[0];
+ p2 = pPtr[1];
+
+ // make ranges discret
+ while(pPtr[2] && (pPtr[2] - p2 == 1))
+ {
+ p2 = pPtr[3];
+ pPtr += 2;
+ }
+ rTarget.MergeRange( p1, p2 );
+ pPtr += 2;
+ }
+
+ rTarget.Put(rSource);
+}
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuPage::FuPage( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq )
+: FuPoor(pViewSh, pWin, pView, pDoc, rReq),
+ mrReq(rReq),
+ mpArgs( rReq.GetArgs() ),
+ mpBackgroundObjUndoAction( 0 ),
+ mbPageBckgrdDeleted( false ),
+ mbMasterPage( false ),
+ mbDisplayBackgroundTabPage( true ),
+ mpPage(0)
+{
+}
+
+FunctionReference FuPage::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuPage( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuPage::DoExecute( SfxRequest& )
+{
+ mpDrawViewShell = dynamic_cast<DrawViewShell*>(mpViewShell);
+ DBG_ASSERT( mpDrawViewShell, "sd::FuPage::FuPage(), called without a current DrawViewShell!" );
+ if( mpDrawViewShell )
+ {
+ mbMasterPage = mpDrawViewShell->GetEditMode() == EM_MASTERPAGE;
+ mbDisplayBackgroundTabPage = (mpDrawViewShell->GetPageKind() == PK_STANDARD);
+ mpPage = mpDrawViewShell->getCurrentPage();
+ }
+
+ if( mpPage )
+ {
+ // if there are no arguments given, open the dialog
+ if( !mpArgs )
+ {
+ mpView->SdrEndTextEdit();
+ mpArgs = ExecuteDialog(mpWindow);
+ }
+
+ // if we now have arguments, apply them to current page
+ if( mpArgs )
+ ApplyItemSet( mpArgs );
+ }
+}
+
+FuPage::~FuPage()
+{
+ delete mpBackgroundObjUndoAction;
+}
+
+void FuPage::Activate()
+{
+}
+
+void FuPage::Deactivate()
+{
+}
+
+const SfxItemSet* FuPage::ExecuteDialog( Window* pParent )
+{
+ PageKind ePageKind = mpDrawViewShell->GetPageKind();
+
+ SfxItemSet aNewAttr(mpDoc->GetPool(),
+ mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE),
+ mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE),
+ SID_ATTR_PAGE, SID_ATTR_PAGE_BSP,
+ SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER,
+ SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW,
+ XATTR_FILL_FIRST, XATTR_FILL_LAST,
+ EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
+ 0);
+
+ ///////////////////////////////////////////////////////////////////////
+ // Retrieve additional data for dialog
+
+ SvxShadowItem aShadowItem(SID_ATTR_BORDER_SHADOW);
+ aNewAttr.Put( aShadowItem );
+ SvxBoxItem aBoxItem( SID_ATTR_BORDER_OUTER );
+ aNewAttr.Put( aBoxItem );
+
+ aNewAttr.Put( SvxFrameDirectionItem(
+ mpDoc->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP,
+ EE_PARA_WRITINGDIR ) );
+
+ ///////////////////////////////////////////////////////////////////////
+ // Retrieve page-data for dialog
+
+ SvxPageItem aPageItem( SID_ATTR_PAGE );
+ aPageItem.SetDescName( mpPage->GetName() );
+ aPageItem.SetPageUsage( (SvxPageUsage) SVX_PAGE_ALL );
+ aPageItem.SetLandscape( mpPage->GetOrientation() == ORIENTATION_LANDSCAPE ? TRUE: FALSE );
+ aPageItem.SetNumType( mpDoc->GetPageNumType() );
+ aNewAttr.Put( aPageItem );
+
+ // size
+ maSize = mpPage->GetSize();
+ SvxSizeItem aSizeItem( SID_ATTR_PAGE_SIZE, maSize );
+ aNewAttr.Put( aSizeItem );
+
+ // Max size
+ SvxSizeItem aMaxSizeItem( SID_ATTR_PAGE_MAXSIZE, Size( MAXWIDTH, MAXHEIGHT ) );
+ aNewAttr.Put( aMaxSizeItem );
+
+ // paperbin
+ SvxPaperBinItem aPaperBinItem( SID_ATTR_PAGE_PAPERBIN, (const BYTE)mpPage->GetPaperBin() );
+ aNewAttr.Put( aPaperBinItem );
+
+ SvxLRSpaceItem aLRSpaceItem( (USHORT)mpPage->GetLftBorder(), (USHORT)mpPage->GetRgtBorder(), 0, 0, mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE));
+ aNewAttr.Put( aLRSpaceItem );
+
+ SvxULSpaceItem aULSpaceItem( (USHORT)mpPage->GetUppBorder(), (USHORT)mpPage->GetLwrBorder(), mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE));
+ aNewAttr.Put( aULSpaceItem );
+
+ // Applikation
+ bool bScale = mpDoc->GetDocumentType() != DOCUMENT_TYPE_DRAW;
+ aNewAttr.Put( SfxBoolItem( SID_ATTR_PAGE_EXT1, bScale ? TRUE : FALSE ) );
+
+ BOOL bFullSize = mpPage->IsMasterPage() ?
+ mpPage->IsBackgroundFullSize() : ((SdPage&)mpPage->TRG_GetMasterPage()).IsBackgroundFullSize();
+
+ aNewAttr.Put( SfxBoolItem( SID_ATTR_PAGE_EXT2, bFullSize ) );
+
+ ///////////////////////////////////////////////////////////////////////
+ // Merge ItemSet for dialog
+
+ const USHORT* pPtr = aNewAttr.GetRanges();
+ USHORT p1 = pPtr[0], p2 = pPtr[1];
+ while(pPtr[2] && (pPtr[2] - p2 == 1))
+ {
+ p2 = pPtr[3];
+ pPtr += 2;
+ }
+ pPtr += 2;
+ SfxItemSet aMergedAttr( *aNewAttr.GetPool(), p1, p2 );
+
+ mergeItemSetsImpl( aMergedAttr, aNewAttr );
+
+ SdStyleSheet* pStyleSheet = mpPage->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND);
+
+ // merge page background filling to the dialogs input set
+ if( mbDisplayBackgroundTabPage )
+ {
+ if( mbMasterPage )
+ {
+ if(pStyleSheet)
+ mergeItemSetsImpl( aMergedAttr, pStyleSheet->GetItemSet() );
+ }
+ else
+ {
+ // Only this page, get attributes for background fill
+ const SfxItemSet& rBackgroundAttributes = mpPage->getSdrPageProperties().GetItemSet();
+
+ if(XFILL_NONE != ((const XFillStyleItem&)rBackgroundAttributes.Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ // page attributes are used, take them
+ aMergedAttr.Put(rBackgroundAttributes);
+ }
+ else
+ {
+ if(pStyleSheet
+ && XFILL_NONE != ((const XFillStyleItem&)pStyleSheet->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ // if the page has no fill style, use the settings from the
+ // background stylesheet (if used)
+ mergeItemSetsImpl(aMergedAttr, pStyleSheet->GetItemSet());
+ }
+ else
+ {
+ // no fill style from page, start with no fill style
+ aMergedAttr.Put(XFillStyleItem(XFILL_NONE));
+ }
+ }
+ }
+ }
+
+ std::auto_ptr< SfxItemSet > pTempSet;
+
+ if( GetSlotID() == SID_SELECT_BACKGROUND )
+ {
+ SvxOpenGraphicDialog aDlg(SdResId(STR_SET_BACKGROUND_PICTURE));
+
+ if( aDlg.Execute() == GRFILTER_OK )
+ {
+ Graphic aGraphic;
+ int nError = aDlg.GetGraphic(aGraphic);
+ if( nError == GRFILTER_OK )
+ {
+ pTempSet.reset( new SfxItemSet( mpDoc->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0) );
+
+ pTempSet->Put( XFillStyleItem( XFILL_BITMAP ) );
+ pTempSet->Put( XFillBitmapItem( String(RTL_CONSTASCII_USTRINGPARAM("background")), XOBitmap(aGraphic) ) );
+ pTempSet->Put( XFillBmpStretchItem( TRUE ));
+ pTempSet->Put( XFillBmpTileItem( FALSE ));
+ }
+ }
+ }
+ else
+ {
+ // create the dialog
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ std::auto_ptr<SfxAbstractTabDialog> pDlg( pFact ? pFact->CreateSdTabPageDialog(NULL, &aMergedAttr, mpDocSh, mbDisplayBackgroundTabPage ) : 0 );
+ if( pDlg.get() && pDlg->Execute() == RET_OK )
+ pTempSet.reset( new SfxItemSet(*pDlg->GetOutputItemSet()) );
+ }
+
+ if( pTempSet.get() )
+ {
+ pStyleSheet->AdjustToFontHeight(*pTempSet);
+
+ if( mbDisplayBackgroundTabPage )
+ {
+ // if some fillstyle-items are not set in the dialog, then
+ // try to use the items before
+ BOOL bChanges = FALSE;
+ for( USHORT i=XATTR_FILL_FIRST; i<XATTR_FILL_LAST; i++ )
+ {
+ if( aMergedAttr.GetItemState( i ) != SFX_ITEM_DEFAULT )
+ {
+ if( pTempSet->GetItemState( i ) == SFX_ITEM_DEFAULT )
+ pTempSet->Put( aMergedAttr.Get( i ) );
+ else
+ if( aMergedAttr.GetItem( i ) != pTempSet->GetItem( i ) )
+ bChanges = TRUE;
+ }
+ }
+
+ // if the background for this page was set to invisible, the background-object has to be deleted, too.
+ if( ( ( (XFillStyleItem*) pTempSet->GetItem( XATTR_FILLSTYLE ) )->GetValue() == XFILL_NONE ) ||
+ ( ( pTempSet->GetItemState( XATTR_FILLSTYLE ) == SFX_ITEM_DEFAULT ) &&
+ ( ( (XFillStyleItem*) aMergedAttr.GetItem( XATTR_FILLSTYLE ) )->GetValue() == XFILL_NONE ) ) )
+ mbPageBckgrdDeleted = TRUE;
+
+ bool bSetToAllPages = false;
+
+ // Ask, wether the setting are for the background-page or for the current page
+ if( !mbMasterPage && bChanges )
+ {
+ // But don't ask in notice-view, because we can't change the background of
+ // notice-masterpage (at the moment)
+ if( ePageKind != PK_NOTES )
+ {
+ String aTit(SdResId( STR_PAGE_BACKGROUND_TITLE ));
+ String aTxt(SdResId( STR_PAGE_BACKGROUND_TXT ));
+ MessBox aQuestionBox (
+ pParent,
+ WB_YES_NO | WB_DEF_YES,
+ aTit,
+ aTxt );
+ aQuestionBox.SetImage( QueryBox::GetStandardImage() );
+ bSetToAllPages = ( RET_YES == aQuestionBox.Execute() );
+ }
+
+ if( mbPageBckgrdDeleted )
+ {
+ mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction(
+ *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet());
+
+ if(!mpPage->IsMasterPage())
+ {
+ // on normal pages, switch off fill attribute usage
+ mpPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
+ }
+ }
+ }
+
+ // Sonderbehandlung: die INVALIDS auf NULL-Pointer
+ // zurueckgesetzen (sonst landen INVALIDs oder
+ // Pointer auf die DefaultItems in der Vorlage;
+ // beides wuerde die Attribut-Vererbung unterbinden)
+ pTempSet->ClearInvalidItems();
+
+ if( mbMasterPage )
+ {
+ StyleSheetUndoAction* pAction = new StyleSheetUndoAction(mpDoc, (SfxStyleSheet*)pStyleSheet, &(*pTempSet.get()));
+ mpDocSh->GetUndoManager()->AddUndoAction(pAction);
+ pStyleSheet->GetItemSet().Put( *(pTempSet.get()) );
+ pStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+ else if( bSetToAllPages )
+ {
+ String aComment(SdResId(STR_UNDO_CHANGE_PAGEFORMAT));
+ SfxUndoManager* pUndoMgr = mpDocSh->GetUndoManager();
+ pUndoMgr->EnterListAction(aComment, aComment);
+ SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc);
+ pUndoGroup->SetComment(aComment);
+
+ //Set background on all master pages
+ USHORT nMasterPageCount = mpDoc->GetMasterSdPageCount(ePageKind);
+ for (USHORT i = 0; i < nMasterPageCount; ++i)
+ {
+ SdPage *pMasterPage = mpDoc->GetMasterSdPage(i, ePageKind);
+ SdStyleSheet *pStyle =
+ pMasterPage->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND);
+ StyleSheetUndoAction* pAction =
+ new StyleSheetUndoAction(mpDoc, (SfxStyleSheet*)pStyle, &(*pTempSet.get()));
+ pUndoGroup->AddAction(pAction);
+ pStyle->GetItemSet().Put( *(pTempSet.get()) );
+ pStyle->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+
+ //Remove background from all pages to reset to the master bg
+ USHORT nPageCount(mpDoc->GetSdPageCount(ePageKind));
+ for(USHORT i=0; i<nPageCount; ++i)
+ {
+ SdPage *pPage = mpDoc->GetSdPage(i, ePageKind);
+
+ const SfxItemSet& rFillAttributes = pPage->getSdrPageProperties().GetItemSet();
+ if(XFILL_NONE != ((const XFillStyleItem&)rFillAttributes.Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ SdBackgroundObjUndoAction *pBackgroundObjUndoAction = new SdBackgroundObjUndoAction(*mpDoc, *pPage, rFillAttributes);
+ pUndoGroup->AddAction(pBackgroundObjUndoAction);
+ pPage->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
+ pPage->ActionChanged();
+ }
+ }
+
+ pUndoMgr->AddUndoAction(pUndoGroup);
+ pUndoMgr->LeaveListAction();
+
+ }
+
+ const SfxPoolItem *pItem;
+ if( SFX_ITEM_SET == pTempSet->GetItemState( EE_PARA_WRITINGDIR, sal_False, &pItem ) )
+ {
+ sal_uInt32 nVal = ((SvxFrameDirectionItem*)pItem)->GetValue();
+ mpDoc->SetDefaultWritingMode( nVal == FRMDIR_HORI_RIGHT_TOP ? ::com::sun::star::text::WritingMode_RL_TB : ::com::sun::star::text::WritingMode_LR_TB );
+ }
+
+ mpDoc->SetChanged(TRUE);
+
+ // BackgroundFill of Masterpage: no hard attributes allowed
+ SdrPage& rUsedMasterPage = mpPage->IsMasterPage() ? *mpPage : mpPage->TRG_GetMasterPage();
+ OSL_ENSURE(rUsedMasterPage.IsMasterPage(), "No MasterPage (!)");
+ rUsedMasterPage.getSdrPageProperties().ClearItem();
+ OSL_ENSURE(0 != rUsedMasterPage.getSdrPageProperties().GetStyleSheet(),
+ "MasterPage without StyleSheet detected (!)");
+ }
+
+ aNewAttr.Put(*(pTempSet.get()));
+ mrReq.Done( aNewAttr );
+
+ return mrReq.GetArgs();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+void FuPage::ApplyItemSet( const SfxItemSet* pArgs )
+{
+ if( !pArgs )
+ return;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Set new page-attributes
+ PageKind ePageKind = mpDrawViewShell->GetPageKind();
+ const SfxPoolItem* pPoolItem;
+ BOOL bSetPageSizeAndBorder = FALSE;
+ Size aNewSize(maSize);
+ INT32 nLeft = -1, nRight = -1, nUpper = -1, nLower = -1;
+ BOOL bScaleAll = TRUE;
+ Orientation eOrientation = mpPage->GetOrientation();
+ SdPage* pMasterPage = mpPage->IsMasterPage() ? mpPage : &(SdPage&)(mpPage->TRG_GetMasterPage());
+ BOOL bFullSize = pMasterPage->IsBackgroundFullSize();
+ USHORT nPaperBin = mpPage->GetPaperBin();
+
+ if( pArgs->GetItemState(SID_ATTR_PAGE, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ {
+ mpDoc->SetPageNumType(((const SvxPageItem*) pPoolItem)->GetNumType());
+
+ eOrientation = (((const SvxPageItem*) pPoolItem)->IsLandscape() == ORIENTATION_LANDSCAPE) ?
+ ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT;
+
+ if( mpPage->GetOrientation() != eOrientation )
+ bSetPageSizeAndBorder = TRUE;
+
+ mpDrawViewShell->ResetActualPage();
+ }
+
+ if( pArgs->GetItemState(SID_ATTR_PAGE_SIZE, TRUE, &pPoolItem) == SFX_ITEM_SET )
+ {
+ aNewSize = ((const SvxSizeItem*) pPoolItem)->GetSize();
+
+ if( mpPage->GetSize() != aNewSize )
+ bSetPageSizeAndBorder = TRUE;
+ }
+
+ if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_LRSPACE),
+ TRUE, &pPoolItem) == SFX_ITEM_SET )
+ {
+ nLeft = ((const SvxLRSpaceItem*) pPoolItem)->GetLeft();
+ nRight = ((const SvxLRSpaceItem*) pPoolItem)->GetRight();
+
+ if( mpPage->GetLftBorder() != nLeft || mpPage->GetRgtBorder() != nRight )
+ bSetPageSizeAndBorder = TRUE;
+
+ }
+
+ if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_ULSPACE),
+ TRUE, &pPoolItem) == SFX_ITEM_SET )
+ {
+ nUpper = ((const SvxULSpaceItem*) pPoolItem)->GetUpper();
+ nLower = ((const SvxULSpaceItem*) pPoolItem)->GetLower();
+
+ if( mpPage->GetUppBorder() != nUpper || mpPage->GetLwrBorder() != nLower )
+ bSetPageSizeAndBorder = TRUE;
+ }
+
+ if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_PAGE_EXT1), TRUE, &pPoolItem) == SFX_ITEM_SET )
+ {
+ bScaleAll = ((const SfxBoolItem*) pPoolItem)->GetValue();
+ }
+
+ if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_PAGE_EXT2), TRUE, &pPoolItem) == SFX_ITEM_SET )
+ {
+ bFullSize = ((const SfxBoolItem*) pPoolItem)->GetValue();
+
+ if(pMasterPage->IsBackgroundFullSize() != bFullSize )
+ bSetPageSizeAndBorder = TRUE;
+ }
+
+ // Papierschacht (PaperBin)
+ if( pArgs->GetItemState(mpDoc->GetPool().GetWhich(SID_ATTR_PAGE_PAPERBIN), TRUE, &pPoolItem) == SFX_ITEM_SET )
+ {
+ nPaperBin = ((const SvxPaperBinItem*) pPoolItem)->GetValue();
+
+ if( mpPage->GetPaperBin() != nPaperBin )
+ bSetPageSizeAndBorder = TRUE;
+ }
+
+ if (nLeft == -1 && nUpper != -1)
+ {
+ bSetPageSizeAndBorder = TRUE;
+ nLeft = mpPage->GetLftBorder();
+ nRight = mpPage->GetRgtBorder();
+ }
+ else if (nLeft != -1 && nUpper == -1)
+ {
+ bSetPageSizeAndBorder = TRUE;
+ nUpper = mpPage->GetUppBorder();
+ nLower = mpPage->GetLwrBorder();
+ }
+
+ if( bSetPageSizeAndBorder || !mbMasterPage )
+ mpDrawViewShell->SetPageSizeAndBorder(ePageKind, aNewSize, nLeft, nRight, nUpper, nLower, bScaleAll, eOrientation, nPaperBin, bFullSize );
+
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+ // if bMasterPage==FALSE then create a background-object for this page with the
+ // properties set in the dialog before, but if mbPageBckgrdDeleted==TRUE then
+ // the background of this page was set to invisible, so it would be a mistake
+ // to create a new background-object for this page !
+ //
+
+ if( mbDisplayBackgroundTabPage )
+ {
+ if( !mbMasterPage && !mbPageBckgrdDeleted )
+ {
+ // Only this page
+ delete mpBackgroundObjUndoAction;
+ mpBackgroundObjUndoAction = new SdBackgroundObjUndoAction(
+ *mpDoc, *mpPage, mpPage->getSdrPageProperties().GetItemSet());
+ mpPage->getSdrPageProperties().ClearItem();
+ mpPage->getSdrPageProperties().PutItemSet(*pArgs);
+ }
+ }
+
+ // add undo action for background object
+ if( mpBackgroundObjUndoAction )
+ {
+ // set merge flag, because a SdUndoGroupAction could have been inserted before
+ mpDocSh->GetUndoManager()->AddUndoAction( mpBackgroundObjUndoAction, TRUE );
+ mpBackgroundObjUndoAction = 0;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // Objekte koennen max. so gross wie die ViewSize werden
+ //
+ Size aPageSize = mpDoc->GetSdPage(0, ePageKind)->GetSize();
+ Size aViewSize = Size(aPageSize.Width() * 3, aPageSize.Height() * 2);
+ mpDoc->SetMaxObjSize(aViewSize);
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // ggfs. Preview den neuen Kontext mitteilen
+ //
+ mpDrawViewShell->UpdatePreview( mpDrawViewShell->GetActualPage() );
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuparagr.cxx b/sd/source/ui/func/fuparagr.cxx
new file mode 100644
index 000000000000..68f8a3e922d0
--- /dev/null
+++ b/sd/source/ui/func/fuparagr.cxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuparagr.hxx"
+#include <editeng/eeitem.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/svxids.hrc>
+#include <editeng/editdata.hxx>
+#include <editeng/lrspitem.hxx>
+#include <svx/svdoutl.hxx>
+
+#include "app.hrc"
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+#include "sdabstdlg.hxx"
+#include "paragr.hrc"
+#include "sdattr.hrc"
+
+namespace sd {
+
+TYPEINIT1( FuParagraph, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuParagraph::FuParagraph (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuParagraph::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuParagraph( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuParagraph::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ OutlinerView* pOutlView = mpView->GetTextEditOutlinerView();
+ ::Outliner* pOutliner = mpView->GetTextEditOutliner();
+
+ if( !pArgs )
+ {
+ SfxItemSet aEditAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aEditAttr );
+ SfxItemPool *pPool = aEditAttr.GetPool();
+ SfxItemSet aNewAttr( *pPool,
+ EE_ITEMS_START, EE_ITEMS_END,
+ SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
+ ATTR_PARANUMBERING_START, ATTR_PARANUMBERING_END,
+ 0 );
+
+ aNewAttr.Put( aEditAttr );
+
+ // linker Rand als Offset
+ const long nOff = ( (SvxLRSpaceItem&)aNewAttr.Get( EE_PARA_LRSPACE ) ).GetTxtLeft();
+ // Umrechnung, da TabulatorTabPage immer von Twips ausgeht !
+ SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
+ aNewAttr.Put( aOff );
+
+ if( pOutlView && pOutliner )
+ {
+ ESelection eSelection = pOutlView->GetSelection();
+ aNewAttr.Put( SfxInt16Item( ATTR_NUMBER_NEWSTART_AT, pOutliner->GetNumberingStartValue( eSelection.nStartPara ) ) );
+ aNewAttr.Put( SfxBoolItem( ATTR_NUMBER_NEWSTART, pOutliner->IsParaIsNumberingRestart( eSelection.nStartPara ) ) );
+ }
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdParagraphTabDlg(NULL, &aNewAttr ) : 0;
+ if( pDlg )
+ {
+ USHORT nResult = pDlg->Execute();
+
+ switch( nResult )
+ {
+ case RET_OK:
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+
+ pArgs = rReq.GetArgs();
+ }
+ break;
+
+ default:
+ {
+ delete pDlg;
+ }
+ return; // Abbruch
+ }
+ delete( pDlg );
+ }
+ }
+ mpView->SetAttributes( *pArgs );
+
+ if( pOutlView && pOutliner )
+ {
+ ESelection eSelection = pOutlView->GetSelection();
+
+ const SfxPoolItem *pItem = 0;
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_NUMBER_NEWSTART, sal_False, &pItem ) )
+ {
+ const sal_Bool bNewStart = ((SfxBoolItem*)pItem)->GetValue() ? sal_True : sal_False;
+ pOutliner->SetParaIsNumberingRestart( eSelection.nStartPara, bNewStart );
+ }
+
+ if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_NUMBER_NEWSTART_AT, sal_False, &pItem ) )
+ {
+ const sal_Int16 nStartAt = ((SfxInt16Item*)pItem)->GetValue();
+ pOutliner->SetNumberingStartValue( eSelection.nStartPara, nStartAt );
+ }
+ }
+
+ // invalidieren der Slots
+ static USHORT SidArray[] = {
+ SID_ATTR_TABSTOP,
+ SID_ATTR_PARA_ADJUST_LEFT,
+ SID_ATTR_PARA_ADJUST_RIGHT,
+ SID_ATTR_PARA_ADJUST_CENTER,
+ SID_ATTR_PARA_ADJUST_BLOCK,
+ SID_ATTR_PARA_LINESPACE_10,
+ SID_ATTR_PARA_LINESPACE_15,
+ SID_ATTR_PARA_LINESPACE_20,
+ SID_ATTR_PARA_LRSPACE,
+ SID_ATTR_PARA_LEFT_TO_RIGHT,
+ SID_ATTR_PARA_RIGHT_TO_LEFT,
+ SID_RULER_TEXT_RIGHT_TO_LEFT,
+ SID_PARASPACE_INCREASE,
+ SID_PARASPACE_DECREASE,
+ 0 };
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+}
+
+void FuParagraph::Activate()
+{
+}
+
+void FuParagraph::Deactivate()
+{
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
new file mode 100755
index 000000000000..0342c5f2bbc5
--- /dev/null
+++ b/sd/source/ui/func/fupoor.cxx
@@ -0,0 +1,1277 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fupoor.hxx"
+
+#include <svx/svxids.hrc>
+#include <svl/aeitem.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdoole2.hxx>
+#include <svx/svdograf.hxx>
+#include <vcl/seleng.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <vcl/dialog.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XLayer.hpp>
+#include <com/sun/star/drawing/XLayerManager.hpp>
+#include <com/sun/star/container/XChild.hpp>
+
+#ifndef SD_FRAMW_VIEW_HXX
+#include "FrameView.hxx"
+#endif
+#include "app.hrc"
+#include "fusel.hxx"
+#include "sdpage.hxx"
+#include "drawview.hxx"
+#include "DrawViewShell.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "zoomlist.hxx"
+#include "Client.hxx"
+#include "slideshow.hxx"
+#include "LayerTabBar.hxx"
+
+#include <sfx2/viewfrm.hxx>
+
+// #97016# IV
+#include <svx/svditer.hxx>
+
+// #98533#
+#include <editeng/editeng.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+
+namespace sd {
+
+TYPEINIT0( FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuPoor::FuPoor (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDrDoc,
+ SfxRequest& rReq)
+ : mpView(pView),
+ mpViewShell(pViewSh),
+ mpWindow(pWin),
+ mpDocSh( pDrDoc->GetDocSh() ),
+ mpDoc(pDrDoc),
+ nSlotId( rReq.GetSlot() ),
+ nSlotValue(0),
+ pDialog(NULL),
+ bIsInDragMode(FALSE),
+ bNoScrollUntilInside (TRUE),
+ bScrollable (FALSE),
+ bDelayActive (FALSE),
+ bFirstMouseMove (FALSE),
+ // #95491# remember MouseButton state
+ mnCode(0)
+{
+ ReceiveRequest(rReq);
+
+ aScrollTimer.SetTimeoutHdl( LINK(this, FuPoor, ScrollHdl) );
+ aScrollTimer.SetTimeout(SELENG_AUTOREPEAT_INTERVAL);
+
+ aDragTimer.SetTimeoutHdl( LINK(this, FuPoor, DragHdl) );
+ aDragTimer.SetTimeout(SELENG_DRAGDROP_TIMEOUT);
+
+ aDelayToScrollTimer.SetTimeoutHdl( LINK(this, FuPoor, DelayHdl) );
+ aDelayToScrollTimer.SetTimeout(2000);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuPoor::~FuPoor()
+{
+ aDragTimer.Stop();
+ aScrollTimer.Stop();
+ aDelayToScrollTimer.Stop ();
+
+ if (pDialog)
+ delete pDialog;
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuPoor::Activate()
+{
+ if (pDialog)
+ {
+ pDialog->Show();
+ }
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuPoor::Deactivate()
+{
+ aDragTimer.Stop();
+ aScrollTimer.Stop();
+ aDelayToScrollTimer.Stop ();
+ bScrollable =
+ bDelayActive = FALSE;
+
+ if (pDialog)
+ {
+ pDialog->Hide();
+ }
+
+ if (mpWindow) mpWindow->ReleaseMouse ();
+}
+
+/*************************************************************************
+|*
+|* Scrollen bei Erreichen des Fensterrandes; wird von
+|* MouseMove aufgerufen
+|*
+\************************************************************************/
+
+void FuPoor::ForceScroll(const Point& aPixPos)
+{
+ aScrollTimer.Stop();
+
+ if ( !mpView->IsDragHelpLine() && !mpView->IsSetPageOrg() &&
+ !SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) )
+ {
+/* Size aSize = mpWindow->GetSizePixel();
+ short dx = 0, dy = 0;
+
+ if ( aPixPos.X() <= 0 ) dx = -1;
+ if ( aPixPos.X() >= aSize.Width() ) dx = 1;
+ if ( aPixPos.Y() <= 0 ) dy = -1;
+ if ( aPixPos.Y() >= aSize.Height() ) dy = 1;
+*/
+ Point aPos = mpWindow->OutputToScreenPixel(aPixPos);
+ const Rectangle& rRect = mpViewShell->GetAllWindowRect();
+
+ if ( bNoScrollUntilInside )
+ {
+ if ( rRect.IsInside(aPos) )
+ bNoScrollUntilInside = FALSE;
+ }
+ else
+ {
+ short dx = 0, dy = 0;
+
+ if ( aPos.X() <= rRect.Left() ) dx = -1;
+ if ( aPos.X() >= rRect.Right() ) dx = 1;
+ if ( aPos.Y() <= rRect.Top() ) dy = -1;
+ if ( aPos.Y() >= rRect.Bottom() ) dy = 1;
+
+ if ( dx != 0 || dy != 0 )
+ {
+ if (bScrollable)
+ {
+ // Scrollaktion in abgeleiteter Klasse
+ ScrollStart();
+ mpViewShell->ScrollLines(dx, dy);
+ ScrollEnd();
+ aScrollTimer.Start();
+ }
+ else if (! bDelayActive) StartDelayToScrollTimer ();
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* Timer-Handler fuer Fensterscrolling
+|*
+\************************************************************************/
+
+IMPL_LINK_INLINE_START( FuPoor, ScrollHdl, Timer *, EMPTYARG )
+{
+ Point aPnt(mpWindow->GetPointerPosPixel());
+
+ // #95491# use remembered MouseButton state to create correct
+ // MouseEvents for this artifical MouseMove.
+ MouseMove(MouseEvent(aPnt, 1, 0, GetMouseButtonCode()));
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( FuPoor, ScrollHdl, Timer *, pTimer )
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+BOOL FuPoor::KeyInput(const KeyEvent& rKEvt)
+{
+ USHORT nCode = rKEvt.GetKeyCode().GetCode();
+ BOOL bReturn = FALSE;
+ BOOL bSlideShow = SlideShow::IsRunning( mpViewShell->GetViewShellBase() );
+
+ switch (nCode)
+ {
+ // #97016# IV
+ case KEY_RETURN:
+ {
+ if(rKEvt.GetKeyCode().IsMod1())
+ {
+ if(mpViewShell && mpViewShell->ISA(DrawViewShell))
+ {
+ DrawViewShell* pDrawViewShell =
+ static_cast<DrawViewShell*>(mpViewShell);
+ SdPage* pActualPage = pDrawViewShell->GetActualPage();
+ SdrTextObj* pCandidate = 0L;
+
+ if(pActualPage)
+ {
+ SdrObjListIter aIter(*pActualPage, IM_DEEPNOGROUPS);
+
+ while(aIter.IsMore() && !pCandidate)
+ {
+ SdrObject* pObj = aIter.Next();
+
+ if(pObj && pObj->ISA(SdrTextObj))
+ {
+ sal_uInt32 nInv(pObj->GetObjInventor());
+ sal_uInt16 nKnd(pObj->GetObjIdentifier());
+
+ if(SdrInventor == nInv &&
+ (OBJ_TITLETEXT == nKnd || OBJ_OUTLINETEXT == nKnd || OBJ_TEXT == nKnd))
+ {
+ pCandidate = (SdrTextObj*)pObj;
+ }
+ }
+ }
+ }
+
+ if(pCandidate)
+ {
+ mpView->UnMarkAll();
+ mpView->MarkObj(pCandidate, mpView->GetSdrPageView());
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_ATTR_CHAR, SFX_CALLMODE_ASYNCHRON);
+ }
+ else
+ {
+ // insert a new page with the same page layout
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_INSERTPAGE_QUICK, SFX_CALLMODE_ASYNCHRON);
+ }
+
+ // consumed
+ bReturn = TRUE;
+ }
+ }
+ else
+ {
+ // #98255# activate OLE object on RETURN for selected object
+ // #98198# activate text edit on RETURN for selected object
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if( !mpView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrOle2Obj ) && !mpDocSh->IsUIActive() )
+ {
+ //HMHmpView->HideMarkHdl();
+ mpViewShell->ActivateObject( static_cast< SdrOle2Obj* >( pObj ), 0 );
+ }
+ else if( pObj && pObj->IsEmptyPresObj() && pObj->ISA( SdrGrafObj ) )
+ {
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_GRAPHIC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ }
+ else
+ {
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_CHAR, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ }
+
+ // consumed
+ bReturn = TRUE;
+ }
+ }
+ }
+ break;
+
+ // #97016# II
+ case KEY_TAB:
+ {
+ // #98994# handle Mod1 and Mod2 to get travelling running on different systems
+ if(rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
+ {
+ // #97016# II do something with a selected handle?
+ const SdrHdlList& rHdlList = mpView->GetHdlList();
+ sal_Bool bForward(!rKEvt.GetKeyCode().IsShift());
+
+ ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
+
+ // guarantee visibility of focused handle
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ Point aHdlPosition(pHdl->GetPos());
+ Rectangle aVisRect(aHdlPosition - Point(100, 100), Size(200, 200));
+ mpView->MakeVisible(aVisRect, *mpWindow);
+ }
+
+ // consumed
+ bReturn = TRUE;
+ }
+ }
+ break;
+
+ case KEY_ESCAPE:
+ {
+ bReturn = FuPoor::cancel();
+ }
+ break;
+
+ case KEY_ADD:
+ {
+ if (!mpView->IsTextEdit() && !bSlideShow && !mpDocSh->IsUIActive())
+ {
+ // Zoom vergroessern
+ mpViewShell->SetZoom(mpWindow->GetZoom() * 3 / 2);
+
+ if (mpViewShell->ISA(DrawViewShell))
+ static_cast<DrawViewShell*>(mpViewShell)
+ ->SetZoomOnPage(FALSE);
+
+ bReturn = TRUE;
+ }
+ }
+ break;
+
+ case KEY_SUBTRACT:
+ {
+ if (!mpView->IsTextEdit() && !bSlideShow && !mpDocSh->IsUIActive())
+ {
+ // Zoom verringern
+ mpViewShell->SetZoom(mpWindow->GetZoom() * 2 / 3);
+
+ if (mpViewShell->ISA(DrawViewShell))
+ static_cast<DrawViewShell*>(mpViewShell)
+ ->SetZoomOnPage(FALSE);
+
+ bReturn = TRUE;
+ }
+ }
+ break;
+
+ case KEY_MULTIPLY:
+ {
+ if (!mpView->IsTextEdit() && !bSlideShow)
+ {
+ // Zoom auf Seite
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_SIZE_PAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ bReturn = TRUE;
+ }
+ }
+ break;
+
+ case KEY_DIVIDE:
+ {
+ if (!mpView->IsTextEdit() && !bSlideShow)
+ {
+ // Zoom auf selektierte Objekte
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_SIZE_OPTIMAL, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ bReturn = TRUE;
+ }
+ }
+ break;
+
+ case KEY_POINT:
+ {
+ ZoomList* pZoomList = mpViewShell->GetZoomList();
+
+ if (!mpView->IsTextEdit() && pZoomList->IsNextPossible() && !bSlideShow && !mpDocSh->IsUIActive())
+ {
+ // Naechstes ZoomRect einstellen
+ mpViewShell->SetZoomRect(pZoomList->GetNextZoomRect());
+ bReturn = TRUE;
+ }
+ }
+ break;
+
+ case KEY_COMMA:
+ {
+ ZoomList* pZoomList = mpViewShell->GetZoomList();
+
+ if (!mpView->IsTextEdit() && pZoomList->IsPreviousPossible() && !bSlideShow && !mpDocSh->IsUIActive())
+ {
+ // Vorheriges ZoomRect einstellen
+ mpViewShell->SetZoomRect(pZoomList->GetPreviousZoomRect());
+ bReturn = TRUE;
+ }
+ }
+ break;
+
+ case KEY_HOME:
+ {
+ if (!mpView->IsTextEdit()
+ && mpViewShell->ISA(DrawViewShell)
+ && !bSlideShow)
+ {
+ // Sprung zu erster Seite
+ static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(0);
+ bReturn = TRUE;
+ }
+ }
+ break;
+
+ case KEY_END:
+ {
+ if (!mpView->IsTextEdit()
+ && mpViewShell->ISA(DrawViewShell)
+ && !bSlideShow)
+ {
+ // Sprung zu letzter Seite
+ SdPage* pPage =
+ static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
+ static_cast<DrawViewShell*>(mpViewShell)
+ ->SwitchPage(mpDoc->GetSdPageCount(
+ pPage->GetPageKind()) - 1);
+ bReturn = TRUE;
+ }
+ }
+ break;
+
+ case KEY_PAGEUP:
+ {
+ if( rKEvt.GetKeyCode().IsMod1() && rKEvt.GetKeyCode().IsMod2() )
+ break;
+
+ if(mpViewShell->ISA(DrawViewShell) && !bSlideShow)
+ {
+ // The page-up key switches layers or pages depending on the
+ // modifier key.
+ if ( ! rKEvt.GetKeyCode().GetAllModifier())
+ {
+ // With no modifier pressed we move to the previous
+ // slide.
+ mpView->SdrEndTextEdit();
+
+ // Previous page.
+ bReturn = TRUE;
+ SdPage* pPage = static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
+ USHORT nSdPage = (pPage->GetPageNum() - 1) / 2;
+
+ if (nSdPage > 0)
+ {
+ // Switch the page and send events regarding
+ // deactivation the old page and activating the new
+ // one.
+ TabControl* pPageTabControl =
+ static_cast<DrawViewShell*>(mpViewShell)
+ ->GetPageTabControl();
+ if (pPageTabControl->IsReallyShown())
+ pPageTabControl->SendDeactivatePageEvent ();
+ static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(nSdPage - 1);
+ if (pPageTabControl->IsReallyShown())
+ pPageTabControl->SendActivatePageEvent ();
+ }
+ }
+ else if (rKEvt.GetKeyCode().IsMod1())
+ {
+ // With the CONTROL modifier we switch layers.
+ if (static_cast<DrawViewShell*>(mpViewShell)->IsLayerModeActive())
+ {
+ // Moves to the previous layer.
+ SwitchLayer (-1);
+ }
+ }
+ }
+ }
+ break;
+
+ case KEY_PAGEDOWN:
+ {
+ if( rKEvt.GetKeyCode().IsMod1() && rKEvt.GetKeyCode().IsMod2() )
+ break;
+ if(mpViewShell->ISA(DrawViewShell) && !bSlideShow)
+ {
+ // The page-down key switches layers or pages depending on the
+ // modifier key.
+ if ( ! rKEvt.GetKeyCode().GetAllModifier())
+ {
+ // With no modifier pressed we move to the next slide.
+ mpView->SdrEndTextEdit();
+
+ // Next page.
+ bReturn = TRUE;
+ SdPage* pPage = static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
+ USHORT nSdPage = (pPage->GetPageNum() - 1) / 2;
+
+ if (nSdPage < mpDoc->GetSdPageCount(pPage->GetPageKind()) - 1)
+ {
+ // Switch the page and send events regarding
+ // deactivation the old page and activating the new
+ // one.
+ TabControl* pPageTabControl =
+ static_cast<DrawViewShell*>(mpViewShell)->GetPageTabControl();
+ if (pPageTabControl->IsReallyShown())
+ pPageTabControl->SendDeactivatePageEvent ();
+ static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(nSdPage + 1);
+ if (pPageTabControl->IsReallyShown())
+ pPageTabControl->SendActivatePageEvent ();
+ }
+ }
+ else if (rKEvt.GetKeyCode().IsMod1())
+ {
+ // With the CONTROL modifier we switch layers.
+ if (static_cast<DrawViewShell*>(mpViewShell)->IsLayerModeActive())
+ {
+ // With the layer mode active pressing page-down
+ // moves to the next layer.
+ SwitchLayer (+1);
+ }
+ }
+ }
+ }
+ break;
+
+ // #97016# II change select state when focus is on poly point
+ case KEY_SPACE:
+ {
+ const SdrHdlList& rHdlList = mpView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ if(pHdl)
+ {
+ if(pHdl->GetKind() == HDL_POLY)
+ {
+ // rescue ID of point with focus
+ sal_uInt32 nPol(pHdl->GetPolyNum());
+ sal_uInt32 nPnt(pHdl->GetPointNum());
+
+ if(mpView->IsPointMarked(*pHdl))
+ {
+ if(rKEvt.GetKeyCode().IsShift())
+ {
+ mpView->UnmarkPoint(*pHdl);
+ }
+ }
+ else
+ {
+ if(!rKEvt.GetKeyCode().IsShift())
+ {
+ mpView->UnmarkAllPoints();
+ }
+
+ mpView->MarkPoint(*pHdl);
+ }
+
+ if(0L == rHdlList.GetFocusHdl())
+ {
+ // restore point with focus
+ SdrHdl* pNewOne = 0L;
+
+ for(sal_uInt32 a(0); !pNewOne && a < rHdlList.GetHdlCount(); a++)
+ {
+ SdrHdl* pAct = rHdlList.GetHdl(a);
+
+ if(pAct
+ && pAct->GetKind() == HDL_POLY
+ && pAct->GetPolyNum() == nPol
+ && pAct->GetPointNum() == nPnt)
+ {
+ pNewOne = pAct;
+ }
+ }
+
+ if(pNewOne)
+ {
+ ((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne);
+ }
+ }
+
+ bReturn = TRUE;
+ }
+ }
+ }
+ break;
+
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ {
+ if (!mpView->IsTextEdit() && !bSlideShow)
+ {
+ long nX = 0;
+ long nY = 0;
+
+ if (nCode == KEY_UP)
+ {
+ // Scroll nach oben
+ nX = 0;
+ nY =-1;
+ }
+ else if (nCode == KEY_DOWN)
+ {
+ // Scroll nach unten
+ nX = 0;
+ nY = 1;
+ }
+ else if (nCode == KEY_LEFT)
+ {
+ // Scroll nach links
+ nX =-1;
+ nY = 0;
+ }
+ else if (nCode == KEY_RIGHT)
+ {
+ // Scroll nach rechts
+ nX = 1;
+ nY = 0;
+ }
+
+ if (mpView->AreObjectsMarked() && !rKEvt.GetKeyCode().IsMod1() &&
+ !mpDocSh->IsReadOnly())
+ {
+ // #97016# II
+ const SdrHdlList& rHdlList = mpView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+
+ // #109007#
+ sal_Bool bIsMoveOfConnectedHandle(sal_False);
+ sal_Bool bOldSuppress = false;
+ SdrEdgeObj* pEdgeObj = 0L;
+
+ if(pHdl && pHdl->GetObj() && pHdl->GetObj()->ISA(SdrEdgeObj) && 0 == pHdl->GetPolyNum())
+ {
+ pEdgeObj = (SdrEdgeObj*)pHdl->GetObj();
+
+ if(0L == pHdl->GetPointNum())
+ {
+ if(pEdgeObj->GetConnection(sal_True).GetObject())
+ {
+ bIsMoveOfConnectedHandle = sal_True;
+ }
+ }
+ if(1L == pHdl->GetPointNum())
+ {
+ if(pEdgeObj->GetConnection(sal_False).GetObject())
+ {
+ bIsMoveOfConnectedHandle = sal_True;
+ }
+ }
+ }
+
+ // #109007#
+ if(pEdgeObj)
+ {
+ // Suppress default connects to inside object and object center
+ bOldSuppress = pEdgeObj->GetSuppressDefaultConnect();
+ pEdgeObj->SetSuppressDefaultConnect(sal_True);
+ }
+
+ // #109007#
+ if(bIsMoveOfConnectedHandle)
+ {
+ sal_uInt16 nMarkHdSiz(mpView->GetMarkHdlSizePixel());
+ Size aHalfConSiz(nMarkHdSiz + 1, nMarkHdSiz + 1);
+ aHalfConSiz = mpWindow->PixelToLogic(aHalfConSiz);
+
+ if(100 < aHalfConSiz.Width())
+ nX *= aHalfConSiz.Width();
+ else
+ nX *= 100;
+
+ if(100 < aHalfConSiz.Height())
+ nY *= aHalfConSiz.Height();
+ else
+ nY *= 100;
+ }
+ else if(rKEvt.GetKeyCode().IsMod2())
+ {
+ // #97016# move in 1 pixel distance
+ Size aLogicSizeOnePixel = (mpWindow) ? mpWindow->PixelToLogic(Size(1,1)) : Size(100, 100);
+ nX *= aLogicSizeOnePixel.Width();
+ nY *= aLogicSizeOnePixel.Height();
+ }
+ else if(rKEvt.GetKeyCode().IsShift())
+ {
+ nX *= 1000;
+ nY *= 1000;
+ }
+ else
+ {
+ // old, fixed move distance
+ nX *= 100;
+ nY *= 100;
+ }
+
+ if(0L == pHdl)
+ {
+ // #67368# only take action when move is allowed
+ if(mpView->IsMoveAllowed())
+ {
+ // #90129# restrict movement to WorkArea
+ const Rectangle& rWorkArea = mpView->GetWorkArea();
+
+ if(!rWorkArea.IsEmpty())
+ {
+ Rectangle aMarkRect(mpView->GetMarkedObjRect());
+ aMarkRect.Move(nX, nY);
+
+ if(!aMarkRect.IsInside(rWorkArea))
+ {
+ if(aMarkRect.Left() < rWorkArea.Left())
+ {
+ nX += rWorkArea.Left() - aMarkRect.Left();
+ }
+
+ if(aMarkRect.Right() > rWorkArea.Right())
+ {
+ nX -= aMarkRect.Right() - rWorkArea.Right();
+ }
+
+ if(aMarkRect.Top() < rWorkArea.Top())
+ {
+ nY += rWorkArea.Top() - aMarkRect.Top();
+ }
+
+ if(aMarkRect.Bottom() > rWorkArea.Bottom())
+ {
+ nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
+ }
+ }
+ }
+
+ // no handle selected
+ if(0 != nX || 0 != nY)
+ {
+ mpView->MoveAllMarked(Size(nX, nY));
+
+ // #97016# II
+ mpView->MakeVisible(mpView->GetAllMarkedRect(), *mpWindow);
+ }
+ }
+ }
+ else
+ {
+ // move handle with index nHandleIndex
+ if(pHdl && (nX || nY))
+ {
+ // now move the Handle (nX, nY)
+ Point aStartPoint(pHdl->GetPos());
+ Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
+ const SdrDragStat& rDragStat = mpView->GetDragStat();
+
+ // start dragging
+ mpView->BegDragObj(aStartPoint, 0, pHdl, 0);
+
+ if(mpView->IsDragObj())
+ {
+ FASTBOOL bWasNoSnap = rDragStat.IsNoSnap();
+ BOOL bWasSnapEnabled = mpView->IsSnapEnabled();
+
+ // switch snapping off
+ if(!bWasNoSnap)
+ ((SdrDragStat&)rDragStat).SetNoSnap(TRUE);
+ if(bWasSnapEnabled)
+ mpView->SetSnapEnabled(FALSE);
+
+ mpView->MovAction(aEndPoint);
+ mpView->EndDragObj();
+
+ // restore snap
+ if(!bWasNoSnap)
+ ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
+ if(bWasSnapEnabled)
+ mpView->SetSnapEnabled(bWasSnapEnabled);
+ }
+
+ // make moved handle visible
+ Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200));
+ mpView->MakeVisible(aVisRect, *mpWindow);
+ }
+ }
+
+ // #109007#
+ if(pEdgeObj)
+ {
+ // Restore original suppress value
+ pEdgeObj->SetSuppressDefaultConnect(bOldSuppress);
+ }
+ }
+ else
+ {
+ // Seite scrollen
+ ScrollStart();
+ mpViewShell->ScrollLines(nX, nY);
+ ScrollEnd();
+ }
+
+ bReturn = TRUE;
+ }
+ }
+ break;
+ }
+
+ if (bReturn)
+ {
+ mpWindow->ReleaseMouse();
+ }
+
+ // #98198# when a text-editable object is selected and the
+ // input character is printable, activate text edit on that object
+ // and feed character to object
+ if(!bReturn && !mpDocSh->IsReadOnly())
+ {
+ if(!mpView->IsTextEdit() && mpViewShell)
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if(1 == rMarkList.GetMarkCount())
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ if(pObj->ISA(SdrTextObj) && pObj->HasTextEdit() && !pObj->ISA(SdrOle2Obj))
+ {
+ // #98533# use common IsSimpleCharInput from
+ // the EditEngine.
+ sal_Bool bPrintable(EditEngine::IsSimpleCharInput(rKEvt));
+
+ if(bPrintable)
+ {
+ // try to activate textedit mode for the selected object
+ SfxStringItem aInputString(SID_ATTR_CHAR, String(rKEvt.GetCharCode()));
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_ATTR_CHAR,
+ SFX_CALLMODE_ASYNCHRON,
+ &aInputString,
+ 0L);
+
+ // consumed
+ bReturn = TRUE;
+ }
+ }
+ }
+ else
+ {
+ // #99039# test if there is a title object there. If yes, try to
+ // set it to edit mode and start typing...
+ if(mpViewShell->ISA(DrawViewShell)
+ && EditEngine::IsSimpleCharInput(rKEvt))
+ {
+ DrawViewShell* pDrawViewShell =
+ static_cast<DrawViewShell*>(mpViewShell);
+ SdPage* pActualPage = pDrawViewShell->GetActualPage();
+ SdrTextObj* pCandidate = 0L;
+
+ if(pActualPage)
+ {
+ SdrObjListIter aIter(*pActualPage, IM_DEEPNOGROUPS);
+
+ while(aIter.IsMore() && !pCandidate)
+ {
+ SdrObject* pObj = aIter.Next();
+
+ if(pObj && pObj->ISA(SdrTextObj))
+ {
+ sal_uInt32 nInv(pObj->GetObjInventor());
+ sal_uInt16 nKnd(pObj->GetObjIdentifier());
+
+ if(SdrInventor == nInv && OBJ_TITLETEXT == nKnd)
+ {
+ pCandidate = (SdrTextObj*)pObj;
+ }
+ }
+ }
+ }
+
+ // when candidate found and candidate is untouched, start editing text...
+ if(pCandidate && pCandidate->IsEmptyPresObj())
+ {
+ mpView->UnMarkAll();
+ mpView->MarkObj(pCandidate, mpView->GetSdrPageView());
+ SfxStringItem aInputString(SID_ATTR_CHAR, String(rKEvt.GetCharCode()));
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
+ SID_ATTR_CHAR,
+ SFX_CALLMODE_ASYNCHRON,
+ &aInputString,
+ 0L);
+
+ // consumed
+ bReturn = TRUE;
+ }
+ }
+ }
+ }
+ }
+
+ return(bReturn);
+}
+
+BOOL FuPoor::MouseMove(const MouseEvent& )
+{
+ return FALSE;
+}
+
+// #97016# II
+void FuPoor::SelectionHasChanged()
+{
+ const SdrHdlList& rHdlList = mpView->GetHdlList();
+ ((SdrHdlList&)rHdlList).ResetFocusHdl();
+}
+
+/*************************************************************************
+|*
+|* Cut object to clipboard
+|*
+\************************************************************************/
+
+void FuPoor::DoCut()
+{
+ if (mpView)
+ {
+ mpView->DoCut(mpWindow);
+ }
+}
+
+/*************************************************************************
+|*
+|* Copy object to clipboard
+|*
+\************************************************************************/
+
+void FuPoor::DoCopy()
+{
+ if (mpView)
+ {
+ mpView->DoCopy(mpWindow);
+ }
+}
+
+/*************************************************************************
+|*
+|* Paste object from clipboard
+|*
+\************************************************************************/
+
+void FuPoor::DoPaste()
+{
+ if (mpView)
+ {
+ mpView->DoPaste(mpWindow);
+ }
+}
+
+/*************************************************************************
+|*
+|* Timer-Handler fuer Drag&Drop
+|*
+\************************************************************************/
+
+IMPL_LINK( FuPoor, DragHdl, Timer *, EMPTYARG )
+{
+ if( mpView )
+ {
+ USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ SdrHdl* pHdl = mpView->PickHandle(aMDPos);
+
+ if ( pHdl==NULL && mpView->IsMarkedHit(aMDPos, nHitLog)
+ && !mpView->IsPresObjSelected(FALSE, TRUE) )
+ {
+ mpWindow->ReleaseMouse();
+ bIsInDragMode = TRUE;
+ mpView->StartDrag( aMDPos, mpWindow );
+ }
+ }
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* Command-event
+|*
+\************************************************************************/
+
+BOOL FuPoor::Command(const CommandEvent& rCEvt)
+{
+ return( mpView->Command(rCEvt,mpWindow) );
+}
+
+/*************************************************************************
+|*
+|* Timer-Handler fuer Fensterscrolling
+|*
+\************************************************************************/
+
+IMPL_LINK_INLINE_START( FuPoor, DelayHdl, Timer *, EMPTYARG )
+{
+ aDelayToScrollTimer.Stop ();
+ bScrollable = TRUE;
+
+ Point aPnt(mpWindow->GetPointerPosPixel());
+
+ // #95491# use remembered MouseButton state to create correct
+ // MouseEvents for this artifical MouseMove.
+ MouseMove(MouseEvent(aPnt, 1, 0, GetMouseButtonCode()));
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( FuPoor, DelayHdl, Timer *, pTimer )
+
+/*************************************************************************
+|*
+|* Handler fuer Maustaste
+|*
+\************************************************************************/
+
+BOOL FuPoor::MouseButtonUp (const MouseEvent& rMEvt)
+{
+ // #95491# remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ aDelayToScrollTimer.Stop ();
+ return bScrollable =
+ bDelayActive = FALSE;
+}
+
+BOOL FuPoor::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ // #95491# remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* Handler fuer Maustaste
+|*
+\************************************************************************/
+
+void FuPoor::StartDelayToScrollTimer ()
+{
+ bDelayActive = TRUE;
+ aDelayToScrollTimer.Start ();
+}
+
+/*************************************************************************
+|*
+|* Help-event
+|*
+\************************************************************************/
+
+BOOL FuPoor::RequestHelp(const HelpEvent& rHEvt)
+{
+ BOOL bReturn = FALSE;
+
+ SdrPageView* pPV = mpView->GetSdrPageView();
+
+ if (pPV)
+ {
+ SdPage* pPage = (SdPage*) pPV->GetPage();
+
+ if (pPage)
+ {
+ bReturn = pPage->RequestHelp(mpWindow, mpView, rHEvt);
+ }
+ }
+
+ return(bReturn);
+}
+
+void FuPoor::Paint(const Rectangle&, ::sd::Window* )
+{
+}
+
+/*************************************************************************
+|*
+|* Request verarbeiten
+|*
+\************************************************************************/
+
+void FuPoor::ReceiveRequest(SfxRequest& rReq)
+{
+ const SfxItemSet* pSet = rReq.GetArgs();
+
+ if (pSet)
+ {
+ if( pSet->GetItemState( nSlotId ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem& rItem = pSet->Get( nSlotId );
+
+ if( rItem.ISA( SfxAllEnumItem ) )
+ {
+ nSlotValue = ( ( const SfxAllEnumItem& ) rItem ).GetValue();
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* #97016#
+|*
+\************************************************************************/
+
+SdrObject* FuPoor::CreateDefaultObject(const sal_uInt16, const Rectangle& )
+{
+ // empty base implementation
+ return 0L;
+}
+
+void FuPoor::ImpForceQuadratic(Rectangle& rRect)
+{
+ if(rRect.GetWidth() > rRect.GetHeight())
+ {
+ rRect = Rectangle(
+ Point(rRect.Left() + ((rRect.GetWidth() - rRect.GetHeight()) / 2), rRect.Top()),
+ Size(rRect.GetHeight(), rRect.GetHeight()));
+ }
+ else
+ {
+ rRect = Rectangle(
+ Point(rRect.Left(), rRect.Top() + ((rRect.GetHeight() - rRect.GetWidth()) / 2)),
+ Size(rRect.GetWidth(), rRect.GetWidth()));
+ }
+}
+
+
+
+
+void FuPoor::SwitchLayer (sal_Int32 nOffset)
+{
+ if(mpViewShell && mpViewShell->ISA(DrawViewShell))
+ {
+ DrawViewShell* pDrawViewShell =
+ static_cast<DrawViewShell*>(mpViewShell);
+
+ // Calculate the new index.
+ sal_Int32 nIndex = pDrawViewShell->GetActiveTabLayerIndex() + nOffset;
+
+ // Make sure the new index lies inside the range of valid indices.
+ if (nIndex < 0)
+ nIndex = 0;
+ else if (nIndex >= pDrawViewShell->GetTabLayerCount ())
+ nIndex = pDrawViewShell->GetTabLayerCount() - 1;
+
+ // Set the new active layer.
+ if (nIndex != pDrawViewShell->GetActiveTabLayerIndex ())
+ {
+ LayerTabBar* pLayerTabControl =
+ static_cast<DrawViewShell*>(mpViewShell)->GetLayerTabControl();
+ if (pLayerTabControl != NULL)
+ pLayerTabControl->SendDeactivatePageEvent ();
+
+ pDrawViewShell->SetActiveTabLayerIndex (nIndex);
+
+ if (pLayerTabControl != NULL)
+ pLayerTabControl->SendActivatePageEvent ();
+ }
+ }
+}
+
+/** is called when the currenct function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns true if a active function was aborted
+*/
+bool FuPoor::cancel()
+{
+ if ( !this->ISA(FuSelection) )
+ {
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
+ return true;
+ }
+
+ return false;
+}
+
+// #i33136#
+bool FuPoor::doConstructOrthogonal() const
+{
+ return (
+ SID_DRAW_XLINE == nSlotId ||
+ SID_DRAW_CIRCLEARC == nSlotId ||
+ SID_DRAW_SQUARE == nSlotId ||
+ SID_DRAW_SQUARE_NOFILL == nSlotId ||
+ SID_DRAW_SQUARE_ROUND == nSlotId ||
+ SID_DRAW_SQUARE_ROUND_NOFILL == nSlotId ||
+ SID_DRAW_CIRCLE == nSlotId ||
+ SID_DRAW_CIRCLE_NOFILL == nSlotId ||
+ SID_DRAW_CIRCLEPIE == nSlotId ||
+ SID_DRAW_CIRCLEPIE_NOFILL == nSlotId ||
+ SID_DRAW_CIRCLECUT == nSlotId ||
+ SID_DRAW_CIRCLECUT_NOFILL == nSlotId ||
+ SID_DRAW_XPOLYGON == nSlotId ||
+ SID_DRAW_XPOLYGON_NOFILL == nSlotId ||
+ SID_3D_CUBE == nSlotId ||
+ SID_3D_SPHERE == nSlotId ||
+ SID_3D_SHELL == nSlotId ||
+ SID_3D_HALF_SPHERE == nSlotId ||
+ SID_3D_TORUS == nSlotId ||
+ SID_3D_CYLINDER == nSlotId ||
+ SID_3D_CONE == nSlotId ||
+ SID_3D_PYRAMID == nSlotId);
+}
+
+void FuPoor::DoExecute( SfxRequest& )
+{
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuprlout.cxx b/sd/source/ui/func/fuprlout.cxx
new file mode 100644
index 000000000000..0d6f0b5aa565
--- /dev/null
+++ b/sd/source/ui/func/fuprlout.cxx
@@ -0,0 +1,287 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuprlout.hxx"
+#include <vcl/wrkwin.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/smplhint.hxx>
+#include <svl/itempool.hxx>
+#include <sot/storage.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/svdundo.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/request.hxx>
+
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "pres.hxx"
+#include "DrawViewShell.hxx"
+#ifndef SD_FRAMW_VIEW_HXX
+#include "FrameView.hxx"
+#endif
+#include "stlpool.hxx"
+#include "View.hxx"
+#include "glob.hrc"
+#include "glob.hxx"
+#include "strings.hrc"
+#include "strmname.h"
+#include "app.hrc"
+#include "DrawDocShell.hxx"
+#include "unprlout.hxx"
+#include "unchss.hxx"
+#include "unmovss.hxx"
+#include "sdattr.hxx"
+#include "sdresid.hxx"
+#include "drawview.hxx"
+#include "eetext.hxx"
+#include <editeng/editdata.hxx>
+#include "sdabstdlg.hxx"
+
+namespace sd
+{
+
+#ifndef SO2_DECL_SVSTORAGE_DEFINED
+#define SO2_DECL_SVSTORAGE_DEFINED
+SO2_DECL_REF(SvStorage)
+#endif
+
+TYPEINIT1( FuPresentationLayout, FuPoor );
+
+#define POOL_BUFFER_SIZE (USHORT)32768
+#define DOCUMENT_BUFFER_SIZE (USHORT)32768
+#define DOCUMENT_TOKEN (sal_Unicode('#'))
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuPresentationLayout::FuPresentationLayout (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuPresentationLayout::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuPresentationLayout( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuPresentationLayout::DoExecute( SfxRequest& rReq )
+{
+ // damit nicht Objekte, die gerade editiert werden oder selektiert
+ // sind , verschwinden
+ mpView->SdrEndTextEdit();
+
+ if(mpView->GetSdrPageView())
+ {
+ mpView->UnmarkAll();
+ }
+
+ BOOL bError = FALSE;
+
+ // die aktive Seite ermitteln
+ USHORT nSelectedPage = SDRPAGE_NOTFOUND;
+ for (USHORT nPage = 0; nPage < mpDoc->GetSdPageCount(PK_STANDARD); nPage++)
+ {
+ if (mpDoc->GetSdPage(nPage, PK_STANDARD)->IsSelected())
+ {
+ nSelectedPage = nPage;
+ break;
+ }
+ }
+
+ DBG_ASSERT(nSelectedPage != SDRPAGE_NOTFOUND, "keine selektierte Seite");
+ SdPage* pSelectedPage = mpDoc->GetSdPage(nSelectedPage, PK_STANDARD);
+ String aOldPageLayoutName(pSelectedPage->GetLayoutName());
+ String aOldLayoutName(aOldPageLayoutName);
+ aOldLayoutName.Erase(aOldLayoutName.SearchAscii(SD_LT_SEPARATOR));
+
+ // wenn wir auf einer Masterpage sind, gelten die Aenderungen fuer alle
+ // Seiten und Notizseiten, die das betreffende Layout benutzen
+ BOOL bOnMaster = FALSE;
+ if( mpViewShell && mpViewShell->ISA(DrawViewShell))
+ {
+ EditMode eEditMode =
+ static_cast<DrawViewShell*>(mpViewShell)->GetEditMode();
+ if (eEditMode == EM_MASTERPAGE)
+ bOnMaster = TRUE;
+ }
+ BOOL bMasterPage = bOnMaster;
+ BOOL bCheckMasters = FALSE;
+
+ // Dialog aufrufen
+ BOOL bLoad = FALSE; // tauchen neue Masterpages auf?
+ String aFile;
+
+ SfxItemSet aSet(mpDoc->GetPool(), ATTR_PRESLAYOUT_START, ATTR_PRESLAYOUT_END);
+
+ aSet.Put( SfxBoolItem( ATTR_PRESLAYOUT_LOAD, bLoad));
+ aSet.Put( SfxBoolItem( ATTR_PRESLAYOUT_MASTER_PAGE, bMasterPage ) );
+ aSet.Put( SfxBoolItem( ATTR_PRESLAYOUT_CHECK_MASTERS, bCheckMasters ) );
+ aSet.Put( SfxStringItem( ATTR_PRESLAYOUT_NAME, aOldLayoutName));
+
+
+
+ const SfxItemSet *pArgs = rReq.GetArgs ();
+
+ if (pArgs)
+ {
+ if (pArgs->GetItemState(ATTR_PRESLAYOUT_LOAD) == SFX_ITEM_SET)
+ bLoad = ((SfxBoolItem&)pArgs->Get(ATTR_PRESLAYOUT_LOAD)).GetValue();
+ if( pArgs->GetItemState( ATTR_PRESLAYOUT_MASTER_PAGE ) == SFX_ITEM_SET )
+ bMasterPage = ( (SfxBoolItem&) pArgs->Get( ATTR_PRESLAYOUT_MASTER_PAGE ) ).GetValue();
+ if( pArgs->GetItemState( ATTR_PRESLAYOUT_CHECK_MASTERS ) == SFX_ITEM_SET )
+ bCheckMasters = ( (SfxBoolItem&) pArgs->Get( ATTR_PRESLAYOUT_CHECK_MASTERS ) ).GetValue();
+ if (pArgs->GetItemState(ATTR_PRESLAYOUT_NAME) == SFX_ITEM_SET)
+ aFile = ((SfxStringItem&)pArgs->Get(ATTR_PRESLAYOUT_NAME)).GetValue();
+ }
+ else
+ {
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdPresLayoutDlg* pDlg = pFact ? pFact->CreateSdPresLayoutDlg(mpDocSh, mpViewShell, NULL, aSet ) : 0;
+
+ USHORT nResult = pDlg ? pDlg->Execute() : RET_CANCEL;
+
+ switch (nResult)
+ {
+ case RET_OK:
+ {
+ pDlg->GetAttr(aSet);
+ if (aSet.GetItemState(ATTR_PRESLAYOUT_LOAD) == SFX_ITEM_SET)
+ bLoad = ((SfxBoolItem&)aSet.Get(ATTR_PRESLAYOUT_LOAD)).GetValue();
+ if( aSet.GetItemState( ATTR_PRESLAYOUT_MASTER_PAGE ) == SFX_ITEM_SET )
+ bMasterPage = ( (SfxBoolItem&) aSet.Get( ATTR_PRESLAYOUT_MASTER_PAGE ) ).GetValue();
+ if( aSet.GetItemState( ATTR_PRESLAYOUT_CHECK_MASTERS ) == SFX_ITEM_SET )
+ bCheckMasters = ( (SfxBoolItem&) aSet.Get( ATTR_PRESLAYOUT_CHECK_MASTERS ) ).GetValue();
+ if (aSet.GetItemState(ATTR_PRESLAYOUT_NAME) == SFX_ITEM_SET)
+ aFile = ((SfxStringItem&)aSet.Get(ATTR_PRESLAYOUT_NAME)).GetValue();
+ }
+ break;
+
+ default:
+ bError = TRUE;
+ }
+ delete pDlg;
+ }
+
+ if (!bError)
+ {
+ mpDocSh->SetWaitCursor( TRUE );
+
+ // Hier werden nur Masterpages ausgewechselt, d.h. die aktuelle Seite
+ // bleibt aktuell. Damit beim Ein- und Ausfuegen der Masterpages nicht
+ // dauernd via PageOrderChangedHint die Methode ResetActualPage gerufen
+ // wird, wird jetzt blockiert.
+ // That isn't quitely right. If the masterpageview is active and you are
+ // removing a masterpage, it's possible that you are removing the
+ // current masterpage. So you have to call ResetActualPage !
+ if( mpViewShell->ISA(DrawViewShell) && !bCheckMasters )
+ static_cast<DrawView*>(mpView)->BlockPageOrderChangedHint(TRUE);
+
+ if (bLoad)
+ {
+ String aFileName = aFile.GetToken( 0, DOCUMENT_TOKEN );
+ SdDrawDocument* pTempDoc = mpDoc->OpenBookmarkDoc( aFileName );
+
+ // #69581: If I chosed the standard-template I got no filename and so I get no
+ // SdDrawDocument-Pointer. But the method SetMasterPage is able to handle
+ // a NULL-pointer as a Standard-template ( look at SdDrawDocument::SetMasterPage )
+ String aLayoutName;
+ if( pTempDoc )
+ aLayoutName = aFile.GetToken( 1, DOCUMENT_TOKEN );
+
+ mpDoc->SetMasterPage(nSelectedPage, aLayoutName, pTempDoc, bMasterPage, bCheckMasters);
+ mpDoc->CloseBookmarkDoc();
+ }
+ else
+ {
+ // MasterPage mit dem LayoutNamen aFile aus aktuellem Doc verwenden
+ mpDoc->SetMasterPage(nSelectedPage, aFile, mpDoc, bMasterPage, bCheckMasters);
+ }
+
+ // Blockade wieder aufheben
+ if (mpViewShell->ISA(DrawViewShell) && !bCheckMasters )
+ static_cast<DrawView*>(mpView)->BlockPageOrderChangedHint(FALSE);
+
+ /*************************************************************************
+ |* Falls dargestellte Masterpage sichtbar war, neu darstellen
+ \************************************************************************/
+ if (!bError && nSelectedPage != SDRPAGE_NOTFOUND)
+ {
+ if (bOnMaster)
+ {
+ if (mpViewShell->ISA(DrawViewShell))
+ {
+ ::sd::View* pView =
+ static_cast<DrawViewShell*>(mpViewShell)->GetView();
+ USHORT nPgNum = pSelectedPage->TRG_GetMasterPage().GetPageNum();
+
+ if (static_cast<DrawViewShell*>(mpViewShell)->GetPageKind() == PK_NOTES)
+ nPgNum++;
+
+ pView->HideSdrPage();
+ pView->ShowSdrPage(pView->GetModel()->GetMasterPage(nPgNum));
+ }
+
+ // damit TabBar aktualisiert wird
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_MASTERPAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+ else
+ {
+ pSelectedPage->SetAutoLayout(pSelectedPage->GetAutoLayout());
+ }
+ }
+
+ // fake a mode change to repaint the page tab bar
+ if( mpViewShell && mpViewShell->ISA( DrawViewShell ) )
+ {
+ DrawViewShell* pDrawViewSh =
+ static_cast<DrawViewShell*>(mpViewShell);
+ EditMode eMode = pDrawViewSh->GetEditMode();
+ BOOL bLayer = pDrawViewSh->IsLayerModeActive();
+ pDrawViewSh->ChangeEditMode( eMode, !bLayer );
+ pDrawViewSh->ChangeEditMode( eMode, bLayer );
+ }
+
+ mpDocSh->SetWaitCursor( FALSE );
+ }
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuprobjs.cxx b/sd/source/ui/func/fuprobjs.cxx
new file mode 100644
index 000000000000..d65bc8aaffe3
--- /dev/null
+++ b/sd/source/ui/func/fuprobjs.cxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fuprobjs.hxx"
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <svl/style.hxx>
+#include <editeng/outliner.hxx>
+#include <svl/smplhint.hxx>
+
+
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "strings.hrc"
+#include "glob.hrc"
+#include "prltempl.hrc"
+
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#ifndef SD_OUTLINE_VIEW_SHELL_HX
+#include "OutlineViewShell.hxx"
+#endif
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include "glob.hxx"
+#include "prlayout.hxx"
+#include "unchss.hxx"
+#include "sdabstdlg.hxx"
+namespace sd {
+
+TYPEINIT1( FuPresentationObjects, FuPoor );
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuPresentationObjects::FuPresentationObjects (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuPresentationObjects::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuPresentationObjects( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuPresentationObjects::DoExecute( SfxRequest& )
+{
+ OutlineViewShell* pOutlineViewShell = dynamic_cast< OutlineViewShell* >( mpViewShell );
+ DBG_ASSERT( pOutlineViewShell, "sd::FuPresentationObjects::DoExecute(), does not work without an OutlineViewShell!");
+ if( !pOutlineViewShell )
+ return;
+
+ // ergibt die Selektion ein eindeutiges Praesentationslayout?
+ // wenn nicht, duerfen die Vorlagen nicht bearbeitet werden
+ SfxItemSet aSet(mpDoc->GetItemPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT);
+ pOutlineViewShell->GetStatusBarState( aSet );
+ String aLayoutName = (((SfxStringItem&)aSet.Get(SID_STATUS_LAYOUT)).GetValue());
+ DBG_ASSERT(aLayoutName.Len(), "Layout unbestimmt");
+
+ BOOL bUnique = FALSE;
+ sal_Int16 nDepth, nTmp;
+ OutlineView* pOlView = static_cast<OutlineView*>(pOutlineViewShell->GetView());
+ OutlinerView* pOutlinerView = pOlView->GetViewByWindow( (Window*) mpWindow );
+ ::Outliner* pOutl = pOutlinerView->GetOutliner();
+ List* pList = pOutlinerView->CreateSelectionList();
+ Paragraph* pPara = (Paragraph*)pList->First();
+ nDepth = pOutl->GetDepth((USHORT)pOutl->GetAbsPos( pPara ) );
+ bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE );
+
+ while( pPara )
+ {
+ nTmp = pOutl->GetDepth((USHORT) pOutl->GetAbsPos( pPara ) );
+
+ if( nDepth != nTmp )
+ {
+ bUnique = FALSE;
+ break;
+ }
+
+ if( pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) != bPage )
+ {
+ bUnique = FALSE;
+ break;
+ }
+ bUnique = TRUE;
+
+ pPara = (Paragraph*) pList->Next();
+ }
+
+ if( bUnique )
+ {
+ String aStyleName = aLayoutName;
+ aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR ) );
+ USHORT nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
+ PresentationObjects ePO;
+
+ if( bPage )
+ {
+ ePO = PO_TITLE;
+ String aStr(SdResId( STR_LAYOUT_TITLE ));
+ aStyleName.Append( aStr );
+ }
+ else
+ {
+ ePO = (PresentationObjects) ( PO_OUTLINE_1 + nDepth - 1 );
+ String aStr(SdResId( STR_LAYOUT_OUTLINE ));
+ aStyleName.Append( aStr );
+ aStyleName.Append( sal_Unicode(' ') );
+ aStyleName.Append( UniString::CreateFromInt32( nDepth ) );
+ }
+
+ SfxStyleSheetBasePool* pStyleSheetPool = mpDocSh->GetStyleSheetPool();
+ SfxStyleSheetBase* pStyleSheet = pStyleSheetPool->Find( aStyleName, SD_STYLE_FAMILY_MASTERPAGE );
+ DBG_ASSERT(pStyleSheet, "StyleSheet nicht gefunden");
+
+ if( pStyleSheet )
+ {
+ SfxStyleSheetBase& rStyleSheet = *pStyleSheet;
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdPresLayoutTemplateDlg( mpDocSh, NULL, SdResId( nDlgId ), rStyleSheet, ePO, pStyleSheetPool ) : 0;
+ if( pDlg && (pDlg->Execute() == RET_OK) )
+ {
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ // Undo-Action
+ StyleSheetUndoAction* pAction = new StyleSheetUndoAction
+ (mpDoc, (SfxStyleSheet*)pStyleSheet,
+ pOutSet);
+ mpDocSh->GetUndoManager()->AddUndoAction(pAction);
+
+ pStyleSheet->GetItemSet().Put( *pOutSet );
+ ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ }
+ delete( pDlg );
+ }
+ }
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuscale.cxx b/sd/source/ui/func/fuscale.cxx
new file mode 100644
index 000000000000..dc5677c6ef2d
--- /dev/null
+++ b/sd/source/ui/func/fuscale.cxx
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuscale.hxx"
+
+#include <svx/dialogs.hrc>
+
+#include "app.hrc"
+#include "View.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "OutlineViewShell.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "DrawViewShell.hxx"
+#include "ViewShell.hxx"
+#include "fuzoom.hxx" // wegen SidArrayZoom[]
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <svx/svdpagv.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/zoom_def.hxx>
+#include <svx/zoomitem.hxx>
+#include <sfx2/request.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+namespace sd {
+
+TYPEINIT1( FuScale, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuScale::FuScale (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuScale::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuScale( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuScale::DoExecute( SfxRequest& rReq )
+{
+ INT16 nValue;
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SfxItemSet aNewAttr( mpDoc->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM );
+ SvxZoomItem* pZoomItem;
+ USHORT nZoomValues = SVX_ZOOM_ENABLE_ALL;
+
+ nValue = (INT16) mpWindow->GetZoom();
+
+ // Zoom auf Seitengroesse ?
+ if( mpViewShell && mpViewShell->ISA( DrawViewShell ) &&
+ static_cast<DrawViewShell*>(mpViewShell)->IsZoomOnPage() )
+ {
+ pZoomItem = new SvxZoomItem( SVX_ZOOM_WHOLEPAGE, nValue );
+ }
+ else
+ {
+ pZoomItem = new SvxZoomItem( SVX_ZOOM_PERCENT, nValue );
+ }
+
+ // Bereich einschraenken
+ if( mpViewShell )
+ {
+ if( mpViewShell->ISA( DrawViewShell ) )
+ {
+ SdrPageView* pPageView = mpView->GetSdrPageView();
+ if( ( pPageView && pPageView->GetObjList()->GetObjCount() == 0 ) )
+ // || ( mpView->GetMarkedObjectList().GetMarkCount() == 0 ) )
+ {
+ nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
+ }
+ }
+ else if( mpViewShell->ISA( OutlineViewShell ) )
+ {
+ nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
+ nZoomValues &= ~SVX_ZOOM_ENABLE_WHOLEPAGE;
+ nZoomValues &= ~SVX_ZOOM_ENABLE_PAGEWIDTH;
+ }
+ }
+
+ pZoomItem->SetValueSet( nZoomValues );
+ aNewAttr.Put( *pZoomItem );
+
+ AbstractSvxZoomDialog* pDlg=NULL;
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ pDlg = pFact->CreateSvxZoomDialog(NULL, aNewAttr);
+ }
+
+ if( pDlg )
+ {
+ pDlg->SetLimits( (USHORT)mpWindow->GetMinZoom(), (USHORT)mpWindow->GetMaxZoom() );
+ USHORT nResult = pDlg->Execute();
+ switch( nResult )
+ {
+ case RET_CANCEL:
+ {
+ delete pDlg;
+ delete pZoomItem;
+ rReq.Ignore ();
+ return; // Abbruch
+ }
+ default:
+ {
+ rReq.Ignore ();
+ /*
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ pArgs = rReq.GetArgs();*/
+ }
+ break;
+ }
+
+ const SfxItemSet aArgs (*(pDlg->GetOutputItemSet ()));
+
+ delete pDlg;
+
+ switch (((const SvxZoomItem &) aArgs.Get (SID_ATTR_ZOOM)).GetType ())
+ {
+ case SVX_ZOOM_PERCENT:
+ {
+ nValue = ((const SvxZoomItem &) aArgs.Get (SID_ATTR_ZOOM)).GetValue ();
+
+ mpViewShell->SetZoom( nValue );
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom );
+ }
+ break;
+
+ case SVX_ZOOM_OPTIMAL:
+ {
+ if( mpViewShell->ISA( DrawViewShell ) )
+ {
+ // Namensverwirrung: SID_SIZE_ALL -> Zoom auf alle Objekte
+ // --> Wird als Optimal im Programm angeboten
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+ }
+ break;
+
+ case SVX_ZOOM_PAGEWIDTH:
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ break;
+
+ case SVX_ZOOM_WHOLEPAGE:
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ break;
+ default:
+ break;
+ }
+ }
+
+ delete pZoomItem;
+ }
+ else if(mpViewShell && (pArgs->Count () == 1))
+ {
+ SFX_REQUEST_ARG (rReq, pScale, SfxUInt32Item, ID_VAL_ZOOM, FALSE);
+ mpViewShell->SetZoom (pScale->GetValue ());
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom );
+ }
+
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fusearch.cxx b/sd/source/ui/func/fusearch.cxx
new file mode 100755
index 000000000000..04fcf124cc14
--- /dev/null
+++ b/sd/source/ui/func/fusearch.cxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fusearch.hxx"
+
+#include <sfx2/viewfrm.hxx>
+
+#include <svx/svxids.hrc>
+#include <svl/srchitem.hxx>
+#include <svx/srchdlg.hxx>
+#include <sfx2/bindings.hxx>
+#include "fupoor.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "drawdoc.hxx"
+#include "app.hrc"
+#include "app.hxx"
+#include "View.hxx"
+#include "Outliner.hxx"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#include "ViewShellBase.hxx"
+
+class SfxRequest;
+
+namespace sd {
+
+static USHORT SidArraySpell[] = {
+ SID_DRAWINGMODE,
+ SID_OUTLINEMODE,
+ SID_DIAMODE,
+ SID_NOTESMODE,
+ SID_HANDOUTMODE,
+ 0 };
+
+TYPEINIT1( FuSearch, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuSearch::FuSearch (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq )
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq),
+ pSdOutliner(NULL),
+ bOwnOutliner(FALSE)
+{
+}
+
+FunctionReference FuSearch::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuSearch( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuSearch::DoExecute( SfxRequest& )
+{
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArraySpell );
+
+ if ( mpViewShell->ISA(DrawViewShell) )
+ {
+ bOwnOutliner = TRUE;
+ pSdOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
+ }
+ else if ( mpViewShell->ISA(OutlineViewShell) )
+ {
+ bOwnOutliner = FALSE;
+ pSdOutliner = mpDoc->GetOutliner();
+ }
+
+ if (pSdOutliner)
+ pSdOutliner->PrepareSpelling();
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuSearch::~FuSearch()
+{
+ if ( ! mpDocSh->IsInDestruction() && mpDocSh->GetViewShell()!=NULL)
+ mpDocSh->GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SidArraySpell );
+
+ if (pSdOutliner)
+ pSdOutliner->EndSpelling();
+
+ if (bOwnOutliner)
+ delete pSdOutliner;
+}
+
+
+/*************************************************************************
+|*
+|* Suchen&Ersetzen
+|*
+\************************************************************************/
+
+void FuSearch::SearchAndReplace( const SvxSearchItem* pSearchItem )
+{
+ ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current());
+ ViewShell* pViewShell = NULL;
+ if (pBase != NULL)
+ pViewShell = pBase->GetMainViewShell().get();
+
+ if (pViewShell != NULL)
+ {
+ if ( pSdOutliner && pViewShell->ISA(DrawViewShell) && !bOwnOutliner )
+ {
+ pSdOutliner->EndSpelling();
+
+ bOwnOutliner = TRUE;
+ pSdOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
+ pSdOutliner->PrepareSpelling();
+ }
+ else if ( pSdOutliner && pViewShell->ISA(OutlineViewShell) && bOwnOutliner )
+ {
+ pSdOutliner->EndSpelling();
+ delete pSdOutliner;
+
+ bOwnOutliner = FALSE;
+ pSdOutliner = mpDoc->GetOutliner();
+ pSdOutliner->PrepareSpelling();
+ }
+
+ if (pSdOutliner)
+ {
+ BOOL bEndSpelling = pSdOutliner->StartSearchAndReplace(pSearchItem);
+
+ if (bEndSpelling)
+ {
+ pSdOutliner->EndSpelling();
+ pSdOutliner->PrepareSpelling();
+ }
+ }
+ }
+}
+
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx
new file mode 100644
index 000000000000..2ddf6a5fb885
--- /dev/null
+++ b/sd/source/ui/func/fusel.cxx
@@ -0,0 +1,1498 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fusel.hxx"
+#include <vos/process.hxx>
+#include <basic/sbstar.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/polysc3d.hxx>
+#include "drawview.hxx"
+#include <svtools/imapobj.hxx>
+#include <svl/urihelper.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <svx/svxids.hrc>
+#include <svx/xfillit0.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/docfile.hxx>
+#include <tools/debug.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/flditem.hxx>
+
+#include <svx/svdotable.hxx>
+
+#include "app.hrc"
+#include "strings.hrc"
+#include "res_bmp.hrc"
+#include "GraphicDocShell.hxx"
+#include "app.hxx"
+#include "DrawDocShell.hxx"
+#include "stlpool.hxx"
+#include "anmdef.hxx"
+#include "anminfo.hxx"
+#include "fudraw.hxx"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#ifndef SD_FRAMW_VIEW_HXX
+#include "FrameView.hxx"
+#endif
+#include "View.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "DrawViewShell.hxx"
+#include "ToolBarManager.hxx"
+#include "pgjump.hxx"
+#include <svx/globl3d.hxx>
+#include "Client.hxx"
+
+#include "slideshow.hxx"
+
+// #108981#
+#include <svx/svdundo.hxx>
+#include <avmedia/mediawindow.hxx>
+
+#include <svx/sdrhittesthelper.hxx>
+
+using namespace ::com::sun::star;
+
+namespace sd {
+
+TYPEINIT1( FuSelection, FuDraw );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuSelection::FuSelection (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuDraw(pViewSh, pWin, pView, pDoc, rReq),
+ bTempRotation(FALSE),
+ bSelectionChanged(FALSE),
+ bHideAndAnimate(FALSE),
+ pHdl(NULL),
+ bSuppressChangesOfSelection(FALSE),
+ bMirrorSide0(FALSE),
+ nEditMode(SID_BEZIER_MOVE),
+ pWaterCanCandidate(NULL)
+{
+}
+
+FunctionReference FuSelection::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuSelection( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuSelection::DoExecute( SfxRequest& rReq )
+{
+ FuDraw::DoExecute( rReq );
+
+ // Objektbar auswaehlen
+ SelectionHasChanged();
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuSelection::~FuSelection()
+{
+ mpView->UnmarkAllPoints();
+ mpView->ResetCreationActive();
+
+ if ( mpView->GetDragMode() != SDRDRAG_MOVE )
+ {
+ mpView->SetDragMode(SDRDRAG_MOVE);
+ }
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ // Hack fuer #?????#
+ bHideAndAnimate = FALSE;
+
+ pHdl = NULL;
+ BOOL bReturn = FuDraw::MouseButtonDown(rMEvt);
+ BOOL bWaterCan = SD_MOD()->GetWaterCan();
+ const bool bReadOnly = mpDocSh->IsReadOnly();
+ // When the right mouse button is pressed then only select objects
+ // (and deselect others) as a preparation for showing the context
+ // menu.
+ const bool bSelectionOnly = rMEvt.IsRight();
+
+ bMBDown = TRUE;
+ bSelectionChanged = FALSE;
+
+ if ( mpView->IsAction() )
+ {
+ if ( rMEvt.IsRight() )
+ mpView->BckAction();
+ return TRUE;
+ }
+
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+
+ // The following code is executed for right clicks as well as for left
+ // clicks in order to modify the selection for the right button as a
+ // preparation for the context menu. The functions BegMarkObject() and
+ // BegDragObject(), however, are not called for right clicks because a)
+ // it makes no sense and b) to have IsAction() return FALSE when called
+ // from Command() which is a prerequisite for the context menu.
+ if ((rMEvt.IsLeft() || rMEvt.IsRight())
+ && !mpView->IsAction()
+ && (mpView->IsFrameDragSingles() || !mpView->HasMarkablePoints()))
+ {
+ /******************************************************************
+ * KEIN BEZIER_EDITOR
+ ******************************************************************/
+ mpWindow->CaptureMouse();
+ pHdl = mpView->PickHandle(aMDPos);
+ SdrObject* pObj;
+ SdrPageView* pPV;
+
+ long nAngle0 = GetAngle(aMDPos - mpView->GetRef1());
+ nAngle0 -= 27000;
+ nAngle0 = NormAngle360(nAngle0);
+ bMirrorSide0 = BOOL (nAngle0 < 18000L);
+
+ if (!pHdl && mpView->Is3DRotationCreationActive())
+ {
+ /******************************************************************
+ * Wenn 3D-Rotationskoerper erstellt werden sollen, jetzt
+ * die Erstellung beenden
+ ******************************************************************/
+ bSuppressChangesOfSelection = TRUE;
+ if(mpWindow)
+ mpWindow->EnterWait();
+ mpView->End3DCreation();
+ bSuppressChangesOfSelection = FALSE;
+ mpView->ResetCreationActive();
+ if(mpWindow)
+ mpWindow->LeaveWait();
+ }
+
+ BOOL bTextEdit = FALSE;
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if ( eHit == SDRHIT_TEXTEDITOBJ && ( mpViewShell->GetFrameView()->IsQuickEdit() || dynamic_cast< sdr::table::SdrTableObj* >( aVEvt.pObj ) != NULL ) )
+ {
+ bTextEdit = TRUE;
+ }
+
+ if(!bTextEdit
+ && !mpDocSh->IsReadOnly()
+ && ((mpView->IsMarkedHit(aMDPos, nHitLog) && !rMEvt.IsShift() && !rMEvt.IsMod2()) || pHdl != NULL)
+ && (rMEvt.GetClicks() != 2)
+ )
+ {
+ if (!pHdl && mpView->Is3DRotationCreationActive())
+ {
+ // Wechsel Rotationskoerper -> Selektion
+ mpView->ResetCreationActive();
+ }
+ else if (bWaterCan)
+ {
+ // Remember the selected object for proper handling in
+ // MouseButtonUp().
+ pWaterCanCandidate = pickObject (aMDPos);
+ }
+ else
+ {
+ // Handle oder markiertes Objekt getroffen
+ bFirstMouseMove = TRUE;
+ aDragTimer.Start();
+ }
+
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
+ bReturn = TRUE;
+ }
+ else
+ {
+ if (!rMEvt.IsMod2() && mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO))
+ {
+ mpView->BegMacroObj(aMDPos, nHitLog, pObj, pPV, mpWindow);
+ bReturn = TRUE;
+ }
+ else if ( bTextEdit )
+ {
+ UINT16 nSdrObjKind = aVEvt.pObj->GetObjIdentifier();
+
+ if (aVEvt.pObj->GetObjInventor() == SdrInventor &&
+ (nSdrObjKind == OBJ_TEXT ||
+ nSdrObjKind == OBJ_TITLETEXT ||
+ nSdrObjKind == OBJ_OUTLINETEXT ||
+ !aVEvt.pObj->IsEmptyPresObj()))
+ {
+ // Seamless Editing: Verzweigen zur Texteingabe
+ if (!rMEvt.IsShift())
+ mpView->UnmarkAll();
+
+ SfxUInt16Item aItem(SID_TEXTEDIT, 1);
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_TEXTEDIT, SFX_CALLMODE_SYNCHRON |
+ SFX_CALLMODE_RECORD, &aItem, 0L);
+ return bReturn; // VORSICHT, durch den synchronen Slot ist das objekt jetzt geloescht
+ }
+ }
+ else if ( !rMEvt.IsMod2() && rMEvt.GetClicks() == 1 &&
+ aVEvt.eEvent == SDREVENT_EXECUTEURL )
+ {
+ mpWindow->ReleaseMouse();
+ SfxStringItem aStrItem(SID_FILE_NAME, aVEvt.pURLField->GetURL());
+ SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName());
+ SfxBoolItem aBrowseItem( SID_BROWSE, TRUE );
+ SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
+ mpWindow->ReleaseMouse();
+
+ if (rMEvt.IsMod1())
+ {
+ // Im neuen Frame oeffnen
+ pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aBrowseItem, &aReferer, 0L);
+ }
+ else
+ {
+ // Im aktuellen Frame oeffnen
+ SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
+ pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
+ }
+
+ bReturn = TRUE;
+ }
+ else if(!rMEvt.IsMod2()
+ && mpViewShell->ISA(DrawViewShell)
+ )
+ {
+ if(mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER))
+ {
+ // Animate object when not just selecting.
+ if ( ! bSelectionOnly)
+ bReturn = AnimateObj(pObj, aMDPos);
+
+ if (!bReturn && (pObj->ISA(SdrObjGroup) || pObj->ISA(E3dPolyScene)))
+ {
+ if(rMEvt.GetClicks() == 1)
+ {
+ // In die Gruppe hineinschauen
+ if (mpView->PickObj(aMDPos, mpView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_DEEP))
+ bReturn = AnimateObj(pObj, aMDPos);
+ }
+ else if( !bReadOnly && rMEvt.GetClicks() == 2)
+ {
+ // Neu: Doppelklick auf selektiertes Gruppenobjekt
+ // Gruppe betreten
+ if ( ! bSelectionOnly
+ && pObj
+ && pObj->GetPage() == pPV->GetPage())
+ bReturn = pPV->EnterGroup(pObj);
+ }
+ }
+ }
+
+ // #i71727# replaced else here with two possibilities, once the original else (!pObj)
+ // and also ignoring the found object when it's on a masterpage
+ if(!pObj || (pObj->GetPage() && pObj->GetPage()->IsMasterPage()))
+ {
+ if(mpView->IsGroupEntered() && 2 == rMEvt.GetClicks())
+ {
+ // New: double click on empty space/on obj on MasterPage, leave group
+ mpView->LeaveOneGroup();
+ bReturn = TRUE;
+ }
+ }
+ }
+
+ if (!bReturn)
+ {
+ if (bWaterCan)
+ {
+ if ( ! (rMEvt.IsShift() || rMEvt.IsMod2()))
+ {
+ // Find the object under the current mouse position
+ // and store it for the MouseButtonUp() method to
+ // evaluate.
+ pWaterCanCandidate = pickObject (aMDPos);
+ }
+ }
+ else
+ {
+ bReturn = TRUE;
+ BOOL bDeactivateOLE = FALSE;
+
+ if ( !rMEvt.IsShift() && !rMEvt.IsMod2() )
+ {
+ OSL_ASSERT (mpViewShell->GetViewShell()!=NULL);
+ Client* pIPClient = static_cast<Client*>(
+ mpViewShell->GetViewShell()->GetIPClient());
+
+ if (pIPClient && pIPClient->IsObjectInPlaceActive())
+ {
+ // OLE-Objekt wird im nachfolgenden UnmarkAll() deaktiviert
+ bDeactivateOLE = TRUE;
+ }
+
+ mpView->UnmarkAll();
+ }
+
+ BOOL bMarked = FALSE;
+
+ if ( !rMEvt.IsMod1() && !bDeactivateOLE)
+ {
+ if ( rMEvt.IsMod2() )
+ {
+ bMarked = mpView->MarkNextObj(aMDPos, nHitLog, rMEvt.IsShift() );
+ }
+ else
+ {
+ BOOL bToggle = FALSE;
+
+ if (rMEvt.IsShift() && mpView->GetMarkedObjectList().GetMarkCount() > 1)
+ {
+ // Bei Einfachselektion kein Toggle
+ bToggle = TRUE;
+ }
+
+ bMarked = mpView->MarkObj(aMDPos, nHitLog, bToggle, FALSE);
+ }
+ }
+
+ if( !bDeactivateOLE )
+ {
+ if ( !bReadOnly &&
+ bMarked &&
+ (!rMEvt.IsShift() || mpView->IsMarkedHit(aMDPos, nHitLog)))
+ {
+ /**********************************************************
+ * Objekt verschieben
+ **********************************************************/
+ aDragTimer.Start();
+
+ pHdl=mpView->PickHandle(aMDPos);
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
+ }
+ else
+ {
+ /**********************************************************
+ * Objekt selektieren
+ **********************************************************/
+ if ( ! rMEvt.IsRight())
+ mpView->BegMarkObj(aMDPos);
+ }
+ }
+ }
+ }
+ }
+ }
+ else if ( !bReadOnly
+ && (rMEvt.IsLeft() || rMEvt.IsRight())
+ && !mpView->IsAction())
+ {
+ /**********************************************************************
+ * BEZIER-EDITOR
+ **********************************************************************/
+ mpWindow->CaptureMouse();
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_HANDLE && aVEvt.pHdl->GetKind() == HDL_BWGT)
+ {
+ /******************************************************************
+ * Handle draggen
+ ******************************************************************/
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && nEditMode == SID_BEZIER_INSERT)
+ {
+ /******************************************************************
+ * Klebepunkt einfuegen
+ ******************************************************************/
+ mpView->BegInsObjPoint(aMDPos, rMEvt.IsMod1());
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1())
+ {
+ /******************************************************************
+ * Klebepunkt selektieren
+ ******************************************************************/
+ if (!rMEvt.IsShift())
+ mpView->UnmarkAllPoints();
+
+ if ( ! rMEvt.IsRight())
+ mpView->BegMarkPoints(aMDPos);
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2())
+ {
+ /******************************************************************
+ * Objekt verschieben
+ ******************************************************************/
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, NULL, nDrgLog);
+ }
+ else if (eHit == SDRHIT_HANDLE)
+ {
+ /******************************************************************
+ * Klebepunkt selektieren
+ ******************************************************************/
+ if (!mpView->IsPointMarked(*aVEvt.pHdl) || rMEvt.IsShift())
+ {
+ if (!rMEvt.IsShift())
+ {
+ mpView->UnmarkAllPoints();
+ pHdl = mpView->PickHandle(aMDPos);
+ }
+ else
+ {
+ if (mpView->IsPointMarked(*aVEvt.pHdl))
+ {
+ mpView->UnmarkPoint(*aVEvt.pHdl);
+ pHdl = NULL;
+ }
+ else
+ {
+ pHdl = mpView->PickHandle(aMDPos);
+ }
+ }
+
+ if (pHdl)
+ {
+ mpView->MarkPoint(*pHdl);
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
+ }
+ }
+ else
+ {
+ // #90239# point IS marked and NO shift is pressed. Start
+ // dragging of selected point(s)
+ pHdl = mpView->PickHandle(aMDPos);
+ if(pHdl)
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*)NULL, pHdl, nDrgLog);
+ }
+ }
+ else
+ {
+ /******************************************************************
+ * Objekt selektieren oder draggen
+ ******************************************************************/
+ if (!rMEvt.IsShift() && !rMEvt.IsMod2() && eHit == SDRHIT_UNMARKEDOBJECT)
+ {
+ mpView->UnmarkAllObj();
+ }
+
+ BOOL bMarked = FALSE;
+
+ if (!rMEvt.IsMod1())
+ {
+ if (rMEvt.IsMod2())
+ {
+ bMarked = mpView->MarkNextObj(aMDPos, nHitLog, rMEvt.IsShift());
+ }
+ else
+ {
+ bMarked = mpView->MarkObj(aMDPos, nHitLog, rMEvt.IsShift(), FALSE);
+ }
+ }
+
+ if (bMarked &&
+ (!rMEvt.IsShift() || eHit == SDRHIT_MARKEDOBJECT))
+ {
+ // Objekt verschieben
+ if ( ! rMEvt.IsRight())
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
+ }
+ else if (mpView->AreObjectsMarked())
+ {
+ /**************************************************************
+ * Klebepunkt selektieren
+ **************************************************************/
+ if (!rMEvt.IsShift())
+ mpView->UnmarkAllPoints();
+
+ if ( ! rMEvt.IsRight())
+ mpView->BegMarkPoints(aMDPos);
+ }
+ else
+ {
+ /**************************************************************
+ * Objekt selektieren
+ **************************************************************/
+ if ( ! rMEvt.IsRight())
+ mpView->BegMarkObj(aMDPos);
+ }
+
+ ForcePointer(&rMEvt);
+ }
+ }
+
+ if (!bIsInDragMode)
+ {
+ ForcePointer(&rMEvt);
+ }
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuSelection::MouseMove(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FuDraw::MouseMove(rMEvt);
+
+ if (aDragTimer.IsActive())
+ {
+ if(bFirstMouseMove)
+ {
+ bFirstMouseMove = FALSE;
+ }
+ else
+ {
+ aDragTimer.Stop();
+ }
+ }
+
+ if (mpView->IsAction())
+ {
+ Point aPix(rMEvt.GetPosPixel());
+ Point aPnt(mpWindow->PixelToLogic(aPix));
+
+ ForceScroll(aPix);
+
+ if (mpView->IsInsObjPoint())
+ {
+ mpView->MovInsObjPoint(aPnt);
+ }
+ else
+ {
+ mpView->MovAction(aPnt);
+ }
+ }
+
+ ForcePointer(&rMEvt);
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+ // When the right mouse button is pressed then only select objects
+ // (and deselect others) as a preparation for showing the context
+ // menu.
+ const bool bSelectionOnly = rMEvt.IsRight();
+
+ if (bHideAndAnimate)
+ {
+ // Animation laeuft noch -> sofort returnieren
+ bHideAndAnimate = FALSE;
+ pHdl = NULL;
+ mpWindow->ReleaseMouse();
+ return(TRUE);
+ }
+
+ if (aDragTimer.IsActive() )
+ {
+ aDragTimer.Stop();
+ bIsInDragMode = FALSE;
+ }
+
+ if( !mpView )
+ return (FALSE);
+
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+ USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ if (mpView->IsFrameDragSingles() || !mpView->HasMarkablePoints())
+ {
+ /**********************************************************************
+ * KEIN BEZIER_EDITOR
+ **********************************************************************/
+ if ( mpView->IsDragObj() )
+ {
+ /******************************************************************
+ * Objekt wurde verschoben
+ ******************************************************************/
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+ BOOL bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
+
+ if (bDragWithCopy)
+ {
+ bDragWithCopy = !mpView->IsPresObjSelected(FALSE, TRUE);
+ }
+
+ mpView->SetDragWithCopy(bDragWithCopy);
+ mpView->EndDragObj( mpView->IsDragWithCopy() );
+
+ mpView->ForceMarkedToAnotherPage();
+
+ if (!rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() &&
+ !bSelectionChanged &&
+ Abs(aPnt.X() - aMDPos.X()) < nDrgLog &&
+ Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
+ {
+ /**************************************************************
+ * Toggle zw. Selektion und Rotation
+ **************************************************************/
+ SdrObject* pSingleObj = NULL;
+ ULONG nMarkCount = mpView->GetMarkedObjectList().GetMarkCount();
+
+ if (nMarkCount==1)
+ {
+ pSingleObj = mpView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ }
+
+ if (nSlotId == SID_OBJECT_SELECT
+ && mpView->IsRotateAllowed()
+ && (mpViewShell->GetFrameView()->IsClickChangeRotation()
+ || (pSingleObj
+ && pSingleObj->GetObjInventor()==E3dInventor))
+ && ! bSelectionOnly)
+
+ {
+ bTempRotation = TRUE;
+ nSlotId = SID_OBJECT_ROTATE;
+ Activate();
+ }
+ else if (nSlotId == SID_OBJECT_ROTATE)
+ {
+ nSlotId = SID_OBJECT_SELECT;
+ Activate();
+ }
+ }
+ else if (nSlotId == SID_CONVERT_TO_3D_LATHE)
+ {
+ if (!pHdl)
+ {
+ bSuppressChangesOfSelection = TRUE;
+ mpView->Start3DCreation();
+ bSuppressChangesOfSelection = FALSE;
+ }
+ else if (pHdl->GetKind() != HDL_MIRX &&
+ pHdl->GetKind() != HDL_REF1 &&
+ pHdl->GetKind() != HDL_REF2 && mpView->Is3DRotationCreationActive())
+ {
+ /*********************************************************
+ * Wenn 3D-Rotationskoerper erstellt werden sollen, jetzt
+ * die Erstellung beenden
+ **********************************************************/
+ long nAngle1 = GetAngle(aPnt - mpView->GetRef1());
+ nAngle1 -= 27000;
+ nAngle1 = NormAngle360(nAngle1);
+ BOOL bMirrorSide1 = BOOL (nAngle1 < 18000L);
+
+ if (bMirrorSide0 != bMirrorSide1)
+ {
+ bSuppressChangesOfSelection = TRUE;
+ if(mpWindow)
+ mpWindow->EnterWait();
+ mpView->End3DCreation();
+ bSuppressChangesOfSelection = FALSE;
+ nSlotId = SID_OBJECT_SELECT;
+ if(mpWindow)
+ mpWindow->LeaveWait();
+ Activate();
+ }
+ }
+ }
+ }
+ else if (rMEvt.IsMod1()
+ && !rMEvt.IsMod2()
+ && Abs(aPnt.X() - aMDPos.X()) < nDrgLog
+ && Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
+ {
+ // Gruppe betreten
+ mpView->MarkObj(aPnt, nHitLog, rMEvt.IsShift(), rMEvt.IsMod1());
+ }
+
+ if (mpView->IsAction() )
+ {
+ mpView->EndAction();
+ }
+
+ if( SD_MOD()->GetWaterCan() )
+ {
+ if( rMEvt.IsRight() )
+ {
+ // Bei rechter Maustaste wird im Giesskannenmodus ein Undo ausgefuehrt
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_UNDO, SFX_CALLMODE_ASYNCHRON );
+ }
+ else if (pWaterCanCandidate != NULL)
+ {
+ // Is the candiate object still under the mouse?
+ if (pickObject (aPnt) == pWaterCanCandidate)
+ {
+ SdStyleSheetPool* pPool = static_cast<SdStyleSheetPool*>(
+ mpDocSh->GetStyleSheetPool());
+ if (pPool != NULL)
+ {
+ SfxStyleSheet* pStyleSheet = static_cast<SfxStyleSheet*>(
+ pPool->GetActualStyleSheet());
+ if (pStyleSheet != NULL && mpView->IsUndoEnabled() )
+ {
+ // #108981#
+ // Added UNDOs for the WaterCan mode. This was never done in
+ // the past, thus it was missing all the time.
+ SdrUndoAction* pUndoAttr = mpDoc->GetSdrUndoFactory().CreateUndoAttrObject(*pWaterCanCandidate, sal_True, sal_True);
+ mpView->BegUndo(pUndoAttr->GetComment());
+ mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoGeoObject(*pWaterCanCandidate));
+ mpView->AddUndo(pUndoAttr);
+
+ pWaterCanCandidate->SetStyleSheet (pStyleSheet, FALSE);
+
+ // #108981#
+ mpView->EndUndo();
+ }
+ }
+ }
+ }
+ // else when there has been no object under the mouse when the
+ // button was pressed then nothing happens even when there is
+ // one now.
+ }
+
+ USHORT nClicks = rMEvt.GetClicks();
+
+ if (nClicks == 2 && rMEvt.IsLeft() && bMBDown &&
+ !rMEvt.IsMod1() && !rMEvt.IsShift() )
+ {
+ DoubleClick(rMEvt);
+ }
+
+ bMBDown = FALSE;
+
+ ForcePointer(&rMEvt);
+ pHdl = NULL;
+ mpWindow->ReleaseMouse();
+ SdrObject* pSingleObj = NULL;
+ ULONG nMarkCount = mpView->GetMarkedObjectList().GetMarkCount();
+
+ if (nMarkCount==1)
+ {
+ pSingleObj = mpView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ }
+
+ if ( (nSlotId != SID_OBJECT_SELECT && nMarkCount==0) ||
+ ( mpView->GetDragMode() == SDRDRAG_CROOK &&
+ !mpView->IsCrookAllowed( mpView->IsCrookNoContortion() ) ) ||
+ ( mpView->GetDragMode() == SDRDRAG_SHEAR &&
+ !mpView->IsShearAllowed() && !mpView->IsDistortAllowed() ) ||
+ ( nSlotId==SID_CONVERT_TO_3D_LATHE && pSingleObj &&
+ (pSingleObj->GetObjInventor() != SdrInventor ||
+ pSingleObj->GetObjIdentifier() == OBJ_MEASURE) ) )
+ {
+ bReturn = TRUE;
+ ForcePointer(&rMEvt);
+ pHdl = NULL;
+ mpWindow->ReleaseMouse();
+ FuDraw::MouseButtonUp(rMEvt);
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SYNCHRON);
+ return bReturn; // VORSICHT, durch den synchronen Slot ist das objekt jetzt geloescht
+ }
+
+ FuDraw::MouseButtonUp(rMEvt);
+ }
+ else
+ {
+ /**********************************************************************
+ * BEZIER_EDITOR
+ **********************************************************************/
+ if ( mpView->IsAction() )
+ {
+ if ( mpView->IsInsObjPoint() )
+ {
+ mpView->EndInsObjPoint(SDRCREATE_FORCEEND);
+ }
+ else if ( mpView->IsDragObj() )
+ {
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+ BOOL bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
+
+ if (bDragWithCopy)
+ {
+ bDragWithCopy = !mpView->IsPresObjSelected(FALSE, TRUE);
+ }
+
+ mpView->SetDragWithCopy(bDragWithCopy);
+ mpView->EndDragObj( mpView->IsDragWithCopy() );
+ }
+ else
+ {
+ mpView->EndAction();
+
+ USHORT nDrgLog2 = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ Point aPos = mpWindow->PixelToLogic( rMEvt.GetPosPixel() );
+
+ if (Abs(aMDPos.X() - aPos.X()) < nDrgLog2 &&
+ Abs(aMDPos.Y() - aPos.Y()) < nDrgLog2 &&
+ !rMEvt.IsShift() && !rMEvt.IsMod2())
+ {
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_NONE)
+ {
+ // Klick auf der Stelle: deselektieren
+ mpView->UnmarkAllObj();
+ }
+ }
+ }
+ }
+ else if (!rMEvt.IsShift() && rMEvt.IsMod1() && !rMEvt.IsMod2() &&
+ Abs(aPnt.X() - aMDPos.X()) < nDrgLog &&
+ Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
+ {
+ // Gruppe betreten
+ mpView->MarkObj(aPnt, nHitLog, FALSE, rMEvt.IsMod1());
+ }
+
+
+ ForcePointer(&rMEvt);
+ pHdl = NULL;
+ mpWindow->ReleaseMouse();
+
+ FuDraw::MouseButtonUp(rMEvt);
+ }
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+BOOL FuSelection::KeyInput(const KeyEvent& rKEvt)
+{
+ BOOL bReturn = FALSE;
+
+ switch (rKEvt.GetKeyCode().GetCode())
+ {
+ case KEY_ESCAPE:
+ {
+ bReturn = FuSelection::cancel();
+ }
+ break;
+ }
+
+ if (!bReturn)
+ {
+ bReturn = FuDraw::KeyInput(rKEvt);
+
+ if(mpView->GetMarkedObjectList().GetMarkCount() == 0)
+ {
+ mpView->ResetCreationActive();
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ }
+ }
+
+ return(bReturn);
+
+}
+
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuSelection::Activate()
+{
+ SdrDragMode eMode;
+ mpView->ResetCreationActive();
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+
+ switch( nSlotId )
+ {
+ case SID_OBJECT_ROTATE:
+ {
+ // (gemapter) Slot wird explizit auf Rotate gesetzt #31052#
+ if( mpViewShell->ISA(DrawViewShell) )
+ {
+ USHORT* pSlotArray =
+ static_cast<DrawViewShell*>(mpViewShell)->GetSlotArray();
+ pSlotArray[ 1 ] = SID_OBJECT_ROTATE;
+ }
+
+ eMode = SDRDRAG_ROTATE;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+
+ case SID_OBJECT_MIRROR:
+ {
+ eMode = SDRDRAG_MIRROR;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+
+ case SID_OBJECT_CROP:
+ {
+ eMode = SDRDRAG_CROP;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+
+ case SID_OBJECT_TRANSPARENCE:
+ {
+ eMode = SDRDRAG_TRANSPARENCE;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+
+ case SID_OBJECT_GRADIENT:
+ {
+ eMode = SDRDRAG_GRADIENT;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+
+ case SID_OBJECT_SHEAR:
+ {
+ eMode = SDRDRAG_SHEAR;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+
+ case SID_OBJECT_CROOK_ROTATE:
+ {
+ eMode = SDRDRAG_CROOK;
+
+ if ( mpView->GetDragMode() != eMode )
+ {
+ mpView->SetDragMode(eMode);
+ mpView->SetCrookMode(SDRCROOK_ROTATE);
+ }
+ }
+ break;
+
+ case SID_OBJECT_CROOK_SLANT:
+ {
+ eMode = SDRDRAG_CROOK;
+
+ if ( mpView->GetDragMode() != eMode )
+ {
+ mpView->SetDragMode(eMode);
+ mpView->SetCrookMode(SDRCROOK_SLANT);
+ }
+ }
+ break;
+
+ case SID_OBJECT_CROOK_STRETCH:
+ {
+ eMode = SDRDRAG_CROOK;
+
+ if ( mpView->GetDragMode() != eMode )
+ {
+ mpView->SetDragMode(eMode);
+ mpView->SetCrookMode(SDRCROOK_STRETCH);
+ }
+ }
+ break;
+
+ case SID_CONVERT_TO_3D_LATHE:
+ {
+ eMode = SDRDRAG_MIRROR;
+ bSuppressChangesOfSelection = TRUE;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+
+ if (!mpView->Is3DRotationCreationActive())
+ mpView->Start3DCreation();
+
+ bSuppressChangesOfSelection = FALSE;
+ }
+ break;
+
+ default:
+ {
+ eMode = SDRDRAG_MOVE;
+
+ if ( mpView->GetDragMode() != eMode )
+ mpView->SetDragMode(eMode);
+ }
+ break;
+ }
+
+ if (nSlotId != SID_OBJECT_ROTATE)
+ {
+ bTempRotation = FALSE;
+ }
+
+ FuDraw::Activate();
+}
+
+
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuSelection::Deactivate()
+{
+ FuDraw::Deactivate();
+}
+
+
+/*************************************************************************
+|*
+|* Selektion hat sich geaendert
+|*
+\************************************************************************/
+
+void FuSelection::SelectionHasChanged()
+{
+ bSelectionChanged = TRUE;
+
+ FuDraw::SelectionHasChanged();
+
+ if ((mpView->Is3DRotationCreationActive() && !bSuppressChangesOfSelection))
+ {
+ // Wechsel Rotationskoerper -> Selektion
+ mpView->ResetCreationActive();
+ nSlotId = SID_OBJECT_SELECT;
+ Activate();
+ }
+
+ // Activate the right tool bar for the current context of the view.
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*mpViewShell, *mpView);
+}
+
+
+/*************************************************************************
+|*
+|* Aktuellen Bezier-Editmodus setzen
+|*
+\************************************************************************/
+
+void FuSelection::SetEditMode(USHORT nMode)
+{
+ nEditMode = nMode;
+
+ if (nEditMode == SID_BEZIER_INSERT)
+ {
+ mpView->SetInsObjPointMode(TRUE);
+ }
+ else
+ {
+ mpView->SetInsObjPointMode(FALSE);
+ }
+
+ ForcePointer();
+
+ SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate(SID_BEZIER_MOVE);
+ rBindings.Invalidate(SID_BEZIER_INSERT);
+}
+
+/*************************************************************************
+|*
+|* Animation oder Interaktion ausfuehren
+|*
+\************************************************************************/
+
+BOOL FuSelection::AnimateObj(SdrObject* pObj, const Point& rPos)
+{
+ BOOL bAnimated = FALSE;
+ BOOL bClosed = pObj->IsClosedObj();
+ BOOL bFilled = FALSE;
+
+ if (bClosed)
+ {
+ SfxItemSet aSet(mpDoc->GetPool());
+
+ aSet.Put(pObj->GetMergedItemSet());
+
+ const XFillStyleItem& rFillStyle = (const XFillStyleItem&) aSet.Get(XATTR_FILLSTYLE);
+ bFilled = rFillStyle.GetValue() != XFILL_NONE;
+ }
+
+ const SetOfByte* pVisiLayer = &mpView->GetSdrPageView()->GetVisibleLayers();
+ USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ const long n2HitLog = nHitLog * 2;
+ Point aHitPosR(rPos);
+ Point aHitPosL(rPos);
+ Point aHitPosT(rPos);
+ Point aHitPosB(rPos);
+
+ aHitPosR.X() += n2HitLog;
+ aHitPosL.X() -= n2HitLog;
+ aHitPosT.Y() += n2HitLog;
+ aHitPosB.Y() -= n2HitLog;
+
+ if ( !bClosed ||
+ !bFilled ||
+ (SdrObjectPrimitiveHit(*pObj, aHitPosR, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pObj, aHitPosL, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pObj, aHitPosT, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) &&
+ SdrObjectPrimitiveHit(*pObj, aHitPosB, nHitLog, *mpView->GetSdrPageView(), pVisiLayer, false) ) )
+ {
+ if ( mpDoc->GetIMapInfo( pObj ) )
+ {
+ const IMapObject* pIMapObj = mpDoc->GetHitIMapObject( pObj, rPos, *mpWindow );
+
+ if ( pIMapObj && pIMapObj->GetURL().Len() )
+ {
+ // Sprung zu Dokument
+ mpWindow->ReleaseMouse();
+ SfxStringItem aStrItem(SID_FILE_NAME, pIMapObj->GetURL());
+ SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName());
+ SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
+ SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
+ SfxBoolItem aBrowseItem( SID_BROWSE, TRUE );
+ mpWindow->ReleaseMouse();
+ pFrame->GetDispatcher()->
+ Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
+
+ bAnimated = TRUE;
+ }
+ }
+ else if (!mpDocSh->ISA(GraphicDocShell) &&
+ mpView->ISA(DrawView) &&
+ mpDoc->GetAnimationInfo(pObj))
+ {
+ /**********************************************************
+ * Animations-Objekt in der Mitte getroffen -> Interaktion
+ **********************************************************/
+ SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj);
+ DrawViewShell* pDrViewSh = static_cast<DrawViewShell*>(mpViewShell);
+ mpWindow->ReleaseMouse();
+
+ switch (pInfo->meClickAction)
+ {
+ case presentation::ClickAction_BOOKMARK:
+ {
+ // Sprung zu Bookmark (Seite oder Objekt)
+ SfxStringItem aItem(SID_NAVIGATOR_OBJECT, pInfo->GetBookmark());
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_NAVIGATOR_OBJECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L);
+ bAnimated = TRUE;
+ }
+ break;
+
+ case presentation::ClickAction_DOCUMENT:
+ {
+ String sBookmark( pInfo->GetBookmark() );
+ // Sprung zu Dokument
+ if (sBookmark.Len())
+ {
+ SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName());
+ SfxStringItem aStrItem(SID_FILE_NAME, sBookmark);
+ SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
+ SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
+ SfxBoolItem aBrowseItem( SID_BROWSE, TRUE );
+ pFrame->GetDispatcher()->
+ Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
+ }
+
+ bAnimated = TRUE;
+ }
+ break;
+
+ case presentation::ClickAction_PREVPAGE:
+ {
+ // Sprung zur vorherigen Seite
+ SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_PREVIOUS);
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
+ &aItem, 0L);
+ bAnimated = TRUE;
+ }
+ break;
+
+ case presentation::ClickAction_NEXTPAGE:
+ {
+ // Sprung zur naechsten Seite
+ SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_NEXT);
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
+ &aItem, 0L);
+ bAnimated = TRUE;
+ }
+ break;
+
+ case presentation::ClickAction_FIRSTPAGE:
+ {
+ // Sprung zu erster Seite
+ SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_FIRST);
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
+ &aItem, 0L);
+ bAnimated = TRUE;
+ }
+ break;
+
+ case presentation::ClickAction_LASTPAGE:
+ {
+ // Sprung zu letzter Seite
+ SfxUInt16Item aItem(SID_NAVIGATOR_PAGE, PAGE_LAST);
+ mpViewShell->GetViewFrame()->GetDispatcher()->
+ Execute(SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD,
+ &aItem, 0L);
+ bAnimated = TRUE;
+ }
+ break;
+
+ case presentation::ClickAction_SOUND:
+ {
+ try
+ {
+ mxPlayer.set( avmedia::MediaWindow::createPlayer( pInfo->GetBookmark()), uno::UNO_QUERY_THROW );
+ mxPlayer->start();
+ }
+ catch( uno::Exception& e )
+ {
+ (void)e;
+ }
+ bAnimated = TRUE;
+ }
+ break;
+
+ case presentation::ClickAction_VERB:
+ {
+ // Verb zuweisen
+ mpView->UnmarkAll();
+ mpView->MarkObj(pObj, mpView->GetSdrPageView(), FALSE, FALSE);
+ pDrViewSh->DoVerb((sal_Int16)pInfo->mnVerb);
+ bAnimated = TRUE;
+ }
+ break;
+
+ case presentation::ClickAction_PROGRAM:
+ {
+ String aBaseURL = GetDocSh()->GetMedium()->GetBaseURL();
+ INetURLObject aURL( ::URIHelper::SmartRel2Abs( INetURLObject(aBaseURL), pInfo->GetBookmark(),
+ URIHelper::GetMaybeFileHdl(), true, false,
+ INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS ) );
+
+ if( INET_PROT_FILE == aURL.GetProtocol() )
+ {
+ SfxStringItem aUrl( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+ SfxBoolItem aBrowsing( SID_BROWSE, TRUE );
+
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ if (pViewFrm)
+ pViewFrm->GetDispatcher()->Execute( SID_OPENDOC,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aUrl,
+ &aBrowsing,
+ 0L );
+ }
+
+ bAnimated = TRUE;
+ }
+ break;
+
+ case presentation::ClickAction_MACRO:
+ {
+ // Execute makro
+ String aMacro = pInfo->GetBookmark();
+
+ if ( SfxApplication::IsXScriptURL( aMacro ) )
+ {
+ uno::Any aRet;
+ uno::Sequence< sal_Int16 > aOutArgsIndex;
+ uno::Sequence< uno::Any > aOutArgs;
+ uno::Sequence< uno::Any >* pInArgs =
+ new uno::Sequence< uno::Any >(0);
+
+ ErrCode eErr = mpDocSh->CallXScript( aMacro,
+ *pInArgs, aRet, aOutArgsIndex, aOutArgs);
+
+ // Check the return value from the script
+ BOOL bTmp = sal_False;
+ if ( eErr == ERRCODE_NONE &&
+ aRet.getValueType() == getCppuBooleanType() &&
+ sal_True == ( aRet >>= bTmp ) &&
+ bTmp == TRUE )
+ {
+ bAnimated = TRUE;
+ }
+ else
+ {
+ bAnimated = FALSE;
+ }
+ }
+ else
+ {
+ // aMacro has got following format:
+ // "Macroname.Modulname.Libname.Documentname" or
+ // "Macroname.Modulname.Libname.Applicationsname"
+ String aMacroName =
+ aMacro.GetToken(0, sal_Unicode('.'));
+ String aModulName =
+ aMacro.GetToken(1, sal_Unicode('.'));
+ String aLibName =
+ aMacro.GetToken(2, sal_Unicode('.'));
+ String aDocName =
+ aMacro.GetToken(3, sal_Unicode('.'));
+
+ // In this moment the Call-method only
+ // resolves modulename+macroname
+ String aExecMacro(aModulName);
+ aExecMacro.Append( sal_Unicode('.') );
+ aExecMacro.Append( aMacroName );
+ bAnimated = mpDocSh->GetBasic()->Call(aExecMacro);
+ }
+ }
+ break;
+
+ default:
+ {
+ bAnimated = FALSE;
+ }
+ break;
+ }
+ }
+
+ if (!bAnimated &&
+ mpView->ISA(DrawView) &&
+ !mpDocSh->ISA(GraphicDocShell) &&
+ SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) &&
+ mpDoc->GetAnimationInfo(pObj))
+ {
+ /**********************************************************
+ * Effekt-Objekt in der Mitte getroffen -> Effekt abspielen
+ **********************************************************/
+ SdAnimationInfo* pInfo = mpDoc->GetAnimationInfo(pObj);
+
+ switch (pInfo->meClickAction)
+ {
+ case presentation::ClickAction_VANISH:
+ case presentation::ClickAction_INVISIBLE:
+ break;
+
+ default:
+ bAnimated = FALSE;
+ break;
+ }
+ }
+ }
+
+ return bAnimated;
+}
+
+
+
+/** is called when the currenct function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns true if a active function was aborted
+*/
+bool FuSelection::cancel()
+{
+ if (mpView->Is3DRotationCreationActive())
+ {
+ mpView->ResetCreationActive();
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
+
+
+SdrObject* FuSelection::pickObject (const Point& rTestPoint)
+{
+ SdrObject* pObject = NULL;
+ SdrPageView* pPageView;
+ USHORT nHitLog = USHORT (mpWindow->PixelToLogic(Size(HITPIX,0)).Width());
+ mpView->PickObj (rTestPoint, nHitLog, pObject, pPageView, SDRSEARCH_PICKMARKABLE);
+ return pObject;
+}
+} // end of namespace sd
diff --git a/sd/source/ui/func/fusldlg.cxx b/sd/source/ui/func/fusldlg.cxx
new file mode 100644
index 000000000000..76af1555c861
--- /dev/null
+++ b/sd/source/ui/func/fusldlg.cxx
@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fusldlg.hxx"
+#include <svl/itemset.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include "sdattr.hxx"
+#include "glob.hrc"
+#include "sdmod.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include "optsitem.hxx"
+#include "sdabstdlg.hxx"
+
+namespace sd {
+
+#define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue()
+
+TYPEINIT1( FuSlideShowDlg, FuPoor );
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuSlideShowDlg::FuSlideShowDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
+{
+}
+
+FunctionReference FuSlideShowDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuSlideShowDlg( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuSlideShowDlg::DoExecute( SfxRequest& )
+{
+ PresentationSettings& rPresentationSettings = mpDoc->getPresentationSettings();
+
+ SfxItemSet aDlgSet( mpDoc->GetPool(), ATTR_PRESENT_START, ATTR_PRESENT_END );
+ List aPageNameList;
+ const String& rPresPage = rPresentationSettings.maPresPage;
+ String aFirstPage;
+ String aStandardName( SdResId( STR_PAGE ) );
+ SdPage* pPage = NULL;
+ long nPage;
+
+ for( nPage = mpDoc->GetSdPageCount( PK_STANDARD ) - 1L; nPage >= 0L; nPage-- )
+ {
+ pPage = mpDoc->GetSdPage( (USHORT) nPage, PK_STANDARD );
+ String* pStr = new String( pPage->GetName() );
+
+ if ( !pStr->Len() )
+ {
+ *pStr = String( SdResId( STR_PAGE ) );
+ (*pStr).Append( UniString::CreateFromInt32( nPage + 1 ) );
+ }
+
+ aPageNameList.Insert( pStr, (ULONG) 0 );
+
+ // ist dies unsere (vorhandene) erste Seite?
+ if ( rPresPage == *pStr )
+ aFirstPage = rPresPage;
+ else if ( pPage->IsSelected() && !aFirstPage.Len() )
+ aFirstPage = *pStr;
+ }
+ List* pCustomShowList = mpDoc->GetCustomShowList(); // No Create
+
+ BOOL bStartWithActualPage = SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsStartWithActualPage();
+/* #109180# change in behaviour, even when always start with current page is enabled, range settings are
+ still used
+ if( bStartWithActualPage )
+ {
+ aFirstPage = pViewSh->GetActualPage()->GetName();
+ pCustomShowList = NULL;
+ }
+*/
+ if( !aFirstPage.Len() && pPage )
+ aFirstPage = pPage->GetName();
+
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALL, rPresentationSettings.mbAll ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CUSTOMSHOW, rPresentationSettings.mbCustomShow ) );
+ aDlgSet.Put( SfxStringItem( ATTR_PRESENT_DIANAME, aFirstPage ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ENDLESS, rPresentationSettings.mbEndless ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MANUEL, rPresentationSettings.mbManual ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_MOUSE, rPresentationSettings.mbMouseVisible ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_PEN, rPresentationSettings.mbMouseAsPen ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_NAVIGATOR, rPresentationSettings.mbStartWithNavigator ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ANIMATION_ALLOWED, rPresentationSettings.mbAnimationAllowed ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_CHANGE_PAGE, !rPresentationSettings.mbLockedPages ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_ALWAYS_ON_TOP, rPresentationSettings.mbAlwaysOnTop ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_FULLSCREEN, rPresentationSettings.mbFullScreen ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_START_ACTUAL_PAGE, bStartWithActualPage ) );
+ aDlgSet.Put( SfxUInt32Item( ATTR_PRESENT_PAUSE_TIMEOUT, rPresentationSettings.mnPauseTimeout ) );
+ aDlgSet.Put( SfxBoolItem( ATTR_PRESENT_SHOW_PAUSELOGO, rPresentationSettings.mbShowPauseLogo ) );
+
+ SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
+ aDlgSet.Put( SfxInt32Item( ATTR_PRESENT_DISPLAY, pOptions->GetDisplay() ) );
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdStartPresDlg* pDlg = pFact ? pFact->CreateSdStartPresentationDlg(mpWindow, aDlgSet, aPageNameList, pCustomShowList ) : 0;
+ if( pDlg && (pDlg->Execute() == RET_OK) )
+ {
+ rtl::OUString aPage;
+ long nValue32;
+ sal_Bool bValue;
+ bool bValuesChanged = FALSE;
+
+ pDlg->GetAttr( aDlgSet );
+
+ aPage = ITEMVALUE( aDlgSet, ATTR_PRESENT_DIANAME, SfxStringItem );
+ if( aPage != rPresentationSettings.maPresPage )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.maPresPage = aPage;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALL, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbAll )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbAll = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_CUSTOMSHOW, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbCustomShow )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbCustomShow = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ENDLESS, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbEndless )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbEndless = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MANUEL, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbManual )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbManual = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_MOUSE, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbMouseVisible )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbMouseVisible = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_PEN, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbMouseAsPen )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbMouseAsPen = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_NAVIGATOR, SfxBoolItem );
+ if( bValue != rPresentationSettings.mbStartWithNavigator )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbStartWithNavigator = bValue;
+ }
+
+ bValue = !ITEMVALUE( aDlgSet, ATTR_PRESENT_CHANGE_PAGE, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbLockedPages )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbLockedPages = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ANIMATION_ALLOWED, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbAnimationAllowed )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbAnimationAllowed = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ALWAYS_ON_TOP, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbAlwaysOnTop )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbAlwaysOnTop = bValue;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_FULLSCREEN, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbFullScreen )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbFullScreen = bValue;
+ }
+
+ nValue32 = ITEMVALUE( aDlgSet, ATTR_PRESENT_PAUSE_TIMEOUT, SfxUInt32Item );
+ if( nValue32 != rPresentationSettings.mnPauseTimeout )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mnPauseTimeout = nValue32;
+ }
+
+ bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_SHOW_PAUSELOGO, SfxBoolItem );
+ if ( bValue != rPresentationSettings.mbShowPauseLogo )
+ {
+ bValuesChanged = true;
+ rPresentationSettings.mbShowPauseLogo = bValue;
+ }
+
+ pOptions->SetDisplay( ITEMVALUE( aDlgSet, ATTR_PRESENT_DISPLAY, SfxInt32Item ) );
+
+ // wenn sich etwas geaendert hat, setzen wir das Modified-Flag,
+ if ( bValuesChanged )
+ mpDoc->SetChanged( TRUE );
+ }
+ delete pDlg;
+ // Strings aus Liste loeschen
+ for( void* pStr = aPageNameList.First(); pStr; pStr = aPageNameList.Next() )
+ delete (String*) pStr;
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fusnapln.cxx b/sd/source/ui/func/fusnapln.cxx
new file mode 100755
index 000000000000..fad1cb324fd2
--- /dev/null
+++ b/sd/source/ui/func/fusnapln.cxx
@@ -0,0 +1,219 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "fusnapln.hxx"
+#include <svl/aeitem.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+
+
+#include "strings.hrc"
+
+#include "sdattr.hxx"
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "DrawViewShell.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "sdenumdef.hxx"
+#include "sdresid.hxx"
+#include "sdabstdlg.hxx"
+#include "app.hrc"
+#include <svx/svdpagv.hxx>
+
+namespace sd {
+
+TYPEINIT1( FuSnapLine, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuSnapLine::FuSnapLine(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq) :
+ FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuSnapLine::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuSnapLine( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuSnapLine::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ SdrPageView* pPV = 0;
+ USHORT nHelpLine = 0;
+ BOOL bCreateNew = TRUE;
+
+ // Get index of snap line or snap point from the request.
+ SFX_REQUEST_ARG (rReq, pHelpLineIndex, SfxUInt32Item, ID_VAL_INDEX, FALSE);
+ if (pHelpLineIndex != NULL)
+ {
+ nHelpLine = static_cast<USHORT>(pHelpLineIndex->GetValue());
+ // Reset the argument pointer to trigger the display of the dialog.
+ pArgs = NULL;
+ }
+
+ if ( !pArgs )
+ {
+ SfxItemSet aNewAttr(mpViewShell->GetPool(), ATTR_SNAPLINE_START, ATTR_SNAPLINE_END);
+ bool bLineExist (false);
+ pPV = mpView->GetSdrPageView();
+ Point aLinePos;
+
+ if (pHelpLineIndex == NULL)
+ {
+ // The index of the snap line is not provided as argument to the
+ // request. Determine it from the mouse position.
+
+ aLinePos = static_cast<DrawViewShell*>(mpViewShell)->GetMousePos();
+ static_cast<DrawViewShell*>(mpViewShell)->SetMousePosFreezed( FALSE );
+
+
+ if ( aLinePos.X() >= 0 )
+ {
+ aLinePos = mpWindow->PixelToLogic(aLinePos);
+ USHORT nHitLog = (USHORT) mpWindow->PixelToLogic(Size(HITPIX,0)).Width();
+ bLineExist = mpView->PickHelpLine(aLinePos, nHitLog, *mpWindow, nHelpLine, pPV);
+ if ( bLineExist )
+ aLinePos = (pPV->GetHelpLines())[nHelpLine].GetPos();
+ else
+ pPV = mpView->GetSdrPageView();
+
+ pPV->LogicToPagePos(aLinePos);
+ }
+ else
+ aLinePos = Point(0,0);
+ }
+ else
+ {
+ OSL_ASSERT(pPV!=NULL);
+ aLinePos = (pPV->GetHelpLines())[nHelpLine].GetPos();
+ pPV->LogicToPagePos(aLinePos);
+ bLineExist = true;
+ }
+ aNewAttr.Put(SfxUInt32Item(ATTR_SNAPLINE_X, aLinePos.X()));
+ aNewAttr.Put(SfxUInt32Item(ATTR_SNAPLINE_Y, aLinePos.Y()));
+
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdSnapLineDlg* pDlg = pFact ? pFact->CreateSdSnapLineDlg( NULL, aNewAttr, mpView ) : 0;
+ if( pDlg )
+ {
+ if ( bLineExist )
+ {
+ pDlg->HideRadioGroup();
+
+ const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine];
+
+ if ( rHelpLine.GetKind() == SDRHELPLINE_POINT )
+ {
+ pDlg->SetText(String(SdResId(STR_SNAPDLG_SETPOINT)));
+ pDlg->SetInputFields(TRUE, TRUE);
+ }
+ else
+ {
+ pDlg->SetText(String(SdResId(STR_SNAPDLG_SETLINE)));
+
+ if ( rHelpLine.GetKind() == SDRHELPLINE_VERTICAL )
+ pDlg->SetInputFields(TRUE, FALSE);
+ else
+ pDlg->SetInputFields(FALSE, TRUE);
+ }
+ bCreateNew = FALSE;
+ }
+ else
+ pDlg->HideDeleteBtn();
+
+ USHORT nResult = pDlg->Execute();
+
+ pDlg->GetAttr(aNewAttr);
+ delete pDlg;
+
+ switch( nResult )
+ {
+ case RET_OK:
+ rReq.Done(aNewAttr);
+ pArgs = rReq.GetArgs();
+ break;
+
+ case RET_SNAP_DELETE:
+ // Fangobjekt loeschen
+ if ( !bCreateNew )
+ pPV->DeleteHelpLine(nHelpLine);
+ // und weiter wie bei default
+ default:
+ return;
+ }
+ }
+ }
+ Point aHlpPos;
+
+ aHlpPos.X() = ((const SfxUInt32Item&) pArgs->Get(ATTR_SNAPLINE_X)).GetValue();
+ aHlpPos.Y() = ((const SfxUInt32Item&) pArgs->Get(ATTR_SNAPLINE_Y)).GetValue();
+ pPV->PagePosToLogic(aHlpPos);
+
+ if ( bCreateNew )
+ {
+ SdrHelpLineKind eKind;
+
+ pPV = mpView->GetSdrPageView();
+
+ switch ( (SnapKind) ((const SfxAllEnumItem&)
+ pArgs->Get(ATTR_SNAPLINE_KIND)).GetValue() )
+ {
+ case SK_HORIZONTAL : eKind = SDRHELPLINE_HORIZONTAL; break;
+ case SK_VERTICAL : eKind = SDRHELPLINE_VERTICAL; break;
+ default : eKind = SDRHELPLINE_POINT; break;
+ }
+ pPV->InsertHelpLine(SdrHelpLine(eKind, aHlpPos));
+ }
+ else
+ {
+ const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine];
+ pPV->SetHelpLine(nHelpLine, SdrHelpLine(rHelpLine.GetKind(), aHlpPos));
+ }
+}
+
+void FuSnapLine::Activate()
+{
+}
+
+void FuSnapLine::Deactivate()
+{
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fusumry.cxx b/sd/source/ui/func/fusumry.cxx
new file mode 100644
index 000000000000..3ed152d1f862
--- /dev/null
+++ b/sd/source/ui/func/fusumry.cxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fusumry.hxx"
+#include <editeng/eeitem.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdundo.hxx>
+#include <sfx2/printer.hxx>
+#include <editeng/outlobj.hxx>
+
+#include "strings.hrc"
+
+#include "pres.hxx"
+#include "View.hxx"
+#include "sdpage.hxx"
+#include "Outliner.hxx"
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "ViewShell.hxx"
+#include "DrawDocShell.hxx"
+#include "sdresid.hxx"
+#include "optsitem.hxx"
+#include "DrawViewShell.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuSummaryPage, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+FuSummaryPage::FuSummaryPage (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuSummaryPage::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuSummaryPage( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuSummaryPage::DoExecute( SfxRequest& )
+{
+ ::sd::Outliner* pOutl = NULL;
+ SdPage* pSummaryPage = NULL;
+ USHORT i = 0;
+ USHORT nFirstPage = SDRPAGE_NOTFOUND;
+ USHORT nSelectedPages = 0;
+ USHORT nCount = mpDoc->GetSdPageCount(PK_STANDARD);
+
+ while (i < nCount && nSelectedPages <= 1)
+ {
+ /**********************************************************************
+ * Wieviele Seiten sind selektiert?
+ * Genau eine Seite selektiert: Ab dieser Seite alles zusammenfassen
+ * sonst: Nur die selektierten Seiten zusammenfassen
+ **********************************************************************/
+ SdPage* pActualPage = mpDoc->GetSdPage(i, PK_STANDARD);
+
+ if (pActualPage->IsSelected())
+ {
+ if (nFirstPage == SDRPAGE_NOTFOUND)
+ {
+ nFirstPage = i;
+ }
+
+ nSelectedPages++;
+ }
+
+ i++;
+ }
+
+ bool bBegUndo = false;
+
+ SfxStyleSheet* pStyle = NULL;
+
+ for (i = nFirstPage; i < nCount; i++)
+ {
+ SdPage* pActualPage = mpDoc->GetSdPage(i, PK_STANDARD);
+
+ if (nSelectedPages <= 1 || pActualPage->IsSelected())
+ {
+ SdPage* pActualNotesPage = mpDoc->GetSdPage(i, PK_NOTES);
+ SdrTextObj* pTextObj = (SdrTextObj*) pActualPage->GetPresObj(PRESOBJ_TITLE);
+
+ if (pTextObj && !pTextObj->IsEmptyPresObj())
+ {
+ if (!pSummaryPage)
+ {
+ /**********************************************************
+ * Inhaltsverzeichnis-Seite einfuegen und Outliner anlegen
+ **********************************************************/
+ const bool bUndo = mpView->IsUndoEnabled();
+
+ if( bUndo )
+ {
+ mpView->BegUndo(String(SdResId(STR_UNDO_SUMMARY_PAGE)));
+ bBegUndo = true;
+ }
+
+ SetOfByte aVisibleLayers = pActualPage->TRG_GetMasterPageVisibleLayers();
+
+ // Seite mit Titel & Gliederung!
+ pSummaryPage = (SdPage*) mpDoc->AllocPage(FALSE);
+ pSummaryPage->SetSize(pActualPage->GetSize() );
+ pSummaryPage->SetBorder(pActualPage->GetLftBorder(),
+ pActualPage->GetUppBorder(),
+ pActualPage->GetRgtBorder(),
+ pActualPage->GetLwrBorder() );
+
+ // Seite hinten einfuegen
+ mpDoc->InsertPage(pSummaryPage, nCount * 2 + 1);
+ if( bUndo )
+ mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewPage(*pSummaryPage));
+
+ // MasterPage der aktuellen Seite verwenden
+ pSummaryPage->TRG_SetMasterPage(pActualPage->TRG_GetMasterPage());
+ pSummaryPage->SetLayoutName(pActualPage->GetLayoutName());
+ pSummaryPage->SetAutoLayout(AUTOLAYOUT_ENUM, TRUE);
+ pSummaryPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ pSummaryPage->setHeaderFooterSettings(pActualPage->getHeaderFooterSettings());
+
+ // Notiz-Seite
+ SdPage* pNotesPage = (SdPage*) mpDoc->AllocPage(FALSE);
+ pNotesPage->SetSize(pActualNotesPage->GetSize());
+ pNotesPage->SetBorder(pActualNotesPage->GetLftBorder(),
+ pActualNotesPage->GetUppBorder(),
+ pActualNotesPage->GetRgtBorder(),
+ pActualNotesPage->GetLwrBorder() );
+ pNotesPage->SetPageKind(PK_NOTES);
+
+ // Seite hinten einfuegen
+ mpDoc->InsertPage(pNotesPage, nCount * 2 + 2);
+
+ if( bUndo )
+ mpView->AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewPage(*pNotesPage));
+
+ // MasterPage der aktuellen Seite verwenden
+ pNotesPage->TRG_SetMasterPage(pActualNotesPage->TRG_GetMasterPage());
+ pNotesPage->SetLayoutName(pActualNotesPage->GetLayoutName());
+ pNotesPage->SetAutoLayout(pActualNotesPage->GetAutoLayout(), TRUE);
+ pNotesPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
+ pNotesPage->setHeaderFooterSettings(pActualNotesPage->getHeaderFooterSettings());
+
+ pOutl = new ::sd::Outliner( mpDoc, OUTLINERMODE_OUTLINEOBJECT );
+ pOutl->SetUpdateMode(FALSE);
+ pOutl->EnableUndo(FALSE);
+
+ if (mpDocSh)
+ pOutl->SetRefDevice(SD_MOD()->GetRefDevice( *mpDocSh ));
+
+ pOutl->SetDefTab( mpDoc->GetDefaultTabulator() );
+ pOutl->SetStyleSheetPool((SfxStyleSheetPool*) mpDoc->GetStyleSheetPool());
+ pStyle = pSummaryPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
+ pOutl->SetStyleSheet( 0, pStyle );
+ }
+
+ /**************************************************************
+ * Text hinzufuegen
+ **************************************************************/
+ OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
+ pParaObj->SetOutlinerMode( OUTLINERMODE_OUTLINEOBJECT );
+ pOutl->AddText(*pParaObj);
+ }
+ }
+ }
+
+ if (pSummaryPage)
+ {
+ SdrTextObj* pTextObj = (SdrTextObj*) pSummaryPage->GetPresObj(PRESOBJ_OUTLINE);
+
+ // Harte Absatz- und Zeichenattribute entfernen
+ SfxItemSet aEmptyEEAttr(mpDoc->GetPool(), EE_ITEMS_START, EE_ITEMS_END);
+ ULONG nParaCount = pOutl->GetParagraphCount();
+
+ for (USHORT nPara = 0; nPara < nParaCount; nPara++)
+ {
+ pOutl->SetStyleSheet( nPara, pStyle );
+ pOutl->QuickRemoveCharAttribs(nPara);
+ pOutl->SetParaAttribs(nPara, aEmptyEEAttr);
+ pOutl->SetDepth(pOutl->GetParagraph(nPara), 0);
+ }
+
+ pTextObj->SetOutlinerParaObject( pOutl->CreateParaObject() );
+ pTextObj->SetEmptyPresObj(FALSE);
+
+ // Harte Attribute entfernen (Flag auf TRUE)
+ SfxItemSet aAttr(mpDoc->GetPool());
+ aAttr.Put(XLineStyleItem(XLINE_NONE));
+ aAttr.Put(XFillStyleItem(XFILL_NONE));
+ pTextObj->SetMergedItemSet(aAttr);
+
+ if( bBegUndo )
+ mpView->EndUndo();
+ delete pOutl;
+
+ DrawViewShell* pDrawViewShell= dynamic_cast< DrawViewShell* >( mpViewShell );
+ if(pDrawViewShell)
+ {
+ pDrawViewShell->SwitchPage( (pSummaryPage->GetPageNum() - 1) / 2);
+ }
+ }
+}
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx
new file mode 100644
index 000000000000..43572c2af8a4
--- /dev/null
+++ b/sd/source/ui/func/futempl.cxx
@@ -0,0 +1,733 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include "futempl.hxx"
+
+#include <editeng/editdata.hxx>
+#include <editeng/bulitem.hxx>
+#include <svx/svxids.hrc> // fuer SID_OBJECT_SELECT
+#include <sfx2/bindings.hxx>
+#include <svl/aeitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <editeng/eeitem.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/lrspitem.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/svditer.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+
+#include "stlsheet.hxx"
+#include "sdpage.hxx"
+#include "stlpool.hxx"
+#include "app.hxx"
+#include "View.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "drawview.hxx"
+#include "drawdoc.hxx"
+#include "DrawDocShell.hxx"
+#include "DrawViewShell.hxx"
+#include "ViewShell.hxx"
+#include "res_bmp.hrc"
+#include "glob.hrc"
+#include "prlayout.hxx" // enum PresentationObjects
+#include "prltempl.hrc" // TAB_PRES_LAYOUT_TEMPLATE_x
+#include <svx/tabarea.hxx>
+#include "sdresid.hxx"
+#include "OutlineViewShell.hxx"
+#include "strings.hrc"
+#include "helpids.h"
+#include "sdabstdlg.hxx"
+
+using rtl::OUString;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::container;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::style;
+
+namespace sd
+{
+
+TYPEINIT1( FuTemplate, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuTemplate::FuTemplate (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq )
+ : FuPoor( pViewSh, pWin, pView, pDoc, rReq )
+{
+}
+
+FunctionReference FuTemplate::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuTemplate( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuTemplate::DoExecute( SfxRequest& rReq )
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ USHORT nSId = rReq.GetSlot();
+
+ // StyleSheet-Parameter holen
+ SfxStyleSheetBasePool* pSSPool = mpDoc->GetDocSh()->GetStyleSheetPool();
+ SfxStyleSheetBase* pStyleSheet = NULL;
+
+ const SfxPoolItem* pItem;
+ USHORT nFamily = USHRT_MAX;
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY,
+ FALSE, &pItem ))
+ {
+ nFamily = ( (const SfxUInt16Item &) pArgs->Get( SID_STYLE_FAMILY ) ).GetValue();
+ }
+ else
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILYNAME,
+ FALSE, &pItem ))
+ {
+ String sFamily = ( (const SfxStringItem &) pArgs->Get( SID_STYLE_FAMILYNAME ) ).GetValue();
+ if (sFamily.CompareToAscii("graphics") == COMPARE_EQUAL)
+ nFamily = SD_STYLE_FAMILY_GRAPHICS;
+ else
+ nFamily = SD_STYLE_FAMILY_PSEUDO;
+ }
+
+ String aStyleName;
+ USHORT nRetMask = 0xffff;
+
+ switch( nSId )
+ {
+ case SID_STYLE_APPLY:
+ case SID_STYLE_EDIT:
+ case SID_STYLE_DELETE:
+ case SID_STYLE_FAMILY:
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_APPLY_STYLE, sal_False );
+ SFX_REQUEST_ARG( rReq, pFamilyItem, SfxStringItem, SID_STYLE_FAMILYNAME, sal_False );
+ if ( pFamilyItem && pNameItem )
+ {
+ try
+ {
+ Reference< XStyleFamiliesSupplier > xModel(mpDoc->GetDocSh()->GetModel(), UNO_QUERY_THROW );
+ Reference< XNameAccess > xCont( xModel->getStyleFamilies() );
+ Reference< XNameAccess > xStyles( xCont->getByName(pFamilyItem->GetValue()), UNO_QUERY_THROW );
+ Reference< XPropertySet > xInfo( xStyles->getByName( pNameItem->GetValue() ), UNO_QUERY_THROW );
+
+ OUString aUIName;
+ xInfo->getPropertyValue( ::rtl::OUString::createFromAscii("DisplayName") ) >>= aUIName;
+ if ( aUIName.getLength() )
+ rReq.AppendItem( SfxStringItem( nSId, aUIName ) );
+ }
+ catch( Exception& )
+ {
+ }
+ }
+
+ if (pArgs->GetItemState(nSId) == SFX_ITEM_SET)
+ aStyleName = ( ( (const SfxStringItem &) pArgs->Get( nSId ) ).GetValue() );
+ }
+ }
+
+ switch( nSId )
+ {
+ case SID_STYLE_NEW:
+ {
+ SfxStyleSheetBase *p = pSSPool->Find(aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_ALL );
+ if(p)
+ {
+ pSSPool->Remove(p);
+ p = 0;
+ }
+ pStyleSheet = &pSSPool->Make( aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_USERDEF );
+
+ if (pArgs->GetItemState(SID_STYLE_REFERENCE) == SFX_ITEM_ON)
+ {
+ String aParentName(((const SfxStringItem&) pArgs->Get(SID_STYLE_REFERENCE)).GetValue());
+ pStyleSheet->SetParent(aParentName);
+ }
+ else
+ {
+ pStyleSheet->SetParent(String(SdResId(STR_STANDARD_STYLESHEET_NAME)));
+ }
+ }
+ break;
+
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ // Z.Z. geht immer noch der Dialog auf, um den Namen
+ // der Vorlage einzugeben.
+ if( mpView->AreObjectsMarked() || TRUE )
+ {
+ SfxStyleSheetBase *p = pSSPool->Find(aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_ALL );
+ if(p)
+ {
+ pSSPool->Remove(p);
+ p = 0;
+ }
+ pStyleSheet = &pSSPool->Make( aStyleName, (SfxStyleFamily) nFamily, SFXSTYLEBIT_USERDEF );
+ pStyleSheet->SetParent(String(SdResId(STR_STANDARD_STYLESHEET_NAME)));
+ }
+ }
+ break;
+
+ case SID_STYLE_EDIT:
+ pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
+ break;
+
+ case SID_STYLE_DELETE:
+ pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
+ if( pStyleSheet )
+ {
+ pSSPool->Remove( pStyleSheet );
+ nRetMask = TRUE;
+ mpDoc->SetChanged(TRUE);
+ }
+ else
+ {
+ nRetMask = FALSE;
+ }
+ break;
+
+ case SID_STYLE_APPLY:
+ // Anwenden der Vorlage auf das Dokument
+ pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
+
+ // do not set presentation styles, they will be set implicit
+ if ( pStyleSheet && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_PSEUDO )
+ {
+ SfxStyleSheet* pOldStyleSheet = mpView->GetStyleSheet();
+ String aStr;
+
+ if( // if the object had no style sheet, allow all
+ !pOldStyleSheet ||
+
+ // allow if old and new style sheet has same family
+ pStyleSheet->GetFamily() == pOldStyleSheet->GetFamily() ||
+
+ // allow if old was background objects and new is graphics
+ pStyleSheet->GetFamily() == (SD_STYLE_FAMILY_GRAPHICS && pOldStyleSheet->GetHelpId( aStr ) == HID_PSEUDOSHEET_BACKGROUNDOBJECTS) ||
+
+ // allow if old was presentation and we are a drawing document
+ (pOldStyleSheet->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE && mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW) )
+ {
+ mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
+ mpDoc->SetChanged(TRUE);
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
+ }
+ }
+/* #96983# GrabFocus moved to stylist
+ pWin->GrabFocus();
+*/
+ break;
+
+ case SID_STYLE_WATERCAN:
+ {
+ if( !SD_MOD()->GetWaterCan() )
+ {
+ if( pArgs->GetItemState( nSId ) == SFX_ITEM_SET )
+ {
+ aStyleName = ( ( (const SfxStringItem &) pArgs->Get( nSId ) ).GetValue() );
+ SD_MOD()->SetWaterCan( TRUE );
+ pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
+ }
+ // keine Praesentationsobjektvorlagen, die werden nur
+ // implizit zugewiesen
+ if( pStyleSheet && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_PSEUDO )
+ {
+ ( (SdStyleSheetPool*) pSSPool )->SetActualStyleSheet( pStyleSheet );
+
+ // Es wird explizit in den Selektionsmodus geschaltet
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+
+ }
+ else
+ SD_MOD()->SetWaterCan( FALSE );
+ }
+ else
+ {
+ SD_MOD()->SetWaterCan( FALSE );
+ // Werkzeugleiste muss wieder enabled werden
+ mpViewShell->Invalidate();
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ switch( nSId )
+ {
+ case SID_STYLE_NEW:
+ case SID_STYLE_EDIT:
+ {
+ PresentationObjects ePO = PO_OUTLINE_1;
+
+ if( pStyleSheet )
+ {
+ SfxAbstractTabDialog* pStdDlg = NULL;
+ SfxAbstractTabDialog* pPresDlg = NULL;
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ BOOL bOldDocInOtherLanguage = FALSE;
+ SfxItemSet aOriSet( pStyleSheet->GetItemSet() );
+
+ SfxStyleFamily eFamily = pStyleSheet->GetFamily();
+
+ if (eFamily == SD_STYLE_FAMILY_GRAPHICS)
+ {
+ pStdDlg = pFact ? pFact->CreateSdTabTemplateDlg( 0, mpDoc->GetDocSh(), *pStyleSheet, mpDoc, mpView ) : 0;
+ }
+ else if (eFamily == SD_STYLE_FAMILY_PSEUDO)
+ {
+ String aName(pStyleSheet->GetName());
+ USHORT nDlgId = 0;
+
+ if (aName == String(SdResId(STR_PSEUDOSHEET_TITLE)))
+ {
+ nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
+ ePO = PO_TITLE;
+ }
+ else if (aName == String(SdResId(STR_PSEUDOSHEET_SUBTITLE)))
+ {
+ nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
+ ePO = PO_SUBTITLE;
+ }
+ else if (aName ==
+ String(SdResId(STR_PSEUDOSHEET_BACKGROUND)))
+ {
+ nDlgId = TAB_PRES_LAYOUT_TEMPLATE_BACKGROUND;
+ ePO = PO_BACKGROUND;
+ }
+ else if (aName ==
+ String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS)))
+ {
+ nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
+ ePO = PO_BACKGROUNDOBJECTS;
+ }
+ else if (aName ==
+ String(SdResId(STR_PSEUDOSHEET_NOTES)))
+ {
+ nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
+ ePO = PO_NOTES;
+ }
+ else if(aName.Search(String(SdResId(STR_PSEUDOSHEET_OUTLINE))) !=
+ STRING_NOTFOUND)
+ {
+ nDlgId = TAB_PRES_LAYOUT_TEMPLATE;
+
+ String aOutlineStr((SdResId(STR_PSEUDOSHEET_OUTLINE)));
+ // die Nummer ermitteln; ein Leerzeichen zwischen
+ // Name und Nummer beachten
+ String aNumStr(aName.Copy(aOutlineStr.Len() + 1));
+ USHORT nLevel = (USHORT)aNumStr.ToInt32();
+ switch (nLevel)
+ {
+ case 1: ePO = PO_OUTLINE_1; break;
+ case 2: ePO = PO_OUTLINE_2; break;
+ case 3: ePO = PO_OUTLINE_3; break;
+ case 4: ePO = PO_OUTLINE_4; break;
+ case 5: ePO = PO_OUTLINE_5; break;
+ case 6: ePO = PO_OUTLINE_6; break;
+ case 7: ePO = PO_OUTLINE_7; break;
+ case 8: ePO = PO_OUTLINE_8; break;
+ case 9: ePO = PO_OUTLINE_9; break;
+ }
+ }
+ else
+ {
+ DBG_ERROR("Vorlage aus aelterer anderssprachiger Version");
+ bOldDocInOtherLanguage = TRUE;
+ }
+
+ if( !bOldDocInOtherLanguage )
+ {
+ pPresDlg = pFact ? pFact->CreateSdPresLayoutTemplateDlg( mpDocSh, NULL, SdResId(nDlgId), *pStyleSheet, ePO, pSSPool ) : 0;
+ }
+ }
+ else if (eFamily == SD_STYLE_FAMILY_CELL)
+ {
+ }
+
+ USHORT nResult = RET_CANCEL;
+ const SfxItemSet* pOutSet = NULL;
+ if (pStdDlg)
+ {
+ nResult = pStdDlg->Execute();
+ pOutSet = pStdDlg->GetOutputItemSet();
+ }
+ else if( pPresDlg )
+ {
+ nResult = pPresDlg->Execute();
+ pOutSet = pPresDlg->GetOutputItemSet();
+ }
+
+ switch( nResult )
+ {
+ case RET_OK:
+ {
+ nRetMask = pStyleSheet->GetMask();
+
+ if (eFamily == SD_STYLE_FAMILY_PSEUDO)
+ {
+ SfxItemSet aTempSet(*pOutSet);
+ ((SdStyleSheet*)pStyleSheet)->AdjustToFontHeight(aTempSet);
+
+ // Sonderbehandlung: die INVALIDS auf NULL-Pointer
+ // zurueckgesetzen (sonst landen INVALIDs oder
+ // Pointer auf die DefaultItems in der Vorlage;
+ // beides wuerde die Attribut-Vererbung unterbinden)
+ aTempSet.ClearInvalidItems();
+
+ // EE_PARA_NUMBULLET item is only valid in first outline template
+ if( (ePO >= PO_OUTLINE_2) && (ePO <= PO_OUTLINE_9) )
+ {
+ if (aTempSet.GetItemState(EE_PARA_NUMBULLET) == SFX_ITEM_SET)
+ {
+ SvxNumRule aRule(*((SvxNumBulletItem*)aTempSet.GetItem(EE_PARA_NUMBULLET))->GetNumRule());
+
+ String sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
+ sStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
+ SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( sStyleName, SD_STYLE_FAMILY_PSEUDO);
+
+ if(pFirstStyleSheet)
+ {
+ pFirstStyleSheet->GetItemSet().Put( SvxNumBulletItem( aRule, EE_PARA_NUMBULLET ));
+ SdStyleSheet* pRealSheet = ((SdStyleSheet*)pFirstStyleSheet)->GetRealStyleSheet();
+ pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+
+ aTempSet.ClearItem( EE_PARA_NUMBULLET );
+ }
+ }
+
+ String sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
+ sStyleName.Append( sal_Unicode( ' ' ));
+
+ pStyleSheet->GetItemSet().Put(aTempSet);
+ SdStyleSheet* pRealSheet =((SdStyleSheet*)pStyleSheet)->GetRealStyleSheet();
+ pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+
+ if( (ePO >= PO_OUTLINE_1) && (ePO <= PO_OUTLINE_8) )
+ {
+ for( USHORT n = (USHORT)(ePO - PO_OUTLINE_1 + 2); n < 10; n++ )
+ {
+ String aName( sStyleName );
+ aName.Append( String::CreateFromInt32( (sal_Int32) n ));
+
+ SfxStyleSheetBase* pSheet = pSSPool->Find( aName, SD_STYLE_FAMILY_PSEUDO);
+
+ if(pSheet)
+ {
+ SdStyleSheet* pRealStyleSheet = ((SdStyleSheet*)pSheet)->GetRealStyleSheet();
+ pRealStyleSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+ }
+ }
+ }
+
+ SfxItemSet& rAttr = pStyleSheet->GetItemSet();
+
+/* #i35937#
+ if ( rAttr.GetItemState( EE_PARA_LRSPACE ) == SFX_ITEM_ON )
+ {
+ // SvxLRSpaceItem hart gesetzt: NumBulletItem anpassen
+ if ( aOriSet.GetItemState( EE_PARA_LRSPACE ) != SFX_ITEM_ON ||
+ (const SvxLRSpaceItem&) aOriSet.Get( EE_PARA_LRSPACE ) !=
+ (const SvxLRSpaceItem&) rAttr.Get( EE_PARA_LRSPACE ) )
+ {
+ SvxNumBulletItem aNumBullet( (const SvxNumBulletItem&) rAttr.Get(EE_PARA_NUMBULLET) );
+
+ sal_uInt16 nLevel = 0;
+ if( (ePO >= PO_OUTLINE_2) && (ePO <= PO_OUTLINE_9) )
+ nLevel = (sal_uInt16)(ePO - PO_OUTLINE_1 + 1);
+
+ EditEngine::ImportBulletItem( aNumBullet, nLevel, NULL,
+ &(const SvxLRSpaceItem&) rAttr.Get( EE_PARA_LRSPACE ) );
+
+ // the numbering bullet item is not valid in styles Outline 2 to Outline 9
+ if( nLevel != 0 )
+ {
+ // so put it into Outline 1 then..
+ String sStyleName((SdResId(STR_PSEUDOSHEET_OUTLINE)));
+ sStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
+ SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( sStyleName, SD_STYLE_FAMILY_PSEUDO);
+
+ if(pFirstStyleSheet)
+ {
+ pFirstStyleSheet->GetItemSet().Put( aNumBullet);
+ SdStyleSheet* pRealSheet = ((SdStyleSheet*)pFirstStyleSheet)->GetRealStyleSheet();
+ pRealSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
+ }
+ }
+ else
+ {
+ ( (SfxItemSet&) rAttr).Put( aNumBullet );
+ }
+ }
+ }
+*/
+ // check for unique names of named items for xml
+ if( rAttr.GetItemState( XATTR_FILLBITMAP ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLBITMAP );
+ SfxPoolItem* pNewItem = ((XFillBitmapItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ if( rAttr.GetItemState( XATTR_LINEDASH ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEDASH );
+ SfxPoolItem* pNewItem = ((XLineDashItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ if( rAttr.GetItemState( XATTR_LINESTART ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINESTART );
+ SfxPoolItem* pNewItem = ((XLineStartItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ if( rAttr.GetItemState( XATTR_LINEEND ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEEND );
+ SfxPoolItem* pNewItem = ((XLineEndItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ if( rAttr.GetItemState( XATTR_FILLGRADIENT ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLGRADIENT );
+ SfxPoolItem* pNewItem = ((XFillGradientItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ if( rAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLFLOATTRANSPARENCE );
+ SfxPoolItem* pNewItem = ((XFillFloatTransparenceItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+ if( rAttr.GetItemState( XATTR_FILLHATCH ) == SFX_ITEM_SET )
+ {
+ const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLHATCH );
+ SfxPoolItem* pNewItem = ((XFillHatchItem*)pOldItem)->checkForUniqueItem( mpDoc );
+ if( pOldItem != pNewItem )
+ {
+ rAttr.Put( *pNewItem );
+ delete pNewItem;
+ }
+ }
+
+ ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+
+ DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >( mpViewShell );
+ if( pDrawViewShell )
+ {
+ PageKind ePageKind = pDrawViewShell->GetPageKind();
+ if( ePageKind == PK_NOTES || ePageKind == PK_HANDOUT )
+ {
+ SdPage* pPage = mpViewShell->GetActualPage();
+
+ if(pDrawViewShell->GetEditMode() == EM_MASTERPAGE)
+ {
+ pPage = static_cast<SdPage*>((&(pPage->TRG_GetMasterPage())));
+ }
+
+ if( pPage )
+ {
+ SdrObjListIter aIter( *pPage );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pObj = aIter.Next();
+ if( pObj->ISA(SdrPageObj) )
+ {
+ // repaint only
+ pObj->ActionChanged();
+ // pObj->SendRepaintBroadcast();
+ }
+ }
+ }
+ }
+ }
+
+ if( mpDoc->GetOnlineSpell() )
+ {
+ const SfxPoolItem* pTempItem;
+ if( SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE, FALSE, &pTempItem ) ||
+ SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CJK, FALSE, &pTempItem ) ||
+ SFX_ITEM_SET == rAttr.GetItemState(EE_CHAR_LANGUAGE_CTL, FALSE, &pTempItem ) )
+ {
+ mpDoc->StopOnlineSpelling();
+ mpDoc->StartOnlineSpelling();
+ }
+ }
+
+ mpDoc->SetChanged(TRUE);
+ }
+ break;
+
+ default:
+ {
+ if( nSId == SID_STYLE_NEW )
+ pSSPool->Remove( pStyleSheet );
+ delete pStdDlg;
+ delete pPresDlg;
+ }
+ return; // Abbruch
+ }
+ delete pStdDlg;
+ delete pPresDlg;
+ }
+ }
+ break;
+
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ if( pStyleSheet )
+ {
+ nRetMask = pStyleSheet->GetMask();
+ SfxItemSet aCoreSet( mpDoc->GetPool() );
+ mpView->GetAttributes( aCoreSet, TRUE );
+
+ // wenn das Objekt eine Vorlage hatte, wird diese Parent
+ // der neuen Vorlage
+ SfxStyleSheet* pOldStyle = mpView->GetStyleSheet();
+
+ // Wenn pOldStyle == pStyleSheet -> Rekursion
+ if( pOldStyle != pStyleSheet )
+ {
+ if (pOldStyle)
+ {
+ pStyleSheet->SetParent(pOldStyle->GetName());
+ }
+
+ SfxItemSet* pStyleSet = &pStyleSheet->GetItemSet();
+ pStyleSet->Put(aCoreSet);
+
+ // Vorlage anwenden (Aber nicht, wenn gerade ein Text
+ // editiert wird, denn dazu muesste die Edit Engine
+ // Vorlagen auf Zeichenebene beherrschen.)
+ if (!mpView->GetTextEditObject())
+ {
+ mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
+ }
+
+ ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ mpDoc->SetChanged(TRUE);
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
+ }
+ }
+ }
+ break;
+
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ {
+ if ((mpView->AreObjectsMarked() && mpView->GetMarkedObjectList().GetMarkCount() == 1) ||
+ mpView->ISA(OutlineView))
+ {
+ pStyleSheet = mpView->GetStyleSheet();
+
+ if( pStyleSheet )
+ {
+ nRetMask = pStyleSheet->GetMask();
+ SfxItemSet aCoreSet( mpDoc->GetPool() );
+ mpView->GetAttributes( aCoreSet );
+
+ SfxItemSet* pStyleSet = &pStyleSheet->GetItemSet();
+ pStyleSet->Put( aCoreSet );
+
+ mpView->SetStyleSheet( (SfxStyleSheet*) pStyleSheet);
+
+ ( (SfxStyleSheet*) pStyleSheet )->Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ mpDoc->SetChanged(TRUE);
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
+ }
+ }
+ }
+ break;
+
+ }
+ if( nRetMask != 0xffff )
+ rReq.SetReturnValue( SfxUInt16Item( nSId, nRetMask ) );
+}
+
+void FuTemplate::Activate()
+{
+}
+
+void FuTemplate::Deactivate()
+{
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
new file mode 100644
index 000000000000..2fd808dcda3e
--- /dev/null
+++ b/sd/source/ui/func/futext.cxx
@@ -0,0 +1,1543 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "futext.hxx"
+#include <editeng/eeitem.hxx>
+#include <editeng/editerr.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/svxerr.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/help.hxx>
+#include <editeng/editstat.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/intitem.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/svdogrp.hxx>
+#include <editeng/flditem.hxx>
+#include <svl/style.hxx>
+#include <svx/svdpagv.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/editeng.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svxids.hrc>
+#include <sfx2/docfile.hxx>
+#include <comphelper/processfactory.hxx>
+#include <editeng/outlobj.hxx>
+#include <svtools/langtab.hxx>
+
+// #104122#
+#include <editeng/frmdiritem.hxx>
+
+#include <svx/svdetc.hxx>
+#include <editeng/editview.hxx>
+
+#include "sdresid.hxx"
+#include "app.hrc"
+#include "res_bmp.hrc"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
+#include "View.hxx"
+#include "Outliner.hxx"
+#include "Window.hxx"
+#include "drawdoc.hxx"
+#include "sdpage.hxx"
+#include "sdmod.hxx"
+#include "FrameView.hxx"
+#include "ToolBarManager.hxx"
+#include "DrawDocShell.hxx"
+#include "glob.hrc"
+#include "pres.hxx"
+#include "optsitem.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+
+namespace sd {
+
+static USHORT SidArray[] = {
+ SID_STYLE_FAMILY2, // 5542
+ SID_STYLE_FAMILY5, // 5545
+ SID_CUT, // 5710
+ SID_COPY, // 5711
+ SID_ATTR_TABSTOP, // 10002
+ SID_ATTR_CHAR_FONT, // 10007
+ SID_ATTR_CHAR_POSTURE, // 10008
+ SID_ATTR_CHAR_WEIGHT, // 10009
+ SID_ATTR_CHAR_UNDERLINE, // 10014
+ SID_ATTR_CHAR_FONTHEIGHT, // 10015
+ SID_ATTR_CHAR_COLOR, // 10017
+ SID_ATTR_PARA_ADJUST_LEFT, // 10028
+ SID_ATTR_PARA_ADJUST_RIGHT, // 10029
+ SID_ATTR_PARA_ADJUST_CENTER, // 10030
+ SID_ATTR_PARA_ADJUST_BLOCK, // 10031
+ SID_ATTR_PARA_LINESPACE_10, // 10034
+ SID_ATTR_PARA_LINESPACE_15, // 10035
+ SID_ATTR_PARA_LINESPACE_20, // 10036
+ SID_ATTR_PARA_LRSPACE, // 10043
+ SID_OUTLINE_UP, // 10150
+ SID_OUTLINE_DOWN, // 10151
+ SID_OUTLINE_LEFT, // 10152
+ SID_OUTLINE_RIGHT, // 10153
+ SID_FORMTEXT_STYLE, // 10257
+ SID_SET_SUPER_SCRIPT, // 10294
+ SID_SET_SUB_SCRIPT, // 10295
+ SID_HYPERLINK_GETLINK, // 10361
+ SID_CHARMAP, // 10503
+ SID_TEXTDIRECTION_LEFT_TO_RIGHT, // 10907
+ SID_TEXTDIRECTION_TOP_TO_BOTTOM, // 10908
+ SID_ATTR_PARA_LEFT_TO_RIGHT, // 10950
+ SID_ATTR_PARA_RIGHT_TO_LEFT, // 10951
+ FN_NUM_BULLET_ON, // 20138
+ SID_PARASPACE_INCREASE, // 27346
+ SID_PARASPACE_DECREASE, // 27347
+ 0 };
+
+TYPEINIT1( FuText, FuConstruct );
+
+
+static BOOL bTestText = 0;
+
+/*************************************************************************
+|*
+|* Basisklasse fuer Textfunktionen
+|*
+\************************************************************************/
+
+FuText::FuText( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+: FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
+, bFirstObjCreated(FALSE)
+, rRequest (rReq)
+{
+}
+
+FunctionReference FuText::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuText( pViewSh, pWin, pView, pDoc, rReq ) );
+ return xFunc;
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+void FuText::disposing()
+{
+ if(mpView)
+ {
+ if(mpView->SdrEndTextEdit(FALSE) == SDRENDTEXTEDIT_DELETED)
+ mxTextObj.reset( 0 );
+
+ // die RequestHandler der benutzten Outliner zuruecksetzen auf den
+ // Handler am Dokument
+ ::Outliner* pOutliner = mpView->GetTextEditOutliner();
+
+ if (pOutliner)
+ pOutliner->SetStyleSheetPool(static_cast<SfxStyleSheetPool*>(mpDoc->GetStyleSheetPool()));
+ }
+}
+
+/*************************************************************************
+|*
+|* Execute functionality of this class:
+|*
+|* #71422: Start the functionality of this class in this method
+|* and not in the ctor.
+|* If you construct an object of this class and you put the
+|* address of this object to pFuActual you've got a problem,
+|* because some methods inside DoExecute use the pFuActual-Pointer.
+|* If the code inside DoExecute is executed inside the ctor,
+|* the value of pFuActual is not right. And the value will not
+|* be right until the ctor finished !!!
+|*
+\************************************************************************/
+void FuText::DoExecute( SfxRequest& )
+{
+ mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBarShell(
+ ToolBarManager::TBG_FUNCTION,
+ RID_DRAW_TEXT_TOOLBOX);
+
+ mpView->SetCurrentObj(OBJ_TEXT);
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+
+ MouseEvent aMEvt(mpWindow->GetPointerPosPixel());
+
+ if (nSlotId == SID_TEXTEDIT)
+ {
+ // Try to select an object
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ SdrViewEvent aVEvt;
+ mpView->PickAnything(aMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ mpView->MarkObj(aVEvt.pRootObj, pPV);
+
+ mxTextObj.reset( dynamic_cast< SdrTextObj* >( aVEvt.pObj ) );
+ }
+ else if (mpView->AreObjectsMarked())
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ mxTextObj.reset( dynamic_cast< SdrTextObj* >( pObj ) );
+ }
+ }
+
+ // check for table
+ if (mpView->AreObjectsMarked())
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if( pObj && (pObj->GetObjInventor() == SdrInventor ) && (pObj->GetObjIdentifier() == OBJ_TABLE) )
+ {
+ mpViewShell->GetViewShellBase().GetToolBarManager()->AddToolBarShell( ToolBarManager::TBG_FUNCTION, RID_DRAW_TABLE_TOOLBOX );
+ }
+ }
+ }
+
+ BOOL bQuickDrag = TRUE;
+
+ const SfxItemSet* pArgs = rRequest.GetArgs();
+
+ if (pArgs
+
+ // #98198# test for type before using
+ && SID_TEXTEDIT == nSlotId
+ && SFX_ITEM_SET == pArgs->GetItemState(SID_TEXTEDIT)
+
+ && (UINT16)((SfxUInt16Item&)pArgs->Get(SID_TEXTEDIT)).GetValue() == 2)
+ {
+ // Selection by doubleclick -> don't allow QuickDrag
+ bQuickDrag = FALSE;
+ }
+
+ SetInEditMode(aMEvt, bQuickDrag);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL FuText::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ bMBDown = TRUE;
+
+ BOOL bReturn = FuDraw::MouseButtonDown(rMEvt);
+
+ /* af: (de)Select object before showing the context menu.
+ // Fuer PopupMenu (vorher DrawViewShell)
+ if ((rMEvt.GetButtons() == MOUSE_RIGHT) && rMEvt.GetClicks() == 1 &&
+ mpView->IsTextEdit())
+ {
+ return (TRUE);
+ }
+ */
+
+ mpView->SetMarkHdlWhenTextEdit(TRUE);
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_TEXTEDIT)
+ {
+ // Text getroffen -> Event von SdrView auswerten lassen
+ if (mpView->MouseButtonDown(rMEvt, mpWindow))
+ return (TRUE);
+ }
+
+ if (rMEvt.GetClicks() == 1)
+ {
+ if (mpView->IsTextEdit() && eHit != SDRHIT_MARKEDOBJECT && eHit != SDRHIT_HANDLE)
+ {
+ // Texteingabe beenden
+ if(mpView->SdrEndTextEdit() == SDRENDTEXTEDIT_DELETED)
+ {
+ // Bugfix von MBA: bei Doppelclick auf der Wiese im Modus Text wird
+ // beim zweiten Click eHit = SDRHIT_TEXTEDITOBJ erhalten, weil ja der
+ // zweite Click auf das im ersten Click angelegte TextObject geht.
+ // Dieses wird aber in SdrEndTextEdit entfernt, weil es leer ist. Es
+ // befindet sich aber noch in der Mark-Liste und der Aufruf MarkObj
+ // weiter unten greift dann auf das tote Object zu.
+ // Als einfacher Fix wird nach SdrEndTextEdit noch einmal eHit ermittelt,
+ // was dann SDRHIT_NONE liefert.
+ mxTextObj.reset( NULL );
+ eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ }
+
+ mpView->SetCurrentObj(OBJ_TEXT);
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+ }
+
+ if (rMEvt.IsLeft() || rMEvt.IsRight())
+ {
+ mpWindow->CaptureMouse();
+ SdrObject* pObj;
+ SdrPageView* pPV = mpView->GetSdrPageView();
+
+ if (eHit == SDRHIT_TEXTEDIT)
+ {
+ SetInEditMode(rMEvt, FALSE);
+ }
+ else
+ {
+ BOOL bMacro = FALSE;
+
+ if (bMacro && mpView->PickObj(aMDPos,mpView->getHitTolLog(),pObj,pPV,SDRSEARCH_PICKMACRO))
+ {
+ // Makro
+ USHORT nHitLog = USHORT ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
+ mpView->BegMacroObj(aMDPos,nHitLog,pObj,pPV,mpWindow);
+ }
+ else
+ {
+ if (eHit != SDRHIT_HANDLE)
+ {
+ // Selektion aufheben
+ if (!rMEvt.IsShift() && eHit == SDRHIT_TEXTEDITOBJ)
+ {
+ mpView->UnmarkAll();
+ mpView->SetDragMode(SDRDRAG_MOVE);
+ }
+ }
+
+ if ( aVEvt.eEvent == SDREVENT_EXECUTEURL ||
+ eHit == SDRHIT_HANDLE ||
+ eHit == SDRHIT_MARKEDOBJECT ||
+ eHit == SDRHIT_TEXTEDITOBJ ||
+ ( eHit == SDRHIT_UNMARKEDOBJECT && bFirstObjCreated &&
+ !bPermanent ) )
+ {
+ /**********************************************************
+ * Handle, markiertes oder unmarkiertes Objekt getroffen
+ **********************************************************/
+ if (eHit == SDRHIT_TEXTEDITOBJ)
+ {
+ /******************************************************
+ * Text eines unmarkierten Objekts getroffen:
+ * Objekt wird selektiert und in EditMode versetzt
+ ******************************************************/
+ mpView->MarkObj(aVEvt.pRootObj, pPV);
+
+ if (aVEvt.pObj && aVEvt.pObj->ISA(SdrTextObj))
+ {
+ mxTextObj.reset( static_cast<SdrTextObj*>(aVEvt.pObj) );
+ }
+
+ SetInEditMode(rMEvt, TRUE);
+ }
+ else if (aVEvt.eEvent == SDREVENT_EXECUTEURL && !rMEvt.IsMod2())
+ {
+ /******************************************************
+ * URL ausfuehren
+ ******************************************************/
+ mpWindow->ReleaseMouse();
+ SfxStringItem aStrItem(SID_FILE_NAME, aVEvt.pURLField->GetURL());
+ SfxStringItem aReferer(SID_REFERER, mpDocSh->GetMedium()->GetName());
+ SfxBoolItem aBrowseItem( SID_BROWSE, TRUE );
+ SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
+ mpWindow->ReleaseMouse();
+
+ if (rMEvt.IsMod1())
+ {
+ // Im neuen Frame oeffnen
+ pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aBrowseItem, &aReferer, 0L);
+ }
+ else
+ {
+ // Im aktuellen Frame oeffnen
+ SfxFrameItem aFrameItem(SID_DOCFRAME, pFrame);
+ pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aStrItem, &aFrameItem, &aBrowseItem, &aReferer, 0L);
+ }
+ }
+ else
+ {
+ /******************************************************
+ * Objekt oder Handle draggen
+ ******************************************************/
+
+ // #i78748#
+ // do the EndTextEdit first, it will delete the handles and force a
+ // recreation. This will make aVEvt.pHdl to point to a deleted handle,
+ // thus it is necessary to reset it and to get it again.
+ ::Outliner* pOutl = mpView->GetTextEditOutliner();
+
+ if (mxTextObj.is() && (mxTextObj->GetOutlinerParaObject() ||
+ (pOutl && pOutl->GetText(pOutl->GetParagraph( 0 )).Len() != 0)))
+ {
+ mpView->SdrEndTextEdit();
+
+ if(aVEvt.pHdl)
+ {
+ // force new handle identification, the pointer will be dead here
+ // since SdrEndTextEdit has resetted (deleted) the handles.
+ aVEvt.pHdl = 0;
+ mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ }
+ }
+
+ if (!aVEvt.pHdl)
+ {
+ if( eHit == SDRHIT_UNMARKEDOBJECT )
+ {
+ if ( !rMEvt.IsShift() )
+ mpView->UnmarkAll();
+
+ mpView->MarkObj(aVEvt.pRootObj, pPV);
+ }
+
+ // Objekt draggen
+ bFirstMouseMove = TRUE;
+ aDragTimer.Start();
+ }
+
+
+ if ( ! rMEvt.IsRight())
+ {
+ // we need to pick again since SdrEndTextEdit can rebuild the handles list
+ eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ if( (eHit == SDRHIT_HANDLE) || (eHit == SDRHIT_MARKEDOBJECT) )
+ {
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpView->BegDragObj(aMDPos, (OutputDevice*) NULL, aVEvt.pHdl, nDrgLog);
+ }
+ }
+ bReturn = true;
+ }
+ }
+ else if ( nSlotId != SID_TEXTEDIT &&
+ (bPermanent || !bFirstObjCreated) )
+ {
+ /**********************************************************
+ * Objekt erzeugen
+ **********************************************************/
+ mpView->SetCurrentObj(OBJ_TEXT);
+ mpView->SetEditMode(SDREDITMODE_CREATE);
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpView->BegCreateObj(aMDPos, (OutputDevice*) NULL, nDrgLog);
+ }
+ else
+ {
+ /**********************************************************
+ * Selektieren
+ **********************************************************/
+ if( !rMEvt.IsShift() )
+ mpView->UnmarkAll();
+
+ mpView->BegMarkObj( aMDPos );
+ }
+ }
+ }
+ }
+ }
+ else if ( rMEvt.GetClicks() == 2 && !mpView->IsTextEdit() )
+ {
+ MouseEvent aMEvt( mpWindow->GetPointerPosPixel() );
+ SetInEditMode( aMEvt, FALSE );
+ }
+
+ if (!bIsInDragMode)
+ {
+ ForcePointer(&rMEvt);
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate(SidArray);
+ }
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuText::MouseMove(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FuDraw::MouseMove(rMEvt);
+
+ if (aDragTimer.IsActive() )
+ {
+ if( bFirstMouseMove )
+ bFirstMouseMove = FALSE;
+ else
+ aDragTimer.Stop();
+ }
+
+ if (!bReturn && mpView->IsAction() && !mpDocSh->IsReadOnly())
+ {
+ Point aPix(rMEvt.GetPosPixel());
+ Point aPnt(mpWindow->PixelToLogic(aPix));
+
+ ForceScroll(aPix);
+ mpView->MovAction(aPnt);
+ }
+
+ ForcePointer(&rMEvt);
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+// #97016#
+void FuText::ImpSetAttributesForNewTextObject(SdrTextObj* pTxtObj)
+{
+ if(mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
+ {
+ if( nSlotId == SID_ATTR_CHAR )
+ {
+ // Impress-Textobjekt wird erzeugt (faellt auf Zeilenhoehe zusammen)
+ // Damit das Objekt beim anschliessenden Erzeugen gleich die richtige
+ // Hoehe bekommt (sonst wird zuviel gepainted)
+ SfxItemSet aSet(mpViewShell->GetPool());
+ aSet.Put(SdrTextMinFrameHeightItem(0));
+ aSet.Put(SdrTextAutoGrowWidthItem(FALSE));
+ aSet.Put(SdrTextAutoGrowHeightItem(TRUE));
+ pTxtObj->SetMergedItemSet(aSet);
+ pTxtObj->AdjustTextFrameWidthAndHeight();
+ aSet.Put(SdrTextMaxFrameHeightItem(pTxtObj->GetLogicRect().GetSize().Height()));
+ pTxtObj->SetMergedItemSet(aSet);
+ }
+ else if( nSlotId == SID_ATTR_CHAR_VERTICAL )
+ {
+ SfxItemSet aSet(mpViewShell->GetPool());
+ aSet.Put(SdrTextMinFrameWidthItem(0));
+ aSet.Put(SdrTextAutoGrowWidthItem(TRUE));
+ aSet.Put(SdrTextAutoGrowHeightItem(FALSE));
+
+ // #91853# Needs to be set since default is SDRTEXTHORZADJUST_BLOCK
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+ pTxtObj->SetMergedItemSet(aSet);
+ pTxtObj->AdjustTextFrameWidthAndHeight();
+ aSet.Put(SdrTextMaxFrameWidthItem(pTxtObj->GetLogicRect().GetSize().Width()));
+ pTxtObj->SetMergedItemSet(aSet);
+ }
+ }
+ else
+ {
+ if( nSlotId == SID_ATTR_CHAR_VERTICAL )
+ {
+ // draw text object, needs to be initialized when vertical text is used
+ SfxItemSet aSet(mpViewShell->GetPool());
+
+ // #91510#
+ aSet.Put(SdrTextAutoGrowWidthItem(TRUE));
+ aSet.Put(SdrTextAutoGrowHeightItem(FALSE));
+
+ // #91508#
+ //aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
+ //aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+
+ // #107235#
+ // Set defaults for vertical klick-n'drag text object, pool defaults are:
+ // SdrTextVertAdjustItem: SDRTEXTVERTADJUST_TOP
+ // SdrTextHorzAdjustItem: SDRTEXTHORZADJUST_BLOCK
+ // Analog to that (thus, #91508# was not completely correct):
+ aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK));
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+
+ pTxtObj->SetMergedItemSet(aSet);
+ }
+ }
+}
+
+// #97016#
+void FuText::ImpSetAttributesFitToSize(SdrTextObj* pTxtObj)
+{
+ // FitToSize (An Rahmen anpassen)
+ SfxItemSet aSet(mpViewShell->GetPool(), SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWWIDTH);
+ SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL;
+ aSet.Put(SdrTextFitToSizeTypeItem(eFTS));
+ aSet.Put(SdrTextAutoGrowHeightItem(FALSE));
+ aSet.Put(SdrTextAutoGrowWidthItem(FALSE));
+ pTxtObj->SetMergedItemSet(aSet);
+ pTxtObj->AdjustTextFrameWidthAndHeight();
+}
+
+// #97016#
+void FuText::ImpSetAttributesFitToSizeVertical(SdrTextObj* pTxtObj)
+{
+ SfxItemSet aSet(mpViewShell->GetPool(),
+ SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWWIDTH);
+ SdrFitToSizeType eFTS = SDRTEXTFIT_PROPORTIONAL;
+ aSet.Put(SdrTextFitToSizeTypeItem(eFTS));
+ aSet.Put(SdrTextAutoGrowHeightItem(FALSE));
+ aSet.Put(SdrTextAutoGrowWidthItem(FALSE));
+ pTxtObj->SetMergedItemSet(aSet);
+ pTxtObj->AdjustTextFrameWidthAndHeight();
+}
+
+// #97016#
+void FuText::ImpSetAttributesFitCommon(SdrTextObj* pTxtObj)
+{
+ // Normales Textobjekt
+ if (mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS)
+ {
+ if( nSlotId == SID_ATTR_CHAR )
+ {
+ // Impress-Textobjekt (faellt auf Zeilenhoehe zusammen)
+ SfxItemSet aSet(mpViewShell->GetPool());
+ aSet.Put(SdrTextMinFrameHeightItem(0));
+ aSet.Put(SdrTextMaxFrameHeightItem(0));
+ aSet.Put(SdrTextAutoGrowHeightItem(TRUE));
+ aSet.Put(SdrTextAutoGrowWidthItem(FALSE));
+ pTxtObj->SetMergedItemSet(aSet);
+ }
+ else if( nSlotId == SID_ATTR_CHAR_VERTICAL )
+ {
+ SfxItemSet aSet(mpViewShell->GetPool());
+ aSet.Put(SdrTextMinFrameWidthItem(0));
+ aSet.Put(SdrTextMaxFrameWidthItem(0));
+ aSet.Put(SdrTextAutoGrowWidthItem(TRUE));
+ aSet.Put(SdrTextAutoGrowHeightItem(FALSE));
+ pTxtObj->SetMergedItemSet(aSet);
+ }
+
+ pTxtObj->AdjustTextFrameWidthAndHeight();
+ }
+}
+
+BOOL FuText::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+
+ if (aDragTimer.IsActive())
+ {
+ aDragTimer.Stop();
+ bIsInDragMode = FALSE;
+ }
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+
+ Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if( (mpView && mpView->MouseButtonUp(rMEvt, mpWindow)) || rMEvt.GetClicks() == 2 )
+ return (TRUE); // Event von der SdrView ausgewertet
+
+ BOOL bEmptyTextObj = FALSE;
+
+ if (mxTextObj.is())
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1
+ && ( rMarkList.GetMark(0)->GetMarkedSdrObj() == mxTextObj.get()) )
+ {
+ if( mxTextObj.is() && !GetTextObj()->GetOutlinerParaObject() )
+ bEmptyTextObj = TRUE;
+ else
+ bFirstObjCreated = TRUE;
+ }
+ else
+ {
+ mxTextObj.reset( 0 );
+ }
+ }
+
+ if( mpView && mpView->IsDragObj())
+ {
+ /**********************************************************************
+ * Objekt wurde verschoben
+ **********************************************************************/
+ FrameView* pFrameView = mpViewShell->GetFrameView();
+ BOOL bDragWithCopy = (rMEvt.IsMod1() && pFrameView->IsDragWithCopy());
+
+ if (bDragWithCopy)
+ {
+ bDragWithCopy = !mpView->IsPresObjSelected(FALSE, TRUE);
+ }
+
+ mpView->SetDragWithCopy(bDragWithCopy);
+ mpView->EndDragObj( mpView->IsDragWithCopy() );
+ mpView->ForceMarkedToAnotherPage();
+ mpView->SetCurrentObj(OBJ_TEXT);
+ }
+ else if( mpView && mpView->IsCreateObj() && rMEvt.IsLeft())
+ {
+ /**********************************************************************
+ * Objekt wurde erzeugt
+ **********************************************************************/
+ mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetCreateObj() ) );
+
+ if( mxTextObj.is() )
+ {
+ //AW outliner needs to be set to vertical when there is no
+ // outliner object up to now; also it needs to be set back to not
+ // vertical when there was a vertical one used last time.
+ OutlinerParaObject* pOPO = GetTextObj()->GetOutlinerParaObject();
+ SdrOutliner& rOutl = mxTextObj->GetModel()->GetDrawOutliner(GetTextObj());
+ BOOL bVertical((pOPO && pOPO->IsVertical())
+ || nSlotId == SID_ATTR_CHAR_VERTICAL
+ || nSlotId == SID_TEXT_FITTOSIZE_VERTICAL);
+ rOutl.SetVertical(bVertical);
+
+ // #107235#
+ // Before ImpSetAttributesForNewTextObject the vertical writing mode
+ // needs to be set at the object. This is done here at the OutlinerParaObject
+ // directly to not mirror the layout text items involved. These items will be set
+ // from ImpSetAttributesForNewTextObject and below.
+ OutlinerParaObject* pPara = GetTextObj()->GetOutlinerParaObject();
+
+ if(!pPara)
+ {
+ GetTextObj()->ForceOutlinerParaObject();
+ pPara = GetTextObj()->GetOutlinerParaObject();
+ }
+
+ if(pPara && (bool)bVertical != pPara->IsVertical())
+ {
+ // set ParaObject orientation accordingly
+ pPara->SetVertical(bVertical);
+ }
+
+ // #97016#
+ ImpSetAttributesForNewTextObject(GetTextObj());
+ }
+
+ if (!mpView->EndCreateObj(SDRCREATE_FORCEEND))
+ {
+ // Textobjekt konnte nicht erzeugt werden
+ mxTextObj.reset(0);
+ }
+ else if (nSlotId == SID_TEXT_FITTOSIZE)
+ {
+ // #97016#
+ ImpSetAttributesFitToSize(GetTextObj());
+
+ SetInEditMode(rMEvt, FALSE);
+ }
+ else if ( nSlotId == SID_TEXT_FITTOSIZE_VERTICAL )
+ {
+ // #97016#
+ ImpSetAttributesFitToSizeVertical(GetTextObj());
+
+ SetInEditMode(rMEvt, FALSE);
+ }
+ else
+ {
+ // #97016#
+ ImpSetAttributesFitCommon(GetTextObj());
+
+ // Damit die Handles und der graue Rahmen stimmen
+ mpView->AdjustMarkHdl();
+ mpView->PickHandle(aPnt);
+ SetInEditMode(rMEvt, FALSE);
+ }
+ }
+ else if ( mpView && mpView->IsAction())
+ {
+ mpView->EndAction();
+ }
+
+ ForcePointer(&rMEvt);
+ mpWindow->ReleaseMouse();
+ USHORT nDrgLog1 = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+
+ if ( mpView && !mpView->AreObjectsMarked() &&
+ Abs(aMDPos.X() - aPnt.X()) < nDrgLog1 &&
+ Abs(aMDPos.Y() - aPnt.Y()) < nDrgLog1 &&
+ !rMEvt.IsShift() && !rMEvt.IsMod2() )
+ {
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ SdrViewEvent aVEvt;
+ mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ mpView->MarkObj(aVEvt.pRootObj, pPV);
+ }
+
+ if ( !mxTextObj.is() && mpView )
+ {
+ if ( ( (!bEmptyTextObj && bPermanent) ||
+ (!bFirstObjCreated && !bPermanent) ) &&
+ !mpDocSh->IsReadOnly() &&
+ nSlotId != SID_TEXTEDIT )
+ {
+ /**********************************************************************
+ * Mengentext (linksbuendiges AutoGrow)
+ **********************************************************************/
+ mpView->SetCurrentObj(OBJ_TEXT);
+ mpView->SetEditMode(SDREDITMODE_CREATE);
+ USHORT nDrgLog = USHORT ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
+ mpView->BegCreateObj(aMDPos, (OutputDevice*) NULL, nDrgLog);
+
+ BOOL bSnapEnabled = mpView->IsSnapEnabled();
+
+ if (bSnapEnabled)
+ mpView->SetSnapEnabled(FALSE);
+
+ aPnt.X() += nDrgLog + nDrgLog;
+ aPnt.Y() += nDrgLog + nDrgLog;
+ mpView->MovAction(aPnt);
+
+ mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetCreateObj() ) );
+
+ if(mxTextObj.is())
+ {
+ GetTextObj()->SetDisableAutoWidthOnDragging(TRUE);
+ }
+
+ if(!mpView->EndCreateObj(SDRCREATE_FORCEEND))
+ {
+ mxTextObj.reset(0);
+ }
+
+ if(bSnapEnabled)
+ mpView->SetSnapEnabled(bSnapEnabled);
+
+ if(mxTextObj.is())
+ {
+ SfxItemSet aSet(mpViewShell->GetPool());
+ aSet.Put(SdrTextMinFrameHeightItem(0));
+ aSet.Put(SdrTextMinFrameWidthItem(0));
+ aSet.Put(SdrTextAutoGrowHeightItem(TRUE));
+ aSet.Put(SdrTextAutoGrowWidthItem(TRUE));
+
+ // #91508#
+ if(nSlotId == SID_ATTR_CHAR_VERTICAL)
+ {
+ // #107235#
+ //
+ // Here, all items which need to be different from pool default need to be set
+ // again on the newly created text object.
+ // Since this is a simple klick text object, it is first created, then SetVertical()
+ // is used, then ImpSetAttributesForNewTextObject is called and then the object is
+ // deleted again since not the minimum drag distance was travelled. Then, a new
+ // klick text object is created and thus all that stuff needs to be set again here.
+ //
+ // Before using the new object the vertical writing mode
+ // needs to be set. This is done here at the OutlinerParaObject
+ // directly to not mirror the layout text items involved. These items will be set
+ // below.
+ OutlinerParaObject* pPara = GetTextObj()->GetOutlinerParaObject();
+
+ if(!pPara)
+ {
+ GetTextObj()->ForceOutlinerParaObject();
+ pPara = GetTextObj()->GetOutlinerParaObject();
+ }
+
+ if(pPara && sal_True != pPara->IsVertical())
+ {
+ // set ParaObject orientation accordingly
+ pPara->SetVertical(sal_True);
+ }
+
+ // #91508#
+ // aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+
+ // #107235#
+ // Analog to the else case below, for vertical simple click texts
+ // one of the defaulted setted items from ImpSetAttributesForNewTextObject
+ // needs to be adapted to non-block mode. This could have been done with the
+ // #104122#, but was obviously overseen.
+ const SfxItemSet& rSet = mpView->GetDefaultAttr();
+ SvxFrameDirection eDirection = (SvxFrameDirection)((SvxFrameDirectionItem&)rSet.Get(EE_PARA_WRITINGDIR)).GetValue();
+
+ if(FRMDIR_HORI_RIGHT_TOP == eDirection || FRMDIR_VERT_TOP_RIGHT == eDirection)
+ {
+ aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM));
+ }
+ else
+ {
+ aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
+ }
+ }
+ else
+ {
+ // #104122# This is for Format/Page settings. Since this also leads
+ // to the object defaults to be changed, i think this code can be
+ // removed. CL. wanted to take a look before adding this.
+ //const SdrTextHorzAdjust eHA = ( ( pDoc && pDoc->GetDefaultWritingMode() == ::com::sun::star::text::WritingMode_RL_TB ) ?
+ // SDRTEXTHORZADJUST_RIGHT : SDRTEXTHORZADJUST_LEFT );
+ //aSet.Put( SdrTextHorzAdjustItem( eHA ) );
+
+ // #104122# Look in the object defaults if left-to-right is wanted. If
+ // yes, set text anchoring to right to let the box grow to left.
+ const SfxItemSet& rSet = mpView->GetDefaultAttr();
+ SvxFrameDirection eDirection = (SvxFrameDirection)((SvxFrameDirectionItem&)rSet.Get(EE_PARA_WRITINGDIR)).GetValue();
+
+ if(FRMDIR_HORI_RIGHT_TOP == eDirection)
+ {
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+ }
+ else
+ {
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT));
+ }
+ }
+
+ GetTextObj()->SetMergedItemSet(aSet);
+ GetTextObj()->SetDisableAutoWidthOnDragging(TRUE);
+ SetInEditMode(rMEvt, FALSE);
+ }
+
+ bFirstObjCreated = TRUE;
+ }
+ else
+ {
+ // In die Fkt. Selektion wechseln
+ if (mpView->SdrEndTextEdit() == SDRENDTEXTEDIT_DELETED)
+ {
+ mxTextObj.reset(0);
+ }
+
+ mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_OBJECT_SELECT,
+ SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+ }
+ }
+
+ bMBDown = FALSE;
+ FuConstruct::MouseButtonUp(rMEvt);
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+BOOL FuText::KeyInput(const KeyEvent& rKEvt)
+{
+ BOOL bReturn = FALSE;
+ mpView->SetMarkHdlWhenTextEdit(TRUE);
+
+ KeyCode nCode = rKEvt.GetKeyCode();
+ BOOL bShift = nCode.IsShift();
+
+ // #97016# IV
+ if(mxTextObj.is())
+ {
+ // maybe object is deleted, test if it's equal to the selected object
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ SdrObject* pSelectedObj = 0L;
+
+ if(1 == rMarkList.GetMarkCount())
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ pSelectedObj = pMark->GetMarkedSdrObj();
+ }
+
+ if(mxTextObj.get() != pSelectedObj)
+ {
+ mxTextObj.reset(0);
+ }
+ }
+
+ if ( mxTextObj.is() && mxTextObj->GetObjInventor() == SdrInventor && mxTextObj->GetObjIdentifier() == OBJ_TITLETEXT && rKEvt.GetKeyCode().GetCode() == KEY_RETURN )
+ {
+ // Titeltext-Objekt: immer "weiche" Umbrueche
+ bShift = TRUE;
+ }
+
+ USHORT nKey = nCode.GetCode();
+ KeyCode aKeyCode (nKey, bShift, nCode.IsMod1(), nCode.IsMod2(), nCode.IsMod3() );
+ KeyEvent aKEvt(rKEvt.GetCharCode(), aKeyCode);
+
+ BOOL bOK = TRUE;
+
+ if (mpDocSh->IsReadOnly())
+ {
+ bOK = !EditEngine::DoesKeyChangeText(aKEvt);
+ }
+ if( aKeyCode.GetCode() == KEY_PAGEUP || aKeyCode.GetCode() == KEY_PAGEDOWN )
+ {
+ bOK = FALSE; // default handling in base class
+ }
+
+ if (bOK && mpView->KeyInput(aKEvt, mpWindow) )
+ {
+ bReturn = TRUE;
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+
+// if ( pTextObj )
+// pTextObj->SetEmptyPresObj(FALSE);
+ }
+ else if (aKeyCode == KEY_ESCAPE)
+ {
+ bReturn = cancel();
+ }
+
+ if( bPermanent )
+ {
+ mpView->SetCurrentObj(OBJ_TEXT);
+ mpView->SetEditMode(SDREDITMODE_CREATE);
+ }
+
+ if (!bReturn)
+ {
+ bReturn = FuDraw::KeyInput(aKEvt);
+ }
+
+ return (bReturn);
+}
+
+
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuText::Activate()
+{
+ mpView->SetQuickTextEditMode(mpViewShell->GetFrameView()->IsQuickEdit());
+
+ // #i89661# it's no longer necessary to make it so big here, it's fine tuned
+ // for text objects in SdrMarkView::CheckSingleSdrObjectHit
+ mpView->SetHitTolerancePixel( 2 * HITPIX );
+
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ if (pOLV)
+ pOLV->ShowCursor();
+
+ FuConstruct::Activate();
+
+ if( pOLV )
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+}
+
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuText::Deactivate()
+{
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ if (pOLV)
+ pOLV->HideCursor();
+
+ mpView->SetHitTolerancePixel( HITPIX );
+
+ FuConstruct::Deactivate();
+}
+
+
+/*************************************************************************
+|*
+|* Objekt in Edit-Mode setzen
+|*
+\************************************************************************/
+
+void FuText::SetInEditMode(const MouseEvent& rMEvt, BOOL bQuickDrag)
+{
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ if( mxTextObj.is() && (mxTextObj->GetPage() == pPV->GetPage()) )
+ {
+ mpView->SetCurrentObj(OBJ_TEXT);
+
+ if( bPermanent )
+ mpView->SetEditMode(SDREDITMODE_CREATE);
+ else
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+
+ BOOL bEmptyOutliner = FALSE;
+
+ if (!GetTextObj()->GetOutlinerParaObject() && mpView->GetTextEditOutliner())
+ {
+ ::Outliner* pOutl = mpView->GetTextEditOutliner();
+ ULONG nParaAnz = pOutl->GetParagraphCount();
+ Paragraph* p1stPara = pOutl->GetParagraph( 0 );
+
+ if (nParaAnz==1 && p1stPara)
+ {
+ // Bei nur einem Pararaph
+ if (pOutl->GetText(p1stPara).Len() == 0)
+ {
+ bEmptyOutliner = TRUE;
+ }
+ }
+ }
+
+ if (GetTextObj() != mpView->GetTextEditObject() || bEmptyOutliner)
+ {
+ UINT32 nInv = mxTextObj->GetObjInventor();
+ UINT16 nSdrObjKind = mxTextObj->GetObjIdentifier();
+
+ if (nInv == SdrInventor && GetTextObj()->HasTextEdit() &&
+ (nSdrObjKind == OBJ_TEXT ||
+ nSdrObjKind == OBJ_TITLETEXT ||
+ nSdrObjKind == OBJ_OUTLINETEXT || !mxTextObj->IsEmptyPresObj() ) )
+ {
+ // Neuen Outliner machen (gehoert der SdrObjEditView)
+ SdrOutliner* pOutl = SdrMakeOutliner( OUTLINERMODE_OUTLINEOBJECT, mpDoc );
+
+ if (bEmptyOutliner)
+ mpView->SdrEndTextEdit(sal_True);
+
+ SdrTextObj* pTextObj = GetTextObj();
+ if( pTextObj )
+ {
+ OutlinerParaObject* pOPO = pTextObj->GetOutlinerParaObject();
+ if( ( pOPO && pOPO->IsVertical() ) || (nSlotId == SID_ATTR_CHAR_VERTICAL) || (nSlotId == SID_TEXT_FITTOSIZE_VERTICAL) )
+ pOutl->SetVertical( TRUE );
+
+ if( pTextObj->getTextCount() > 1 )
+ {
+ Point aPix(rMEvt.GetPosPixel());
+ Point aPnt(mpWindow->PixelToLogic(aPix));
+ pTextObj->setActiveText( pTextObj->CheckTextHit(aPnt ) );
+ }
+
+ if (mpView->SdrBeginTextEdit(pTextObj, pPV, mpWindow, sal_True, pOutl) && mxTextObj->GetObjInventor() == SdrInventor)
+ {
+ bFirstObjCreated = TRUE;
+ DeleteDefaultText();
+
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ nSdrObjKind = mxTextObj->GetObjIdentifier();
+
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = mpView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (eHit == SDRHIT_TEXTEDIT)
+ {
+ // Text getroffen
+ if (nSdrObjKind == OBJ_TEXT ||
+ nSdrObjKind == OBJ_TITLETEXT ||
+ nSdrObjKind == OBJ_OUTLINETEXT ||
+ nSdrObjKind == OBJ_TABLE ||
+ nSlotId == SID_TEXTEDIT ||
+ !bQuickDrag)
+ {
+ pOLV->MouseButtonDown(rMEvt);
+ pOLV->MouseMove(rMEvt);
+ pOLV->MouseButtonUp(rMEvt);
+ }
+
+ if (mpViewShell->GetFrameView()->IsQuickEdit() && bQuickDrag && GetTextObj()->GetOutlinerParaObject())
+ {
+ pOLV->MouseButtonDown(rMEvt);
+ }
+ }
+ else
+ {
+ // #98198# Move cursor to end of text
+ ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
+ pOLV->SetSelection(aNewSelection);
+ }
+ }
+ else
+ {
+ mpView->RestoreDefaultText(dynamic_cast< SdrTextObj* >( mxTextObj.get() ));
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ mxTextObj.reset(0);
+ }
+}
+
+/*************************************************************************
+|*
+|* Texteingabe wird gestartet, ggf. Default-Text loeschen
+|*
+\************************************************************************/
+
+BOOL FuText::DeleteDefaultText()
+{
+ BOOL bDeleted = FALSE;
+
+ if ( mxTextObj.is() && mxTextObj->IsEmptyPresObj() )
+ {
+ String aString;
+ SdPage* pPage = (SdPage*) mxTextObj->GetPage();
+
+ if (pPage)
+ {
+ PresObjKind ePresObjKind = pPage->GetPresObjKind(mxTextObj.get());
+
+ if ( (ePresObjKind == PRESOBJ_TITLE ||
+ ePresObjKind == PRESOBJ_OUTLINE ||
+ ePresObjKind == PRESOBJ_NOTES ||
+ ePresObjKind == PRESOBJ_TEXT) &&
+ !pPage->IsMasterPage() )
+ {
+ ::Outliner* pOutliner = mpView->GetTextEditOutliner();
+ SfxStyleSheet* pSheet = pOutliner->GetStyleSheet( 0 );
+ BOOL bIsUndoEnabled = pOutliner->IsUndoEnabled();
+ if( bIsUndoEnabled )
+ pOutliner->EnableUndo(FALSE);
+
+ pOutliner->SetText( String(), pOutliner->GetParagraph( 0 ) );
+
+ if( bIsUndoEnabled )
+ pOutliner->EnableUndo(TRUE);
+
+ if (pSheet &&
+ (ePresObjKind == PRESOBJ_NOTES || ePresObjKind == PRESOBJ_TEXT))
+ pOutliner->SetStyleSheet(0, pSheet);
+
+ mxTextObj->SetEmptyPresObj(TRUE);
+ bDeleted = TRUE;
+ }
+ }
+ }
+
+ return(bDeleted);
+}
+
+/*************************************************************************
+|*
+|* Command-event
+|*
+\************************************************************************/
+
+BOOL FuText::Command(const CommandEvent& rCEvt)
+{
+ return( FuPoor::Command(rCEvt) );
+}
+
+/*************************************************************************
+|*
+|* Help-event
+|*
+\************************************************************************/
+
+BOOL FuText::RequestHelp(const HelpEvent& rHEvt)
+{
+ BOOL bReturn = FALSE;
+
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
+
+ if ((Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled()) &&
+ mxTextObj.is() && pOLV && pOLV->GetFieldUnderMousePointer())
+ {
+ String aHelpText;
+ const SvxFieldItem* pFieldItem = pOLV->GetFieldUnderMousePointer();
+ const SvxFieldData* pField = pFieldItem->GetField();
+
+ if (pField && pField->ISA(SvxURLField))
+ {
+ /******************************************************************
+ * URL-Field
+ ******************************************************************/
+ aHelpText = INetURLObject::decode( ((const SvxURLField*)pField)->GetURL(), '%', INetURLObject::DECODE_WITH_CHARSET );
+ }
+ if (aHelpText.Len())
+ {
+ Rectangle aLogicPix = mpWindow->LogicToPixel(mxTextObj->GetLogicRect());
+ Rectangle aScreenRect(mpWindow->OutputToScreenPixel(aLogicPix.TopLeft()),
+ mpWindow->OutputToScreenPixel(aLogicPix.BottomRight()));
+
+ if (Help::IsBalloonHelpEnabled())
+ {
+ bReturn = Help::ShowBalloon( (Window*)mpWindow, rHEvt.GetMousePosPixel(), aScreenRect, aHelpText);
+ }
+ else if (Help::IsQuickHelpEnabled())
+ {
+ bReturn = Help::ShowQuickHelp( (Window*)mpWindow, aScreenRect, aHelpText);
+ }
+ }
+ }
+
+ if (!bReturn)
+ {
+ bReturn = FuConstruct::RequestHelp(rHEvt);
+ }
+
+ return(bReturn);
+}
+
+/*************************************************************************
+|*
+|* Request verarbeiten
+|*
+\************************************************************************/
+
+void FuText::ReceiveRequest(SfxRequest& rReq)
+{
+ nSlotId = rReq.GetSlot();
+
+ // Dann Basisklasse rufen (dort wird u.a. nSlotId NICHT gesetzt)
+ FuPoor::ReceiveRequest(rReq);
+
+ if (nSlotId == SID_TEXTEDIT || mpViewShell->GetFrameView()->IsQuickEdit() || /*#95971#*/ SID_ATTR_CHAR == nSlotId)
+ {
+ MouseEvent aMEvt(mpWindow->GetPointerPosPixel());
+
+ mxTextObj.reset(0);
+
+ if (nSlotId == SID_TEXTEDIT)
+ {
+ // Wird gerade editiert?
+ if(!bTestText)
+ mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetTextEditObject() ) );
+
+ if (!mxTextObj.is())
+ {
+ // Versuchen, ein Obj zu selektieren
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ SdrViewEvent aVEvt;
+ mpView->PickAnything(aMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+ mpView->MarkObj(aVEvt.pRootObj, pPV);
+
+ if (aVEvt.pObj && aVEvt.pObj->ISA(SdrTextObj))
+ {
+ mxTextObj.reset( static_cast< SdrTextObj* >( aVEvt.pObj ) );
+ }
+ }
+ }
+ else if (mpView->AreObjectsMarked())
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ if (pObj->ISA(SdrTextObj))
+ {
+ mxTextObj.reset( static_cast< SdrTextObj* >( pObj ) );
+ }
+ }
+ }
+
+ BOOL bQuickDrag = TRUE;
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if (pArgs
+
+ // #98198# test for type before using
+ && SID_TEXTEDIT == nSlotId
+ && SFX_ITEM_SET == pArgs->GetItemState(SID_TEXTEDIT)
+
+ && (UINT16) ((SfxUInt16Item&) pArgs->Get(SID_TEXTEDIT)).GetValue() == 2)
+ {
+ // Anwahl per Doppelklick -> kein QuickDrag zulassen
+ bQuickDrag = FALSE;
+ }
+
+ SetInEditMode(aMEvt, bQuickDrag);
+ }
+}
+
+
+
+/*************************************************************************
+|*
+|* SpellChecker: Error-LinkHdl
+|*
+\************************************************************************/
+
+IMPL_LINK( FuText, SpellError, void *, nLang )
+{
+ String aError( SvtLanguageTable::GetLanguageString( (LanguageType)(ULONG)nLang ) );
+ ErrorHandler::HandleError(* new StringErrorInfo(
+ ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aError) );
+ return 0;
+}
+
+
+/*************************************************************************
+|*
+|* Reaktion auf Doppelklick
+|*
+\************************************************************************/
+void FuText::DoubleClick(const MouseEvent& )
+{
+ // Nichts zu tun
+}
+
+/** #97016#
+ #105815# Removed the insertion of default text and putting a new text
+ object directly into edit mode.
+*/
+SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
+{
+ // case SID_TEXTEDIT: // BASIC ???
+ // case SID_ATTR_CHAR:
+ // case SID_ATTR_CHAR_VERTICAL:
+ // case SID_TEXT_FITTOSIZE:
+ // case SID_TEXT_FITTOSIZE_VERTICAL:
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject(
+ mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
+ 0L, mpDoc);
+
+ if(pObj)
+ {
+ if(pObj->ISA(SdrTextObj))
+ {
+ SdrTextObj* pText = (SdrTextObj*)pObj;
+ pText->SetLogicRect(rRectangle);
+
+ sal_Bool bVertical = (SID_ATTR_CHAR_VERTICAL == nID || SID_TEXT_FITTOSIZE_VERTICAL == nID);
+ pText->SetVerticalWriting(bVertical);
+
+ // #97016#
+ ImpSetAttributesForNewTextObject(pText);
+
+ if (nSlotId == SID_TEXT_FITTOSIZE)
+ {
+ // #97016#
+ ImpSetAttributesFitToSize(pText);
+ }
+ else if ( nSlotId == SID_TEXT_FITTOSIZE_VERTICAL )
+ {
+ // #97016#
+ ImpSetAttributesFitToSizeVertical(pText);
+ }
+ else
+ {
+ // #97016#
+ ImpSetAttributesFitCommon(pText);
+ }
+
+ // Put text object into edit mode.
+ SdrPageView* pPV = mpView->GetSdrPageView();
+ mpView->SdrBeginTextEdit(pText, pPV);
+ }
+ else
+ {
+ DBG_ERROR("Object is NO text object");
+ }
+ }
+
+ return pObj;
+}
+
+
+
+
+/** is called when the currenct function should be aborted. <p>
+ This is used when a function gets a KEY_ESCAPE but can also
+ be called directly.
+
+ @returns true if a active function was aborted
+*/
+bool FuText::cancel()
+{
+ if ( mpView->IsTextEdit() )
+ {
+ if(mpView->SdrEndTextEdit() == SDRENDTEXTEDIT_DELETED)
+ mxTextObj.reset(0);
+
+ mpView->SetCurrentObj(OBJ_TEXT);
+ mpView->SetEditMode(SDREDITMODE_EDIT);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFontList, ::sd::View* pView )
+{
+ if( !pFontList || !pView )
+ return;
+
+ if( pOLV )
+ {
+ pOLV->GetEditView().ChangeFontSize( bGrow, pFontList );
+ }
+ else
+ {
+// SdDrawDocument* pDoc = pView->GetDoc();
+
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ for( sal_uInt32 nMark = 0; nMark < rMarkList.GetMarkCount(); nMark++ )
+ {
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( rMarkList.GetMark(nMark)->GetMarkedSdrObj() );
+ if( pTextObj )
+ {
+ for( sal_Int32 nText = 0; nText < pTextObj->getTextCount(); nText++ )
+ {
+ pTextObj->setActiveText( nText );
+
+ // Put text object into edit mode.
+ SdrPageView* pPV = pView->GetSdrPageView();
+ pView->SdrBeginTextEdit(pTextObj, pPV);
+
+ pOLV = pView->GetTextEditOutlinerView();
+ if( pOLV )
+ {
+ EditEngine* pEditEngine = pOLV->GetEditView().GetEditEngine();
+ if( pEditEngine )
+ {
+ ESelection aSel;
+ aSel.nEndPara = pEditEngine->GetParagraphCount()-1;
+ aSel.nEndPos = pEditEngine->GetTextLen(aSel.nEndPara);
+ pOLV->SetSelection(aSel);
+ }
+
+ ChangeFontSize( bGrow, pOLV, pFontList, pView );
+ }
+
+ pView->SdrEndTextEdit();
+ }
+
+ SfxItemSet aShapeSet( pTextObj->GetMergedItemSet() );
+ if( EditView::ChangeFontSize( bGrow, aShapeSet, pFontList ) )
+ {
+ pTextObj->SetObjectItemNoBroadcast( aShapeSet.Get( EE_CHAR_FONTHEIGHT ) );
+ pTextObj->SetObjectItemNoBroadcast( aShapeSet.Get( EE_CHAR_FONTHEIGHT_CJK ) );
+ pTextObj->SetObjectItemNoBroadcast( aShapeSet.Get( EE_CHAR_FONTHEIGHT_CTL ) );
+ }
+ }
+ }
+ }
+}
+
+} // end of namespace sd
+
diff --git a/sd/source/ui/func/futhes.cxx b/sd/source/ui/func/futhes.cxx
new file mode 100644
index 000000000000..2ec18c0f019a
--- /dev/null
+++ b/sd/source/ui/func/futhes.cxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "futhes.hxx"
+
+#include <tools/pstm.hxx>
+#include <editeng/outliner.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/eeitem.hxx>
+
+#include <svx/dialogs.hrc>
+#include <svx/svxerr.hxx>
+#include <svx/dialmgr.hxx>
+#include <editeng/unolingu.hxx>
+#include <comphelper/processfactory.hxx>
+#include "app.hrc"
+#include "strings.hrc"
+#include "drawdoc.hxx"
+#include "app.hxx"
+#include "View.hxx"
+#include "Outliner.hxx"
+#include "DrawViewShell.hxx"
+#include "OutlineViewShell.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "sdresid.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+
+class SfxRequest;
+
+namespace sd {
+
+TYPEINIT1( FuThesaurus, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuThesaurus::FuThesaurus( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq )
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuThesaurus::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuThesaurus( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuThesaurus::DoExecute( SfxRequest& )
+{
+ SfxErrorContext aContext(ERRCTX_SVX_LINGU_THESAURUS, String(),
+ mpWindow, RID_SVXERRCTX, &DIALOG_MGR() );
+
+ if( mpViewShell && mpViewShell->ISA(DrawViewShell) )
+ {
+ SdrTextObj* pTextObj = NULL;
+
+ if ( mpView->AreObjectsMarked() )
+ {
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if ( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrMark* pMark = rMarkList.GetMark(0);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
+
+ if ( pObj->ISA(SdrTextObj) )
+ {
+ pTextObj = (SdrTextObj*) pObj;
+ }
+ }
+ }
+
+ ::Outliner* pOutliner = mpView->GetTextEditOutliner();
+ const OutlinerView* pOutlView = mpView->GetTextEditOutlinerView();
+
+ if ( pTextObj && pOutliner && pOutlView )
+ {
+ if ( !pOutliner->GetSpeller().is() )
+ {
+ Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
+ if ( xSpellChecker.is() )
+ pOutliner->SetSpeller( xSpellChecker );
+
+ Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
+ if( xHyphenator.is() )
+ pOutliner->SetHyphenator( xHyphenator );
+
+ pOutliner->SetDefaultLanguage( mpDoc->GetLanguage( EE_CHAR_LANGUAGE ) );
+ }
+
+ EESpellState eState = ( (OutlinerView*) pOutlView)->StartThesaurus();
+ DBG_ASSERT(eState != EE_SPELL_NOSPELLER, "No SpellChecker");
+
+ if (eState == EE_SPELL_NOLANGUAGE)
+ {
+ ErrorBox(mpWindow, WB_OK, String(SdResId(STR_NOLANGUAGE))).Execute();
+ }
+ }
+ }
+ else if ( mpViewShell->ISA(OutlineViewShell) )
+ {
+ Outliner* pOutliner = mpDoc->GetOutliner();
+ OutlinerView* pOutlView = pOutliner->GetView(0);
+
+ if ( !pOutliner->GetSpeller().is() )
+ {
+ Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
+ if ( xSpellChecker.is() )
+ pOutliner->SetSpeller( xSpellChecker );
+
+ Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
+ if( xHyphenator.is() )
+ pOutliner->SetHyphenator( xHyphenator );
+
+ pOutliner->SetDefaultLanguage( mpDoc->GetLanguage( EE_CHAR_LANGUAGE ) );
+ }
+
+ EESpellState eState = pOutlView->StartThesaurus();
+ DBG_ASSERT(eState != EE_SPELL_NOSPELLER, "No SpellChecker");
+
+ if (eState == EE_SPELL_NOLANGUAGE)
+ {
+ ErrorBox(mpWindow, WB_OK, String(SdResId(STR_NOLANGUAGE))).Execute();
+ }
+ }
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx
new file mode 100755
index 000000000000..31797f3c8a03
--- /dev/null
+++ b/sd/source/ui/func/futransf.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "futransf.hxx"
+
+#include <svx/dialogs.hrc>
+#include <svx/polysc3d.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+
+#include "strings.hrc"
+#include "ViewShell.hxx"
+#include "View.hxx"
+#include "sdresid.hxx"
+#include "drawdoc.hxx"
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+namespace sd {
+
+TYPEINIT1( FuTransform, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuTransform::FuTransform(ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
+ SdDrawDocument* pDoc, SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuTransform::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuTransform( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuTransform::DoExecute( SfxRequest& rReq )
+{
+ if( mpView->AreObjectsMarked() )
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ // --------- itemset for size and position --------
+ SfxItemSet aSet( mpView->GetGeoAttrFromMarked() );
+
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if( rMarkList.GetMarkCount() == 1 &&
+ pObj->GetObjInventor() == SdrInventor &&
+ pObj->GetObjIdentifier() == OBJ_CAPTION )
+ {
+ // --------- itemset for caption --------
+ SfxItemSet aNewAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aNewAttr );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ std::auto_ptr< SfxAbstractTabDialog > pDlg( pFact->CreateCaptionDialog( NULL, mpView ) );
+
+ const USHORT* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
+ SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange );
+ aCombSet.Put( aNewAttr );
+ aCombSet.Put( aSet );
+ pDlg->SetInputSet( &aCombSet );
+
+ if( pDlg.get() && (pDlg->Execute() == RET_OK) )
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ pArgs = rReq.GetArgs();
+ }
+ }
+ }
+ else
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ std::auto_ptr< SfxAbstractTabDialog > pDlg( pFact->CreateSvxTransformTabDialog( NULL, &aSet, mpView ) );
+ if( pDlg.get() && (pDlg->Execute() == RET_OK) )
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ pArgs = rReq.GetArgs();
+ }
+ }
+ }
+ }
+
+ if( pArgs )
+ {
+ // Undo
+ String aString( mpView->GetDescriptionOfMarkedObjects() );
+ aString.Append( sal_Unicode(' ') );
+ aString.Append( String( SdResId( STR_TRANSFORM ) ) );
+ mpView->BegUndo( aString );
+
+ mpView->SetGeoAttrToMarked( *pArgs );
+ mpView->SetAttributes( *pArgs );
+ mpView->EndUndo();
+ }
+ }
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/futxtatt.cxx b/sd/source/ui/func/futxtatt.cxx
new file mode 100644
index 000000000000..f434f2790620
--- /dev/null
+++ b/sd/source/ui/func/futxtatt.cxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "futxtatt.hxx"
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "drawdoc.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuTextAttrDlg, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuTextAttrDlg::FuTextAttrDlg (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuTextAttrDlg::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuTextAttrDlg( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuTextAttrDlg::DoExecute( SfxRequest& rReq )
+{
+ SfxItemSet aNewAttr( mpDoc->GetPool() );
+ mpView->GetAttributes( aNewAttr );
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( NULL, &aNewAttr, mpView );
+
+ USHORT nResult = pDlg->Execute();
+
+ switch( nResult )
+ {
+ case RET_OK:
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+
+ pArgs = rReq.GetArgs();
+ }
+ break;
+
+ default:
+ {
+ delete( pDlg );
+ }
+ return; // Abbruch
+ }
+ delete( pDlg );
+ }
+ mpView->SetAttributes( *pArgs );
+}
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuvect.cxx b/sd/source/ui/func/fuvect.cxx
new file mode 100644
index 000000000000..5a8419ba7822
--- /dev/null
+++ b/sd/source/ui/func/fuvect.cxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuvect.hxx"
+#include <tools/poly.hxx>
+#ifndef _SVDOPATH_HXX //autogen
+#include <svx/svdograf.hxx>
+#endif
+#include <vcl/msgbox.hxx>
+#ifndef _SVX_SVDOGRAF_HXX //autogen
+#include <svx/svdograf.hxx>
+#endif
+#ifndef _SVX_SVDEDTV_HXX //autogen
+#include <svx/svdedtv.hxx>
+#endif
+
+
+#include "View.hxx"
+#include "ViewShell.hxx"
+#include "Window.hxx"
+#include "strings.hrc"
+#include "sdresid.hxx"
+#include "sdabstdlg.hxx"
+
+namespace sd
+{
+
+TYPEINIT1( FuVectorize, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuVectorize::FuVectorize (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor (pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+FunctionReference FuVectorize::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuVectorize( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuVectorize::DoExecute( SfxRequest& )
+{
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrGrafObj ) )
+ {
+ SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
+ AbstractSdVectorizeDlg* pDlg = pFact ? pFact->CreateSdVectorizeDlg( mpWindow, ( (SdrGrafObj*) pObj )->GetGraphic().GetBitmap(), mpDocSh ) : 0;
+ if( pDlg && pDlg->Execute() == RET_OK )
+ {
+ const GDIMetaFile& rMtf = pDlg->GetGDIMetaFile();
+ SdrPageView* pPageView = mpView->GetSdrPageView();
+
+ if( pPageView && rMtf.GetActionCount() )
+ {
+ SdrGrafObj* pVectObj = (SdrGrafObj*) pObj->Clone();
+ String aStr( mpView->GetDescriptionOfMarkedObjects() );
+
+ aStr.Append( sal_Unicode(' ') );
+ aStr.Append( String( SdResId( STR_UNDO_VECTORIZE ) ) );
+ mpView->BegUndo( aStr );
+ pVectObj->SetGraphic( rMtf );
+ mpView->ReplaceObjectAtView( pObj, *pPageView, pVectObj );
+ mpView->EndUndo();
+ }
+ }
+ delete pDlg;
+ }
+ }
+}
+
+} // end of namespace sd
diff --git a/sd/source/ui/func/fuzoom.cxx b/sd/source/ui/func/fuzoom.cxx
new file mode 100644
index 000000000000..390522cc33ca
--- /dev/null
+++ b/sd/source/ui/func/fuzoom.cxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "fuzoom.hxx"
+
+#include <svx/svxids.hrc>
+#include <sfx2/bindings.hxx>
+#include <sfx2/viewfrm.hxx>
+#include "app.hrc"
+#include <svx/svdpagv.hxx>
+
+#ifndef SD_FRAMW_VIEW_HXX
+#include "FrameView.hxx"
+#endif
+#include "ViewShell.hxx"
+#include "View.hxx"
+#ifndef SD_WINDOW_SHELL_HXX
+#include "Window.hxx"
+#endif
+#include "drawdoc.hxx"
+#include "zoomlist.hxx"
+
+namespace sd {
+
+USHORT SidArrayZoom[] = {
+ SID_ATTR_ZOOM,
+ SID_ZOOM_OUT,
+ SID_ZOOM_IN,
+ 0 };
+
+TYPEINIT1( FuZoom, FuPoor );
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+FuZoom::FuZoom(
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq),
+ bVisible(FALSE),
+ bStartDrag(FALSE)
+{
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+FuZoom::~FuZoom()
+{
+ if (bVisible)
+ {
+ // Hide ZoomRect
+ mpViewShell->DrawMarkRect(aZoomRect);
+
+ bVisible = FALSE;
+ bStartDrag = FALSE;
+ }
+}
+
+FunctionReference FuZoom::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ FunctionReference xFunc( new FuZoom( pViewSh, pWin, pView, pDoc, rReq ) );
+ return xFunc;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL FuZoom::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ // #95491# remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ mpWindow->CaptureMouse();
+ bStartDrag = TRUE;
+
+ aBeginPosPix = rMEvt.GetPosPixel();
+ aBeginPos = mpWindow->PixelToLogic(aBeginPosPix);
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+BOOL FuZoom::MouseMove(const MouseEvent& rMEvt)
+{
+ if (bStartDrag)
+ {
+ if (bVisible)
+ {
+ mpViewShell->DrawMarkRect(aZoomRect);
+ }
+
+ Point aPosPix = rMEvt.GetPosPixel();
+ ForceScroll(aPosPix);
+
+ aEndPos = mpWindow->PixelToLogic(aPosPix);
+ aBeginPos = mpWindow->PixelToLogic(aBeginPosPix);
+
+ if (nSlotId == SID_ZOOM_PANNING)
+ {
+ // Panning
+
+ Point aScroll = aBeginPos - aEndPos;
+
+ // #i2237#
+ // removed old stuff here which still forced zoom to be
+ // %BRUSH_SIZE which is outdated now
+
+ if (aScroll.X() != 0 || aScroll.Y() != 0)
+ {
+ Size aWorkSize = mpView->GetWorkArea().GetSize();
+ Size aPageSize = mpView->GetSdrPageView()->GetPage()->GetSize();
+ aScroll.X() /= aWorkSize.Width() / aPageSize.Width();
+ aScroll.Y() /= aWorkSize.Height() / aPageSize.Height();
+ mpViewShell->Scroll(aScroll.X(), aScroll.Y());
+ aBeginPosPix = aPosPix;
+ }
+ }
+ else
+ {
+ Rectangle aRect(aBeginPos, aEndPos);
+ aZoomRect = aRect;
+ aZoomRect.Justify();
+ mpViewShell->DrawMarkRect(aZoomRect);
+ }
+
+ bVisible = TRUE;
+ }
+
+ return bStartDrag;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL FuZoom::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ // #95491# remember button state for creation of own MouseEvents
+ SetMouseButtonCode(rMEvt.GetButtons());
+
+ if (bVisible)
+ {
+ // Hide ZoomRect
+ mpViewShell->DrawMarkRect(aZoomRect);
+ bVisible = FALSE;
+ }
+
+ Point aPosPix = rMEvt.GetPosPixel();
+
+ if(SID_ZOOM_PANNING != nSlotId)
+ {
+ // Zoom
+ Size aZoomSizePixel = mpWindow->LogicToPixel(aZoomRect).GetSize();
+ ULONG nTol = DRGPIX + DRGPIX;
+
+ if ( aZoomSizePixel.Width() < (long) nTol && aZoomSizePixel.Height() < (long) nTol )
+ {
+ // Klick auf der Stelle: Zoomfaktor verdoppeln
+ Point aPos = mpWindow->PixelToLogic(aPosPix);
+ Size aSize = mpWindow->PixelToLogic(mpWindow->GetOutputSizePixel());
+ aSize.Width() /= 2;
+ aSize.Height() /= 2;
+ aPos.X() -= aSize.Width() / 2;
+ aPos.Y() -= aSize.Height() / 2;
+ aZoomRect.SetPos(aPos);
+ aZoomRect.SetSize(aSize);
+ }
+
+ mpViewShell->SetZoomRect(aZoomRect);
+ }
+
+ Rectangle aVisAreaWin = mpWindow->PixelToLogic(Rectangle(Point(0,0),
+ mpWindow->GetOutputSizePixel()));
+ mpViewShell->GetZoomList()->InsertZoomRect(aVisAreaWin);
+
+ bStartDrag = FALSE;
+ mpWindow->ReleaseMouse();
+ mpViewShell->Cancel();
+
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void FuZoom::Activate()
+{
+ aPtr = mpWindow->GetPointer();
+
+ if (nSlotId == SID_ZOOM_PANNING)
+ {
+ mpWindow->SetPointer(Pointer(POINTER_HAND));
+ }
+ else
+ {
+ mpWindow->SetPointer(Pointer(POINTER_MAGNIFY));
+ }
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+void FuZoom::Deactivate()
+{
+ mpWindow->SetPointer( aPtr );
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom );
+}
+} // end of namespace sd
diff --git a/sd/source/ui/func/makefile.mk b/sd/source/ui/func/makefile.mk
new file mode 100755
index 000000000000..e4df8fe9d65a
--- /dev/null
+++ b/sd/source/ui/func/makefile.mk
@@ -0,0 +1,185 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PROJECTPCH=sd
+PROJECTPCHSOURCE=$(PRJ)$/util\sd
+PRJNAME=sd
+TARGET=func
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+AUTOSEG=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/fuformatpaintbrush.obj \
+ $(SLO)$/fuhhconv.obj \
+ $(SLO)$/undoheaderfooter.obj \
+ $(SLO)$/undolayer.obj \
+ $(SLO)$/fupoor.obj \
+ $(SLO)$/fudraw.obj \
+ $(SLO)$/fuzoom.obj \
+ $(SLO)$/fusel.obj \
+ $(SLO)$/fuconstr.obj \
+ $(SLO)$/fuconrec.obj \
+ $(SLO)$/fuconuno.obj \
+ $(SLO)$/fuconbez.obj \
+ $(SLO)$/fuediglu.obj \
+ $(SLO)$/fusldlg.obj \
+ $(SLO)$/fuscale.obj \
+ $(SLO)$/futransf.obj \
+ $(SLO)$/futext.obj \
+ $(SLO)$/fuline.obj \
+ $(SLO)$/sdundo.obj \
+ $(SLO)$/sdundogr.obj \
+ $(SLO)$/fuoaprms.obj \
+ $(SLO)$/unoaprms.obj \
+ $(SLO)$/fuarea.obj \
+ $(SLO)$/fuchar.obj \
+ $(SLO)$/fuconarc.obj \
+ $(SLO)$/fuparagr.obj \
+ $(SLO)$/fubullet.obj \
+ $(SLO)$/futempl.obj \
+ $(SLO)$/fuoutl.obj \
+ $(SLO)$/fuoltext.obj \
+ $(SLO)$/fuinsert.obj \
+ $(SLO)$/fupage.obj \
+ $(SLO)$/undopage.obj \
+ $(SLO)$/fuprlout.obj \
+ $(SLO)$/fuprobjs.obj \
+ $(SLO)$/fulinend.obj \
+ $(SLO)$/fusnapln.obj \
+ $(SLO)$/fuolbull.obj \
+ $(SLO)$/fucopy.obj \
+ $(SLO)$/fulink.obj \
+ $(SLO)$/futhes.obj \
+ $(SLO)$/fusearch.obj \
+ $(SLO)$/fuinsfil.obj \
+ $(SLO)$/futxtatt.obj \
+ $(SLO)$/fumeasur.obj \
+ $(SLO)$/fuconnct.obj \
+ $(SLO)$/unprlout.obj \
+ $(SLO)$/fudspord.obj \
+ $(SLO)$/unmovss.obj \
+ $(SLO)$/fucon3d.obj \
+ $(SLO)$/fumorph.obj \
+ $(SLO)$/fuexpand.obj \
+ $(SLO)$/fusumry.obj \
+ $(SLO)$/fucushow.obj \
+ $(SLO)$/fuvect.obj \
+ $(SLO)$/bulmaper.obj \
+ $(SLO)$/undoback.obj \
+ $(SLO)$/fuconcs.obj \
+ $(SLO)$/smarttag.obj
+
+.IF "$(GUI)" == "WNT"
+
+NOOPTFILES=\
+ $(SLO)$/futext.obj
+
+.ENDIF # wnt
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1OBJFILES= \
+ $(SLO)$/fuformatpaintbrush.obj \
+ $(SLO)$/fuhhconv.obj \
+ $(SLO)$/undoheaderfooter.obj \
+ $(SLO)$/undolayer.obj \
+ $(SLO)$/fupoor.obj \
+ $(SLO)$/fudraw.obj \
+ $(SLO)$/fuzoom.obj \
+ $(SLO)$/fusel.obj \
+ $(SLO)$/fuconstr.obj \
+ $(SLO)$/fuconrec.obj \
+ $(SLO)$/fuconuno.obj \
+ $(SLO)$/fuconbez.obj \
+ $(SLO)$/fuediglu.obj \
+ $(SLO)$/fusldlg.obj \
+ $(SLO)$/fuscale.obj \
+ $(SLO)$/futransf.obj \
+ $(SLO)$/futext.obj \
+ $(SLO)$/fuline.obj \
+ $(SLO)$/sdundo.obj \
+ $(SLO)$/sdundogr.obj \
+ $(SLO)$/fuoaprms.obj \
+ $(SLO)$/unoaprms.obj \
+ $(SLO)$/fuarea.obj \
+ $(SLO)$/fuchar.obj \
+ $(SLO)$/fuconarc.obj \
+ $(SLO)$/fuparagr.obj \
+ $(SLO)$/fubullet.obj \
+ $(SLO)$/futempl.obj \
+ $(SLO)$/fuoutl.obj \
+ $(SLO)$/fuoltext.obj \
+ $(SLO)$/smarttag.obj
+
+LIB3TARGET= $(SLB)$/$(TARGET)_2.lib
+LIB3OBJFILES= \
+ $(SLO)$/fuinsert.obj \
+ $(SLO)$/fupage.obj \
+ $(SLO)$/undopage.obj \
+ $(SLO)$/fuprlout.obj \
+ $(SLO)$/fuprobjs.obj \
+ $(SLO)$/fulinend.obj \
+ $(SLO)$/fusnapln.obj \
+ $(SLO)$/fuolbull.obj \
+ $(SLO)$/fucopy.obj \
+ $(SLO)$/fulink.obj \
+ $(SLO)$/futhes.obj \
+ $(SLO)$/fusearch.obj \
+ $(SLO)$/fuinsfil.obj \
+ $(SLO)$/futxtatt.obj \
+ $(SLO)$/fumeasur.obj \
+ $(SLO)$/fuconnct.obj \
+ $(SLO)$/unprlout.obj \
+ $(SLO)$/fudspord.obj \
+ $(SLO)$/unmovss.obj \
+ $(SLO)$/fucon3d.obj \
+ $(SLO)$/fumorph.obj \
+ $(SLO)$/fuexpand.obj \
+ $(SLO)$/fusumry.obj \
+ $(SLO)$/fucushow.obj \
+ $(SLO)$/fuvect.obj \
+ $(SLO)$/bulmaper.obj \
+ $(SLO)$/undoback.obj \
+ $(SLO)$/fuconcs.obj
+
+LIB2TARGET= $(SLB)$/$(TARGET)_ui.lib
+LIB2OBJFILES= \
+ $(SLO)$/bulmaper.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/sd/source/ui/func/sdundo.cxx b/sd/source/ui/func/sdundo.cxx
new file mode 100644
index 000000000000..83619cc0efe9
--- /dev/null
+++ b/sd/source/ui/func/sdundo.cxx
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "sdundo.hxx"
+#include <tools/debug.hxx>
+
+TYPEINIT1(SdUndoAction, SfxUndoAction);
+
diff --git a/sd/source/ui/func/sdundogr.cxx b/sd/source/ui/func/sdundogr.cxx
new file mode 100755
index 000000000000..7b7a361bba80
--- /dev/null
+++ b/sd/source/ui/func/sdundogr.cxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "sdundogr.hxx"
+
+
+TYPEINIT1(SdUndoGroup, SdUndoAction);
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+SdUndoGroup::~SdUndoGroup()
+{
+ ULONG nLast = aCtn.Count();
+ for (ULONG nAction = 0; nAction < nLast; nAction++)
+ {
+ delete (SdUndoAction*) aCtn.GetObject(nAction);
+ }
+ aCtn.Clear();
+}
+
+/*************************************************************************
+|*
+|* Merge
+|*
+\************************************************************************/
+
+BOOL SdUndoGroup::Merge( SfxUndoAction* pNextAction )
+{
+ BOOL bRet = FALSE;
+
+ if( pNextAction && pNextAction->ISA( SdUndoAction ) )
+ {
+ SdUndoAction* pClone = static_cast< SdUndoAction* >( pNextAction )->Clone();
+
+ if( pClone )
+ {
+ AddAction( pClone );
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* Undo, umgekehrte Reihenfolge der Ausfuehrung
+|*
+\************************************************************************/
+
+void SdUndoGroup::Undo()
+{
+ long nLast = aCtn.Count();
+ for (long nAction = nLast - 1; nAction >= 0; nAction--)
+ {
+ ((SdUndoAction*)aCtn.GetObject((ULONG)nAction))->Undo();
+ }
+
+}
+
+/*************************************************************************
+|*
+|* Redo
+|*
+\************************************************************************/
+
+void SdUndoGroup::Redo()
+{
+ ULONG nLast = aCtn.Count();
+ for (ULONG nAction = 0; nAction < nLast; nAction++)
+ {
+ ((SdUndoAction*)aCtn.GetObject(nAction))->Redo();
+ }
+
+}
+
+/*************************************************************************
+|*
+|* eine Aktion hinzufuegen
+|*
+\************************************************************************/
+
+void SdUndoGroup::AddAction(SdUndoAction* pAction)
+{
+ aCtn.Insert(pAction, CONTAINER_APPEND);
+}
diff --git a/sd/source/ui/func/smarttag.cxx b/sd/source/ui/func/smarttag.cxx
new file mode 100755
index 000000000000..a8b6c0647237
--- /dev/null
+++ b/sd/source/ui/func/smarttag.cxx
@@ -0,0 +1,479 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "ViewShell.hxx"
+#include "smarttag.hxx"
+#include "Window.hxx"
+#include "View.hxx"
+
+namespace sd
+{
+
+// ====================================================================
+
+SmartTag::SmartTag( ::sd::View& rView )
+: mrView( rView )
+, mbSelected( false )
+{
+ SmartTagReference xThis( this );
+ mrView.getSmartTags().add( xThis );
+}
+
+// --------------------------------------------------------------------
+
+SmartTag::~SmartTag()
+{
+}
+
+// --------------------------------------------------------------------
+
+bool SmartTag::MouseButtonDown( const MouseEvent&, SmartHdl& )
+{
+ return false;
+}
+
+/** returns true if the SmartTag consumes this event. */
+bool SmartTag::KeyInput( const KeyEvent& /*rKEvt*/ )
+{
+ return false;
+}
+
+/** returns true if the SmartTag consumes this event. */
+bool SmartTag::RequestHelp( const HelpEvent& /*rHEvt*/ )
+{
+ return false;
+}
+
+/** returns true if the SmartTag consumes this event. */
+bool SmartTag::Command( const CommandEvent& /*rCEvt*/ )
+{
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+void SmartTag::addCustomHandles( SdrHdlList& /*rHandlerList*/ )
+{
+}
+
+// --------------------------------------------------------------------
+
+void SmartTag::select()
+{
+ mbSelected = true;
+}
+
+// --------------------------------------------------------------------
+
+void SmartTag::deselect()
+{
+ mbSelected = false;
+}
+
+// --------------------------------------------------------------------
+
+bool SmartTag::isSelected() const
+{
+ return mbSelected;
+}
+
+// --------------------------------------------------------------------
+
+void SmartTag::disposing()
+{
+ SmartTagReference xThis( this );
+ mrView.getSmartTags().remove( xThis );
+}
+
+// --------------------------------------------------------------------
+
+bool SmartTag::getContext( SdrViewContext& /*rContext*/ )
+{
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+ULONG SmartTag::GetMarkablePointCount() const
+{
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+ULONG SmartTag::GetMarkedPointCount() const
+{
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+BOOL SmartTag::MarkPoint(SdrHdl& /*rHdl*/, BOOL /*bUnmark*/ )
+{
+ return FALSE;
+}
+
+// --------------------------------------------------------------------
+
+BOOL SmartTag::MarkPoints(const Rectangle* /*pRect*/, BOOL /*bUnmark*/ )
+{
+ return FALSE;
+}
+
+// --------------------------------------------------------------------
+
+void SmartTag::CheckPossibilities()
+{
+}
+
+// ====================================================================
+
+SmartTagSet::SmartTagSet( View& rView )
+: mrView( rView )
+{
+}
+
+// --------------------------------------------------------------------
+
+SmartTagSet::~SmartTagSet()
+{
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::add( const SmartTagReference& xTag )
+{
+ maSet.insert( xTag );
+ mrView.InvalidateAllWin();
+
+ if( xTag == mxMouseOverTag )
+ mxMouseOverTag.clear();
+
+ if( xTag == mxSelectedTag )
+ mxSelectedTag.clear();
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::remove( const SmartTagReference& xTag )
+{
+ std::set< SmartTagReference >::iterator aIter( maSet.find( xTag ) );
+ if( aIter != maSet.end() )
+ maSet.erase( aIter );
+ mrView.InvalidateAllWin();
+
+ if( xTag == mxMouseOverTag )
+ mxMouseOverTag.clear();
+
+ if( xTag == mxSelectedTag )
+ mxSelectedTag.clear();
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::Dispose()
+{
+ std::set< SmartTagReference > aSet;
+ aSet.swap( maSet );
+ for( std::set< SmartTagReference >::iterator aIter( aSet.begin() ); aIter != aSet.end(); )
+ (*aIter++)->Dispose();
+ mrView.InvalidateAllWin();
+ mxMouseOverTag.clear();
+ mxSelectedTag.clear();
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::select( const SmartTagReference& xTag )
+{
+ if( mxSelectedTag != xTag )
+ {
+ if( mxSelectedTag.is() )
+ mxSelectedTag->deselect();
+
+ mxSelectedTag = xTag;
+ mxSelectedTag->select();
+ mrView.SetPossibilitiesDirty();
+ if( mrView.GetMarkedObjectCount() > 0 )
+ mrView.UnmarkAllObj();
+ else
+ mrView.updateHandles();
+ }
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::deselect()
+{
+ if( mxSelectedTag.is() )
+ {
+ mxSelectedTag->deselect();
+ mxSelectedTag.clear();
+ mrView.SetPossibilitiesDirty();
+ mrView.updateHandles();
+ }
+}
+
+// --------------------------------------------------------------------
+
+bool SmartTagSet::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ Point aMDPos( mrView.GetViewShell()->GetActiveWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
+ SdrHdl* pHdl = mrView.PickHandle(aMDPos);
+
+ // check if a smart tag is selected and no handle is hit
+ if( mxSelectedTag.is() && !pHdl )
+ {
+ // deselect smart tag
+ deselect();
+ return false;
+ }
+
+ // if a smart tag handle is hit, foreward event to its smart tag
+ SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( pHdl );
+ if(pSmartHdl && pSmartHdl->getTag().is() )
+ {
+ SmartTagReference xTag( pSmartHdl->getTag() );
+ return xTag->MouseButtonDown( rMEvt, *pSmartHdl );
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+bool SmartTagSet::KeyInput( const KeyEvent& rKEvt )
+{
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->KeyInput( rKEvt );
+ else if( rKEvt.GetKeyCode().GetCode() == KEY_SPACE )
+ {
+ SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( mrView.GetHdlList().GetFocusHdl() );
+ if( pSmartHdl )
+ {
+ const_cast< SdrHdlList& >( mrView.GetHdlList() ).ResetFocusHdl();
+ SmartTagReference xTag( pSmartHdl->getTag() );
+ select( xTag );
+ return true;
+ }
+ }
+
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+bool SmartTagSet::RequestHelp( const HelpEvent& rHEvt )
+{
+ Point aMDPos( mrView.GetViewShell()->GetActiveWindow()->PixelToLogic( rHEvt.GetMousePosPixel() ) );
+ SdrHdl* pHdl = mrView.PickHandle(aMDPos);
+
+ if( pHdl )
+ {
+ // if a smart tag handle is hit, foreward event to its smart tag
+ SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( pHdl );
+ if(pSmartHdl && pSmartHdl->getTag().is() )
+ {
+ SmartTagReference xTag( pSmartHdl->getTag() );
+ return xTag->RequestHelp( rHEvt );
+ }
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+/** returns true if the SmartTag consumes this event. */
+bool SmartTagSet::Command( const CommandEvent& rCEvt )
+{
+ if( rCEvt.IsMouseEvent() )
+ {
+ Point aMDPos( mrView.GetViewShell()->GetActiveWindow()->PixelToLogic( rCEvt.GetMousePosPixel() ) );
+ SdrHdl* pHdl = mrView.PickHandle(aMDPos);
+
+ if( pHdl )
+ {
+ // if a smart tag handle is hit, foreward event to its smart tag
+ SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( pHdl );
+ if(pSmartHdl && pSmartHdl->getTag().is() )
+ {
+ SmartTagReference xTag( pSmartHdl->getTag() );
+ return xTag->Command( rCEvt );
+ }
+ }
+ }
+ else
+ {
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->Command( rCEvt );
+
+ }
+
+ return false;
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::addCustomHandles( SdrHdlList& rHandlerList )
+{
+ if( !maSet.empty() )
+ {
+ for( std::set< SmartTagReference >::iterator aIter( maSet.begin() ); aIter != maSet.end(); )
+ (*aIter++)->addCustomHandles( rHandlerList );
+ }
+}
+
+// --------------------------------------------------------------------
+
+/** returns true if the currently selected smart tag has
+ a special context, returned in rContext. */
+bool SmartTagSet::getContext( SdrViewContext& rContext ) const
+{
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->getContext( rContext );
+ else
+ return false;
+}
+
+// --------------------------------------------------------------------
+// support point editing
+// --------------------------------------------------------------------
+
+BOOL SmartTagSet::HasMarkablePoints() const
+{
+ return GetMarkablePointCount() != 0 ? TRUE : FALSE;
+}
+
+// --------------------------------------------------------------------
+
+ULONG SmartTagSet::GetMarkablePointCount() const
+{
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->GetMarkablePointCount();
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+BOOL SmartTagSet::HasMarkedPoints() const
+{
+ return GetMarkedPointCount() != 0 ? TRUE : FALSE;
+}
+
+// --------------------------------------------------------------------
+
+ULONG SmartTagSet::GetMarkedPointCount() const
+{
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->GetMarkedPointCount();
+ else
+ return 0;
+}
+
+// --------------------------------------------------------------------
+
+BOOL SmartTagSet::IsPointMarkable(const SdrHdl& rHdl) const
+{
+ const SmartHdl* pSmartHdl = dynamic_cast< const SmartHdl* >( &rHdl );
+
+ return pSmartHdl && pSmartHdl->isMarkable();
+}
+
+// --------------------------------------------------------------------
+
+BOOL SmartTagSet::MarkPoint(SdrHdl& rHdl, BOOL bUnmark )
+{
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->MarkPoint( rHdl, bUnmark );
+
+ return FALSE;
+}
+
+// --------------------------------------------------------------------
+
+BOOL SmartTagSet::MarkPoints(const Rectangle* pRect, BOOL bUnmark)
+{
+ if( mxSelectedTag.is() )
+ return mxSelectedTag->MarkPoints( pRect, bUnmark );
+ return FALSE;
+}
+
+// --------------------------------------------------------------------
+
+void SmartTagSet::CheckPossibilities()
+{
+ if( mxSelectedTag.is() )
+ mxSelectedTag->CheckPossibilities();
+}
+
+// ====================================================================
+
+SmartHdl::SmartHdl( const SmartTagReference& xTag, SdrObject* pObject, const Point& rPnt, SdrHdlKind eNewKind /*=HDL_MOVE*/ )
+: SdrHdl( rPnt, eNewKind )
+, mxTag( xTag )
+{
+ SetObj( pObject );
+}
+
+// --------------------------------------------------------------------
+
+SmartHdl::SmartHdl( const SmartTagReference& xTag, const Point& rPnt, SdrHdlKind eNewKind /*=HDL_MOVE*/ )
+: SdrHdl( rPnt, eNewKind )
+, mxTag( xTag )
+{
+}
+
+// --------------------------------------------------------------------
+
+bool SmartHdl::isMarkable() const
+{
+ return false;
+}
+
+// ====================================================================
+
+/*
+SmartProxyHdl::SmartProxyHdl( const SmartTagReference& xTag, SdrHdl* pProxyHdl )
+: SmartHdl( xTag, pProxyHdl->GetPos(), pProxyHdl->GetKind() )
+, mpProxyHdl( pProxyHdl )
+{
+}
+
+// --------------------------------------------------------------------
+
+SmartProxyHdl::~SmartProxyHdl()
+{
+ delete mpProxyHdl;
+}
+*/
+} // end of namespace sd
+
diff --git a/sd/source/ui/func/undoback.cxx b/sd/source/ui/func/undoback.cxx
new file mode 100644
index 000000000000..7f0245c50cda
--- /dev/null
+++ b/sd/source/ui/func/undoback.cxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "undoback.hxx"
+#include "sdpage.hxx"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include <svl/itemset.hxx>
+
+// ---------------------------
+// - BackgroundObjUndoAction -
+// ---------------------------
+
+TYPEINIT1( SdBackgroundObjUndoAction, SdUndoAction );
+
+// -----------------------------------------------------------------------------
+
+SdBackgroundObjUndoAction::SdBackgroundObjUndoAction(
+ SdDrawDocument& rDoc,
+ SdPage& rPage,
+ const SfxItemSet& rItenSet)
+: SdUndoAction(&rDoc),
+ mrPage(rPage),
+ mpItemSet(new SfxItemSet(rItenSet))
+{
+ String aString( SdResId( STR_UNDO_CHANGE_PAGEFORMAT ) );
+ SetComment( aString );
+}
+
+// -----------------------------------------------------------------------------
+
+SdBackgroundObjUndoAction::~SdBackgroundObjUndoAction()
+{
+ delete mpItemSet;
+}
+
+// -----------------------------------------------------------------------------
+
+void SdBackgroundObjUndoAction::ImplRestoreBackgroundObj()
+{
+ SfxItemSet* pNew = new SfxItemSet(mrPage.getSdrPageProperties().GetItemSet());
+ mrPage.getSdrPageProperties().ClearItem();
+ mrPage.getSdrPageProperties().PutItemSet(*mpItemSet);
+ delete mpItemSet;
+ mpItemSet = pNew;
+
+ // #110094#-15
+ // tell the page that it's visualization has changed
+ mrPage.ActionChanged();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdBackgroundObjUndoAction::Undo()
+{
+ ImplRestoreBackgroundObj();
+}
+
+// -----------------------------------------------------------------------------
+
+void SdBackgroundObjUndoAction::Redo()
+{
+ ImplRestoreBackgroundObj();
+}
+
+// -----------------------------------------------------------------------------
+
+SdUndoAction* SdBackgroundObjUndoAction::Clone() const
+{
+ return new SdBackgroundObjUndoAction(*mpDoc, mrPage, *mpItemSet);
+}
diff --git a/sd/source/ui/func/undoheaderfooter.cxx b/sd/source/ui/func/undoheaderfooter.cxx
new file mode 100644
index 000000000000..778bd3056027
--- /dev/null
+++ b/sd/source/ui/func/undoheaderfooter.cxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include "app.hrc"
+#include "DrawViewShell.hxx"
+#include "drawview.hxx"
+#include "undoheaderfooter.hxx"
+
+TYPEINIT1(SdHeaderFooterUndoAction, SdUndoAction);
+
+SdHeaderFooterUndoAction::SdHeaderFooterUndoAction( SdDrawDocument* pDoc, SdPage* pPage, const sd::HeaderFooterSettings& rNewSettings )
+: SdUndoAction(pDoc),
+ mpPage(pPage),
+ maOldSettings(pPage->getHeaderFooterSettings()),
+ maNewSettings(rNewSettings)
+{
+}
+
+SdHeaderFooterUndoAction::~SdHeaderFooterUndoAction()
+{
+}
+
+void SdHeaderFooterUndoAction::Undo()
+{
+ mpPage->setHeaderFooterSettings( maOldSettings );
+ SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SWITCHPAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+}
+
+void SdHeaderFooterUndoAction::Redo()
+{
+ mpPage->setHeaderFooterSettings( maNewSettings );
+ SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SWITCHPAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
+}
+
diff --git a/sd/source/ui/func/undolayer.cxx b/sd/source/ui/func/undolayer.cxx
new file mode 100644
index 000000000000..4739ae9b5c16
--- /dev/null
+++ b/sd/source/ui/func/undolayer.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "undolayer.hxx"
+
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "DrawViewShell.hxx"
+#include "strings.hrc"
+#include "sdresid.hxx"
+
+TYPEINIT1(SdLayerModifyUndoAction, SdUndoAction);
+
+SdLayerModifyUndoAction::SdLayerModifyUndoAction(
+ SdDrawDocument* _pDoc, SdrLayer* pLayer,
+ const String& rOldLayerName, const String& rOldLayerTitle, const String& rOldLayerDesc, bool bOldIsVisible, bool bOldIsLocked, bool bOldIsPrintable,
+ const String& rNewLayerName, const String& rNewLayerTitle, const String& rNewLayerDesc, bool bNewIsVisible, bool bNewIsLocked, bool bNewIsPrintable )
+: SdUndoAction( _pDoc ),
+ mpLayer( pLayer ),
+ maOldLayerName( rOldLayerName ),
+ maOldLayerTitle( rOldLayerTitle ),
+ maOldLayerDesc( rOldLayerDesc ),
+ mbOldIsVisible( bOldIsVisible ),
+ mbOldIsLocked( bOldIsLocked ),
+ mbOldIsPrintable( bOldIsPrintable ),
+ maNewLayerName( rNewLayerName ),
+ maNewLayerTitle( rNewLayerTitle ),
+ maNewLayerDesc( rNewLayerDesc ),
+ mbNewIsVisible( bNewIsVisible ),
+ mbNewIsLocked( bNewIsLocked ),
+ mbNewIsPrintable( bNewIsPrintable )
+{
+ String aString(SdResId(STR_MODIFYLAYER));
+ SetComment(aString);
+}
+
+void SdLayerModifyUndoAction::Undo()
+{
+ ::sd::DrawDocShell* mpDocSh = mpDoc->GetDocSh();
+ if( mpDocSh )
+ {
+ ::sd::DrawViewShell* pDrViewSh =
+ PTR_CAST(::sd::DrawViewShell, mpDocSh->GetViewShell() );
+ if( pDrViewSh )
+ {
+ pDrViewSh->ModifyLayer( mpLayer, maOldLayerName, maOldLayerTitle, maOldLayerDesc, mbOldIsVisible, mbOldIsLocked, mbOldIsPrintable );
+ }
+ }
+}
+
+void SdLayerModifyUndoAction::Redo()
+{
+ ::sd::DrawDocShell* mpDocSh = mpDoc->GetDocSh();
+ if( mpDocSh )
+ {
+ ::sd::DrawViewShell* pDrViewSh =
+ PTR_CAST(::sd::DrawViewShell, mpDocSh->GetViewShell() );
+ if( pDrViewSh )
+ {
+ pDrViewSh->ModifyLayer( mpLayer, maNewLayerName, maNewLayerTitle, maNewLayerDesc, mbNewIsVisible, mbNewIsLocked, mbNewIsPrintable );
+ }
+ }
+}
diff --git a/sd/source/ui/func/undopage.cxx b/sd/source/ui/func/undopage.cxx
new file mode 100644
index 000000000000..2da4d6260834
--- /dev/null
+++ b/sd/source/ui/func/undopage.cxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "undopage.hxx"
+
+#include <svx/svxids.hrc>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include "sdpage.hxx"
+#include "DrawViewShell.hxx"
+#include "drawview.hxx"
+#include <svx/svdpagv.hxx>
+
+
+
+TYPEINIT1(SdPageFormatUndoAction, SdUndoAction);
+TYPEINIT1(SdPageLRUndoAction, SdUndoAction);
+TYPEINIT1(SdPageULUndoAction, SdUndoAction);
+
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+SdPageFormatUndoAction::~SdPageFormatUndoAction()
+{
+}
+
+/*************************************************************************
+|*
+|* Undo()
+|*
+\************************************************************************/
+
+void SdPageFormatUndoAction::Undo()
+{
+ Rectangle aOldBorderRect(mnOldLeft, mnOldUpper, mnOldRight, mnOldLower);
+ mpPage->ScaleObjects(maOldSize, aOldBorderRect, mbNewScale);
+ mpPage->SetSize(maOldSize);
+ mpPage->SetLftBorder(mnOldLeft);
+ mpPage->SetRgtBorder(mnOldRight);
+ mpPage->SetUppBorder(mnOldUpper);
+ mpPage->SetLwrBorder(mnOldLower);
+ mpPage->SetOrientation(meOldOrientation);
+ mpPage->SetPaperBin( mnOldPaperBin );
+
+ mpPage->SetBackgroundFullSize( mbOldFullSize );
+ if( !mpPage->IsMasterPage() )
+ ( (SdPage&) mpPage->TRG_GetMasterPage() ).SetBackgroundFullSize( mbOldFullSize );
+
+}
+
+void SdPageFormatUndoAction::Redo()
+{
+ Rectangle aNewBorderRect(mnNewLeft, mnNewUpper, mnNewRight, mnNewLower);
+ mpPage->ScaleObjects(maNewSize, aNewBorderRect, mbNewScale);
+ mpPage->SetSize(maNewSize);
+ mpPage->SetLftBorder(mnNewLeft);
+ mpPage->SetRgtBorder(mnNewRight);
+ mpPage->SetUppBorder(mnNewUpper);
+ mpPage->SetLwrBorder(mnNewLower);
+ mpPage->SetOrientation(meNewOrientation);
+ mpPage->SetPaperBin( mnNewPaperBin );
+
+ mpPage->SetBackgroundFullSize( mbNewFullSize );
+ if( !mpPage->IsMasterPage() )
+ ( (SdPage&) mpPage->TRG_GetMasterPage() ).SetBackgroundFullSize( mbNewFullSize );
+
+}
+
+SdPageLRUndoAction::~SdPageLRUndoAction()
+{
+}
+
+void SdPageLRUndoAction::Undo()
+{
+ mpPage->SetLftBorder(mnOldLeft);
+ mpPage->SetRgtBorder(mnOldRight);
+}
+
+void SdPageLRUndoAction::Redo()
+{
+ mpPage->SetLftBorder(mnNewLeft);
+ mpPage->SetRgtBorder(mnNewRight);
+}
+
+SdPageULUndoAction::~SdPageULUndoAction()
+{
+}
+
+void SdPageULUndoAction::Undo()
+{
+ mpPage->SetUppBorder(mnOldUpper);
+ mpPage->SetLwrBorder(mnOldLower);
+}
+
+/*************************************************************************
+|*
+|* UL-Redo()
+|*
+\************************************************************************/
+
+void SdPageULUndoAction::Redo()
+{
+ mpPage->SetUppBorder(mnNewUpper);
+ mpPage->SetLwrBorder(mnNewLower);
+}
+
diff --git a/sd/source/ui/func/unmovss.cxx b/sd/source/ui/func/unmovss.cxx
new file mode 100644
index 000000000000..2ccaa4da19cb
--- /dev/null
+++ b/sd/source/ui/func/unmovss.cxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+#include "unmovss.hxx"
+#include "DrawDocShell.hxx"
+#include "drawdoc.hxx"
+#include "stlsheet.hxx"
+#include "stlpool.hxx"
+
+SdMoveStyleSheetsUndoAction::SdMoveStyleSheetsUndoAction( SdDrawDocument* pTheDoc, SdStyleSheetVector& rTheStyles, bool bInserted)
+: SdUndoAction(pTheDoc)
+, mbMySheets( !bInserted )
+{
+ maStyles.swap( rTheStyles );
+
+ maListOfChildLists.resize( maStyles.size() );
+ // Liste mit den Listen der StyleSheet-Kinder erstellen
+ std::size_t i = 0;
+ for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); iter++ )
+ {
+ maListOfChildLists[i++] = SdStyleSheetPool::CreateChildList( (*iter).get() );
+ }
+}
+
+/*************************************************************************
+|*
+|* Undo()
+|*
+\************************************************************************/
+
+void SdMoveStyleSheetsUndoAction::Undo()
+{
+ SfxStyleSheetBasePool* pPool = mpDoc->GetStyleSheetPool();
+
+ if (mbMySheets)
+ {
+ // the styles have to be inserted in the pool
+
+ // first insert all styles to the pool
+ for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); iter++ )
+ {
+ pPool->Insert((*iter).get());
+ }
+
+ // now assign the childs again
+ std::vector< SdStyleSheetVector >::iterator childlistiter( maListOfChildLists.begin() );
+ for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); iter++, childlistiter++ )
+ {
+ String aParent((*iter)->GetName());
+ for( SdStyleSheetVector::iterator childiter = (*childlistiter).begin(); childiter != (*childlistiter).end(); childiter++ )
+ {
+ (*childiter)->SetParent(aParent);
+ }
+ }
+ }
+ else
+ {
+ // remove the styles again from the pool
+ for(SdStyleSheetVector::iterator iter = maStyles.begin(); iter != maStyles.end(); iter++ )
+ {
+ pPool->Remove((*iter).get());
+ }
+ }
+ mbMySheets = !mbMySheets;
+}
+
+void SdMoveStyleSheetsUndoAction::Redo()
+{
+ Undo();
+}
+
+SdMoveStyleSheetsUndoAction::~SdMoveStyleSheetsUndoAction()
+{
+}
+
+String SdMoveStyleSheetsUndoAction::GetComment() const
+{
+ return String();
+}
+
+
diff --git a/sd/source/ui/func/unoaprms.cxx b/sd/source/ui/func/unoaprms.cxx
new file mode 100755
index 000000000000..933e961ed927
--- /dev/null
+++ b/sd/source/ui/func/unoaprms.cxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "drawdoc.hxx"
+#include "unoaprms.hxx"
+#include "anminfo.hxx"
+
+
+TYPEINIT1(SdAnimationPrmsUndoAction, SdUndoAction);
+
+
+/*************************************************************************
+|*
+|* Undo()
+|*
+\************************************************************************/
+
+void SdAnimationPrmsUndoAction::Undo()
+{
+ // keine neu Info erzeugt: Daten restaurieren
+ if (!bInfoCreated)
+ {
+ SdDrawDocument* pDoc = (SdDrawDocument*)pObject->GetModel();
+ if( pDoc )
+ {
+ SdAnimationInfo* pInfo = pDoc->GetAnimationInfo( pObject );
+ // So nicht...
+ //SdAnimationInfo* pInfo = (SdAnimationInfo*)pObject->GetUserData(0);
+ pInfo->mbActive = bOldActive;
+ pInfo->meEffect = eOldEffect;
+ pInfo->meTextEffect = eOldTextEffect;
+ pInfo->meSpeed = eOldSpeed;
+ pInfo->mbDimPrevious = bOldDimPrevious;
+ pInfo->maDimColor = aOldDimColor;
+ pInfo->mbDimHide = bOldDimHide;
+ pInfo->mbSoundOn = bOldSoundOn;
+ pInfo->maSoundFile = aOldSoundFile;
+ pInfo->mbPlayFull = bOldPlayFull;
+// pInfo->mSetPath(pOldPathObj);
+ pInfo->meClickAction = eOldClickAction;
+ pInfo->SetBookmark( aOldBookmark );
+// pInfo->mbInvisibleInPresentation = bOldInvisibleInPres;
+ pInfo->mnVerb = nOldVerb;
+ pInfo->mnPresOrder = nOldPresOrder;
+
+ pInfo->meSecondEffect = eOldSecondEffect;
+ pInfo->meSecondSpeed = eOldSecondSpeed;
+ pInfo->mbSecondSoundOn = bOldSecondSoundOn;
+ pInfo->mbSecondPlayFull = bOldSecondPlayFull;
+ }
+ }
+ // Info wurde durch Aktion erzeugt: Info loeschen
+ else
+ {
+ pObject->DeleteUserData(0);
+ }
+ // Damit ein ModelHasChanged() ausgeloest wird, um das Effekte-Window
+ // auf Stand zu bringen (Animations-Reihenfolge)
+ pObject->SetChanged();
+ pObject->BroadcastObjectChange();
+}
+
+/*************************************************************************
+|*
+|* Redo()
+|*
+\************************************************************************/
+
+void SdAnimationPrmsUndoAction::Redo()
+{
+ SdAnimationInfo* pInfo = NULL;
+
+ pInfo = SdDrawDocument::GetShapeUserData(*pObject,true);
+
+ pInfo->mbActive = bNewActive;
+ pInfo->meEffect = eNewEffect;
+ pInfo->meTextEffect = eNewTextEffect;
+ pInfo->meSpeed = eNewSpeed;
+ pInfo->mbDimPrevious = bNewDimPrevious;
+ pInfo->maDimColor = aNewDimColor;
+ pInfo->mbDimHide = bNewDimHide;
+ pInfo->mbSoundOn = bNewSoundOn;
+ pInfo->maSoundFile = aNewSoundFile;
+ pInfo->mbPlayFull = bNewPlayFull;
+// pInfo->mSetPath(pNewPathObj);
+ pInfo->meClickAction = eNewClickAction;
+ pInfo->SetBookmark( aNewBookmark );
+// pInfo->mbInvisibleInPresentation = bNewInvisibleInPres;
+ pInfo->mnVerb = nNewVerb;
+ pInfo->mnPresOrder = nNewPresOrder;
+
+ pInfo->meSecondEffect = eNewSecondEffect;
+ pInfo->meSecondSpeed = eNewSecondSpeed;
+ pInfo->mbSecondSoundOn = bNewSecondSoundOn;
+ pInfo->mbSecondPlayFull = bNewSecondPlayFull;
+
+ // Damit ein ModelHasChanged() ausgeloest wird, um das Effekte-Window
+ // auf Stand zu bringen (Animations-Reihenfolge)
+ pObject->SetChanged();
+ pObject->BroadcastObjectChange();
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+SdAnimationPrmsUndoAction::~SdAnimationPrmsUndoAction()
+{
+}
+
+
diff --git a/sd/source/ui/func/unprlout.cxx b/sd/source/ui/func/unprlout.cxx
new file mode 100644
index 000000000000..ec0b223cf6a8
--- /dev/null
+++ b/sd/source/ui/func/unprlout.cxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sd.hxx"
+
+
+#include "unprlout.hxx"
+
+#include "strings.hrc"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "sdresid.hxx"
+
+
+TYPEINIT1(SdPresentationLayoutUndoAction, SdUndoAction);
+
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+SdPresentationLayoutUndoAction::SdPresentationLayoutUndoAction(
+ SdDrawDocument* pTheDoc,
+ String aTheOldLayoutName,
+ String aTheNewLayoutName,
+ AutoLayout eTheOldAutoLayout,
+ AutoLayout eTheNewAutoLayout,
+ BOOL bSet,
+ SdPage* pThePage):
+ SdUndoAction(pTheDoc)
+{
+ aOldLayoutName = aTheOldLayoutName;
+ aNewLayoutName = aTheNewLayoutName;
+ eOldAutoLayout = eTheOldAutoLayout;
+ eNewAutoLayout = eTheNewAutoLayout;
+ bSetAutoLayout = bSet;
+
+ DBG_ASSERT(pThePage, "keine Page gesetzt!");
+ pPage = pThePage;
+ aComment = String(SdResId(STR_UNDO_SET_PRESLAYOUT));
+}
+
+/*************************************************************************
+|*
+|* Undo()
+|*
+\************************************************************************/
+
+void SdPresentationLayoutUndoAction::Undo()
+{
+ pPage->SetPresentationLayout(aOldLayoutName, TRUE, TRUE, TRUE);
+ if (bSetAutoLayout)
+ pPage->SetAutoLayout(eOldAutoLayout, TRUE);
+}
+
+/*************************************************************************
+|*
+|* Redo()
+|*
+\************************************************************************/
+
+void SdPresentationLayoutUndoAction::Redo()
+{
+ pPage->SetPresentationLayout(aNewLayoutName);
+ if (bSetAutoLayout)
+ pPage->SetAutoLayout(eNewAutoLayout, TRUE);
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+SdPresentationLayoutUndoAction::~SdPresentationLayoutUndoAction()
+{
+}
+
+/*************************************************************************
+|*
+|* Kommentar liefern
+|*
+\************************************************************************/
+
+String SdPresentationLayoutUndoAction::GetComment() const
+{
+ return aComment;
+}
+
+
+