diff options
Diffstat (limited to 'sw/source/ui/ribbar')
-rw-r--r-- | sw/source/ui/ribbar/conarc.cxx | 161 | ||||
-rw-r--r-- | sw/source/ui/ribbar/concustomshape.cxx | 252 | ||||
-rw-r--r-- | sw/source/ui/ribbar/conform.cxx | 144 | ||||
-rw-r--r-- | sw/source/ui/ribbar/conpoly.cxx | 163 | ||||
-rw-r--r-- | sw/source/ui/ribbar/conrect.cxx | 229 | ||||
-rw-r--r-- | sw/source/ui/ribbar/drawbase.cxx | 737 | ||||
-rw-r--r-- | sw/source/ui/ribbar/dselect.cxx | 102 | ||||
-rw-r--r-- | sw/source/ui/ribbar/inputwin.cxx | 685 | ||||
-rw-r--r-- | sw/source/ui/ribbar/inputwin.hrc | 84 | ||||
-rw-r--r-- | sw/source/ui/ribbar/inputwin.src | 345 | ||||
-rw-r--r-- | sw/source/ui/ribbar/makefile.mk | 71 | ||||
-rw-r--r-- | sw/source/ui/ribbar/tblctrl.cxx | 93 | ||||
-rw-r--r-- | sw/source/ui/ribbar/tblctrl.hrc | 35 | ||||
-rw-r--r-- | sw/source/ui/ribbar/tblctrl.src | 94 | ||||
-rw-r--r-- | sw/source/ui/ribbar/tbxanchr.cxx | 166 | ||||
-rw-r--r-- | sw/source/ui/ribbar/tbxanchr.src | 107 | ||||
-rw-r--r-- | sw/source/ui/ribbar/workctrl.cxx | 943 | ||||
-rw-r--r-- | sw/source/ui/ribbar/workctrl.hrc | 88 | ||||
-rw-r--r-- | sw/source/ui/ribbar/workctrl.src | 596 |
19 files changed, 5095 insertions, 0 deletions
diff --git a/sw/source/ui/ribbar/conarc.cxx b/sw/source/ui/ribbar/conarc.cxx new file mode 100644 index 000000000000..4b2fafbd6040 --- /dev/null +++ b/sw/source/ui/ribbar/conarc.cxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * 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_sw.hxx" + + +#include <svx/svdobj.hxx> + + +#include "view.hxx" +#include "edtwin.hxx" +#include "wrtsh.hxx" +#include "drawbase.hxx" +#include "conarc.hxx" + + + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + + + +ConstArc::ConstArc(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) + : SwDrawBase(pWrtShell, pEditWin, pSwView), nAnzButUp(0) +{ +} + +/************************************************************************* +|* +|* MouseButtonDown-event +|* +\************************************************************************/ + + + +BOOL ConstArc::MouseButtonDown( const MouseEvent& rMEvt ) +{ + BOOL bReturn; + + if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == TRUE) + { + if (!nAnzButUp) + aStartPnt = m_pWin->PixelToLogic(rMEvt.GetPosPixel()); + } + return (bReturn); +} + +/************************************************************************* +|* +|* MouseButtonUp-event +|* +\************************************************************************/ + + + +BOOL ConstArc::MouseButtonUp( const MouseEvent& rMEvt ) +{ + BOOL bReturn = FALSE; + + if ((m_pSh->IsDrawCreate() || m_pWin->IsDrawAction()) && rMEvt.IsLeft()) + { + Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel())); + if (!nAnzButUp && aPnt == aStartPnt) + { + SwDrawBase::MouseButtonUp(rMEvt); + bReturn = TRUE; + } + else + { nAnzButUp++; + + if (nAnzButUp == 3) // Kreisbogenerzeugung beendet + { + SwDrawBase::MouseButtonUp(rMEvt); + nAnzButUp = 0; + bReturn = TRUE; + } + else + m_pSh->EndCreate(SDRCREATE_NEXTPOINT); + } + } +/* else if ( pView->IsCreateObj() && rMEvt.IsRight() ) + { + pView->EndCreateObj( SDRCREATE_FORCEEND ); + bReturn = TRUE; + }*/ + + return (bReturn); +} + +/************************************************************************* +|* +|* Function aktivieren +|* +\************************************************************************/ + + + +void ConstArc::Activate(const USHORT nSlotId) +{ + switch (nSlotId) + { + case SID_DRAW_ARC: + m_pWin->SetSdrDrawMode(OBJ_CARC); + break; + case SID_DRAW_PIE: + m_pWin->SetSdrDrawMode(OBJ_SECT); + break; + case SID_DRAW_CIRCLECUT: + m_pWin->SetSdrDrawMode(OBJ_CCUT); + break; + default: + m_pWin->SetSdrDrawMode(OBJ_NONE); + break; + } + + SwDrawBase::Activate(nSlotId); +} + +/************************************************************************* +|* +|* Funktion deaktivieren +|* +\************************************************************************/ + +void ConstArc::Deactivate() +{ + nAnzButUp = 0; + + SwDrawBase::Deactivate(); +} + + + diff --git a/sw/source/ui/ribbar/concustomshape.cxx b/sw/source/ui/ribbar/concustomshape.cxx new file mode 100644 index 000000000000..66ba929fae47 --- /dev/null +++ b/sw/source/ui/ribbar/concustomshape.cxx @@ -0,0 +1,252 @@ +/************************************************************************* + * + * 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_sw.hxx" + + +#include <sfx2/bindings.hxx> +#include <svx/htmlmode.hxx> +#include <svx/sdtacitm.hxx> +#include <svx/svdobj.hxx> +#include <svx/sdtagitm.hxx> +#include <svx/sdtakitm.hxx> +#include <svx/sdtaditm.hxx> +#include <svx/sdtaaitm.hxx> +#include <svx/svdview.hxx> +#include <svx/svdocapt.hxx> +#include <editeng/outlobj.hxx> +#ifndef _CMDID_H +#include <cmdid.h> +#endif +#ifndef _VIEW_HXX +#include <view.hxx> +#endif +#include <edtwin.hxx> +#include <wrtsh.hxx> +#include <viewopt.hxx> +#ifndef _DRAWBASE_HXX +#include <drawbase.hxx> +#endif +#include <concustomshape.hxx> +#include <svx/gallery.hxx> +#include <sfx2/request.hxx> +#ifndef _FM_FMMODEL_HXX +#include <svx/fmmodel.hxx> +#endif +#include <svl/itempool.hxx> +#include <svx/svdpage.hxx> +#include <svx/svdoashp.hxx> +#include <editeng/adjitem.hxx> + +#include <math.h> + +/************************************************************************* +|* +|* C'Tor +|* +\************************************************************************/ +ConstCustomShape::ConstCustomShape( SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView, SfxRequest& rReq ) + : SwDrawBase( pWrtShell, pEditWin, pSwView ) +{ + aCustomShape = ConstCustomShape::GetShapeTypeFromRequest( rReq ); +} + +/************************************************************************* +|* +\************************************************************************/ + +rtl::OUString ConstCustomShape::GetShapeType() const +{ + return aCustomShape; +} + +//static +rtl::OUString ConstCustomShape::GetShapeTypeFromRequest( SfxRequest& rReq ) +{ + rtl::OUString aRet; + const SfxItemSet* pArgs = rReq.GetArgs(); + if ( pArgs ) + { + const SfxStringItem& rItm = (const SfxStringItem&)pArgs->Get( rReq.GetSlot() ); + aRet = rItm.GetValue(); + } + return aRet; +} + +/************************************************************************* +|* +|* MouseButtonDown-event +|* +\************************************************************************/ + +BOOL ConstCustomShape::MouseButtonDown(const MouseEvent& rMEvt) +{ + BOOL bReturn = SwDrawBase::MouseButtonDown(rMEvt); + if ( bReturn ) + { + SdrView *pSdrView = m_pSh->GetDrawView(); + if ( pSdrView ) + { + SdrObject* pObj = pSdrView->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( m_pView->GetPool() ); + if ( bForceNoFillStyle ) + aAttr.Put( XFillStyleItem( XFILL_NONE ) ); + pObj->SetMergedItemSet(aAttr); + } + } + } + return bReturn; +} + +/************************************************************************* +|* +|* MouseButtonUp-event +|* +\************************************************************************/ + +BOOL ConstCustomShape::MouseButtonUp(const MouseEvent& rMEvt) +{ + return SwDrawBase::MouseButtonUp(rMEvt); +} + +/************************************************************************* +|* +|* activate function +|* +\************************************************************************/ + +void ConstCustomShape::Activate(const USHORT nSlotId) +{ + m_pWin->SetSdrDrawMode( OBJ_CUSTOMSHAPE ); + + SwDrawBase::Activate(nSlotId); +} + +/************************************************************************* +|* +|* applying attributes +|* +\************************************************************************/ + +void ConstCustomShape::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 SdrObject* pSourceObj = aFormModel.GetPage( 0 )->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; + } + } + break; + } + } + } + } + if ( !bAttributesAppliedFromGallery ) + { + pObj->SetMergedItem( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) ); + pObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) ); + pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) ); + pObj->SetMergedItem( SdrTextAutoGrowHeightItem( sal_False ) ); + ((SdrObjCustomShape*)pObj)->MergeDefaultAttributes( &aCustomShape ); + } +} + +void ConstCustomShape::CreateDefaultObject() +{ + SwDrawBase::CreateDefaultObject(); + SdrView *pSdrView = m_pSh->GetDrawView(); + if ( pSdrView ) + { + const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); + if ( rMarkList.GetMarkCount() == 1 ) + { + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + if ( pObj && pObj->ISA( SdrObjCustomShape ) ) + SetAttributes( pObj ); + } + } +} + +// #i33136# +bool ConstCustomShape::doConstructOrthogonal() const +{ + return SdrObjCustomShape::doConstructOrthogonal(aCustomShape); +} + +// eof diff --git a/sw/source/ui/ribbar/conform.cxx b/sw/source/ui/ribbar/conform.cxx new file mode 100644 index 000000000000..8682e1d34462 --- /dev/null +++ b/sw/source/ui/ribbar/conform.cxx @@ -0,0 +1,144 @@ +/************************************************************************* + * + * 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_sw.hxx" + + +#include <svx/fmglob.hxx> +#include <svx/svdview.hxx> +#include <svx/fmshell.hxx> + +#include "view.hxx" +#include "edtwin.hxx" +#include "wrtsh.hxx" +#include "drawbase.hxx" +#include "conform.hxx" + +extern BOOL bNoInterrupt; // in mainwn.cxx + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + + +ConstFormControl::ConstFormControl(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) : + SwDrawBase(pWrtShell, pEditWin, pSwView) +{ + m_bInsForm = TRUE; +} + +/************************************************************************* +|* +|* MouseButtonDown-event +|* +\************************************************************************/ + + +BOOL ConstFormControl::MouseButtonDown(const MouseEvent& rMEvt) +{ + BOOL bReturn = FALSE; + + SdrView *pSdrView = m_pSh->GetDrawView(); + + pSdrView->SetOrtho(rMEvt.IsShift()); + pSdrView->SetAngleSnapEnabled(rMEvt.IsShift()); + + if (rMEvt.IsMod2()) + { + pSdrView->SetCreate1stPointAsCenter(TRUE); + pSdrView->SetResizeAtCenter(TRUE); + } + else + { + pSdrView->SetCreate1stPointAsCenter(FALSE); + pSdrView->SetResizeAtCenter(FALSE); + } + + SdrViewEvent aVEvt; + SdrHitKind eHit = pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); + + // Nur neues Objekt, wenn nicht im Basismode (bzw reinem Selektionsmode) + if (rMEvt.IsLeft() && !m_pWin->IsDrawAction() && + (eHit == SDRHIT_UNMARKEDOBJECT || eHit == SDRHIT_NONE || m_pSh->IsDrawCreate())) + { + bNoInterrupt = TRUE; + m_pWin->CaptureMouse(); + + m_pWin->SetPointer(Pointer(POINTER_DRAW_RECT)); + + m_aStartPos = m_pWin->PixelToLogic(rMEvt.GetPosPixel()); + bReturn = m_pSh->BeginCreate( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()), FmFormInventor, m_aStartPos); + + if (bReturn) + m_pWin->SetDrawAction(TRUE); + } + else + bReturn = SwDrawBase::MouseButtonDown(rMEvt); + + return (bReturn); +} + +/************************************************************************* +|* +|* Function aktivieren +|* +\************************************************************************/ + + +void ConstFormControl::Activate(const USHORT nSlotId) +{ + m_pWin->SetSdrDrawMode( static_cast<SdrObjKind>(nSlotId) ); + SwDrawBase::Activate(nSlotId); + m_pSh->GetDrawView()->SetCurrentObj(nSlotId); + + m_pWin->SetPointer(Pointer(POINTER_DRAW_RECT)); +} +/* -----------------------------19.04.2002 12:42------------------------------ + + ---------------------------------------------------------------------------*/ +void ConstFormControl::CreateDefaultObject() +{ + Point aStartPos(GetDefaultCenterPos()); + Point aEndPos(aStartPos); + aStartPos.X() -= 2 * MM50; + aStartPos.Y() -= MM50; + aEndPos.X() += 2 * MM50; + aEndPos.Y() += MM50; + + if(!m_pSh->HasDrawView()) + m_pSh->MakeDrawView(); + + SdrView *pSdrView = m_pSh->GetDrawView(); + pSdrView->SetDesignMode(TRUE); + m_pSh->BeginCreate( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()), FmFormInventor, aStartPos); + m_pSh->MoveCreate(aEndPos); + m_pSh->EndCreate(SDRCREATE_FORCEEND); +} + diff --git a/sw/source/ui/ribbar/conpoly.cxx b/sw/source/ui/ribbar/conpoly.cxx new file mode 100644 index 000000000000..0dbf109cc783 --- /dev/null +++ b/sw/source/ui/ribbar/conpoly.cxx @@ -0,0 +1,163 @@ +/************************************************************************* + * + * 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_sw.hxx" + + +#include <svx/svdmark.hxx> +#include <svx/svdview.hxx> +#include <svx/svdopath.hxx> + +#include "view.hxx" +#include "edtwin.hxx" +#include "wrtsh.hxx" +#include "drawbase.hxx" +#include "conpoly.hxx" +#include <basegfx/polygon/b2dpolygon.hxx> + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + + + +ConstPolygon::ConstPolygon(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) : + SwDrawBase(pWrtShell, pEditWin, pSwView) +{ +} + +/************************************************************************* +|* +|* MouseButtonDown-event +|* +\************************************************************************/ + + + +BOOL ConstPolygon::MouseButtonDown(const MouseEvent& rMEvt) +{ + BOOL bReturn; + + if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == TRUE) + aLastPos = rMEvt.GetPosPixel(); + + return (bReturn); +} + +/************************************************************************* +|* +|* MouseMove-event +|* +\************************************************************************/ + + + +BOOL ConstPolygon::MouseMove(const MouseEvent& rMEvt) +{ + BOOL bReturn = FALSE; + + bReturn = SwDrawBase::MouseMove(rMEvt); + + return bReturn; +} + +/************************************************************************* +|* +|* MouseButtonUp-event +|* +\************************************************************************/ + + + +BOOL ConstPolygon::MouseButtonUp(const MouseEvent& rMEvt) +{ + BOOL bReturn = FALSE; + + if (m_pSh->IsDrawCreate()) + { + if (rMEvt.IsLeft() && rMEvt.GetClicks() == 1 && + m_pWin->GetSdrDrawMode() != OBJ_FREELINE) + { + if (!m_pSh->EndCreate(SDRCREATE_NEXTPOINT)) + { + m_pSh->BreakCreate(); + EnterSelectMode(rMEvt); + return TRUE; + } + } + else + { + Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel())); + bReturn = SwDrawBase::MouseButtonUp(rMEvt); + + // #i85045# removed double mechanism to check for AutoClose polygon + // after construction; the method here did not check for already closed and + // also worked only for a single polygon. Removing. + } + } + else + bReturn = SwDrawBase::MouseButtonUp(rMEvt); + + return (bReturn); +} + +/************************************************************************* +|* +|* Function aktivieren +|* +\************************************************************************/ + + + +void ConstPolygon::Activate(const USHORT nSlotId) +{ + switch (nSlotId) + { + case SID_DRAW_POLYGON_NOFILL: + m_pWin->SetSdrDrawMode(OBJ_PLIN); + break; + + case SID_DRAW_BEZIER_NOFILL: + m_pWin->SetSdrDrawMode(OBJ_PATHLINE); + break; + + case SID_DRAW_FREELINE_NOFILL: + m_pWin->SetSdrDrawMode(OBJ_FREELINE); + break; + + default: + break; + } + + SwDrawBase::Activate(nSlotId); +} + + + diff --git a/sw/source/ui/ribbar/conrect.cxx b/sw/source/ui/ribbar/conrect.cxx new file mode 100644 index 000000000000..3d77ae4829af --- /dev/null +++ b/sw/source/ui/ribbar/conrect.cxx @@ -0,0 +1,229 @@ +/************************************************************************* + * + * 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_sw.hxx" + + +#include <sfx2/bindings.hxx> +#include <svx/htmlmode.hxx> +#include <svx/sdtacitm.hxx> +#include <svx/svdobj.hxx> +#include <svx/sdtagitm.hxx> +#include <svx/sdtakitm.hxx> +#include <svx/sdtaditm.hxx> +#include <svx/sdtaaitm.hxx> +#include <svx/svdview.hxx> +#include <svx/svdocapt.hxx> +#include <editeng/outlobj.hxx> +#include <cmdid.h> +#include <view.hxx> +#include <edtwin.hxx> +#include <wrtsh.hxx> +#include <viewopt.hxx> +#include <drawbase.hxx> +#include <conrect.hxx> + + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +ConstRectangle::ConstRectangle( SwWrtShell* pWrtShell, SwEditWin* pEditWin, + SwView* pSwView ) + : SwDrawBase( pWrtShell, pEditWin, pSwView ), + bMarquee(FALSE), + // #93382# + mbVertical(sal_False) +{ +} + +/************************************************************************* +|* +|* MouseButtonDown-event +|* +\************************************************************************/ + +BOOL ConstRectangle::MouseButtonDown(const MouseEvent& rMEvt) +{ + BOOL bReturn; + + if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == TRUE + && m_pWin->GetSdrDrawMode() == OBJ_CAPTION) + { + m_pView->NoRotate(); + if (m_pView->IsDrawSelMode()) + { + m_pView->FlipDrawSelMode(); + m_pSh->GetDrawView()->SetFrameDragSingles(m_pView->IsDrawSelMode()); + } + } + return (bReturn); +} + +/************************************************************************* +|* +|* MouseButtonUp-event +|* +\************************************************************************/ + +BOOL ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt) +{ + Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel())); + + BOOL bRet = SwDrawBase::MouseButtonUp(rMEvt); + if( bRet ) + { + SdrView *pSdrView = m_pSh->GetDrawView(); + const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); + SdrObject* pObj = rMarkList.GetMark(0) ? rMarkList.GetMark(0)->GetMarkedSdrObj() + : 0; + switch( m_pWin->GetSdrDrawMode() ) + { + case OBJ_TEXT: + if( bMarquee ) + { + m_pSh->ChgAnchor(FLY_AS_CHAR); + + if( pObj ) + { + // die fuer das Scrollen benoetigten Attribute setzen + SfxItemSet aItemSet( pSdrView->GetModel()->GetItemPool(), + SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST); + + aItemSet.Put( SdrTextAutoGrowWidthItem( FALSE ) ); + aItemSet.Put( SdrTextAutoGrowHeightItem( FALSE ) ); + aItemSet.Put( SdrTextAniKindItem( SDRTEXTANI_SCROLL ) ); + aItemSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) ); + aItemSet.Put( SdrTextAniCountItem( 0 ) ); + aItemSet.Put( SdrTextAniAmountItem( + (INT16)m_pWin->PixelToLogic(Size(2,1)).Width()) ); + + pObj->SetMergedItemSetAndBroadcast(aItemSet); + } + } + else if(mbVertical && pObj && pObj->ISA(SdrTextObj)) + { + // #93382# + SdrTextObj* pText = (SdrTextObj*)pObj; + SfxItemSet aSet(pSdrView->GetModel()->GetItemPool()); + + pText->SetVerticalWriting(TRUE); + + aSet.Put(SdrTextAutoGrowWidthItem(TRUE)); + aSet.Put(SdrTextAutoGrowHeightItem(FALSE)); + aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); + aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); + + pText->SetMergedItemSet(aSet); + } + if( pObj ) + { + SdrPageView* pPV = pSdrView->GetSdrPageView(); + m_pView->BeginTextEdit( pObj, pPV, m_pWin, sal_True ); + } + m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln + m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); + break; + + case OBJ_CAPTION: + { + SdrCaptionObj* pCaptObj = dynamic_cast<SdrCaptionObj*>(pObj); + if( bCapVertical && pCaptObj ) + { + pCaptObj->ForceOutlinerParaObject(); + OutlinerParaObject* pOPO = pCaptObj->GetOutlinerParaObject(); + if( pOPO && !pOPO->IsVertical() ) + pOPO->SetVertical( TRUE ); + } + } + break; + default:; //prevent warning + } + } + return bRet; +} + +/************************************************************************* +|* +|* Function aktivieren +|* +\************************************************************************/ + +void ConstRectangle::Activate(const USHORT nSlotId) +{ + bMarquee = bCapVertical = FALSE; + mbVertical = sal_False; + + switch (nSlotId) + { + case SID_DRAW_LINE: + m_pWin->SetSdrDrawMode(OBJ_LINE); + break; + + case SID_DRAW_RECT: + m_pWin->SetSdrDrawMode(OBJ_RECT); + break; + + case SID_DRAW_ELLIPSE: + m_pWin->SetSdrDrawMode(OBJ_CIRC); + break; + + case SID_DRAW_TEXT_MARQUEE: + bMarquee = TRUE; + m_pWin->SetSdrDrawMode(OBJ_TEXT); + break; + + case SID_DRAW_TEXT_VERTICAL: + // #93382# + mbVertical = sal_True; + m_pWin->SetSdrDrawMode(OBJ_TEXT); + break; + + case SID_DRAW_TEXT: + m_pWin->SetSdrDrawMode(OBJ_TEXT); + break; + + case SID_DRAW_CAPTION_VERTICAL: + bCapVertical = TRUE; + // no break + case SID_DRAW_CAPTION: + m_pWin->SetSdrDrawMode(OBJ_CAPTION); + break; + + default: + m_pWin->SetSdrDrawMode(OBJ_NONE); + break; + } + + SwDrawBase::Activate(nSlotId); +} + + + diff --git a/sw/source/ui/ribbar/drawbase.cxx b/sw/source/ui/ribbar/drawbase.cxx new file mode 100644 index 000000000000..61dcd3f23505 --- /dev/null +++ b/sw/source/ui/ribbar/drawbase.cxx @@ -0,0 +1,737 @@ +/************************************************************************* + * + * 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_sw.hxx" +#include <hintids.hxx> +#include <tools/list.hxx> +#include <svx/svdview.hxx> +#include <svx/svdobj.hxx> +#include <svl/ptitem.hxx> +#include <editeng/sizeitem.hxx> +#include <sfx2/request.hxx> +#include <sfx2/bindings.hxx> +#include <fmtclds.hxx> +#include <frmfmt.hxx> +#include "cmdid.h" +#include "basesh.hxx" +#include "view.hxx" +#include "wrtsh.hxx" +#include "drawbase.hxx" +#include "edtwin.hxx" +#include "caption.hxx" +#include "swundo.hxx" +#include "undobj.hxx" +#include "comcore.hrc" + +using namespace ::com::sun::star; + +extern BOOL bNoInterrupt; // in mainwn.cxx + +#define MINMOVE ((USHORT)m_pSh->GetOut()->PixelToLogic(Size(m_pSh->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width()) + + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + + +SwDrawBase::SwDrawBase(SwWrtShell* pSwWrtShell, SwEditWin* pWindow, SwView* pSwView) : + m_pView(pSwView), + m_pSh(pSwWrtShell), + m_pWin(pWindow), + m_nSlotId(USHRT_MAX), + m_bCreateObj(TRUE), + m_bInsForm(FALSE) +{ + if ( !m_pSh->HasDrawView() ) + m_pSh->MakeDrawView(); +} + +/************************************************************************* +|* +|* Destruktor +|* +\************************************************************************/ + +__EXPORT SwDrawBase::~SwDrawBase() +{ + if (m_pView->GetWrtShellPtr()) // Im view-Dtor koennte die wrtsh bereits geloescht worden sein... + m_pSh->GetDrawView()->SetEditMode(TRUE); +} + +/************************************************************************* +|* +|* MouseButtonDown-event +|* +\************************************************************************/ + + +BOOL SwDrawBase::MouseButtonDown(const MouseEvent& rMEvt) +{ + BOOL bReturn = FALSE; + + SdrView *pSdrView = m_pSh->GetDrawView(); + + // #i33136# + // pSdrView->SetOrtho(rMEvt.IsShift()); + pSdrView->SetOrtho(doConstructOrthogonal() ? !rMEvt.IsShift() : rMEvt.IsShift()); + pSdrView->SetAngleSnapEnabled(rMEvt.IsShift()); + + if (rMEvt.IsMod2()) + { + pSdrView->SetCreate1stPointAsCenter(TRUE); + pSdrView->SetResizeAtCenter(TRUE); + } + else + { + pSdrView->SetCreate1stPointAsCenter(FALSE); + pSdrView->SetResizeAtCenter(FALSE); + } + + SdrViewEvent aVEvt; + SdrHitKind eHit = pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); + + // Nur neues Objekt, wenn nicht im Basismode (bzw reinem Selektionsmode) + if (rMEvt.IsLeft() && !m_pWin->IsDrawAction()) + { + if (IsCreateObj() && (eHit == SDRHIT_UNMARKEDOBJECT || eHit == SDRHIT_NONE || m_pSh->IsDrawCreate())) + { + bNoInterrupt = TRUE; + m_pWin->CaptureMouse(); + + m_aStartPos = m_pWin->PixelToLogic(rMEvt.GetPosPixel()); + + bReturn = m_pSh->BeginCreate( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()), m_aStartPos); + + SetDrawPointer(); + + if ( bReturn ) + m_pWin->SetDrawAction(TRUE); + } + else if (!pSdrView->IsAction()) + { + /********************************************************************** + * BEZIER-EDITOR + **********************************************************************/ + m_pWin->CaptureMouse(); + m_aStartPos = m_pWin->PixelToLogic(rMEvt.GetPosPixel()); + UINT16 nEditMode = m_pWin->GetBezierMode(); + + if (eHit == SDRHIT_HANDLE && aVEvt.pHdl->GetKind() == HDL_BWGT) + { + /****************************************************************** + * Handle draggen + ******************************************************************/ + bNoInterrupt = TRUE; + bReturn = pSdrView->BegDragObj(m_aStartPos, (OutputDevice*) NULL, aVEvt.pHdl); + m_pWin->SetDrawAction(TRUE); + } + else if (eHit == SDRHIT_MARKEDOBJECT && nEditMode == SID_BEZIER_INSERT) + { + /****************************************************************** + * Klebepunkt einfuegen + ******************************************************************/ + bNoInterrupt = TRUE; + bReturn = pSdrView->BegInsObjPoint(m_aStartPos, rMEvt.IsMod1()); + m_pWin->SetDrawAction(TRUE); + } + else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1()) + { + /****************************************************************** + * Klebepunkt selektieren + ******************************************************************/ + if (!rMEvt.IsShift()) + pSdrView->UnmarkAllPoints(); + + bReturn = pSdrView->BegMarkPoints(m_aStartPos); + m_pWin->SetDrawAction(TRUE); + } + else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2()) + { + /****************************************************************** + * Objekt verschieben + ******************************************************************/ + return FALSE; + } + else if (eHit == SDRHIT_HANDLE) + { + /****************************************************************** + * Klebepunkt selektieren + ******************************************************************/ + if (pSdrView->HasMarkablePoints() && (!pSdrView->IsPointMarked(*aVEvt.pHdl) || rMEvt.IsShift())) + { + SdrHdl* pHdl = NULL; + + if (!rMEvt.IsShift()) + { + pSdrView->UnmarkAllPoints(); + pHdl = pSdrView->PickHandle(m_aStartPos); + } + else + { + if (pSdrView->IsPointMarked(*aVEvt.pHdl)) + { + bReturn = pSdrView->UnmarkPoint(*aVEvt.pHdl); + pHdl = NULL; + } + else + { + pHdl = pSdrView->PickHandle(m_aStartPos); + } + } + + if (pHdl) + { + bNoInterrupt = TRUE; + pSdrView->MarkPoint(*pHdl); +// bReturn = pSdrView->BegDragObj(m_aStartPos, (OutputDevice*) NULL, pHdl); +// m_pWin->SetDrawAction(TRUE); + } + } + } + else + { + /****************************************************************** + * Objekt selektieren oder draggen + ******************************************************************/ + if (m_pSh->IsObjSelectable(m_aStartPos) && eHit == SDRHIT_UNMARKEDOBJECT) + { + if (pSdrView->HasMarkablePoints()) + pSdrView->UnmarkAllPoints(); + + bNoInterrupt = FALSE; + // Drag im edtwin verwenden + return FALSE; + } + + bNoInterrupt = TRUE; + + if (m_pSh->IsObjSelected()) + { + if (!rMEvt.IsShift()) + { + if (!pSdrView->HasMarkablePoints()) + { + //JP 10.10.2001: Bug 89619 - don't scroll the + // cursor into the visible area + BOOL bUnlockView = !m_pSh->IsViewLocked(); + m_pSh->LockView( TRUE ); //lock visible section + m_pSh->SelectObj(Point(LONG_MAX, LONG_MAX)); // Alles deselektieren + if( bUnlockView ) + m_pSh->LockView( FALSE ); + } + else + pSdrView->UnmarkAllPoints(); + } + } + if (!m_pSh->IsSelFrmMode()) + m_pSh->EnterSelFrmMode(NULL); + + if( 0 != (bReturn = m_pSh->BeginMark(m_aStartPos)) ) + m_pWin->SetDrawAction(TRUE); + + SetDrawPointer(); + } + } + } + return bReturn; +} + +/************************************************************************* +|* +|* MouseMove-event +|* +\************************************************************************/ + + +BOOL SwDrawBase::MouseMove(const MouseEvent& rMEvt) +{ + SdrView *pSdrView = m_pSh->GetDrawView(); + Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel())); + BOOL bRet = FALSE; + + if (IsCreateObj() && !m_pWin->IsDrawSelMode() && pSdrView->IsCreateObj()) + { + // #i33136# + // pSdrView->SetOrtho(rMEvt.IsShift()); + pSdrView->SetOrtho(doConstructOrthogonal() ? !rMEvt.IsShift() : rMEvt.IsShift()); + pSdrView->SetAngleSnapEnabled(rMEvt.IsShift()); + + m_pSh->MoveCreate(aPnt); + bRet = TRUE; + } + else if (pSdrView->IsAction() || pSdrView->IsInsObjPoint() || pSdrView->IsMarkPoints()) + { + m_pSh->MoveMark(aPnt); + bRet = TRUE; + } + + return (bRet); +} + +/************************************************************************* +|* +|* MouseButtonUp-event +|* +\************************************************************************/ + + +BOOL SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt) +{ + BOOL bReturn = FALSE; + BOOL bCheckShell = FALSE; + BOOL bAutoCap = FALSE; + + Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel())); + + if (IsCreateObj() && m_pSh->IsDrawCreate() && !m_pWin->IsDrawSelMode()) + { + const SdrObjKind nDrawMode = m_pWin->GetSdrDrawMode(); + //objects with multiple point may end at the start position + BOOL bMultiPoint = OBJ_PLIN == nDrawMode || + OBJ_PATHLINE == nDrawMode || + OBJ_FREELINE == nDrawMode; + if(rMEvt.IsRight() || (aPnt == m_aStartPos && !bMultiPoint)) + { + m_pSh->BreakCreate(); + m_pView->LeaveDrawCreate(); + } + else + { + if (OBJ_NONE == nDrawMode) + { + SwRewriter aRewriter; + + aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_FRAME)); + m_pSh->StartUndo(UNDO_INSERT, &aRewriter); + } + + m_pSh->EndCreate(SDRCREATE_FORCEEND); + if (OBJ_NONE == nDrawMode) // Textrahmen eingefuegt + { + uno::Reference< frame::XDispatchRecorder > xRecorder = + m_pSh->GetView().GetViewFrame()->GetBindings().GetRecorder(); + if ( xRecorder.is() ) + { + SfxRequest aReq(m_pSh->GetView().GetViewFrame(),FN_INSERT_FRAME); + aReq.AppendItem(SfxUInt16Item( FN_INSERT_FRAME, + static_cast<USHORT>(FLY_AT_PARA) )); + aReq.AppendItem(SfxPointItem( FN_PARAM_1, m_pSh->GetAnchorObjDiff())); + aReq.AppendItem(SvxSizeItem( FN_PARAM_2, m_pSh->GetObjSize())); + aReq.Done(); + } + bAutoCap = TRUE; + if(m_pWin->GetFrmColCount() > 1) + { + SfxItemSet aSet(m_pView->GetPool(),RES_COL,RES_COL); + SwFmtCol aCol((const SwFmtCol&)aSet.Get(RES_COL)); + aCol.Init(m_pWin->GetFrmColCount(), aCol.GetGutterWidth(), aCol.GetWishWidth()); + aSet.Put(aCol); + // Vorlagen-AutoUpdate + SwFrmFmt* pFmt = m_pSh->GetCurFrmFmt(); + if(pFmt && pFmt->IsAutoUpdateFmt()) + m_pSh->AutoUpdateFrame(pFmt, aSet); + else + m_pSh->SetFlyFrmAttr( aSet ); + } + } + if (m_pWin->GetSdrDrawMode() == OBJ_NONE) + m_pSh->EndUndo(UNDO_INSERT); + } + + bReturn = TRUE; + + EnterSelectMode(rMEvt); + } + else + { + SdrView *pSdrView = m_pSh->GetDrawView(); + + if (!pSdrView->HasMarkablePoints()) + { + /********************************************************************** + * KEIN BEZIER_EDITOR + **********************************************************************/ + if ((m_pSh->GetDrawView()->IsMarkObj() || m_pSh->GetDrawView()->IsMarkPoints()) + && rMEvt.IsLeft()) + { + bReturn = m_pSh->EndMark(); + + m_pWin->SetDrawAction(FALSE); + + if (aPnt == m_aStartPos && m_pSh->IsObjSelectable(aPnt)) + { + m_pSh->SelectObj(aPnt, ( rMEvt.IsShift() && + m_pSh->IsSelFrmMode()) ? SW_ADD_SELECT : 0); + + if (!m_pSh->IsObjSelected()) + { + m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln + + m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); + + if (m_pSh->IsSelFrmMode()) + m_pSh->LeaveSelFrmMode(); + } + m_pView->NoRotate(); + + bCheckShell = TRUE; // ggf BezierShell anwerfen + } + else if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction()) + { + if (m_pSh->IsObjSelectable(aPnt)) + m_pSh->SelectObj(aPnt, ( rMEvt.IsShift() && + m_pSh->IsSelFrmMode() ) ? SW_ADD_SELECT : 0 ); + else + { + m_pView->LeaveDrawCreate(); + if (m_pSh->IsSelFrmMode()) + m_pSh->LeaveSelFrmMode(); + } + m_pView->NoRotate(); + + bReturn = TRUE; + } + } + } + else + { + /********************************************************************** + * BEZIER_EDITOR + **********************************************************************/ + if ( pSdrView->IsAction() ) + { + if ( pSdrView->IsInsObjPoint() ) + bReturn = pSdrView->EndInsObjPoint(SDRCREATE_FORCEEND); + else if (pSdrView->IsMarkPoints() ) + bReturn = pSdrView->EndMarkPoints(); + else + { + pSdrView->EndAction(); + bReturn = TRUE; + } + m_pWin->SetDrawAction(FALSE); + + if (aPnt == m_aStartPos) + { + if (!m_pSh->IsObjSelectable(aPnt)) + m_pSh->SelectObj(Point(LONG_MAX, LONG_MAX)); + else if (!bReturn) + { + if (!rMEvt.IsShift()) + pSdrView->UnmarkAllPoints(); + m_pSh->SelectObj(aPnt, (rMEvt.IsShift() && + m_pSh->IsSelFrmMode()) ? SW_ADD_SELECT :0); + } + + if (!m_pSh->IsObjSelected()) + { + m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln + + m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); + + if (m_pSh->IsSelFrmMode()) + m_pSh->LeaveSelFrmMode(); + } + m_pView->NoRotate(); + + bCheckShell = TRUE; // ggf BezierShell anwerfen + } + } + + SetDrawPointer(); + + if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction()) + { + m_pView->LeaveDrawCreate(); + if (m_pSh->IsSelFrmMode()) + m_pSh->LeaveSelFrmMode(); + + m_pView->NoRotate(); + bReturn = TRUE; + } + } + } + + if (bCheckShell) + m_pView->AttrChangedNotify( m_pSh ); // ggf BezierShell anwerfen + + //!!!!!!!!!! Achtung Suizid !!!!!!!!!!! Sollte alles mal erneuert werden + if ( bAutoCap ) + m_pView->AutoCaption(FRAME_CAP); //Kann derzeit nur FRAME sein, sonst auf + //enums umstellen + return (bReturn); +} + +/************************************************************************* +|* +|* Function aktivieren +|* +\************************************************************************/ + + +void SwDrawBase::Activate(const USHORT nSlot) +{ + SetSlotId(nSlot); + SdrView *pSdrView = m_pSh->GetDrawView(); + + pSdrView->SetCurrentObj( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()) ); + pSdrView->SetEditMode(FALSE); + + SetDrawPointer(); + m_pSh->NoEdit(); +} + +/************************************************************************* +|* +|* Function deaktivieren +|* +\************************************************************************/ + + +void __EXPORT SwDrawBase::Deactivate() +{ + SdrView *pSdrView = m_pSh->GetDrawView(); + pSdrView->SetOrtho(FALSE); + pSdrView->SetAngleSnapEnabled(FALSE); + + if (m_pWin->IsDrawAction() && m_pSh->IsDrawCreate()) + m_pSh->BreakCreate(); + + m_pWin->SetDrawAction(FALSE); + + m_pWin->ReleaseMouse(); + bNoInterrupt = FALSE; + +// if(!m_pSh->IsObjSelected()) +// m_pSh->Edit(); + + if(m_pWin->GetApplyTemplate()) + m_pWin->SetApplyTemplate(SwApplyTemplate()); + m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); +} + +/************************************************************************* +|* +|* Tastaturereignisse bearbeiten +|* +|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls +|* FALSE. +|* +\************************************************************************/ + + +BOOL SwDrawBase::KeyInput(const KeyEvent& rKEvt) +{ + BOOL bReturn = FALSE; + USHORT nCode = rKEvt.GetKeyCode().GetCode(); + + switch (nCode) + { + case KEY_ESCAPE: + { + if (m_pWin->IsDrawAction()) + { + BreakCreate(); + m_pView->LeaveDrawCreate(); + } + + bReturn = TRUE; + } + break; + + case KEY_DELETE: + { + m_pSh->DelSelectedObj(); + bReturn = TRUE; + } + break; + + case KEY_UP: + case KEY_DOWN: + case KEY_LEFT: + case KEY_RIGHT: + { + SdrView *pSdrView = m_pSh->GetDrawView(); + + if (!pSdrView->IsTextEdit()) + { + 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 (pSdrView->AreObjectsMarked() && rKEvt.GetKeyCode().IsMod2()) + { + // Objekte verschieben + nX *= 100; + nY *= 100; + pSdrView->MoveAllMarked(Size(nX, nY)); + } + + bReturn = TRUE; + } + } + break; + } + + return (bReturn); +} + + +/************************************************************************* +|* +|* Tastaturereignisse bearbeiten +|* +|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls +|* FALSE. +|* +\************************************************************************/ + + +void SwDrawBase::BreakCreate() +{ + m_pSh->BreakCreate(); + m_pWin->SetDrawAction(FALSE); + m_pWin->ReleaseMouse(); + + Deactivate(); +// m_pView->LeaveDrawCreate(); +} + +/************************************************************************* +|* +|* Mauspointer umschalten +|* +\************************************************************************/ + + +void SwDrawBase::SetDrawPointer() +{ + SdrView *pSdrView = m_pSh->GetDrawView(); + Point aPnt(m_pWin->OutputToScreenPixel(m_pWin->GetPointerPosPixel())); + aPnt = m_pWin->PixelToLogic(m_pWin->ScreenToOutputPixel(aPnt)); + const Pointer aPointTyp = pSdrView->GetPreferedPointer(aPnt, m_pSh->GetOut()); + const Pointer aDrawPt(aPointTyp); + m_pWin->SetPointer(aDrawPt); +} + +/************************************************************************* +|* +|* Ggf in Selektionsmode wechseln +|* +\************************************************************************/ + +void SwDrawBase::EnterSelectMode(const MouseEvent& rMEvt) +{ + m_pWin->SetDrawAction(FALSE); + + if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction()) + { + Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel())); + + if (m_pSh->IsObjSelectable(aPnt)) + { + m_pSh->SelectObj(aPnt); + if (rMEvt.GetModifier() == KEY_SHIFT || !m_pSh->IsObjSelected()) + { + m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln + + m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); + } + } + else + { + m_pView->LeaveDrawCreate(); + if (m_pSh->IsSelFrmMode()) + m_pSh->LeaveSelFrmMode(); + } + m_pView->NoRotate(); + } +} +/* -----------------------------03.04.2002 10:52------------------------------ + + ---------------------------------------------------------------------------*/ +void SwDrawBase::CreateDefaultObject() +{ + Point aStartPos = GetDefaultCenterPos(); + Point aEndPos(aStartPos); + aStartPos.X() -= 8 * MM50; + aStartPos.Y() -= 4 * MM50; + aEndPos.X() += 8 * MM50; + aEndPos.Y() += 4 * MM50; + Rectangle aRect(aStartPos, aEndPos); + m_pSh->CreateDefaultShape( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()), aRect, m_nSlotId); +} +/* -----------------25.10.2002 14:14----------------- + * + * --------------------------------------------------*/ +Point SwDrawBase::GetDefaultCenterPos() +{ + Size aDocSz(m_pSh->GetDocSize()); + const SwRect& rVisArea = m_pSh->VisArea(); + Point aStartPos = rVisArea.Center(); + if(rVisArea.Width() > aDocSz.Width()) + aStartPos.X() = aDocSz.Width() / 2 + rVisArea.Left(); + if(rVisArea.Height() > aDocSz.Height()) + aStartPos.Y() = aDocSz.Height() / 2 + rVisArea.Top(); + return aStartPos; +} + +// #i33136# +bool SwDrawBase::doConstructOrthogonal() const +{ + return false; +} + +// eof diff --git a/sw/source/ui/ribbar/dselect.cxx b/sw/source/ui/ribbar/dselect.cxx new file mode 100644 index 000000000000..b7651eba981e --- /dev/null +++ b/sw/source/ui/ribbar/dselect.cxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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_sw.hxx" + + +#include <sfx2/bindings.hxx> +#include "view.hxx" +#include "edtwin.hxx" +#include "wrtsh.hxx" +#include "cmdid.h" +#include "drawbase.hxx" +#include "dselect.hxx" + +extern BOOL bNoInterrupt; // in mainwn.cxx + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +DrawSelection::DrawSelection(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) : + SwDrawBase(pWrtShell, pEditWin, pSwView) +{ + m_bCreateObj = FALSE; +} + +/************************************************************************* +|* +|* Tastaturereignisse bearbeiten +|* +|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls +|* FALSE. +|* +\************************************************************************/ + +BOOL DrawSelection::KeyInput(const KeyEvent& rKEvt) +{ + BOOL bReturn = FALSE; + + switch (rKEvt.GetKeyCode().GetCode()) + { + case KEY_ESCAPE: + { + if (m_pWin->IsDrawAction()) + { + m_pSh->BreakMark(); + m_pWin->ReleaseMouse(); + } + bReturn = TRUE; + } + break; + } + + if (!bReturn) + bReturn = SwDrawBase::KeyInput(rKEvt); + + return (bReturn); +} + +/************************************************************************* +|* +|* Function aktivieren +|* +\************************************************************************/ + +void DrawSelection::Activate(const USHORT nSlotId) +{ + m_pWin->SetSdrDrawMode(OBJ_NONE); + m_pWin->SetObjectSelect( TRUE ); + SwDrawBase::Activate(nSlotId); + + m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); +} + + diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx new file mode 100644 index 000000000000..c14f91632a4c --- /dev/null +++ b/sw/source/ui/ribbar/inputwin.cxx @@ -0,0 +1,685 @@ +/************************************************************************* + * + * 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_sw.hxx" + + +#include <tools/gen.hxx> +#include <sfx2/imgmgr.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/dispatch.hxx> +#include <svx/ruler.hxx> +#include <svl/zforlist.hxx> +#include <svl/stritem.hxx> + +#include "swtypes.hxx" +#include "cmdid.h" +#include "swmodule.hxx" +#include "wrtsh.hxx" +#include "view.hxx" +#include "calc.hxx" +#include "inputwin.hxx" +#include "fldbas.hxx" +#include "fldmgr.hxx" +#include "frmfmt.hxx" +#include "cellatr.hxx" +#include "edtwin.hxx" +#include "helpid.h" + +// nur fuers UpdateRange - Box in dem der gestackte Cursor sthet loeschen +#include "pam.hxx" + +#include "swundo.hxx" +#include "ribbar.hrc" +#include "inputwin.hrc" + +#include <IDocumentContentOperations.hxx> + +SFX_IMPL_POS_CHILDWINDOW( SwInputChild, FN_EDIT_FORMULA, SFX_OBJECTBAR_OBJECT ) + +//================================================================== + +SwInputWindow::SwInputWindow( Window* pParent, SfxBindings* pBind ) + : ToolBox( pParent , SW_RES( RID_TBX_FORMULA )), + aPos( this, SW_RES(ED_POS)), + aEdit( this, WB_3DLOOK|WB_TABSTOP|WB_BORDER|WB_NOHIDESELECTION), + aPopMenu( SW_RES(MN_CALC_POPUP)), + pMgr(0), + pWrtShell(0), + pView(0), + pBindings(pBind), + aAktTableName(aEmptyStr) +{ + bFirst = bDoesUndo = TRUE; + bActive = bIsTable = bDelSel = bResetUndo = bCallUndo = FALSE; + + FreeResource(); + + SfxImageManager* pManager = SfxImageManager::GetImageManager( SW_MOD() ); + pManager->RegisterToolBox(this); + + pView = ::GetActiveView(); + pWrtShell = pView ? pView->GetWrtShellPtr() : 0; + + InsertWindow( ED_POS, &aPos, 0, 0); + InsertSeparator ( 1 ); + InsertSeparator (); + InsertWindow( ED_FORMULA, &aEdit); + SetHelpId(ED_FORMULA, HID_EDIT_FORMULA); + + BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); + SetItemImage( FN_FORMULA_CALC, pManager->GetImage(FN_FORMULA_CALC, bHC )); + SetItemImage( FN_FORMULA_CANCEL, pManager->GetImage(FN_FORMULA_CANCEL, bHC )); + SetItemImage( FN_FORMULA_APPLY, pManager->GetImage(FN_FORMULA_APPLY, bHC )); + + SetItemBits( FN_FORMULA_CALC, GetItemBits( FN_FORMULA_CALC ) | TIB_DROPDOWNONLY ); + SetDropdownClickHdl( LINK( this, SwInputWindow, DropdownClickHdl )); + + Size aSizeTbx = CalcWindowSizePixel(); + Size aSize = GetSizePixel(); + aSize.Height() = aSizeTbx.Height(); + SetSizePixel( aSize ); + Size aPosSize = aPos.GetSizePixel(); + Size aEditSize = aEdit.GetSizePixel(); + aPosSize.Height() = aEditSize.Height() = GetItemRect(FN_FORMULA_CALC).GetHeight() - 2; + + Point aPosPos = aPos.GetPosPixel(); + Point aEditPos= aEdit.GetPosPixel(); + aPosPos.Y() = aEditPos.Y() = GetItemRect( FN_FORMULA_CALC ).TopLeft().Y() + 1; + aPos.SetPosSizePixel( aPosPos, aPosSize ); + aEdit.SetPosSizePixel( aEditPos, aEditSize ); + + aPopMenu.SetSelectHdl(LINK( this, SwInputWindow, MenuHdl )); +} + +//================================================================== + +__EXPORT SwInputWindow::~SwInputWindow() +{ + SfxImageManager::GetImageManager( SW_MOD() )->ReleaseToolBox(this); + + //Lineale aufwecken + if(pView) + { + pView->GetHLineal().SetActive( TRUE ); + pView->GetVLineal().SetActive( TRUE ); + } + if ( pMgr ) + delete pMgr; + if(pWrtShell) + pWrtShell->EndSelTblCells(); + + if( bResetUndo ) + { + DelBoxCntnt(); + pWrtShell->DoUndo( bDoesUndo ); + if(bCallUndo) + pWrtShell->Undo(); + SwEditShell::SetUndoActionCount( nActionCnt ); + } +} + +//================================================================== + +void SwInputWindow::DataChanged( const DataChangedEvent& rDCEvt ) +{ + if ( rDCEvt.GetType() == DATACHANGED_SETTINGS && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + { + // update item images + SwModule *pMod = SW_MOD(); + SfxImageManager *pImgMgr = SfxImageManager::GetImageManager( pMod ); + BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); + // + SetItemImage( FN_FORMULA_CALC, pImgMgr->GetImage(FN_FORMULA_CALC, bHC )); + SetItemImage( FN_FORMULA_CANCEL, pImgMgr->GetImage(FN_FORMULA_CANCEL, bHC )); + SetItemImage( FN_FORMULA_APPLY, pImgMgr->GetImage(FN_FORMULA_APPLY, bHC )); + } + + ToolBox::DataChanged( rDCEvt ); +} + +//================================================================== + +void __EXPORT SwInputWindow::Resize() +{ + ToolBox::Resize(); + + long nWidth = GetSizePixel().Width(); + long nLeft = aEdit.GetPosPixel().X(); + Size aEditSize = aEdit.GetSizePixel(); + + aEditSize.Width() = Max( ((long)(nWidth - nLeft - 5)), (long)0 ); + aEdit.SetSizePixel( aEditSize ); + aEdit.Invalidate(); +} + +//================================================================== + +void SwInputWindow::ShowWin() +{ + bIsTable = FALSE; + //Lineale anhalten + if(pView) + { + pView->GetHLineal().SetActive( FALSE ); + pView->GetVLineal().SetActive( FALSE ); + + DBG_ASSERT(pWrtShell, "Keine WrtShell!"); + // Cursor in Tabelle + bIsTable = pWrtShell->IsCrsrInTbl() ? TRUE : FALSE; + + if( bFirst ) + pWrtShell->SelTblCells( LINK( this, SwInputWindow, + SelTblCellsNotify) ); + if( bIsTable ) + { + const String& rPos = pWrtShell->GetBoxNms(); + USHORT nPos = 0; + short nSrch = -1; + while( (nPos = rPos.Search( ':',nPos + 1 ) ) != STRING_NOTFOUND ) + nSrch = (short) nPos; + aPos.SetText( rPos.Copy( ++nSrch ) ); + aAktTableName = pWrtShell->GetTableFmt()->GetName(); + } + else + aPos.SetText(SW_RESSTR(STR_TBL_FORMULA)); + + // Aktuelles Feld bearbeiten + ASSERT(pMgr == 0, FieldManager nicht geloescht.); + pMgr = new SwFldMgr; + + // JP 13.01.97: Formel soll immer mit einem "=" beginnen, hier + // also setzen + String sEdit( '=' ); + if( pMgr->GetCurFld() && TYP_FORMELFLD == pMgr->GetCurTypeId() ) + { + sEdit += pMgr->GetCurFldPar2(); + } + else if( bFirst ) + { + if( bIsTable ) + { + bResetUndo = TRUE; + nActionCnt = SwEditShell::GetUndoActionCount(); + SwEditShell::SetUndoActionCount( nActionCnt + 1 ); + + bDoesUndo = pWrtShell->DoesUndo(); + if( !bDoesUndo ) + pWrtShell->DoUndo( TRUE ); + + if( !pWrtShell->SwCrsrShell::HasSelection() ) + { + pWrtShell->MoveSection( fnSectionCurr, fnSectionStart ); + pWrtShell->SetMark(); + pWrtShell->MoveSection( fnSectionCurr, fnSectionEnd ); + } + if( pWrtShell->SwCrsrShell::HasSelection() ) + { + pWrtShell->StartUndo( UNDO_DELETE ); + pWrtShell->Delete(); + if( 0 != pWrtShell->EndUndo( UNDO_DELETE )) + bCallUndo = TRUE; + } + pWrtShell->DoUndo( FALSE ); + + SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA ); + if( pWrtShell->GetTblBoxFormulaAttrs( aSet )) + sEdit += ((SwTblBoxFormula&)aSet.Get( RES_BOXATR_FORMULA )).GetFormula(); + } + } + + if( bFirst ) + { + // WrtShell Flags richtig setzen + pWrtShell->SttSelect(); + pWrtShell->EndSelect(); + } + + bFirst = FALSE; + + aEdit.SetModifyHdl( LINK( this, SwInputWindow, ModifyHdl )); + + aEdit.SetText( sEdit ); + aEdit.SetSelection( Selection( sEdit.Len(), sEdit.Len() ) ); + sOldFml = sEdit; + + aEdit.Invalidate(); + aEdit.Update(); + aEdit.GrabFocus(); + // UserInterface fuer die Eingabe abklemmen + + pView->GetEditWin().LockKeyInput(TRUE); + pView->GetViewFrame()->GetDispatcher()->Lock(TRUE); + pWrtShell->Push(); + } + ToolBox::Show(); +} +//================================================================== + +IMPL_LINK( SwInputWindow, MenuHdl, Menu *, pMenu ) +{ +static const char * __READONLY_DATA aStrArr[] = { + sCalc_Phd, + sCalc_Sqrt, + sCalc_Or, + sCalc_Xor, + sCalc_And, + sCalc_Not, + sCalc_Eq, + sCalc_Neq, + sCalc_Leq, + sCalc_Geq, + sCalc_L, + sCalc_G, + sCalc_Sum, + sCalc_Mean, + sCalc_Min, + sCalc_Max, + sCalc_Sin, + sCalc_Cos, + sCalc_Tan, + sCalc_Asin, + sCalc_Acos, + sCalc_Atan, + sCalc_Pow, + "|", + sCalc_Round +}; + + USHORT nId = pMenu->GetCurItemId(); + if ( nId <= MN_CALC_ROUND ) + { + String aTmp( String::CreateFromAscii(aStrArr[nId - 1]) ); + aTmp += ' '; + aEdit.ReplaceSelected( aTmp ); + } + return 0; +} + +IMPL_LINK( SwInputWindow, DropdownClickHdl, ToolBox*, EMPTYARG ) +{ + USHORT nCurID = GetCurItemId(); + EndSelection(); // setzt CurItemId zurueck ! + switch ( nCurID ) + { + case FN_FORMULA_CALC : + { + aPopMenu.Execute( this, GetItemRect( FN_FORMULA_CALC ), POPUPMENU_NOMOUSEUPCLOSE ); + break; + default: + break; + } + } + + return TRUE; +} + +//================================================================== + + +void __EXPORT SwInputWindow::Click( ) +{ + USHORT nCurID = GetCurItemId(); + EndSelection(); // setzt CurItemId zurueck ! + switch ( nCurID ) + { + case FN_FORMULA_CANCEL: + { + CancelFormula(); + } + break; + case FN_FORMULA_APPLY: + { + ApplyFormula(); + } + break; + } +} + +//================================================================== + +void SwInputWindow::ApplyFormula() +{ + pView->GetViewFrame()->GetDispatcher()->Lock(FALSE); + pView->GetEditWin().LockKeyInput(FALSE); + if( bResetUndo ) + { + DelBoxCntnt(); + pWrtShell->DoUndo( bDoesUndo ); + SwEditShell::SetUndoActionCount( nActionCnt ); + if( bCallUndo ) + pWrtShell->Undo(); + bResetUndo = FALSE; + } + pWrtShell->Pop( FALSE ); + + // JP 13.01.97: Formel soll immer mit einem "=" beginnen, hier + // also wieder entfernen + String sEdit( aEdit.GetText() ); + sEdit.EraseLeadingChars().EraseTrailingChars(); + if( sEdit.Len() && '=' == sEdit.GetChar( 0 ) ) + sEdit.Erase( 0, 1 ); + SfxStringItem aParam(FN_EDIT_FORMULA, sEdit); + + pWrtShell->EndSelTblCells(); + pView->GetEditWin().GrabFocus(); + const SfxPoolItem* aArgs[2]; + aArgs[0] = &aParam; + aArgs[1] = 0; + pView->GetViewFrame()->GetBindings().Execute( FN_EDIT_FORMULA, aArgs, 0, SFX_CALLMODE_ASYNCHRON ); +} + +//================================================================== + +void SwInputWindow::CancelFormula() +{ + if(pView) + { + pView->GetViewFrame()->GetDispatcher()->Lock( FALSE ); + pView->GetEditWin().LockKeyInput(FALSE); + if( bResetUndo ) + { + DelBoxCntnt(); + pWrtShell->DoUndo( bDoesUndo ); + SwEditShell::SetUndoActionCount( nActionCnt ); + if( bCallUndo ) + pWrtShell->Undo(); + bResetUndo = FALSE; + } + pWrtShell->Pop( FALSE ); + + if( bDelSel ) + pWrtShell->EnterStdMode(); + + pWrtShell->EndSelTblCells(); + + pView->GetEditWin().GrabFocus(); + } + pView->GetViewFrame()->GetDispatcher()->Execute( FN_EDIT_FORMULA, SFX_CALLMODE_ASYNCHRON); +} +//================================================================== + +const xub_Unicode CH_LRE = 0x202a; +const xub_Unicode CH_PDF = 0x202c; + +IMPL_LINK( SwInputWindow, SelTblCellsNotify, SwWrtShell *, pCaller ) +{ + if(bIsTable) + { + SwFrmFmt* pTblFmt = pCaller->GetTableFmt(); + String sBoxNms( pCaller->GetBoxNms() ); + String sTblNm; + if( pTblFmt && aAktTableName != pTblFmt->GetName() ) + sTblNm = pTblFmt->GetName(); + + aEdit.UpdateRange( sBoxNms, sTblNm ); + + String sNew; + sNew += CH_LRE; + sNew += aEdit.GetText(); + sNew += CH_PDF; + + if( sNew != sOldFml ) + { + // Die WrtShell ist in der Tabellen Selektion + // dann die Tabellen Selektion wieder aufheben, sonst steht der + // Cursor "im Wald" und das LiveUpdate funktioniert nicht! + pWrtShell->StartAllAction(); + + SwPaM aPam( *pWrtShell->GetStkCrsr()->GetPoint() ); + aPam.Move( fnMoveBackward, fnGoSection ); + aPam.SetMark(); + aPam.Move( fnMoveForward, fnGoSection ); + + IDocumentContentOperations* pIDCO = pWrtShell->getIDocumentContentOperations(); + pIDCO->DeleteRange( aPam ); + pIDCO->InsertString( aPam, sNew ); + pWrtShell->EndAllAction(); + sOldFml = sNew; + } + } + else + aEdit.GrabFocus(); + return 0; +} + + +void SwInputWindow::SetFormula( const String& rFormula, BOOL bDelFlag ) +{ + String sEdit( '=' ); + if( rFormula.Len() ) + { + if( '=' == rFormula.GetChar( 0 ) ) + sEdit = rFormula; + else + sEdit += rFormula; + } + aEdit.SetText( sEdit ); + aEdit.SetSelection( Selection( sEdit.Len(), sEdit.Len() ) ); + aEdit.Invalidate(); + bDelSel = bDelFlag; +} + +IMPL_LINK( SwInputWindow, ModifyHdl, InputEdit*, EMPTYARG ) +{ + if( bIsTable && bResetUndo ) + { + pWrtShell->StartAllAction(); + DelBoxCntnt(); + String sNew; + sNew += CH_LRE; + sNew += aEdit.GetText(); + sNew += CH_PDF; + pWrtShell->SwEditShell::Insert2( sNew ); + pWrtShell->EndAllAction(); + sOldFml = sNew; + } + return 0; +} + + +void SwInputWindow::DelBoxCntnt() +{ + if( bIsTable ) + { + pWrtShell->StartAllAction(); + pWrtShell->ClearMark(); + pWrtShell->Pop( FALSE ); + pWrtShell->Push(); + pWrtShell->MoveSection( fnSectionCurr, fnSectionStart ); + pWrtShell->SetMark(); + pWrtShell->MoveSection( fnSectionCurr, fnSectionEnd ); + pWrtShell->SwEditShell::Delete(); + pWrtShell->EndAllAction(); + } +} + +//================================================================== + +void __EXPORT InputEdit::KeyInput(const KeyEvent& rEvent) +{ + const KeyCode aCode = rEvent.GetKeyCode(); + if(aCode == KEY_RETURN || aCode == KEY_F2 ) + ((SwInputWindow*)GetParent())->ApplyFormula(); + else if(aCode == KEY_ESCAPE ) + ((SwInputWindow*)GetParent())->CancelFormula(); + else + Edit::KeyInput(rEvent); +} + +//================================================================== + +void __EXPORT InputEdit::UpdateRange(const String& rBoxes, + const String& rName ) +{ + if( !rBoxes.Len() ) + { + GrabFocus(); + return; + } + const sal_Unicode cOpen = '<', cClose = '>', + cOpenBracket = '('; + String aPrefix = rName; + if(rName.Len()) + aPrefix += '.'; + String aBoxes = aPrefix; + aBoxes += rBoxes; + Selection aSelection(GetSelection()); + USHORT nSel = (USHORT) aSelection.Len(); + //OS: mit dem folgenden Ausdruck wird sichergestellt, dass im overwrite-Modus + //die selektierte schliessende Klammer nicht geloescht wird + if( nSel && ( nSel > 1 || + GetText().GetChar( (USHORT)aSelection.Min() ) != cClose ) ) + Cut(); + else + aSelection.Max() = aSelection.Min(); + String aActText(GetText()); + const USHORT nLen = aActText.Len(); + if( !nLen ) + { + String aStr(cOpen); + aStr += aBoxes; + aStr += cClose; + SetText(aStr); + USHORT nPos = aStr.Search( cClose ); + ASSERT(nPos < aStr.Len(), Delimiter nicht gefunden.); + ++nPos; + SetSelection( Selection( nPos, nPos )); + } + else + { + BOOL bFound = FALSE; + sal_Unicode cCh; + USHORT nPos, nEndPos = 0, nStartPos = (USHORT) aSelection.Min(); + if( nStartPos-- ) + { + do { + if( cOpen == (cCh = aActText.GetChar( nStartPos ) ) || + cOpenBracket == cCh ) + { + bFound = cCh == cOpen; + break; + } + } while( nStartPos-- > 0 ); + } + if( bFound ) + { + bFound = FALSE; + nEndPos = nStartPos; + while( nEndPos < nLen ) + { + if( cClose == (cCh = aActText.GetChar( nEndPos )) /*|| + cCh == cCloseBracket*/ ) + { + bFound = TRUE; + break; + } + ++nEndPos; + } + // nur wenn akt. Pos im Breich oder direkt dahinter liegt + if( bFound && !( nStartPos < (USHORT)aSelection.Max() && + (USHORT)aSelection.Max() <= nEndPos + 1 )) + bFound = FALSE; + } + if( bFound ) + { + nPos = ++nStartPos + 1; // wir wollen dahinter + aActText.Erase( nStartPos, nEndPos - nStartPos ); + aActText.Insert( aBoxes, nStartPos ); + nPos = nPos + aBoxes.Len(); + } + else + { + String aTmp( (char)cOpen ); + aTmp += aBoxes; + aTmp += (char)cClose; + nPos = (USHORT)aSelection.Min(); + aActText.Insert( aTmp, nPos ); + nPos = nPos + aTmp.Len(); + } + if( GetText() != aActText ) + { + SetText( aActText ); + SetSelection( Selection( nPos, nPos ) ); +// GetModifyHdl().Call( this ); + } + } + GrabFocus(); + +} +//================================================================== + + +SwInputChild::SwInputChild(Window* _pParent, + USHORT nId, + SfxBindings* pBindings, + SfxChildWinInfo* ) : + SfxChildWindow( _pParent, nId ) +{ + pDispatch = pBindings->GetDispatcher(); + pWindow = new SwInputWindow( _pParent, pBindings ); + ((SwInputWindow*)pWindow)->ShowWin(); + eChildAlignment = SFX_ALIGN_LOWESTTOP; +} + + +__EXPORT SwInputChild::~SwInputChild() +{ + if(pDispatch) + pDispatch->Lock(FALSE); +} + + +SfxChildWinInfo __EXPORT SwInputChild::GetInfo() const +{ + SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ + return aInfo; +} + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/ribbar/inputwin.hrc b/sw/source/ui/ribbar/inputwin.hrc new file mode 100644 index 000000000000..96e45ac38708 --- /dev/null +++ b/sw/source/ui/ribbar/inputwin.hrc @@ -0,0 +1,84 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ +#ifndef _INPUTWIN_HRC +#define _INPUTWIN_HRC + + +//PopupMenu Id's +#define MN_CALC_PHD 1 +#define MN_CALC_SQRT 2 +#define MN_CALC_OR 3 +#define MN_CALC_XOR 4 +#define MN_CALC_AND 5 +#define MN_CALC_NOT 6 +#define MN_CALC_EQ 7 +#define MN_CALC_NEQ 8 +#define MN_CALC_LEQ 9 +#define MN_CALC_GEQ 10 +#define MN_CALC_LES 11 +#define MN_CALC_GRE 12 +#define MN_CALC_SUM 13 +#define MN_CALC_MEAN 14 +#define MN_CALC_MIN 15 +#define MN_CALC_MAX 16 +#define MN_CALC_SIN 17 +#define MN_CALC_COS 18 +#define MN_CALC_TAN 19 +#define MN_CALC_ASIN 20 +#define MN_CALC_ACOS 21 +#define MN_CALC_ATAN 22 +#define MN_CALC_POW 23 +#define MN_CALC_LISTSEP 24 +#define MN_CALC_ROUND 25 + +#define MN_POP_OPS 29 +#define MN_POP_STATISTICS 30 +#define MN_POP_FUNC 31 +#define MN_RSC_END 32 + +#define TBX_FORMULA 1 +#define ED_POS 2 +#define ED_FORMULA 3 + +#endif + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/ribbar/inputwin.src b/sw/source/ui/ribbar/inputwin.src new file mode 100644 index 000000000000..13d5fcdd0eae --- /dev/null +++ b/sw/source/ui/ribbar/inputwin.src @@ -0,0 +1,345 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ +/* HelpID ressource file */ +/* HelpID ressource file */ + +#include "cmdid.h" +#include "helpid.h" +#include "globals.hrc" +#include "ribbar.hrc" +#include "inputwin.hrc" +ToolBox RID_TBX_FORMULA +{ + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 600 , 14 ) ; + HelpID = HID_CALC_TOOLBOX ; + SVLook = TRUE ; + Border = TRUE ; + ItemList = + { + ToolBoxItem + { + Identifier = FN_FORMULA_CALC ; + HelpID = FN_FORMULA_CALC ; + DropDown = TRUE ; + Text [ en-US ] = "Formula" ; + /* ### ACHTUNG: Neuer Text in Resource? Formel auswählen : Formel auswõhlen */ + }; + ToolBoxItem + { + Identifier = FN_FORMULA_CANCEL ; + HelpID = FN_FORMULA_CANCEL ; + Text [ en-US ] = "Cancel" ; + /* ### ACHTUNG: Neuer Text in Resource? Formel nicht übenehmen : Formel nicht ³benehmen */ + }; + ToolBoxItem + { + Identifier = FN_FORMULA_APPLY ; + HelpID = FN_FORMULA_APPLY ; + /* ### ACHTUNG: Neuer Text in Resource? Übernehmen : šbernehmen */ + Text [ en-US ] = "Apply" ; + /* ### ACHTUNG: Neuer Text in Resource? Formel einfügen : Formel einf³gen */ + }; + }; + Edit ED_POS + { + Border = TRUE ; + Size = MAP_APPFONT ( 45 , 11 ) ; + ReadOnly = TRUE ; + SVLook = TRUE ; + Center = TRUE ; + }; + Edit ED_FORMULA + { + Border = TRUE ; + TabStop = TRUE ; + Size = MAP_APPFONT ( 500 , 11 ) ; + SVLook = TRUE ; + }; +}; +Menu MN_CALC_POPUP +{ + ItemList = + { + MenuItem + { + Identifier = MN_CALC_SUM ; + HelpID = HID_MN_CALC_SUM ; + Text [ en-US ] = "Sum" ; + }; + MenuItem + { + Identifier = MN_CALC_ROUND ; + HelpID = HID_MN_CALC_ROUND ; + Text [ en-US ] = "Round" ; + }; + MenuItem + { + Identifier = MN_CALC_PHD ; + HelpID = HID_MN_CALC_PHD ; + Text [ en-US ] = "Percent" ; + }; + MenuItem + { + Identifier = MN_CALC_SQRT ; + HelpID = HID_MN_CALC_SQRT ; + Text [ en-US ] = "Square Root" ; + }; + MenuItem + { + Identifier = MN_CALC_POW ; + HelpID = HID_MN_CALC_POW ; + Text [ en-US ] = "Power" ; + }; + MenuItem + { + Identifier = MN_POP_OPS ; + HelpID = HID_MN_POP_OPS ; + Text [ en-US ] = "Operators" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = MN_CALC_LISTSEP ; + HelpID = HID_MN_CALC_LISTSEP ; + Text [ en-US ] = "List Separator" ; + }; + MenuItem + { + Identifier = MN_CALC_EQ ; + HelpID = HID_MN_CALC_EQ ; + Text [ en-US ] = "Equal" ; + }; + MenuItem + { + Identifier = MN_CALC_NEQ ; + HelpID = HID_MN_CALC_NEQ ; + Text [ en-US ] = "Not Equal" ; + }; + MenuItem + { + Identifier = MN_CALC_LEQ ; + HelpID = HID_MN_CALC_LEQ ; + Text [ en-US ] = "Less Than or Equal" ; + }; + MenuItem + { + Identifier = MN_CALC_GEQ ; + HelpID = HID_MN_CALC_GEQ ; + /* ### ACHTUNG: Neuer Text in Resource? Gr~ößer Gleich : Gr~÷˜er Gleich */ + Text [ en-US ] = "Greater Than or Equal" ; + }; + MenuItem + { + Identifier = MN_CALC_LES ; + HelpID = HID_MN_CALC_LES ; + Text [ en-US ] = "Less" ; + }; + MenuItem + { + Identifier = MN_CALC_GRE ; + HelpID = HID_MN_CALC_GRE ; + /* ### ACHTUNG: Neuer Text in Resource? G~rößer : G~r÷˜er */ + Text [ en-US ] = "Greater" ; + }; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + Identifier = MN_CALC_OR ; + HelpID = HID_MN_CALC_OR ; + Text [ en-US ] = "Boolean Or" ; + }; + MenuItem + { + Identifier = MN_CALC_XOR ; + HelpID = HID_MN_CALC_XOR ; + Text [ en-US ] = "Boolean Xor" ; + }; + MenuItem + { + Identifier = MN_CALC_AND ; + HelpID = HID_MN_CALC_AND ; + Text [ en-US ] = "Boolean And" ; + }; + MenuItem + { + Identifier = MN_CALC_NOT ; + HelpID = HID_MN_CALC_NOT ; + Text [ en-US ] = "Boolean Not" ; + }; + }; + }; + }; + MenuItem + { + Identifier = MN_POP_STATISTICS ; + HelpID = HID_MN_POP_STATISTICS ; + Text [ en-US ] = "Statistical Functions" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = MN_CALC_MEAN ; + HelpID = HID_MN_CALC_MEAN ; + Text [ en-US ] = "Mean" ; + }; + MenuItem + { + Identifier = MN_CALC_MIN ; + HelpID = HID_MN_CALC_MIN ; + Text [ en-US ] = "Minimum" ; + }; + MenuItem + { + Identifier = MN_CALC_MAX ; + HelpID = HID_MN_CALC_MAX ; + Text [ en-US ] = "Maximum" ; + }; + }; + }; + }; + MenuItem + { + Identifier = MN_POP_FUNC ; + HelpID = HID_MN_POP_FUNC ; + Text [ en-US ] = "Functions" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = MN_CALC_SIN ; + HelpID = HID_MN_CALC_SIN ; + Text [ en-US ] = "Sine" ; + }; + MenuItem + { + Identifier = MN_CALC_COS ; + HelpID = HID_MN_CALC_COS ; + Text [ en-US ] = "Cosine" ; + }; + MenuItem + { + Identifier = MN_CALC_TAN ; + HelpID = HID_MN_CALC_TAN ; + Text [ en-US ] = "Tangent" ; + }; + MenuItem + { + Identifier = MN_CALC_ASIN ; + HelpID = HID_MN_CALC_ASIN ; + Text [ en-US ] = "Arcsine" ; + }; + MenuItem + { + Identifier = MN_CALC_ACOS ; + HelpID = HID_MN_CALC_ACOS ; + Text [ en-US ] = "Arccosine" ; + }; + MenuItem + { + Identifier = MN_CALC_ATAN ; + HelpID = HID_MN_CALC_ATAN ; + Text [ en-US ] = "Arctangent" ; + }; + }; + }; + }; + }; +}; +String STR_TBL_FORMULA +{ + Text [ en-US ] = "Text formula" ; +}; +#define TB_INPUT \ + ToolBoxItem\ + {\ + Identifier = FN_FORMULA_CALC ; \ + HelpID = FN_FORMULA_CALC ; \ + Text [ en-US ] = "Formula" ; \ + /* ### ACHTUNG: Neuer Text in Resource? Formel auswählen : Formel auswõhlen */\ + };\ + ToolBoxItem\ + {\ + Identifier = FN_FORMULA_CANCEL ; \ + HelpID = FN_FORMULA_CANCEL ; \ + Text [ en-US ] = "Cancel" ; \ + /* ### ACHTUNG: Neuer Text in Resource? Formel nicht übenehmen : Formel nicht ³benehmen */\ + };\ + ToolBoxItem\ + {\ + Identifier = FN_FORMULA_APPLY ; \ + HelpID = FN_FORMULA_APPLY ; \ + /* ### ACHTUNG: Neuer Text in Resource? Übernehmen : šbernehmen */\ + Text [ en-US ] = "Apply" ; \ + /* ### ACHTUNG: Neuer Text in Resource? Formel einfügen : Formel einf³gen */\ + }; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/ribbar/makefile.mk b/sw/source/ui/ribbar/makefile.mk new file mode 100644 index 000000000000..2405d4b16d9f --- /dev/null +++ b/sw/source/ui/ribbar/makefile.mk @@ -0,0 +1,71 @@ +#************************************************************************* +# +# 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=..$/..$/.. + +PRJNAME=sw +TARGET=ribbar + +# --- Settings ----------------------------------------------------- + +.INCLUDE : $(PRJ)$/inc$/swpre.mk +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/inc$/sw.mk + +# --- Files -------------------------------------------------------- + +SRS1NAME=$(TARGET) +SRC1FILES = \ + tbxanchr.src \ + inputwin.src \ + tblctrl.src \ + workctrl.src + +EXCEPTIONSFILES = \ + $(SLO)$/tblctrl.obj \ + $(SLO)$/tbxanchr.obj \ + $(SLO)$/workctrl.obj + +SLOFILES = \ + $(SLO)$/inputwin.obj \ + $(SLO)$/tbxanchr.obj \ + $(SLO)$/conrect.obj \ + $(SLO)$/conform.obj \ + $(SLO)$/conpoly.obj \ + $(SLO)$/conarc.obj \ + $(SLO)$/concustomshape.obj \ + $(SLO)$/dselect.obj \ + $(SLO)$/drawbase.obj \ + $(SLO)$/tblctrl.obj \ + $(SLO)$/workctrl.obj + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk + +$(SRS)$/ribbar.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc + diff --git a/sw/source/ui/ribbar/tblctrl.cxx b/sw/source/ui/ribbar/tblctrl.cxx new file mode 100644 index 000000000000..ad5046af6b42 --- /dev/null +++ b/sw/source/ui/ribbar/tblctrl.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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_sw.hxx" + + +#include <svl/intitem.hxx> + +#include <vcl/toolbox.hxx> +#include <sfx2/app.hxx> + +#include "cmdid.h" +#include "swtypes.hxx" +#include "tblctrl.hxx" +#include "tblctrl.hrc" + + + +SFX_IMPL_TOOLBOX_CONTROL( SwTableOptimizeCtrl, SfxUInt16Item ); + +/********************************************************************** + +**********************************************************************/ + + + + +SwTableOptimizeCtrl::SwTableOptimizeCtrl( + USHORT nSlotId, + USHORT nId, + ToolBox& rTbx ) : + SfxToolBoxControl( nSlotId, nId, rTbx ) +{ + rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); +} +/********************************************************************** + +**********************************************************************/ + + + +SwTableOptimizeCtrl::~SwTableOptimizeCtrl() +{ +} + +/********************************************************************** + +**********************************************************************/ + + + +SfxPopupWindow* SwTableOptimizeCtrl::CreatePopupWindow() +{ + rtl::OUString aToolBarResStr( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/optimizetablebar" )); + createAndPositionSubToolBar( aToolBarResStr ); + return NULL; +} + +/********************************************************************** + +**********************************************************************/ + + + +SfxPopupWindowType SwTableOptimizeCtrl::GetPopupWindowType() const +{ + return SFX_POPUPWINDOW_ONCLICK; +} diff --git a/sw/source/ui/ribbar/tblctrl.hrc b/sw/source/ui/ribbar/tblctrl.hrc new file mode 100644 index 000000000000..7cfa32d7bb5d --- /dev/null +++ b/sw/source/ui/ribbar/tblctrl.hrc @@ -0,0 +1,35 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ +#ifndef _TBLCTRL_HRC +#define _TBLCTRL_HRC +#include "ribbar.hrc" + +#define TBX_OPTIMIZE_TABLE 1 + +#endif + + diff --git a/sw/source/ui/ribbar/tblctrl.src b/sw/source/ui/ribbar/tblctrl.src new file mode 100644 index 000000000000..0c783172af74 --- /dev/null +++ b/sw/source/ui/ribbar/tblctrl.src @@ -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. + * + ************************************************************************/ + +#include "tblctrl.hrc" +#include "helpid.h" +#include "cmdid.h" +FloatingWindow RID_TBL_OPT_CTRL +{ + Moveable = TRUE ; + Closeable = TRUE ; + Hide = TRUE ; + SVLook = TRUE ; + HelpID = HID_TBL_OPT_CTRL ; + ToolBox TBX_OPTIMIZE_TABLE + { + MenuStrings = TRUE ; + SVLook = TRUE ; + HelpID = 1 ; + ItemList = + { + ToolBoxItem + { + Identifier = FN_TABLE_BALANCE_CELLS ; + HelpID = FN_TABLE_BALANCE_CELLS ; + }; + ToolBoxItem + { + Identifier = FN_TABLE_BALANCE_ROWS ; + HelpID = FN_TABLE_BALANCE_ROWS ; + }; + ToolBoxItem + { + Identifier = FN_TABLE_OPTIMAL_HEIGHT ; + HelpID = FN_TABLE_OPTIMAL_HEIGHT ; + }; + ToolBoxItem + { + Identifier = FN_TABLE_ADJUST_CELLS ; + HelpID = FN_TABLE_ADJUST_CELLS ; + }; + }; + }; + Text [ en-US ] = "Optimize" ; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/ribbar/tbxanchr.cxx b/sw/source/ui/ribbar/tbxanchr.cxx new file mode 100644 index 000000000000..6c20f9dd818d --- /dev/null +++ b/sw/source/ui/ribbar/tbxanchr.cxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * 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_sw.hxx" + + + +#include <string> // HACK: prevent conflict between STLPORT and Workshop headers +#include <vcl/timer.hxx> +#include <sfx2/app.hxx> +#include <svx/htmlmode.hxx> +#include <svl/intitem.hxx> +#include <sfx2/dispatch.hxx> +#ifndef _TOOLBOX_HXX //autogen +#include <vcl/toolbox.hxx> +#endif +#include <sfx2/mnumgr.hxx> + + +#include "cmdid.h" +#include "docsh.hxx" +#include "swtypes.hxx" +#include "swmodule.hxx" +#include "wrtsh.hxx" +#include "view.hxx" +#include "viewopt.hxx" +#include "errhdl.hxx" +#include "ribbar.hrc" +#include "tbxanchr.hxx" + + + +SFX_IMPL_TOOLBOX_CONTROL(SwTbxAnchor, SfxUInt16Item); + +/****************************************************************************** + * Beschreibung: + ******************************************************************************/ + +SwTbxAnchor::SwTbxAnchor( USHORT nSlotId, USHORT nId, ToolBox& rTbx ) : + SfxToolBoxControl( nSlotId, nId, rTbx ), + nActAnchorId(0) +{ + rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); +} + +/****************************************************************************** + * Beschreibung: + ******************************************************************************/ + + SwTbxAnchor::~SwTbxAnchor() +{ +} + +/****************************************************************************** + * Beschreibung: + ******************************************************************************/ + +void SwTbxAnchor::StateChanged( USHORT /*nSID*/, SfxItemState eState, const SfxPoolItem* pState ) +{ + GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SFX_ITEM_DISABLED) ); + + if( eState == SFX_ITEM_AVAILABLE ) + { + const SfxUInt16Item* pItem = PTR_CAST( SfxUInt16Item, pState ); + if(pItem) + nActAnchorId = pItem->GetValue(); + } + +} + +/****************************************************************************** + * Beschreibung: + ******************************************************************************/ + +SfxPopupWindow* SwTbxAnchor::CreatePopupWindow() +{ + SwTbxAnchor::Click(); + return 0; +} + +/****************************************************************************** + * Beschreibung: + ******************************************************************************/ + +void SwTbxAnchor::Click() +{ + PopupMenu aPopMenu(SW_RES(MN_ANCHOR_POPUP)); + + SfxViewFrame* pViewFrame( 0 ); + SfxDispatcher* pDispatch( 0 ); + SfxViewShell* pCurSh( SfxViewShell::Current() ); + + if ( pCurSh ) + { + pViewFrame = pCurSh->GetViewFrame(); + if ( pViewFrame ) + pDispatch = pViewFrame->GetDispatcher(); + } + +// SfxDispatcher* pDispatch = GetBindings().GetDispatcher(); +// SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : 0; + SwView* pActiveView = 0; + if(pViewFrame) + { + const TypeId aTypeId = TYPE(SwView); + SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId); + while( pView ) + { + if(pView->GetViewFrame() == pViewFrame) + { + pActiveView = pView; + break; + } + pView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId); + } + } + if(!pActiveView) + { + DBG_ERROR("No active view could be found"); + return; + } + SwWrtShell* pWrtShell = pActiveView->GetWrtShellPtr(); + aPopMenu.EnableItem( FN_TOOL_ANKER_FRAME, 0 != pWrtShell->IsFlyInFly() ); + + Rectangle aRect(GetToolBox().GetItemRect(GetId())); + USHORT nHtmlMode = ::GetHtmlMode((SwDocShell*)SfxObjectShell::Current()); + BOOL bHtmlModeNoAnchor = ( nHtmlMode & HTMLMODE_ON) && 0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS); + + if (bHtmlModeNoAnchor || pWrtShell->IsInHeaderFooter()) + aPopMenu.RemoveItem(aPopMenu.GetItemPos(FN_TOOL_ANKER_PAGE)); + + if (nActAnchorId) + aPopMenu.CheckItem(nActAnchorId); + + + USHORT nSlotId = aPopMenu.Execute(&GetToolBox(), aRect); + GetToolBox().EndSelection(); + + if (nSlotId) + pDispatch->Execute(nSlotId, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD); +} diff --git a/sw/source/ui/ribbar/tbxanchr.src b/sw/source/ui/ribbar/tbxanchr.src new file mode 100644 index 000000000000..41067b18fb08 --- /dev/null +++ b/sw/source/ui/ribbar/tbxanchr.src @@ -0,0 +1,107 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#include "ribbar.hrc" +#include "cmdid.h" +Menu MN_ANCHOR_POPUP +{ + ItemList = + { + MenuItem + { + _MenuItemFlags = MIB_RADIOCHECK ; + RadioCheck = TRUE ; + Identifier = FN_TOOL_ANKER_PAGE ; + Text [ en-US ] = "To Page" ; + }; + MenuItem + { + _MenuItemFlags = MIB_RADIOCHECK ; + RadioCheck = TRUE ; + Identifier = FN_TOOL_ANKER_PARAGRAPH ; + Text [ en-US ] = "To Paragraph" ; + }; + MenuItem + { + _MenuItemFlags = MIB_RADIOCHECK ; + RadioCheck = TRUE ; + Identifier = FN_TOOL_ANKER_AT_CHAR ; + Text [ en-US ] = "To Character" ; + }; + MenuItem + { + _MenuItemFlags = MIB_RADIOCHECK ; + RadioCheck = TRUE ; + Identifier = FN_TOOL_ANKER_CHAR ; + Text [ en-US ] = "As Character" ; + }; + MenuItem + { + _MenuItemFlags = MIB_RADIOCHECK ; + RadioCheck = TRUE ; + Identifier = FN_TOOL_ANKER_FRAME ; + Text [ en-US ] = "To Frame" ; + }; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/ribbar/workctrl.cxx b/sw/source/ui/ribbar/workctrl.cxx new file mode 100644 index 000000000000..c75cb3f0dfc4 --- /dev/null +++ b/sw/source/ui/ribbar/workctrl.cxx @@ -0,0 +1,943 @@ +/************************************************************************* + * + * 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_sw.hxx" + + + +#include <string> // HACK: prevent conflict between STLPORT and Workshop headers +#include <svl/eitem.hxx> +#include <svx/htmlmode.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/bindings.hxx> +#ifndef _SFX_IMAGEMGR_HXX +#include <sfx2/imagemgr.hxx> +#endif +#include <swmodule.hxx> +#ifndef _VIEW_HXX +#include <view.hxx> +#endif +#include <initui.hxx> +#include <viewopt.hxx> +#ifndef _DOCSH_HXX +#include <docsh.hxx> +#endif +#include <gloshdl.hxx> +#include <glosdoc.hxx> +#include <gloslst.hxx> +#include <workctrl.hxx> +#ifndef _WORKCTRL_HRC +#include <workctrl.hrc> +#endif +#ifndef _CMDID_H +#include <cmdid.h> +#endif +#ifndef _HELPID_H +#include <helpid.h> +#endif +#include <wrtsh.hxx> +#include <svl/imageitm.hxx> +#include <vcl/lstbox.hxx> +#include <rtl/ustring.hxx> +#include "swabstdlg.hxx" +#include <misc.hrc> + +#include <vcl/svapp.hxx> + +//JP 14.01.99: Size Abpruefung +#define NAVI_ENTRIES 20 +#if NAVI_ENTRIES != NID_COUNT +#error SwScrollNaviPopup-CTOR static Array falsche Size. Wurden neue IDs zugefuegt ?? +#endif + +using ::rtl::OUString; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::frame; + +SFX_IMPL_TOOLBOX_CONTROL( SwTbxInsertCtrl, SfxImageItem); +SFX_IMPL_TOOLBOX_CONTROL( SwTbxAutoTextCtrl, SfxBoolItem ); + +/********************************************************************** + +**********************************************************************/ +SwTbxInsertCtrl::SwTbxInsertCtrl( + USHORT nSlotId, + USHORT nId, + ToolBox& rTbx ) : + SfxToolBoxControl( nSlotId, nId, rTbx ), + nLastSlotId(FN_INSERT_CTRL == nSlotId ? FN_INSERT_TABLE : SID_INSERT_DIAGRAM) +{ + rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) ); +} +/********************************************************************** + +**********************************************************************/ +SwTbxInsertCtrl::~SwTbxInsertCtrl() +{ +} + +void SAL_CALL SwTbxInsertCtrl::update() throw (uno::RuntimeException) +{ + ToolBox& rTbx = GetToolBox(); + rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); + aSlotURL += rtl::OUString::valueOf( sal_Int32( nLastSlotId )); + Image aImage = GetImage( m_xFrame, + aSlotURL, + hasBigImages(), + rTbx.GetSettings().GetStyleSettings().GetHighContrastMode() ); + + rTbx.SetItemImage(GetId(), aImage); + rTbx.Invalidate(); + + SfxToolBoxControl::update(); +} + +/********************************************************************** + +**********************************************************************/ + + +void SwTbxInsertCtrl::StateChanged( USHORT /*nSID*/, + SfxItemState eState, + const SfxPoolItem* pState ) +{ + USHORT nId = GetId(); + GetToolBox().EnableItem( nId, (GetItemState(pState) != SFX_ITEM_DISABLED) ); + + if( eState == SFX_ITEM_AVAILABLE ) + { + const SfxImageItem* pItem = PTR_CAST( SfxImageItem, pState ); + if(pItem) + { + nLastSlotId = pItem->GetValue(); + if( nLastSlotId ) + nId = nLastSlotId; + + rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); + aSlotURL += rtl::OUString::valueOf( sal_Int32( nId )); + ToolBox& rBox = GetToolBox(); + Image aImage = GetImage( m_xFrame, + aSlotURL, + hasBigImages(), + rBox.GetSettings().GetStyleSettings().GetHighContrastMode() ); + rBox.SetItemImage(GetId(), aImage); + rBox.SetItemImageMirrorMode( GetId(), FALSE ); + rBox.SetItemImageAngle( GetId(), pItem->GetRotation() ); + rBox.SetItemImageMirrorMode( GetId(), pItem->IsMirrored() ); + } + } + +} +/********************************************************************** + +**********************************************************************/ + + +SfxPopupWindow* SwTbxInsertCtrl::CreatePopupWindow() +{ + if(GetSlotId() == FN_INSERT_CTRL) + { + OUString aToolBarResStr( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/insertbar" )); + createAndPositionSubToolBar( aToolBarResStr ); + } + else /* FN_INSERT_OBJ_CTRL */ + { + OUString aToolBarResStr( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/insertobjectbar" )); + createAndPositionSubToolBar( aToolBarResStr ); + } + return NULL; +} + +/********************************************************************** + +**********************************************************************/ + + +SfxPopupWindowType SwTbxInsertCtrl::GetPopupWindowType() const +{ + return nLastSlotId ? SFX_POPUPWINDOW_ONTIMEOUT : SFX_POPUPWINDOW_ONCLICK; +} + + +/********************************************************************** + +**********************************************************************/ + + +void SwTbxInsertCtrl::Select( BOOL /*bMod1*/ ) +{ + if( nLastSlotId ) + { + SfxViewShell* pCurSh( SfxViewShell::Current() ); + SfxDispatcher* pDispatch( 0 ); + + if ( pCurSh ) + { + SfxViewFrame* pViewFrame = pCurSh->GetViewFrame(); + if ( pViewFrame ) + pDispatch = pViewFrame->GetDispatcher(); + } + + if ( pDispatch ) + pDispatch->Execute(nLastSlotId); + } +} + +/********************************************************************** + +**********************************************************************/ + + +SwTbxAutoTextCtrl::SwTbxAutoTextCtrl( + USHORT nSlotId, + USHORT nId, + ToolBox& rTbx ) : + SfxToolBoxControl( nSlotId, nId, rTbx ), + pPopup(0), + pView(0) +{ + rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) ); +} +/********************************************************************** + +**********************************************************************/ + + +SwTbxAutoTextCtrl::~SwTbxAutoTextCtrl() +{ + DelPopup(); +} + +/********************************************************************** + +**********************************************************************/ + + +SfxPopupWindow* SwTbxAutoTextCtrl::CreatePopupWindow() +{ + pView = ::GetActiveView(); + if(pView && !pView->GetDocShell()->IsReadOnly() && + !pView->GetWrtShell().HasReadonlySel() ) + { + ToolBox& rBox = GetToolBox(); + + Rectangle aItemRect( rBox.GetItemRect( GetId() ) ); + Point aPt(rBox.OutputToScreenPixel(aItemRect.TopLeft())); + aPt.X() += aItemRect.GetWidth()/2; + aPt.Y() += aItemRect.GetHeight()/2; + if(pView) + { + Link aLnk = LINK(this, SwTbxAutoTextCtrl, PopupHdl); + + if (GetSlotId() == FN_INSERT_FIELD_CTRL) + { + pPopup = new PopupMenu(SW_RES(RID_INSERT_FIELD_CTRL)); + pPopup->SetSelectHdl(aLnk); + + if (::GetHtmlMode(pView->GetDocShell()) & HTMLMODE_ON) + { + pPopup->RemoveItem(pPopup->GetItemPos(FN_INSERT_FLD_PGCOUNT)); + pPopup->RemoveItem(pPopup->GetItemPos(FN_INSERT_FLD_TOPIC)); + } + } + else + { + pPopup = new PopupMenu; + SwGlossaryList* pGlossaryList = ::GetGlossaryList(); + USHORT nGroupCount = pGlossaryList->GetGroupCount(); + for(USHORT i = 1; i <= nGroupCount; i++) + { + // Gruppenname mit Pfad-Extension besorgen + String sTitle; + String sGroupName = pGlossaryList->GetGroupName(i - 1, FALSE, &sTitle); + USHORT nBlockCount = pGlossaryList->GetBlockCount(i -1); + if(nBlockCount) + { + USHORT nIndex = 100 * (i); + // aber ohne extension einfuegen + pPopup->InsertItem( i, sTitle);//sGroupName.GetToken(0, GLOS_DELIM)); + PopupMenu* pSub = new PopupMenu; + pSub->SetSelectHdl(aLnk); + pPopup->SetPopupMenu(i, pSub); + for(USHORT j = 0; j < nBlockCount; j++) + { + String sEntry; + String sLongName(pGlossaryList->GetBlockName(i - 1, j, sEntry)); + sEntry.AppendAscii(" - "); + sEntry += sLongName; + pSub->InsertItem(++nIndex, sEntry); + } + } + } + } + } + ToolBox* pToolBox = &GetToolBox(); + USHORT nId = GetId(); + pToolBox->SetItemDown( nId, TRUE ); + + pPopup->Execute( pToolBox, pToolBox->GetItemRect( nId ), + (pToolBox->GetAlign() == WINDOWALIGN_TOP || pToolBox->GetAlign() == WINDOWALIGN_BOTTOM) ? + POPUPMENU_EXECUTE_DOWN : POPUPMENU_EXECUTE_RIGHT ); + + pToolBox->SetItemDown( nId, FALSE ); + } + GetToolBox().EndSelection(); + DelPopup(); + return 0; + +} + + +/********************************************************************** + +**********************************************************************/ + + +SfxPopupWindowType SwTbxAutoTextCtrl::GetPopupWindowType() const +{ + return SFX_POPUPWINDOW_ONTIMEOUT; +} + +/********************************************************************** + +**********************************************************************/ + + +void SwTbxAutoTextCtrl::StateChanged( USHORT nSID, + SfxItemState eState, + const SfxPoolItem* pState ) +{ + GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SFX_ITEM_DISABLED) ); + if(FN_INSERT_FIELD_CTRL == nSID && eState >= SFX_ITEM_DEFAULT) + { + GetToolBox().CheckItem( GetId(), ((SfxBoolItem*)pState)->GetValue() ); + } +} + +/********************************************************************** + +**********************************************************************/ + + +IMPL_LINK(SwTbxAutoTextCtrl, PopupHdl, PopupMenu*, pMenu) +{ + USHORT nId = pMenu->GetCurItemId(); + + if ( GetSlotId() == FN_INSERT_FIELD_CTRL) + { + Sequence< PropertyValue > aArgs; + const char* pChar = 0; + switch(nId) + { + case FN_INSERT_FLD_DATE: + pChar = ".uno:InsertDateField"; + break; + case FN_INSERT_FLD_TIME: + pChar = ".uno:InsertTimeField"; + break; + case FN_INSERT_FLD_PGNUMBER: + pChar = ".uno:InsertPageNumberField"; + break; + case FN_INSERT_FLD_PGCOUNT: + pChar = ".uno:InsertPageCountField"; + break; + case FN_INSERT_FLD_TOPIC: + pChar = ".uno:InsertTopicField"; + break; + case FN_INSERT_FLD_TITLE: + pChar = ".uno:InsertTitleField"; + break; + case FN_INSERT_FLD_AUTHOR: + pChar = ".uno:InsertAuthorField"; + break; + default: + pChar = ".uno:InsertFieldCtrl"; + } + Dispatch( rtl::OUString::createFromAscii( pChar ),aArgs ); + } + else + { + USHORT nBlock = nId / 100; + + SwGlossaryList* pGlossaryList = ::GetGlossaryList(); + String sShortName; + String sGroup = pGlossaryList->GetGroupName(nBlock - 1, FALSE); + String sLongName(pGlossaryList->GetBlockName(nBlock - 1, nId - (100 * nBlock) - 1, sShortName)); + + SwGlossaryHdl* pGlosHdl = pView->GetGlosHdl(); + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!"); + ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc( DLG_RENAME_GLOS ); + if ( fnSetActGroup ) + (*fnSetActGroup)( sGroup ); + pGlosHdl->SetCurGroup(sGroup, TRUE); + pGlosHdl->InsertGlossary(sShortName); + } + return 0; +} + +/********************************************************************** + +**********************************************************************/ + + +void SwTbxAutoTextCtrl::DelPopup() +{ + if(pPopup) + { + if (GetSlotId() != FN_INSERT_FIELD_CTRL) + { + for( USHORT i = 0; i < pPopup->GetItemCount(); i ++ ) + { + PopupMenu* pSubPopup = pPopup->GetPopupMenu(pPopup->GetItemId(i)); + delete pSubPopup; + } + } + delete pPopup; + pPopup = 0; + } +} + +/*-----------------19.02.97 10.52------------------- + Navigations-Popup +--------------------------------------------------*/ +// determine the order of the toolbox items +static USHORT __READONLY_DATA aNavigationInsertIds[ NAVI_ENTRIES ] = +{ + // -- first line + NID_TBL, + NID_FRM, + NID_GRF, + NID_OLE, + NID_PGE, + NID_OUTL, + NID_MARK, + NID_DRW, + NID_CTRL, + NID_PREV, + // -- second line + NID_REG, + NID_BKM, + NID_SEL, + NID_FTN, + NID_POSTIT, + NID_SRCH_REP, + NID_INDEX_ENTRY, + NID_TABLE_FORMULA, + NID_TABLE_FORMULA_ERROR, + NID_NEXT +}; +static USHORT __READONLY_DATA aNavigationHelpIds[ NAVI_ENTRIES ] = +{ + // -- first line + HID_NID_TBL, + HID_NID_FRM, + HID_NID_GRF, + HID_NID_OLE, + HID_NID_PGE, + HID_NID_OUTL, + HID_NID_MARK, + HID_NID_DRW, + HID_NID_CTRL, + HID_NID_PREV, + // -- second line + HID_NID_REG, + HID_NID_BKM, + HID_NID_SEL, + HID_NID_FTN, + HID_NID_POSTIT, + HID_NID_SRCH_REP, + HID_NID_INDEX_ENTRY, + HID_NID_TABLE_FORMULA, + HID_NID_TABLE_FORMULA_ERROR, + HID_NID_NEXT +}; + +SwScrollNaviPopup::SwScrollNaviPopup( USHORT nId, const Reference< XFrame >& rFrame ) + : SfxPopupWindow(nId, rFrame, SW_RES(RID_SCROLL_NAVIGATION_WIN) ), + aToolBox(this, 0), + aSeparator(this, SW_RES(FL_SEP)), + aInfoField(this, SW_RES(FI_INFO)), + aIList(SW_RES(IL_VALUES)), + aIListH(SW_RES(ILH_VALUES)), + nFwdId(FN_START_OF_NEXT_PAGE), + nBackId(FN_START_OF_PREV_PAGE) +{ + USHORT i; + + aToolBox.SetHelpId(HID_NAVI_VS); + aToolBox.SetLineCount( 2 ); + aToolBox.SetOutStyle(TOOLBOX_STYLE_FLAT); + for( i = 0; i < NID_COUNT; i++) + { + USHORT nNaviId = aNavigationInsertIds[i]; + String sText; + ToolBoxItemBits nTbxBits = 0; + if((NID_PREV != nNaviId) && (NID_NEXT != nNaviId)) + { + // -2, there's no string for Next/Prev + USHORT nResStr = ST_TBL - 2 + nNaviId - NID_START; + sText = String(SW_RES(nResStr)); + nTbxBits = TIB_CHECKABLE; + } + aToolBox.InsertItem(nNaviId, sText, nTbxBits); + aToolBox.SetHelpId( nNaviId, aNavigationHelpIds[i] ); + } + ApplyImageList(); + aToolBox.InsertBreak(NID_COUNT/2); + // don't call it before! + FreeResource(); + + // these are global strings + for( i = 0; i < 2 * NID_COUNT; i++) + { + sQuickHelp[i] = String(SW_RES(STR_IMGBTN_START + i)); + } + + Size aImgSize = aIList.GetImageSize(); + aImgSize.Width() += 5; + aImgSize.Height() += 5; + Size aSz = aToolBox.CalcWindowSizePixel(2); + aToolBox.SetPosSizePixel( Point(), aSz ); + USHORT nItemId = SwView::GetMoveType(); + aInfoField.SetText(aToolBox.GetItemText(nItemId)); + aToolBox.CheckItem( nItemId, sal_True ); + Size aFTSize(aInfoField.GetSizePixel()); + Size aSepSize(aSeparator.GetSizePixel()); + aSepSize.Width() = aSz.Width(); + + aSz.Height() += aFTSize.Height() + aSepSize.Height(); + aInfoField.SetPosSizePixel( + Point(0, aSz.Height() - aFTSize.Height()), Size(aSz.Width(), aFTSize.Height())); + + aSeparator.SetSizePixel(aSepSize); + aSeparator.SetPosPixel(Point(0, aSz.Height() - aFTSize.Height() - aSepSize.Height())); + + SetOutputSizePixel(aSz); + aToolBox.SetSelectHdl(LINK(this, SwScrollNaviPopup, SelectHdl)); + aToolBox.StartSelection(); + aToolBox.Show(); +} +/*-----------------19.02.97 12.45------------------- + +--------------------------------------------------*/ + +SwScrollNaviPopup::~SwScrollNaviPopup() +{ +} +/* -----------------------------08.05.2002 14:00------------------------------ + + ---------------------------------------------------------------------------*/ +void SwScrollNaviPopup::DataChanged( const DataChangedEvent& rDCEvt ) +{ + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && + (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + ApplyImageList(); + + Window::DataChanged( rDCEvt ); +} +/* -----------------------------08.05.2002 14:02------------------------------ + + ---------------------------------------------------------------------------*/ +void SwScrollNaviPopup::ApplyImageList() +{ + ImageList& rImgLst = aToolBox.GetSettings().GetStyleSettings().GetHighContrastMode() ? + aIListH : aIList; + for(USHORT i = 0; i < NID_COUNT; i++) + { + USHORT nNaviId = aNavigationInsertIds[i]; + aToolBox.SetItemImage(nNaviId, rImgLst.GetImage(nNaviId)); + } +} +/*-----------------19.02.97 13.58------------------- + +--------------------------------------------------*/ + +SfxPopupWindow* SwScrollNaviPopup::Clone() const +{ + return new SwScrollNaviPopup( GetId(), GetFrame() ); +} + +/*-----------------19.02.97 14.10------------------- + +--------------------------------------------------*/ + +IMPL_LINK(SwScrollNaviPopup, SelectHdl, ToolBox*, pSet) +{ + USHORT nSet = pSet->GetCurItemId(); + if( nSet != NID_PREV && nSet != NID_NEXT ) + { + SwView::SetMoveType(nSet); + aToolBox.SetItemText(NID_NEXT, sQuickHelp[nSet - NID_START]); + aToolBox.SetItemText(NID_PREV, sQuickHelp[nSet - NID_START + NID_COUNT]); + aInfoField.SetText(aToolBox.GetItemText(nSet)); + //check the current button only + for(USHORT i = 0; i < NID_COUNT; i++) + { + USHORT nItemId = aToolBox.GetItemId( i ); + aToolBox.CheckItem( nItemId, nItemId == nSet ); + } + } + else + { + SfxBoolItem aNext(FN_SCROLL_NEXT_PREV, NID_NEXT == nSet); + Any a; + Sequence< PropertyValue > aArgs( 1 ); + aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollNextPrev" )); + aNext.QueryValue( a ); + aArgs[0].Value = a; + SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ScrollNextPrev" )), + aArgs ); + } + return 0; +} +/*-----------------23.02.97 18.21------------------- + +--------------------------------------------------*/ + +void SwScrollNaviToolBox::MouseButtonUp( const MouseEvent& rMEvt ) +{ + ToolBox::MouseButtonUp(rMEvt); + if ( ((SwScrollNaviPopup*)GetParent())->IsInPopupMode() ) + ((SwScrollNaviPopup*)GetParent())->EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL ); +} + +/*-----------------20.06.97 13:28------------------- + +--------------------------------------------------*/ +void SwScrollNaviToolBox::RequestHelp( const HelpEvent& rHEvt ) +{ + SetItemText(NID_NEXT, SwScrollNaviPopup::GetQuickHelpText(TRUE)); + SetItemText(NID_PREV, SwScrollNaviPopup::GetQuickHelpText(FALSE)); + ToolBox::RequestHelp( rHEvt ); + +} + +/*-----------------20.06.97 13:41------------------- + +--------------------------------------------------*/ +String SwScrollNaviPopup::GetQuickHelpText(BOOL bNext) +{ + USHORT nResId = STR_IMGBTN_START; + nResId += SwView::GetMoveType() - NID_START; + if(!bNext) + nResId += NID_COUNT; + return String(SW_RES(nResId)); +} +/* -----------------------------05.09.2002 13:53------------------------------ + + ---------------------------------------------------------------------------*/ +void SwNaviImageButton::Click() +{ +// SfxBindings& rBind = SfxViewFrame::Current()->GetBindings(); +// rBind.ENTERREGISTRATIONS(); + pPopup = new + SwScrollNaviPopup( FN_SCROLL_NAVIGATION, + m_xFrame ); +// rBind.LEAVEREGISTRATIONS(); + Point aPos = OutputToScreenPixel(Point(0,0)); + Rectangle aRect(aPos, GetSizePixel()); + SetPopupWindow( pPopup ); + pPopup->StartPopupMode(aRect, FLOATWIN_POPUPMODE_LEFT|FLOATWIN_POPUPMODE_ALLOWTEAROFF); +} + +//-------------------------------------------------------------------- + +void SwNaviImageButton::SetPopupWindow( SfxPopupWindow* pWindow ) +{ + pPopupWindow = pWindow; + pPopupWindow->SetPopupModeEndHdl( LINK( this, SwNaviImageButton, PopupModeEndHdl )); + pPopupWindow->SetDeleteLink_Impl( LINK( this, SwNaviImageButton, ClosePopupWindow )); +} + +//-------------------------------------------------------------------- + +IMPL_LINK( SwNaviImageButton, PopupModeEndHdl, void *, EMPTYARG ) +{ + if ( pPopupWindow->IsVisible() ) + { + // Replace floating window with popup window and destroy + // floating window instance. + delete pFloatingWindow; + pFloatingWindow = pPopupWindow; + pPopupWindow = 0; + } + else + { + // Popup window has been closed by the user. No replacement, instance + // will destroy itself. + pPopupWindow = 0; + } + + return 1; +} + +//-------------------------------------------------------------------- +IMPL_LINK( SwNaviImageButton, ClosePopupWindow, SfxPopupWindow *, pWindow ) +{ + if ( pWindow == pFloatingWindow ) + pFloatingWindow = 0; + else + pPopupWindow = 0; + + return 1; +} + +/*-----------------21.02.97 09:41------------------- + +--------------------------------------------------*/ + +void SwHlpImageButton::RequestHelp( const HelpEvent& rHEvt ) +{ + + SetQuickHelpText(SwScrollNaviPopup::GetQuickHelpText(!bUp)); + + ImageButton::RequestHelp(rHEvt); +} + +/*-----------------25.02.97 12:38------------------- + +--------------------------------------------------*/ + +SwNaviImageButton::SwNaviImageButton( + Window* pParent, + const Reference< XFrame >& rFrame ) : + ImageButton(pParent, SW_RES(BTN_NAVI)), + pPopup(0), + aImage(SW_RES(IMG_BTN)), + aImageH(SW_RES(IMG_BTN_H)), + sQuickText(SW_RES(ST_QUICK)), + pPopupWindow(0), + pFloatingWindow(0), + m_xFrame( rFrame ) +{ + FreeResource(); + SetStyle(GetStyle()|WB_NOPOINTERFOCUS); + SetQuickHelpText(sQuickText); + SetModeImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? aImageH : aImage); +} +/* -----------------------------2002/07/05 9:41------------------------------- + + ---------------------------------------------------------------------------*/ +void SwNaviImageButton::DataChanged( const DataChangedEvent& rDCEvt ) +{ + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && + (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + SetModeImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? aImageH : aImage); + + Window::DataChanged( rDCEvt ); +} +/* -----------------26.11.2002 09:28----------------- + * + * --------------------------------------------------*/ +class SwZoomBox_Impl : public ComboBox +{ + USHORT nSlotId; + BOOL bRelease; + uno::Reference< frame::XDispatchProvider > m_xDispatchProvider; + +public: + SwZoomBox_Impl( + Window* pParent, + USHORT nSlot, + const Reference< XDispatchProvider >& rDispatchProvider ); + ~SwZoomBox_Impl(); + +protected: + virtual void Select(); + virtual long Notify( NotifyEvent& rNEvt ); + + void ReleaseFocus(); + +}; +/* -----------------26.11.2002 09:29----------------- + * + * --------------------------------------------------*/ +SwZoomBox_Impl::SwZoomBox_Impl( + Window* pParent, + USHORT nSlot, + const Reference< XDispatchProvider >& rDispatchProvider ): + ComboBox( pParent, SW_RES(RID_PVIEW_ZOOM_LB)), + nSlotId(nSlot), + bRelease(TRUE), + m_xDispatchProvider( rDispatchProvider ) +{ + EnableAutocomplete( FALSE ); + USHORT aZoomValues[] = + { 25, 50, 75, 100, 150, 200 }; + for(USHORT i = 0; i < sizeof(aZoomValues)/sizeof(USHORT); i++) + { + String sEntry = String::CreateFromInt32(aZoomValues[i]); + sEntry += '%'; + InsertEntry(sEntry); + } +} +/* -----------------26.11.2002 09:29----------------- + * + * --------------------------------------------------*/ +SwZoomBox_Impl::~SwZoomBox_Impl() +{} +/* -----------------26.11.2002 09:34----------------- + * + * --------------------------------------------------*/ +void SwZoomBox_Impl::Select() +{ + if ( !IsTravelSelect() ) + { + String sEntry(GetText()); + sEntry.EraseAllChars( '%' ); + USHORT nZoom = (USHORT)sEntry.ToInt32(); + if(nZoom < MINZOOM) + nZoom = MINZOOM; + if(nZoom > MAXZOOM) + nZoom = MAXZOOM; + + SfxUInt16Item aItem( nSlotId, nZoom ); + if ( FN_PREVIEW_ZOOM == nSlotId ) + { + Any a; + Sequence< PropertyValue > aArgs( 1 ); + aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreviewZoom" )); + aItem.QueryValue( a ); + aArgs[0].Value = a; + SfxToolBoxControl::Dispatch( + m_xDispatchProvider, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PreviewZoom" )), + aArgs ); + } + + ReleaseFocus(); + } +} +/* -----------------02.12.2002 07:49----------------- + * + * --------------------------------------------------*/ +long SwZoomBox_Impl::Notify( NotifyEvent& rNEvt ) +{ + long nHandled = 0; + + if ( rNEvt.GetType() == EVENT_KEYINPUT ) + { + USHORT nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); + + switch ( nCode ) + { + case KEY_RETURN: + case KEY_TAB: + { + if ( KEY_TAB == nCode ) + bRelease = FALSE; + else + nHandled = 1; + Select(); + break; + } + + case KEY_ESCAPE: + SetText( GetSavedValue() ); + ReleaseFocus(); + break; + } + } + else if ( EVENT_LOSEFOCUS == rNEvt.GetType() ) + { + Window* pFocusWin = Application::GetFocusWindow(); + if ( !HasFocus() && GetSubEdit() != pFocusWin ) + SetText( GetSavedValue() ); + } + + return nHandled ? nHandled : ComboBox::Notify( rNEvt ); +} +/* -----------------02.12.2002 07:51----------------- + * + * --------------------------------------------------*/ +void SwZoomBox_Impl::ReleaseFocus() +{ + if ( !bRelease ) + { + bRelease = TRUE; + return; + } + SfxViewShell* pCurSh = SfxViewShell::Current(); + + if ( pCurSh ) + { + Window* pShellWnd = pCurSh->GetWindow(); + + if ( pShellWnd ) + pShellWnd->GrabFocus(); + } +} + +/* -----------------26.11.2002 09:29----------------- + * + * --------------------------------------------------*/ +SFX_IMPL_TOOLBOX_CONTROL( SwPreviewZoomControl, SfxUInt16Item); + +SwPreviewZoomControl::SwPreviewZoomControl( + USHORT nSlotId, + USHORT nId, + ToolBox& rTbx) : + SfxToolBoxControl( nSlotId, nId, rTbx ) +{ +} +/* -----------------26.11.2002 09:29----------------- + * + * --------------------------------------------------*/ +SwPreviewZoomControl::~SwPreviewZoomControl() +{ +} +/* -----------------26.11.2002 09:29----------------- + * + * --------------------------------------------------*/ +void SwPreviewZoomControl::StateChanged( USHORT /*nSID*/, + SfxItemState eState, + const SfxPoolItem* pState ) +{ + USHORT nId = GetId(); + GetToolBox().EnableItem( nId, (GetItemState(pState) != SFX_ITEM_DISABLED) ); + SwZoomBox_Impl* pBox = (SwZoomBox_Impl*)GetToolBox().GetItemWindow( GetId() ); + if(SFX_ITEM_AVAILABLE <= eState) + { + String sZoom(String::CreateFromInt32(((const SfxUInt16Item*)pState)->GetValue())); + sZoom += '%'; + pBox->SetText(sZoom); + pBox->SaveValue(); + } +} +/* -----------------26.11.2002 09:29----------------- + * + * --------------------------------------------------*/ +Window* SwPreviewZoomControl::CreateItemWindow( Window *pParent ) +{ + SwZoomBox_Impl* pRet = new SwZoomBox_Impl( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY )); + return pRet; +} diff --git a/sw/source/ui/ribbar/workctrl.hrc b/sw/source/ui/ribbar/workctrl.hrc new file mode 100644 index 000000000000..5e5180f363aa --- /dev/null +++ b/sw/source/ui/ribbar/workctrl.hrc @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ +#ifndef _WORKCTRL_HRC +#define _WORKCTRL_HRC +#include "ribbar.hrc" + +#define TBX_INSERT 1 +#define TBX_OBJ_INSERT 2 +#define TBX_FIELD_INSERT 3 +#define TBX_NAVIGATION 4 +#define IL_VALUES 5 +#define IMG_BTN 6 +#define ST_QUICK 7 +#define FI_INFO 8 +#define FL_SEP 9 +#define ILH_VALUES 10 +#define IMG_BTN_H 11 + + +#define ST_TBL 12 +#define ST_FRM 13 +#define ST_PGE 14 +#define ST_DRW 15 +#define ST_CTRL 16 +#define ST_REG 17 +#define ST_BKM 18 +#define ST_GRF 19 +#define ST_OLE 20 +#define ST_OUTL 21 +#define ST_SEL 22 +#define ST_FTN 23 +#define ST_MARK 24 +#define ST_POSTIT 25 +#define ST_SRCH_REP 26 +#define ST_INDEX_ENTRY 27 +#define ST_TABLE_FORMULA 28 +#define ST_TABLE_FORMULA_ERROR 29 + +// doppelter Eintrag! hrc und hxx +// diese Ids bestimmen, was die Buttons unter dem Scrollbar tun +#define NID_START 20000 +#define NID_NEXT 20000 +#define NID_PREV 20001 +#define NID_TBL 20002 +#define NID_FRM 20003 +#define NID_PGE 20004 +#define NID_DRW 20005 +#define NID_CTRL 20006 +#define NID_REG 20007 +#define NID_BKM 20008 +#define NID_GRF 20009 +#define NID_OLE 20010 +#define NID_OUTL 20011 +#define NID_SEL 20012 +#define NID_FTN 20013 +#define NID_MARK 20014 +#define NID_POSTIT 20015 +#define NID_SRCH_REP 20016 +#define NID_INDEX_ENTRY 20017 +#define NID_TABLE_FORMULA 20018 +#define NID_TABLE_FORMULA_ERROR 20019 +#define NID_COUNT 20 + +#endif diff --git a/sw/source/ui/ribbar/workctrl.src b/sw/source/ui/ribbar/workctrl.src new file mode 100644 index 000000000000..93681f526502 --- /dev/null +++ b/sw/source/ui/ribbar/workctrl.src @@ -0,0 +1,596 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef _SVXIDS_HRC +#include <svx/svxids.hrc> +#endif +#ifndef _GLOBLMN_HRC +#include <svx/globlmn.hrc> +#endif +#include "workctrl.hrc" +#include "workctrl.hrc" +#include "helpid.h" +#include "cmdid.h" +FloatingWindow RID_INSERT_CTRL +{ + Moveable = TRUE ; + Closeable = TRUE ; + Hide = TRUE ; + SVLook = TRUE ; + HelpID = HID_INSERT_CTRL ; + /* ### ACHTUNG: Neuer Text in Resource? Einfügen : Einf³gen */ + ToolBox TBX_INSERT + { + MenuStrings = TRUE ; + SVLook = TRUE ; + HelpID = 1 ; + ItemList = + { + ToolBoxItem + { + Identifier = FN_INSERT_FRAME_INTERACT_NOCOL ; + HelpID = FN_INSERT_FRAME_INTERACT_NOCOL ; + }; + ToolBoxItem + { + Identifier = FN_INSERT_FRAME_INTERACT ; + HelpID = FN_INSERT_FRAME_INTERACT ; + DropDown = TRUE ; + }; + ToolBoxItem + { + Identifier = SID_INSERT_GRAPHIC ; + HelpID = SID_INSERT_GRAPHIC ; + }; + ToolBoxItem + { + Identifier = FN_INSERT_TABLE ; + HelpID = FN_INSERT_TABLE ; + DropDown = TRUE ; + }; + ToolBoxItem + { + Identifier = SID_INSERTDOC ; + HelpID = SID_INSERTDOC ; + }; + ToolBoxItem + { + Identifier = FN_INSERT_FOOTNOTE ; + HelpID = FN_INSERT_FOOTNOTE ; + }; + ToolBoxItem + { + Identifier = FN_INSERT_ENDNOTE ; + HelpID = FN_INSERT_ENDNOTE ; + }; + ToolBoxItem + { + Identifier = FN_INSERT_SYMBOL ; + HelpID = FN_INSERT_SYMBOL ; + }; + ToolBoxItem + { + Identifier = FN_INSERT_REGION ; + HelpID = FN_INSERT_REGION; + DropDown = TRUE ; + }; + ToolBoxItem + { + Identifier = FN_INSERT_IDX_ENTRY_DLG ; + HelpID = FN_INSERT_IDX_ENTRY_DLG ; + }; + ToolBoxItem + { + Identifier = FN_INSERT_BOOKMARK ; + HelpID = FN_INSERT_BOOKMARK ; + RadioCheck = TRUE ; + }; + }; + }; + Text [ en-US ] = "Insert" ; +}; +FloatingWindow RID_INSERT_OBJ_CTRL +{ + Moveable = TRUE ; + Closeable = TRUE ; + Hide = TRUE ; + SVLook = TRUE ; + HelpID = HID_INSERT_OBJ_CTRL ; + /* ### ACHTUNG: Neuer Text in Resource? Objekt einfügen : Objekt einf³gen */ + ToolBox TBX_OBJ_INSERT + { + MenuStrings = TRUE ; + SVLook = TRUE ; + HelpID = 1 ; + ItemList = + { + ToolBoxItem + { + Identifier = SID_INSERT_DIAGRAM ; + HelpID = SID_INSERT_DIAGRAM ; + }; + ToolBoxItem + { + Identifier = FN_INSERT_SMA ; + HelpID = FN_INSERT_SMA ; + }; + ToolBoxItem + { + Identifier = SID_INSERT_FLOATINGFRAME ; + HelpID = SID_INSERT_FLOATINGFRAME ; + }; + ToolBoxItem + { + Identifier = SID_INSERT_OBJECT ; + HelpID = SID_INSERT_OBJECT ; + }; + ToolBoxItem + { + Identifier = SID_INSERT_PLUGIN ; + HelpID = SID_INSERT_PLUGIN ; + }; +#ifdef SOLAR_JAVA + ToolBoxItem + { + Identifier = SID_INSERT_APPLET ; + HelpID = SID_INSERT_APPLET ; + }; +#endif + }; + }; + Text [ en-US ] = "Insert Object" ; +}; +Menu RID_INSERT_FIELD_CTRL +{ + ItemList = + { + MenuItem + { + Identifier = FN_INSERT_FLD_DATE ; + HelpID = FN_INSERT_FLD_DATE ; + Text [ en-US ] = "Date" ; + }; + MenuItem + { + Identifier = FN_INSERT_FLD_TIME ; + HelpID = FN_INSERT_FLD_TIME ; + Text [ en-US ] = "Time" ; + }; + //#ifndef MN_SW_WEB + MenuItem + { + Identifier = FN_INSERT_FLD_PGNUMBER ; + HelpID = FN_INSERT_FLD_PGNUMBER ; + Text [ en-US ] = "Page Number" ; + }; + MenuItem + { + Identifier = FN_INSERT_FLD_PGCOUNT ; + HelpID = FN_INSERT_FLD_PGCOUNT ; + Text [ en-US ] = "Page Count" ; + }; + MenuItem + { + Identifier = FN_INSERT_FLD_TOPIC ; + HelpID = FN_INSERT_FLD_TOPIC ; + Text [ en-US ] = "Subject" ; + }; + MenuItem + { + Identifier = FN_INSERT_FLD_TITLE ; + HelpID = FN_INSERT_FLD_TITLE ; + Text [ en-US ] = "Title" ; + }; + //#endif + MenuItem + { + Identifier = FN_INSERT_FLD_AUTHOR ; + HelpID = FN_INSERT_FLD_AUTHOR ; + Text [ en-US ] = "Author" ; + }; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + Identifier = FN_INSERT_FIELD ; + HelpID = FN_INSERT_FIELD ; + Text [ en-US ] = "Other..." ; + }; + }; +}; +#define SCROLL_IMAGE_IDLIST \ + IdList = \ + { \ + NID_NEXT ; \ + NID_PREV ; \ + NID_TBL ; \ + NID_FRM ; \ + NID_PGE ; \ + NID_DRW ; \ + NID_CTRL ; \ + NID_REG ; \ + NID_BKM ; \ + NID_GRF ; \ + NID_OLE ; \ + NID_OUTL ; \ + NID_SEL ; \ + NID_FTN ; \ + NID_MARK ; \ + NID_POSTIT ; \ + NID_SRCH_REP ; \ + NID_INDEX_ENTRY; \ + NID_TABLE_FORMULA; \ + NID_TABLE_FORMULA_ERROR; \ + }; \ + IdCount = { 20 ; }; + +FloatingWindow RID_SCROLL_NAVIGATION_WIN +{ + Moveable = TRUE ; + Closeable = TRUE ; + Hide = TRUE ; + SVLook = TRUE ; + HelpID = HID_INSERT_CTRL ; + ImageList IL_VALUES + { + Prefix = "sr"; + MaskColor = IMAGE_MASK_COLOR ; + SCROLL_IMAGE_IDLIST + }; + ImageList ILH_VALUES + { + Prefix = "srh"; + MaskColor = IMAGE_MASK_COLOR ; + SCROLL_IMAGE_IDLIST + }; + FixedLine FL_SEP + { + //no position, no text + Size = MAP_APPFONT ( 20 , 4 ) ; + }; + FixedText FI_INFO + { + //no position, no text + Size = MAP_APPFONT ( 20 , 8 ) ; + Center = TRUE; + }; + String ST_TBL + { + Text [ en-US ] = "Table" ; + }; + String ST_FRM + { + Text [ en-US ] = "Text Frame" ; + }; + String ST_PGE + { + Text [ en-US ] = "Page" ; + }; + String ST_DRW + { + Text [ en-US ] = "Drawing" ; + }; + String ST_CTRL + { + Text [ en-US ] = "Control" ; + }; + String ST_REG + { + Text [ en-US ] = "Section" ; + }; + String ST_BKM + { + Text [ en-US ] = "Bookmark" ; + }; + String ST_GRF + { + Text [ en-US ] = "Graphics" ; + }; + String ST_OLE + { + Text [ en-US ] = "OLE object" ; + }; + String ST_OUTL + { + /* ### ACHTUNG: Neuer Text in Resource? Überschrift : šberschrift */ + Text [ en-US ] = "Headings" ; + }; + String ST_SEL + { + Text [ en-US ] = "Selection" ; + }; + String ST_FTN + { + /* ### ACHTUNG: Neuer Text in Resource? Fußnote : Fu˜note */ + Text [ en-US ] = "Footnote" ; + }; + String ST_MARK + { + Text [ en-US ] = "Reminder" ; + }; + String ST_POSTIT + { + Text [ en-US ] = "Note" ; + }; + String ST_SRCH_REP + { + Text [ en-US ] = "Repeat search" ; + }; + String ST_INDEX_ENTRY + { + Text [ en-US ] = "Index entry"; + }; + String ST_TABLE_FORMULA + { + Text [ en-US ] = "Table formula"; + }; + String ST_TABLE_FORMULA_ERROR + { + Text [ en-US ] = "Wrong table formula"; + }; + Text [ en-US ] = "Navigation" ; +}; +/* +Noch ein paar Reserven + ToolBoxItem + { + Identifier = NID_NEXT; + Text = "Vorwärts" ; + }; + ToolBoxItem + { + Identifier = NID_PREV; + Text = "Rückwärts" ; + }; + ToolBoxItem + { + Identifier = NID_CTRL; + Text = "Control" ; + }; + ToolBoxItem + { + Identifier = NID_DRW; + Text = "Zeichenobjekt" ; + }; + + +*/ +/*************************************************************** + Strings fuer die Quickhelp der View-PgUp/Down-Buttons +***************************************************************/ +String STR_IMGBTN_NEXT_DOWN +{ + Text = "" ; +}; +String STR_IMGBTN_PREV_DOWN +{ + Text = "" ; +}; +String STR_IMGBTN_TBL_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächste Tabelle : Nõchste Tabelle */ + Text [ en-US ] = "Next table" ; +}; +String STR_IMGBTN_FRM_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächster Textrahmen : Nõchster Textrahmen */ + Text [ en-US ] = "Next text frame" ; +}; +String STR_IMGBTN_PGE_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächste Seite : Nõchste Seite */ + Text [ en-US ] = "Next page" ; +}; +String STR_IMGBTN_DRW_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächstes Zeichenobjekt : Nõchstes Zeichenobjekt */ + Text [ en-US ] = "Next drawing" ; +}; +String STR_IMGBTN_CTRL_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächstes Kontrollfeld : Nõchstes Kontrollfeld */ + Text [ en-US ] = "Next control" ; +}; +String STR_IMGBTN_REG_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächster Bereich : Nõchster Bereich */ + Text [ en-US ] = "Next section" ; +}; +String STR_IMGBTN_BKM_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächste Textmarke : Nõchste Textmarke */ + Text [ en-US ] = "Next bookmark" ; +}; +String STR_IMGBTN_GRF_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächste Grafik : Nõchste Grafik */ + Text [ en-US ] = "Next graphic" ; +}; +String STR_IMGBTN_OLE_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächstes OLE-Objekt : Nächstes OLE object */ + /* ### ACHTUNG: Neuer Text in Resource? Nächstes OLE-Objekt : Nõchstes OLE-Objekt */ + Text [ en-US ] = "Next OLE object" ; +}; +String STR_IMGBTN_OUTL_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächste Überschrift : Nõchste šberschrift */ + Text [ en-US ] = "Next heading" ; +}; +String STR_IMGBTN_SEL_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächste Markierung : Nõchste Markierung */ + Text [ en-US ] = "Next selection" ; +}; +String STR_IMGBTN_FTN_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächste Fußnote : Nõchste Fu˜note */ + Text [ en-US ] = "Next footnote" ; +}; +String STR_IMGBTN_MARK_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächster Merker : Nõchster Merker */ + Text [ en-US ] = "Next Reminder" ; +}; +String STR_IMGBTN_POSTIT_DOWN +{ + /* ### ACHTUNG: Neuer Text in Resource? Nächste Notiz : Nõchste Notiz */ + Text [ en-US ] = "Next Note" ; +}; +String STR_IMGBTN_SRCH_REP_DOWN +{ + Text [ en-US ] = "Continue search forward" ; +}; +String STR_IMGBTN_INDEX_ENTRY_DOWN +{ + Text [ en-US ] = "Next index entry"; +}; +String STR_IMGBTN_NEXT_UP +{ + Text = "" ; +}; +String STR_IMGBTN_PREV_UP +{ + Text = "" ; +}; +String STR_IMGBTN_TBL_UP +{ + Text [ en-US ] = "Previous table" ; +}; +String STR_IMGBTN_FRM_UP +{ + Text [ en-US ] = "Previous text frame" ; +}; +String STR_IMGBTN_PGE_UP +{ + Text [ en-US ] = "Previous page" ; +}; +String STR_IMGBTN_DRW_UP +{ + Text [ en-US ] = "Previous drawing" ; +}; +String STR_IMGBTN_CTRL_UP +{ + Text [ en-US ] = "Previous control" ; +}; +String STR_IMGBTN_REG_UP +{ + Text [ en-US ] = "Previous section" ; +}; +String STR_IMGBTN_BKM_UP +{ + Text [ en-US ] = "Previous bookmark" ; +}; +String STR_IMGBTN_GRF_UP +{ + Text [ en-US ] = "Previous graphic" ; +}; +String STR_IMGBTN_OLE_UP +{ + /* ### ACHTUNG: Neuer Text in Resource? Voriges OLE-Objekt : Voriges OLE object */ + Text [ en-US ] = "Previous OLE object" ; +}; +String STR_IMGBTN_OUTL_UP +{ + /* ### ACHTUNG: Neuer Text in Resource? Vorige Überschrift : Vorige šberschrift */ + Text [ en-US ] = "Previous heading" ; +}; +String STR_IMGBTN_SEL_UP +{ + Text [ en-US ] = "Previous selection" ; +}; +String STR_IMGBTN_FTN_UP +{ + /* ### ACHTUNG: Neuer Text in Resource? Vorige Fußnote : Vorige Fu˜note */ + Text [ en-US ] = "Previous footnote" ; +}; +String STR_IMGBTN_MARK_UP +{ + Text [ en-US ] = "Previous Reminder" ; +}; +String STR_IMGBTN_POSTIT_UP +{ + Text [ en-US ] = "Previous Note" ; +}; +String STR_IMGBTN_SRCH_REP_UP +{ + Text [ en-US ] = "Continue search backwards" ; +}; +String STR_IMGBTN_INDEX_ENTRY_UP +{ + Text [ en-US ] = "Previous index entry"; +}; +String STR_IMGBTN_TBLFML_UP +{ + Text [ en-US ] = "Previous table formula"; +}; +String STR_IMGBTN_TBLFML_DOWN +{ + Text [ en-US ] = "Next table formula"; +}; +String STR_IMGBTN_TBLFML_ERR_UP +{ + Text [ en-US ] = "Previous faulty table formula"; +}; +String STR_IMGBTN_TBLFML_ERR_DOWN +{ + Text [ en-US ] = "Next faulty table formula"; +}; +ImageButton BTN_NAVI +{ + HelpID = HID_NAVIGATION_IMGBTN ; + SVLOOK = TRUE ; + HIDE = TRUE ; + RectStyle = TRUE ; + SmallStyle = TRUE ; + Image IMG_BTN + { + ImageBitmap = Bitmap { File = "punkt.bmp" ; }; + MaskColor = IMAGE_MASK_COLOR ; + }; + Image IMG_BTN_H + { + ImageBitmap = Bitmap { File = "punkt_h.bmp" ; }; + MaskColor = IMAGE_MASK_COLOR ; + }; + String ST_QUICK + { + Text [ en-US ] = "Navigation" ; + }; +}; +ComboBox RID_PVIEW_ZOOM_LB +{ + HelpId = HID_PVIEW_ZOOM_LB; + Size = MAP_APPFONT ( 30 , 86 ) ; + DropDown = TRUE ; + AutoHScroll = TRUE ; + DDExtraWidth = TRUE ; + Border = TRUE ; + Hide = TRUE ; +}; |