diff options
Diffstat (limited to 'sw/source/uibase/ribbar')
-rw-r--r-- | sw/source/uibase/ribbar/conarc.cxx | 102 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/concustomshape.cxx | 196 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/conform.cxx | 110 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/conpoly.cxx | 107 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/conrect.cxx | 188 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/drawbase.cxx | 623 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/dselect.cxx | 72 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/inputwin.cxx | 636 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/inputwin.hrc | 61 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/inputwin.src | 290 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/tblctrl.cxx | 55 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/tbxanchr.cxx | 124 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.cxx | 775 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.hrc | 73 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.src | 382 |
15 files changed, 3794 insertions, 0 deletions
diff --git a/sw/source/uibase/ribbar/conarc.cxx b/sw/source/uibase/ribbar/conarc.cxx new file mode 100644 index 000000000000..ad4be6f06465 --- /dev/null +++ b/sw/source/uibase/ribbar/conarc.cxx @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <svx/svdobj.hxx> + +#include "view.hxx" +#include "edtwin.hxx" +#include "wrtsh.hxx" +#include "drawbase.hxx" +#include "conarc.hxx" + +ConstArc::ConstArc(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) + : SwDrawBase(pWrtShell, pEditWin, pSwView), nAnzButUp(0) +{ +} + +bool ConstArc::MouseButtonDown( const MouseEvent& rMEvt ) +{ + bool bReturn; + + if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt))) + { + if (!nAnzButUp) + aStartPnt = m_pWin->PixelToLogic(rMEvt.GetPosPixel()); + } + return (bReturn); +} + +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) // Generating of circular arc finished + { + SwDrawBase::MouseButtonUp(rMEvt); + nAnzButUp = 0; + bReturn = true; + } + else + m_pSh->EndCreate(SDRCREATE_NEXTPOINT); + } + } + + return (bReturn); +} + +void ConstArc::Activate(const sal_uInt16 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); +} + +void ConstArc::Deactivate() +{ + nAnzButUp = 0; + + SwDrawBase::Deactivate(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/concustomshape.cxx b/sw/source/uibase/ribbar/concustomshape.cxx new file mode 100644 index 000000000000..9b3a5dfa7b89 --- /dev/null +++ b/sw/source/uibase/ribbar/concustomshape.cxx @@ -0,0 +1,196 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sfx2/bindings.hxx> +#include <sfx2/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 <concustomshape.hxx> +#include <svx/gallery.hxx> +#include <sfx2/request.hxx> +#include <svx/fmmodel.hxx> +#include <svl/itempool.hxx> +#include <svx/svdpage.hxx> +#include <svx/svdoashp.hxx> +#include <editeng/adjustitem.hxx> + +#include <math.h> + +ConstCustomShape::ConstCustomShape( SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView, SfxRequest& rReq ) + : SwDrawBase( pWrtShell, pEditWin, pSwView ) +{ + aCustomShape = ConstCustomShape::GetShapeTypeFromRequest( rReq ); +} + +OUString ConstCustomShape::GetShapeType() const +{ + return aCustomShape; +} + +OUString ConstCustomShape::GetShapeTypeFromRequest( SfxRequest& rReq ) +{ + OUString aRet; + const SfxItemSet* pArgs = rReq.GetArgs(); + if ( pArgs ) + { + const SfxStringItem& rItm = (const SfxStringItem&)pArgs->Get( rReq.GetSlot() ); + aRet = rItm.GetValue(); + } + return aRet; +} + +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 ); + bool bForceNoFillStyle = false; + if ( ((SdrObjCustomShape*)pObj)->UseNoFillStyle() ) + bForceNoFillStyle = true; + + SfxItemSet aAttr( m_pView->GetPool() ); + if ( bForceNoFillStyle ) + aAttr.Put( XFillStyleItem( XFILL_NONE ) ); + pObj->SetMergedItemSet(aAttr); + } + } + } + return bReturn; +} + +bool ConstCustomShape::MouseButtonUp(const MouseEvent& rMEvt) +{ + return SwDrawBase::MouseButtonUp(rMEvt); +} + +void ConstCustomShape::Activate(const sal_uInt16 nSlotId) +{ + m_pWin->SetSdrDrawMode( OBJ_CUSTOMSHAPE ); + + SwDrawBase::Activate(nSlotId); +} + +// applying attributes + +void ConstCustomShape::SetAttributes( SdrObject* pObj ) +{ + bool bAttributesAppliedFromGallery = false; + + if ( GalleryExplorer::GetSdrObjCount( GALLERY_THEME_POWERPOINT ) ) + { + std::vector< 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 = 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( 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); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/conform.cxx b/sw/source/uibase/ribbar/conform.cxx new file mode 100644 index 000000000000..4326a8040324 --- /dev/null +++ b/sw/source/uibase/ribbar/conform.cxx @@ -0,0 +1,110 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 + +ConstFormControl::ConstFormControl(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) : + SwDrawBase(pWrtShell, pEditWin, pSwView) +{ + m_bInsForm = true; +} + +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); + + // Only new object; if not in base mode (or pure selection mode) + 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< sal_uInt16 >(m_pWin->GetSdrDrawMode()), FmFormInventor, m_aStartPos); + + if (bReturn) + m_pWin->SetDrawAction(true); + } + else + bReturn = SwDrawBase::MouseButtonDown(rMEvt); + + return (bReturn); +} + +void ConstFormControl::Activate(const sal_uInt16 nSlotId) +{ + m_pWin->SetSdrDrawMode( static_cast<SdrObjKind>(nSlotId) ); + SwDrawBase::Activate(nSlotId); + m_pSh->GetDrawView()->SetCurrentObj(nSlotId); + + m_pWin->SetPointer(Pointer(POINTER_DRAW_RECT)); +} + +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< sal_uInt16 >(m_pWin->GetSdrDrawMode()), FmFormInventor, aStartPos); + m_pSh->MoveCreate(aEndPos); + m_pSh->EndCreate(SDRCREATE_FORCEEND); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/conpoly.cxx b/sw/source/uibase/ribbar/conpoly.cxx new file mode 100644 index 000000000000..94110be16ec7 --- /dev/null +++ b/sw/source/uibase/ribbar/conpoly.cxx @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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> + +ConstPolygon::ConstPolygon(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) : + SwDrawBase(pWrtShell, pEditWin, pSwView) +{ +} + +bool ConstPolygon::MouseButtonDown(const MouseEvent& rMEvt) +{ + bool bReturn; + + if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt))) + aLastPos = rMEvt.GetPosPixel(); + + return (bReturn); +} + +bool ConstPolygon::MouseMove(const MouseEvent& rMEvt) +{ + bool bReturn = SwDrawBase::MouseMove(rMEvt); + + return bReturn; +} + +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 + { + 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); +} + +void ConstPolygon::Activate(const sal_uInt16 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); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/conrect.cxx b/sw/source/uibase/ribbar/conrect.cxx new file mode 100644 index 000000000000..2b6d08caf53a --- /dev/null +++ b/sw/source/uibase/ribbar/conrect.cxx @@ -0,0 +1,188 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sfx2/bindings.hxx> +#include <sfx2/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> + +ConstRectangle::ConstRectangle( SwWrtShell* pWrtShell, SwEditWin* pEditWin, + SwView* pSwView ) + : SwDrawBase( pWrtShell, pEditWin, pSwView ) + , bMarquee(false) + , bCapVertical(false) + // #93382# + , mbVertical(false) +{ +} + +bool ConstRectangle::MouseButtonDown(const MouseEvent& rMEvt) +{ + bool bReturn; + + if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) + && m_pWin->GetSdrDrawMode() == OBJ_CAPTION) + { + m_pView->NoRotate(); + if (m_pView->IsDrawSelMode()) + { + m_pView->FlipDrawSelMode(); + m_pSh->GetDrawView()->SetFrameDragSingles(m_pView->IsDrawSelMode()); + } + } + return (bReturn); +} + +bool ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt) +{ + 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 ) + { + // Set the attributes needed for scrolling + 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( + (sal_Int16)m_pWin->PixelToLogic(Size(2,1)).Width()) ); + + pObj->SetMergedItemSetAndBroadcast(aItemSet); + } + } + else if(mbVertical && pObj && pObj->ISA(SdrTextObj)) + { + 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, true ); + } + m_pView->LeaveDrawCreate(); // Switch to selection mode + 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; +} + +void ConstRectangle::Activate(const sal_uInt16 nSlotId) +{ + bMarquee = bCapVertical = false; + mbVertical = 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: + mbVertical = 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); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/drawbase.cxx b/sw/source/uibase/ribbar/drawbase.cxx new file mode 100644 index 000000000000..8aba0debcbc9 --- /dev/null +++ b/sw/source/uibase/ribbar/drawbase.cxx @@ -0,0 +1,623 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <hintids.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 <SwRewriter.hxx> +#include "comcore.hrc" + +using namespace ::com::sun::star; + +extern bool bNoInterrupt; // in mainwn.cxx + +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(); +} + +SwDrawBase::~SwDrawBase() +{ + if (m_pView->GetWrtShellPtr()) // In the view-dtor could the wrtsh already been deleted... + m_pSh->GetDrawView()->SetEditMode(true); +} + +bool SwDrawBase::MouseButtonDown(const MouseEvent& rMEvt) +{ + bool bReturn = false; + + SdrView *pSdrView = m_pSh->GetDrawView(); + + // #i33136# + 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); + + // Only new object, if not in the basic mode (or pure selection mode). + 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< sal_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()); + sal_uInt16 nEditMode = m_pWin->GetBezierMode(); + + if (eHit == SDRHIT_HANDLE && aVEvt.pHdl->GetKind() == HDL_BWGT) + { + // Drag handle + bNoInterrupt = true; + bReturn = pSdrView->BegDragObj(m_aStartPos, (OutputDevice*) NULL, aVEvt.pHdl); + m_pWin->SetDrawAction(true); + } + else if (eHit == SDRHIT_MARKEDOBJECT && nEditMode == SID_BEZIER_INSERT) + { + // Insert gluepoint + bNoInterrupt = true; + bReturn = pSdrView->BegInsObjPoint(m_aStartPos, rMEvt.IsMod1()); + m_pWin->SetDrawAction(true); + } + else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1()) + { + // Select gluepoint + if (!rMEvt.IsShift()) + pSdrView->UnmarkAllPoints(); + + bReturn = pSdrView->BegMarkPoints(m_aStartPos); + m_pWin->SetDrawAction(true); + } + else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2()) + { + // Move objekt + return false; + } + else if (eHit == SDRHIT_HANDLE) + { + // Select gluepoint + 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); + } + } + } + else + { + // Select or drag object + if (m_pSh->IsObjSelectable(m_aStartPos) && eHit == SDRHIT_UNMARKEDOBJECT) + { + if (pSdrView->HasMarkablePoints()) + pSdrView->UnmarkAllPoints(); + + bNoInterrupt = false; + // Use drag in edtwin + return false; + } + + bNoInterrupt = true; + + if (m_pSh->IsObjSelected()) + { + if (!rMEvt.IsShift()) + { + if (!pSdrView->HasMarkablePoints()) + { + bool bUnlockView = !m_pSh->IsViewLocked(); + m_pSh->LockView( true ); //lock visible section + m_pSh->SelectObj(Point(LONG_MAX, LONG_MAX)); // deselect all + if( bUnlockView ) + m_pSh->LockView( false ); + } + else + pSdrView->UnmarkAllPoints(); + } + } + if (!m_pSh->IsSelFrmMode()) + m_pSh->EnterSelFrmMode(NULL); + + if( (bReturn = m_pSh->BeginMark(m_aStartPos)) ) + m_pWin->SetDrawAction(true); + + SetDrawPointer(); + } + } + } + return bReturn; +} + +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(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); +} + +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(UndoArg1, SW_RES(STR_FRAME)); + m_pSh->StartUndo(UNDO_INSERT, &aRewriter); + } + + m_pSh->EndCreate(SDRCREATE_FORCEEND); + if (OBJ_NONE == nDrawMode) // Text border inserted + { + 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<sal_uInt16>(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); + // Template 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(); + } + } + + bReturn = true; + + EnterSelectMode(rMEvt); + } + else + { + SdrView *pSdrView = m_pSh->GetDrawView(); + + if (!pSdrView->HasMarkablePoints()) + { + // NO 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(); // Switch to selection mode + + m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); + + if (m_pSh->IsSelFrmMode()) + m_pSh->LeaveSelFrmMode(); + } + m_pView->NoRotate(); + + bCheckShell = true; // if necessary turn on BezierShell + } + 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(); // Switch to selection mode + + m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); + + if (m_pSh->IsSelFrmMode()) + m_pSh->LeaveSelFrmMode(); + } + m_pView->NoRotate(); + + bCheckShell = true; // if necessary turn on BezierShell + } + } + + 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 ); // if necessary turn on BezierShell + + //!!!!!!!!!! Attention suicide !!!!!!!!!!! Everything should be renewed once + if ( bAutoCap ) + m_pView->AutoCaption(FRAME_CAP); //Can currently only be FRAME, otherwise convert + // to enums + return (bReturn); +} + +void SwDrawBase::Activate(const sal_uInt16 nSlot) +{ + SetSlotId(nSlot); + SdrView *pSdrView = m_pSh->GetDrawView(); + + pSdrView->SetCurrentObj( static_cast< sal_uInt16 >(m_pWin->GetSdrDrawMode()) ); + pSdrView->SetEditMode(false); + + SetDrawPointer(); + m_pSh->NoEdit(); +} + +void 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_pWin->GetApplyTemplate()) + m_pWin->SetApplyTemplate(SwApplyTemplate()); + m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); +} + +// Process keyboard events + +// If a KeyEvent is processed then the return value is sal_True, otherwise +// Sal_False. + +bool SwDrawBase::KeyInput(const KeyEvent& rKEvt) +{ + bool bReturn = false; + sal_uInt16 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 to top + nX = 0; + nY =-1; + } + else if (nCode == KEY_DOWN) + { + // Scroll down + nX = 0; + nY = 1; + } + else if (nCode == KEY_LEFT) + { + // Scroll left + nX =-1; + nY = 0; + } + else if (nCode == KEY_RIGHT) + { + // Scroll right + nX = 1; + nY = 0; + } + + if (pSdrView->AreObjectsMarked() && rKEvt.GetKeyCode().IsMod2()) + { + // Move objects + nX *= 100; + nY *= 100; + pSdrView->MoveAllMarked(Size(nX, nY)); + } + + bReturn = true; + } + } + break; + } + + return (bReturn); +} + +// Process keyboard events + +// If a KeyEvent is processed then the return value is sal_True, otherwise +// Sal_False. + +void SwDrawBase::BreakCreate() +{ + m_pSh->BreakCreate(); + m_pWin->SetDrawAction(false); + m_pWin->ReleaseMouse(); + + Deactivate(); +} + +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->GetPreferredPointer(aPnt, m_pSh->GetOut()); + const Pointer aDrawPt(aPointTyp); + m_pWin->SetPointer(aDrawPt); +} + +// If necessary switch into selection mode + +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(); // Switch to selection mode + + m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); + } + } + else + { + m_pView->LeaveDrawCreate(); + if (m_pSh->IsSelFrmMode()) + m_pSh->LeaveSelFrmMode(); + } + m_pView->NoRotate(); + } +} + +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< sal_uInt16 >(m_pWin->GetSdrDrawMode()), aRect, m_nSlotId); +} + +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; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/dselect.cxx b/sw/source/uibase/ribbar/dselect.cxx new file mode 100644 index 000000000000..60c1a06fec8e --- /dev/null +++ b/sw/source/uibase/ribbar/dselect.cxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sfx2/bindings.hxx> +#include "view.hxx" +#include "edtwin.hxx" +#include "wrtsh.hxx" +#include "cmdid.h" +#include "drawbase.hxx" +#include "dselect.hxx" + +DrawSelection::DrawSelection(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) : + SwDrawBase(pWrtShell, pEditWin, pSwView) +{ + m_bCreateObj = false; +} + +// Process keyboard events + +// If a KeyEvent is processed then the return value is sal_True, otherwise +// Sal_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); +} + +void DrawSelection::Activate(const sal_uInt16 nSlotId) +{ + m_pWin->SetSdrDrawMode(OBJ_NONE); + m_pWin->SetObjectSelect( true ); + SwDrawBase::Activate(nSlotId); + + m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx new file mode 100644 index 000000000000..c3caec60a7fe --- /dev/null +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -0,0 +1,636 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sal/config.h> + +#include <comphelper/string.hxx> +#include <officecfg/Office/Common.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 <vcl/settings.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" +#include "access.hrc" + +// Only for the UpdateRange: Delete the box in which the stacked cursor is positioned. +#include "pam.hxx" + +#include "swundo.hxx" +#include "ribbar.hrc" +#include "inputwin.hrc" + +#include <IDocumentContentOperations.hxx> + +SFX_IMPL_POS_CHILDWINDOW_WITHID( 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(aEmptyOUStr) + , m_bDoesUndo(true) + , m_bResetUndo(false) + , m_bCallUndo(false) +{ + bFirst = true; + bActive = bIsTable = bDelSel = false; + + FreeResource(); + + aEdit.SetSizePixel( aEdit.CalcMinimumSize() ); + + SfxImageManager* pManager = SfxImageManager::GetImageManager( SW_MOD() ); + pManager->RegisterToolBox(this); + + pView = ::GetActiveView(); + pWrtShell = pView ? pView->GetWrtShellPtr() : 0; + + InsertWindow( ED_POS, &aPos, 0, 0); + SetItemText(ED_POS, SW_RESSTR(STR_ACCESS_FORMULA_TYPE)); + aPos.SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TYPE)); + SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TOOLBAR)); + InsertSeparator ( 1 ); + InsertSeparator (); + InsertWindow( ED_FORMULA, &aEdit); + SetItemText(ED_FORMULA, SW_RESSTR(STR_ACCESS_FORMULA_TEXT)); + aEdit.SetAccessibleName(SW_RESSTR(STR_ACCESS_FORMULA_TEXT)); + SetHelpId(ED_FORMULA, HID_EDIT_FORMULA); + + SetItemImage( FN_FORMULA_CALC, pManager->GetImage(FN_FORMULA_CALC )); + SetItemImage( FN_FORMULA_CANCEL, pManager->GetImage(FN_FORMULA_CANCEL )); + SetItemImage( FN_FORMULA_APPLY, pManager->GetImage(FN_FORMULA_APPLY )); + + SetItemBits( FN_FORMULA_CALC, GetItemBits( FN_FORMULA_CALC ) | TIB_DROPDOWNONLY ); + SetDropdownClickHdl( LINK( this, SwInputWindow, DropdownClickHdl )); + + Size aSizeTbx = CalcWindowSizePixel(); + Size aEditSize = aEdit.GetSizePixel(); + Rectangle aItemRect( GetItemRect(FN_FORMULA_CALC) ); + long nMaxHeight = (aEditSize.Height() > aItemRect.GetHeight()) ? aEditSize.Height() : aItemRect.GetHeight(); + if( nMaxHeight+2 > aSizeTbx.Height() ) + aSizeTbx.Height() = nMaxHeight+2; + Size aSize = GetSizePixel(); + aSize.Height() = aSizeTbx.Height(); + SetSizePixel( aSize ); + + // align edit and item vcentered + Size aPosSize = aPos.GetSizePixel(); + aPosSize.Height() = nMaxHeight; + aEditSize.Height() = nMaxHeight; + Point aPosPos = aPos.GetPosPixel(); + Point aEditPos = aEdit.GetPosPixel(); + aPosPos.Y() = (aSize.Height() - nMaxHeight)/2 + 1; + aEditPos.Y() = (aSize.Height() - nMaxHeight)/2 + 1; + aPos.SetPosSizePixel( aPosPos, aPosSize ); + aEdit.SetPosSizePixel( aEditPos, aEditSize ); + + aPopMenu.SetSelectHdl(LINK( this, SwInputWindow, MenuHdl )); +} + +SwInputWindow::~SwInputWindow() +{ + SfxImageManager::GetImageManager( SW_MOD() )->ReleaseToolBox(this); + + // wake rulers + if(pView) + { + pView->GetHRuler().SetActive( true ); + pView->GetVRuler().SetActive( true ); + } + delete pMgr; + if(pWrtShell) + pWrtShell->EndSelTblCells(); + + CleanupUglyHackWithUndo(); +} + +void SwInputWindow::CleanupUglyHackWithUndo() +{ + if (m_bResetUndo) + { + if (pWrtShell) + { + DelBoxCntnt(); + pWrtShell->DoUndo(m_bDoesUndo); + if (m_bCallUndo) + { + pWrtShell->Undo(); + } + } + m_bResetUndo = false; // #i117122# once is enough :) + } +} + +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 ); + SetItemImage( FN_FORMULA_CALC, pImgMgr->GetImage(FN_FORMULA_CALC )); + SetItemImage( FN_FORMULA_CANCEL, pImgMgr->GetImage(FN_FORMULA_CANCEL )); + SetItemImage( FN_FORMULA_APPLY, pImgMgr->GetImage(FN_FORMULA_APPLY )); + } + + ToolBox::DataChanged( rDCEvt ); +} + +void SwInputWindow::Resize() +{ + ToolBox::Resize(); + + long nWidth = GetSizePixel().Width(); + long nLeft = aEdit.GetPosPixel().X(); + Size aEditSize = aEdit.GetSizePixel(); + + aEditSize.Width() = std::max( ((long)(nWidth - nLeft - 5)), (long)0 ); + aEdit.SetSizePixel( aEditSize ); + aEdit.Invalidate(); +} + +void SwInputWindow::ShowWin() +{ + bIsTable = false; + // stop rulers + if(pView) + { + pView->GetHRuler().SetActive( false ); + pView->GetVRuler().SetActive( false ); + + OSL_ENSURE(pWrtShell, "no WrtShell!"); + // Cursor in table + bIsTable = pWrtShell->IsCrsrInTbl() ? sal_True : sal_False; + + if( bFirst ) + pWrtShell->SelTblCells( LINK( this, SwInputWindow, + SelTblCellsNotify) ); + if( bIsTable ) + { + const OUString& rPos = pWrtShell->GetBoxNms(); + sal_Int32 nPos = 0; + short nSrch = -1; + while( (nPos = rPos.indexOf( ':',nPos + 1 ) ) != -1 ) + nSrch = (short) nPos; + aPos.SetText( rPos.copy( ++nSrch ) ); + aAktTableName = pWrtShell->GetTableFmt()->GetName(); + } + else + aPos.SetText(SW_RESSTR(STR_TBL_FORMULA)); + + // Edit current field + OSL_ENSURE(pMgr == 0, "FieldManager not deleted"); + pMgr = new SwFldMgr; + + // Formular should always begin with "=" , so set here + OUString sEdit('='); + if( pMgr->GetCurFld() && TYP_FORMELFLD == pMgr->GetCurTypeId() ) + { + sEdit += pMgr->GetCurFldPar2(); + } + else if( bFirst ) + { + if( bIsTable ) + { + m_bResetUndo = true; + SAL_WARN_IF( + officecfg::Office::Common::Undo::Steps::get() <= 0, + "sw", "/org.openoffice.Office.Common/Undo/Steps <= 0"); + + m_bDoesUndo = pWrtShell->DoesUndo(); + if( !m_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 )) + { + m_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 ) + { + // Set WrtShell flags correctly + pWrtShell->SttSelect(); + pWrtShell->EndSelect(); + } + + bFirst = false; + + aEdit.SetModifyHdl( LINK( this, SwInputWindow, ModifyHdl )); + + aEdit.SetText( sEdit ); + aEdit.SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) ); + sOldFml = sEdit; + + aEdit.Invalidate(); + aEdit.Update(); + aEdit.GrabFocus(); + // For input cut the UserInterface + + pView->GetEditWin().LockKeyInput(true); + pView->GetViewFrame()->GetDispatcher()->Lock(true); + pWrtShell->Push(); + } + ToolBox::Show(); +} + +IMPL_LINK( SwInputWindow, MenuHdl, Menu *, pMenu ) +{ +static const char * const 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 +}; + + sal_uInt16 nId = pMenu->GetCurItemId(); + if ( nId <= MN_CALC_ROUND ) + { + OUString aTmp( OUString::createFromAscii(aStrArr[nId - 1]) ); + aTmp += " "; + aEdit.ReplaceSelected( aTmp ); + } + return 0; +} + +IMPL_LINK_NOARG(SwInputWindow, DropdownClickHdl) +{ + sal_uInt16 nCurID = GetCurItemId(); + EndSelection(); // reset back CurItemId ! + switch ( nCurID ) + { + case FN_FORMULA_CALC : + { + aPopMenu.Execute( this, GetItemRect( FN_FORMULA_CALC ), POPUPMENU_NOMOUSEUPCLOSE ); + break; + default: + break; + } + } + + return sal_True; +} + +void SwInputWindow::Click( ) +{ + sal_uInt16 nCurID = GetCurItemId(); + EndSelection(); // reset back CurItemId ! + 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); + CleanupUglyHackWithUndo(); + pWrtShell->Pop( false ); + + // Formular should always begin with "=", so remove it here again + OUString sEdit(comphelper::string::strip(aEdit.GetText(), ' ')); + if( !sEdit.isEmpty() && '=' == sEdit[0] ) + sEdit = sEdit.copy( 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); + CleanupUglyHackWithUndo(); + pWrtShell->Pop( false ); + + if( bDelSel ) + pWrtShell->EnterStdMode(); + + pWrtShell->EndSelTblCells(); + + pView->GetEditWin().GrabFocus(); + + pView->GetViewFrame()->GetDispatcher()->Execute( FN_EDIT_FORMULA, SFX_CALLMODE_ASYNCHRON); + } +} + +const sal_Unicode CH_LRE = 0x202a; +const sal_Unicode CH_PDF = 0x202c; + +IMPL_LINK( SwInputWindow, SelTblCellsNotify, SwWrtShell *, pCaller ) +{ + if(bIsTable) + { + SwFrmFmt* pTblFmt = pCaller->GetTableFmt(); + OUString sBoxNms( pCaller->GetBoxNms() ); + OUString sTblNm; + if( pTblFmt && aAktTableName != pTblFmt->GetName() ) + sTblNm = pTblFmt->GetName(); + + aEdit.UpdateRange( sBoxNms, sTblNm ); + + OUString sNew; + sNew += OUString(CH_LRE); + sNew += aEdit.GetText(); + sNew += OUString(CH_PDF); + + if( sNew != sOldFml ) + { + // The WrtShell is in the table selection, + // then cancel the table selection otherwise, the cursor is + // positioned "in the forest" and the live update does not work! + 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 OUString& rFormula, bool bDelFlag ) +{ + OUString sEdit('='); + if( !rFormula.isEmpty() ) + { + if( '=' == rFormula[0] ) + sEdit = rFormula; + else + sEdit += rFormula; + } + aEdit.SetText( sEdit ); + aEdit.SetSelection( Selection( sEdit.getLength(), sEdit.getLength() ) ); + aEdit.Invalidate(); + bDelSel = bDelFlag; +} + +IMPL_LINK_NOARG(SwInputWindow, ModifyHdl) +{ + if (bIsTable && m_bResetUndo) + { + pWrtShell->StartAllAction(); + DelBoxCntnt(); + OUString sNew; + sNew += OUString(CH_LRE); + sNew += aEdit.GetText(); + sNew += OUString(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 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 InputEdit::UpdateRange(const OUString& rBoxes, + const OUString& rName ) +{ + if( rBoxes.isEmpty() ) + { + GrabFocus(); + return; + } + const sal_Unicode cOpen = '<', cClose = '>', + cOpenBracket = '('; + OUString aPrefix = rName; + if(!rName.isEmpty()) + aPrefix += "."; + OUString aBoxes = aPrefix; + aBoxes += rBoxes; + Selection aSelection(GetSelection()); + sal_uInt16 nSel = (sal_uInt16) aSelection.Len(); + // OS: The following expression ensures that in the overwrite mode, + // the selected closing parenthesis will be not deleted. + if( nSel && ( nSel > 1 || + GetText()[ (sal_uInt16)aSelection.Min() ] != cClose )) + Cut(); + else + aSelection.Max() = aSelection.Min(); + OUString aActText(GetText()); + const sal_uInt16 nLen = aActText.getLength(); + if( !nLen ) + { + OUString aStr = OUStringBuffer(). + append(cOpen).append(aBoxes).append(cClose). + makeStringAndClear(); + SetText(aStr); + sal_Int32 nPos = aStr.indexOf( cClose ); + OSL_ENSURE(nPos != -1, "delimiter not found"); + ++nPos; + SetSelection( Selection( nPos, nPos )); + } + else + { + bool bFound = false; + sal_Unicode cCh; + sal_uInt16 nPos, nEndPos = 0, nStartPos = (sal_uInt16) aSelection.Min(); + if( nStartPos-- ) + { + do { + if( cOpen == (cCh = aActText[ nStartPos ] ) || + cOpenBracket == cCh ) + { + bFound = cCh == cOpen; + break; + } + } while( nStartPos-- > 0 ); + } + if( bFound ) + { + bFound = false; + nEndPos = nStartPos; + while( nEndPos < nLen ) + { + if( cClose == (cCh = aActText[ nEndPos ])) + { + bFound = true; + break; + } + ++nEndPos; + } + // Only if the current position lies in the range or right behind. + if( bFound && !( nStartPos < (sal_uInt16)aSelection.Max() && + (sal_uInt16)aSelection.Max() <= nEndPos + 1 )) + bFound = false; + } + if( bFound ) + { + nPos = ++nStartPos + 1; // We want behind + aActText = aActText.replaceAt( nStartPos, nEndPos - nStartPos, aBoxes ); + nPos = nPos + aBoxes.getLength(); + } + else + { + OUString aTmp = OUStringBuffer(). + append(cOpen).append(aBoxes).append(cClose). + makeStringAndClear(); + nPos = (sal_uInt16)aSelection.Min(); + aActText = aActText.replaceAt( nPos, 0, aTmp ); + nPos = nPos + aTmp.getLength(); + } + if( GetText() != OUString(aActText) ) + { + SetText( aActText ); + SetSelection( Selection( nPos, nPos ) ); + } + } + GrabFocus(); + +} + +SwInputChild::SwInputChild(Window* _pParent, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* ) : + SfxChildWindow( _pParent, nId ) +{ + pDispatch = pBindings->GetDispatcher(); + pWindow = new SwInputWindow( _pParent, pBindings ); + ((SwInputWindow*)pWindow)->ShowWin(); + eChildAlignment = SFX_ALIGN_LOWESTTOP; +} + +SwInputChild::~SwInputChild() +{ + if(pDispatch) + pDispatch->Lock(false); +} + +SfxChildWinInfo SwInputChild::GetInfo() const +{ + SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ + return aInfo; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/inputwin.hrc b/sw/source/uibase/ribbar/inputwin.hrc new file mode 100644 index 000000000000..a62748a019c1 --- /dev/null +++ b/sw/source/uibase/ribbar/inputwin.hrc @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#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 ED_POS 2 +#define ED_FORMULA 3 + +#define STR_ED_POS 1 +#define STR_ED_FORMULA 2 +#define STR_TOOLBAR_FORMULA 35 +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/inputwin.src b/sw/source/uibase/ribbar/inputwin.src new file mode 100644 index 000000000000..d228bbeed267 --- /dev/null +++ b/sw/source/uibase/ribbar/inputwin.src @@ -0,0 +1,290 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +/* HelpID resource file */ +/* HelpID resource file */ + +#include "cmdid.h" +#include "helpid.h" +#include "globals.hrc" +#include "ribbar.hrc" +#include "inputwin.hrc" +#include "access.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 = HID_TBX_FORMULA_CALC ; + DropDown = TRUE ; + Text [ en-US ] = "Formula" ; + }; + ToolBoxItem + { + Identifier = FN_FORMULA_CANCEL ; + HelpId = HID_TBX_FORMULA_CANCEL ; + Text [ en-US ] = "Cancel" ; + }; + ToolBoxItem + { + Identifier = FN_FORMULA_APPLY ; + HelpId = HID_TBX_FORMULA_APPLY ; + Text [ en-US ] = "Apply" ; + }; + }; + 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 ; + 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 ; + 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" ; +}; + +String STR_ACCESS_FORMULA_TOOLBAR +{ + Text [ en-US ] = "Formula Tool Bar" ; +}; + +String STR_ACCESS_FORMULA_TYPE +{ + Text [ en-US ] = "Formula Type" ; +}; + +String STR_ACCESS_FORMULA_TEXT +{ + Text [ en-US ] = "Formula Text" ; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/tblctrl.cxx b/sw/source/uibase/ribbar/tblctrl.cxx new file mode 100644 index 000000000000..2649d74e6951 --- /dev/null +++ b/sw/source/uibase/ribbar/tblctrl.cxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <svl/intitem.hxx> + +#include <vcl/toolbox.hxx> +#include <sfx2/app.hxx> + +#include "cmdid.h" +#include "swtypes.hxx" +#include "tblctrl.hxx" + +SFX_IMPL_TOOLBOX_CONTROL( SwTableOptimizeCtrl, SfxUInt16Item ); + +SwTableOptimizeCtrl::SwTableOptimizeCtrl( + sal_uInt16 nSlotId, + sal_uInt16 nId, + ToolBox& rTbx ) : + SfxToolBoxControl( nSlotId, nId, rTbx ) +{ + rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); +} + +SwTableOptimizeCtrl::~SwTableOptimizeCtrl() +{ +} + +SfxPopupWindow* SwTableOptimizeCtrl::CreatePopupWindow() +{ + createAndPositionSubToolBar("private:resource/toolbar/optimizetablebar"); + return NULL; +} + +SfxPopupWindowType SwTableOptimizeCtrl::GetPopupWindowType() const +{ + return SFX_POPUPWINDOW_ONCLICK; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/tbxanchr.cxx b/sw/source/uibase/ribbar/tbxanchr.cxx new file mode 100644 index 000000000000..e90b3ab9905e --- /dev/null +++ b/sw/source/uibase/ribbar/tbxanchr.cxx @@ -0,0 +1,124 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <string> +#include <vcl/timer.hxx> +#include <sfx2/app.hxx> +#include <sfx2/htmlmode.hxx> +#include <svl/intitem.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/toolbox.hxx> +#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 "ribbar.hrc" +#include "tbxanchr.hxx" + +SFX_IMPL_TOOLBOX_CONTROL(SwTbxAnchor, SfxUInt16Item); + +SwTbxAnchor::SwTbxAnchor( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : + SfxToolBoxControl( nSlotId, nId, rTbx ), + nActAnchorId(0) +{ + rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) ); +} + + SwTbxAnchor::~SwTbxAnchor() +{ +} + +void SwTbxAnchor::StateChanged( sal_uInt16 /*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(); + } + +} + +SfxPopupWindow* SwTbxAnchor::CreatePopupWindow() +{ + SwTbxAnchor::Click(); + return 0; +} + +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(); + } + + 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) + { + OSL_FAIL("No active view found"); + return; + } + SwWrtShell* pWrtShell = pActiveView->GetWrtShellPtr(); + aPopMenu.EnableItem( FN_TOOL_ANCHOR_FRAME, 0 != pWrtShell->IsFlyInFly() ); + + Rectangle aRect(GetToolBox().GetItemRect(GetId())); + + if (pWrtShell->IsInHeaderFooter()) + aPopMenu.RemoveItem(aPopMenu.GetItemPos(FN_TOOL_ANCHOR_PAGE)); + + if (nActAnchorId) + aPopMenu.CheckItem(nActAnchorId); + + sal_uInt16 nSlotId = aPopMenu.Execute(&GetToolBox(), aRect); + GetToolBox().EndSelection(); + + if (nSlotId) + pDispatch->Execute(nSlotId, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx new file mode 100644 index 000000000000..31a8978e746c --- /dev/null +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -0,0 +1,775 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <string> +#include <comphelper/string.hxx> +#include <i18nutil/unicode.hxx> +#include <svl/eitem.hxx> +#include <sfx2/htmlmode.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/imagemgr.hxx> +#include <swmodule.hxx> +#include <view.hxx> +#include <initui.hxx> +#include <viewopt.hxx> +#include <docsh.hxx> +#include <gloshdl.hxx> +#include <glosdoc.hxx> +#include <gloslst.hxx> +#include <workctrl.hxx> +#include <workctrl.hrc> +#include <cmdid.h> +#include <helpid.h> +#include <wrtsh.hxx> +#include <svl/imageitm.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/settings.hxx> +#include <rtl/ustring.hxx> +#include "swabstdlg.hxx" +#include <misc.hrc> + +#include <vcl/svapp.hxx> + +// Size check +#define NAVI_ENTRIES 20 +#if NAVI_ENTRIES != NID_COUNT +#error SwScrollNaviPopup-CTOR static array wrong size. Are new IDs added? +#endif + +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, SfxVoidItem ); +SFX_IMPL_TOOLBOX_CONTROL( SwTbxFieldCtrl, SfxBoolItem ); + +SwTbxInsertCtrl::SwTbxInsertCtrl( + sal_uInt16 nSlotId, + sal_uInt16 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, std::exception) +{ + ToolBox& rTbx = GetToolBox(); + OUString aSlotURL = "slot:" + OUString::number( nLastSlotId); + Image aImage = GetImage( m_xFrame, aSlotURL, hasBigImages() ); + + rTbx.SetItemImage(GetId(), aImage); + rTbx.Invalidate(); + + SfxToolBoxControl::update(); +} + +void SwTbxInsertCtrl::StateChanged( sal_uInt16 /*nSID*/, + SfxItemState eState, + const SfxPoolItem* pState ) +{ + sal_uInt16 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; + + OUString aSlotURL = "slot:" + OUString::number( nId); + ToolBox& rBox = GetToolBox(); + Image aImage = GetImage( m_xFrame, aSlotURL, hasBigImages() ); + 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( "private:resource/toolbar/insertbar" ); + createAndPositionSubToolBar( aToolBarResStr ); + } + else /* FN_INSERT_OBJ_CTRL */ + { + OUString aToolBarResStr( "private:resource/toolbar/insertobjectbar" ); + createAndPositionSubToolBar( aToolBarResStr ); + } + return NULL; +} + +SfxPopupWindowType SwTbxInsertCtrl::GetPopupWindowType() const +{ + return nLastSlotId ? SFX_POPUPWINDOW_ONTIMEOUT : SFX_POPUPWINDOW_ONCLICK; +} + +void SwTbxInsertCtrl::Select( sal_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( + sal_uInt16 nSlotId, + sal_uInt16 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); + + pPopup = new PopupMenu; + SwGlossaryList* pGlossaryList = ::GetGlossaryList(); + sal_uInt16 nGroupCount = pGlossaryList->GetGroupCount(); + for(sal_uInt16 i = 1; i <= nGroupCount; i++) + { + OUString sTitle = pGlossaryList->GetGroupTitle(i - 1); + sal_uInt16 nBlockCount = pGlossaryList->GetBlockCount(i -1); + if(nBlockCount) + { + sal_uInt16 nIndex = 100 * (i); + // but insert without extension + pPopup->InsertItem( i, sTitle); + PopupMenu* pSub = new PopupMenu; + pSub->SetSelectHdl(aLnk); + pPopup->SetPopupMenu(i, pSub); + for(sal_uInt16 j = 0; j < nBlockCount; j++) + { + OUString sLongName(pGlossaryList->GetBlockLongName(i - 1, j)); + OUString sShortName(pGlossaryList->GetBlockShortName(i - 1, j)); + + OUString sEntry = sShortName + " - " + sLongName; + pSub->InsertItem(++nIndex, sEntry); + } + } + } + } + ToolBox* pToolBox = &GetToolBox(); + sal_uInt16 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( sal_uInt16, + SfxItemState, + const SfxPoolItem* pState ) +{ + GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SFX_ITEM_DISABLED) ); +} + +IMPL_LINK(SwTbxAutoTextCtrl, PopupHdl, PopupMenu*, pMenu) +{ + sal_uInt16 nId = pMenu->GetCurItemId(); + + sal_uInt16 nBlock = nId / 100; + + SwGlossaryList* pGlossaryList = ::GetGlossaryList(); + OUString sGroup = pGlossaryList->GetGroupName(nBlock - 1, false); + OUString sShortName = + pGlossaryList->GetBlockShortName(nBlock - 1, nId - (100 * nBlock) - 1); + + SwGlossaryHdl* pGlosHdl = pView->GetGlosHdl(); + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); + OSL_ENSURE(pFact, "Dialogdiet fail!"); + ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc(); + if ( fnSetActGroup ) + (*fnSetActGroup)( sGroup ); + pGlosHdl->SetCurGroup(sGroup, true); + pGlosHdl->InsertGlossary(sShortName); + + return 0; +} + +void SwTbxAutoTextCtrl::DelPopup() +{ + if(pPopup) + { + for( sal_uInt16 i = 0; i < pPopup->GetItemCount(); i ++ ) + { + PopupMenu* pSubPopup = pPopup->GetPopupMenu(pPopup->GetItemId(i)); + delete pSubPopup; + } + delete pPopup; + pPopup = 0; + } +} + +SwTbxFieldCtrl::SwTbxFieldCtrl( + sal_uInt16 nSlotId, + sal_uInt16 nId, + ToolBox& rTbx ) : + SfxToolBoxControl( nSlotId, nId, rTbx ), + pPopup(0), + pView(0) +{ + rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) ); +} + +SwTbxFieldCtrl::~SwTbxFieldCtrl() +{ + DelPopup(); +} + +SfxPopupWindow* SwTbxFieldCtrl::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, SwTbxFieldCtrl, PopupHdl); + + 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)); + } + } + ToolBox* pToolBox = &GetToolBox(); + sal_uInt16 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 SwTbxFieldCtrl::GetPopupWindowType() const +{ + return SFX_POPUPWINDOW_ONTIMEOUT; +} + +void SwTbxFieldCtrl::StateChanged( sal_uInt16, + SfxItemState eState, + const SfxPoolItem* pState ) +{ + GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SFX_ITEM_DISABLED) ); + if (eState >= SFX_ITEM_DEFAULT) + { + GetToolBox().CheckItem( GetId(), ((SfxBoolItem*)pState)->GetValue() ); + } +} + +IMPL_LINK(SwTbxFieldCtrl, PopupHdl, PopupMenu*, pMenu) +{ + sal_uInt16 nId = pMenu->GetCurItemId(); + + 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( OUString::createFromAscii( pChar ),aArgs ); + + return 0; +} + +void SwTbxFieldCtrl::DelPopup() +{ + if(pPopup) + { + delete pPopup; + pPopup = 0; + } +} + +// Navigation-Popup +// determine the order of the toolbox items +static sal_uInt16 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 const char* 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(sal_uInt16 nId, const Reference< XFrame >& rFrame, Window *pParent) + : SfxPopupWindow(nId, rFrame, pParent, 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)) +{ + sal_uInt16 i; + + aToolBox.SetHelpId(HID_NAVI_VS); + aToolBox.SetLineCount( 2 ); + aToolBox.SetOutStyle(TOOLBOX_STYLE_FLAT); + for( i = 0; i < NID_COUNT; i++) + { + sal_uInt16 nNaviId = aNavigationInsertIds[i]; + OUString sText; + ToolBoxItemBits nTbxBits = 0; + if((NID_PREV != nNaviId) && (NID_NEXT != nNaviId)) + { + // -2, there's no string for Next/Prev + sal_uInt16 nResStr = ST_TBL - 2 + nNaviId - NID_START; + sText = SW_RESSTR(nResStr); + nTbxBits = TIB_CHECKABLE; + } + else + { + if (nNaviId == NID_PREV) + sText = SW_RESSTR(STR_IMGBTN_PGE_UP); + else if (nNaviId == NID_NEXT) + sText = SW_RESSTR(STR_IMGBTN_PGE_DOWN); + } + 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] = SW_RESSTR(STR_IMGBTN_START + i); + } + + Size aImgSize = aIList.GetImageSize(); + aImgSize.Width() += 5; + aImgSize.Height() += 5; + Size aSz = aToolBox.CalcWindowSizePixel(2); + aToolBox.SetPosSizePixel( Point(), aSz ); + sal_uInt16 nItemId = SwView::GetMoveType(); + aInfoField.SetText(aToolBox.GetItemText(nItemId)); + aToolBox.CheckItem( nItemId, 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(); +} + +SwScrollNaviPopup::~SwScrollNaviPopup() +{ +} + +void SwScrollNaviPopup::DataChanged( const DataChangedEvent& rDCEvt ) +{ + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && + (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + ApplyImageList(); + + Window::DataChanged( rDCEvt ); +} + +void SwScrollNaviPopup::ApplyImageList() +{ + ImageList& rImgLst = aIList; + for(sal_uInt16 i = 0; i < NID_COUNT; i++) + { + sal_uInt16 nNaviId = aNavigationInsertIds[i]; + aToolBox.SetItemImage(nNaviId, rImgLst.GetImage(nNaviId)); + } +} + +SfxPopupWindow* SwScrollNaviPopup::Clone() const +{ + return new SwScrollNaviPopup( GetId(), GetFrame(), GetParent() ); +} + +IMPL_LINK(SwScrollNaviPopup, SelectHdl, ToolBox*, pSet) +{ + sal_uInt16 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(sal_uInt16 i = 0; i < NID_COUNT; i++) + { + sal_uInt16 nItemId = aToolBox.GetItemId( i ); + aToolBox.CheckItem( nItemId, nItemId == nSet ); + } + } + else + { + Sequence< PropertyValue > aArgs; + OUString cmd(".uno:ScrollToPrevious"); + if (NID_NEXT == nSet) + cmd = OUString(".uno:ScrollToNext"); + SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ), + cmd, aArgs ); + } + return 0; +} + +void SwScrollNaviToolBox::MouseButtonUp( const MouseEvent& rMEvt ) +{ + ToolBox::MouseButtonUp(rMEvt); + if ( ((SwScrollNaviPopup*)GetParent())->IsInPopupMode() ) + ((SwScrollNaviPopup*)GetParent())->EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL ); +} + +void SwScrollNaviToolBox::RequestHelp( const HelpEvent& rHEvt ) +{ + SetItemText(NID_NEXT, SwScrollNaviPopup::GetQuickHelpText(true)); + SetItemText(NID_PREV, SwScrollNaviPopup::GetQuickHelpText(false)); + ToolBox::RequestHelp( rHEvt ); + +} + +OUString SwScrollNaviPopup::GetQuickHelpText(bool bNext) +{ + sal_uInt16 nResId = STR_IMGBTN_START; + nResId += SwView::GetMoveType() - NID_START; + if(!bNext) + nResId += NID_COUNT; + return SW_RESSTR(nResId); +} + +void SwHlpImageButton::RequestHelp( const HelpEvent& rHEvt ) +{ + + SetQuickHelpText(SwScrollNaviPopup::GetQuickHelpText(!bUp)); + + ImageButton::RequestHelp(rHEvt); +} + +class SwZoomBox_Impl : public ComboBox +{ + sal_uInt16 nSlotId; + bool bRelease; + uno::Reference< frame::XDispatchProvider > m_xDispatchProvider; + +public: + SwZoomBox_Impl( + Window* pParent, + sal_uInt16 nSlot, + const Reference< XDispatchProvider >& rDispatchProvider ); + virtual ~SwZoomBox_Impl(); + +protected: + virtual void Select() SAL_OVERRIDE; + virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE; + + void ReleaseFocus(); + +}; + +SwZoomBox_Impl::SwZoomBox_Impl( + Window* pParent, + sal_uInt16 nSlot, + const Reference< XDispatchProvider >& rDispatchProvider ): + ComboBox( pParent, SW_RES(RID_PVIEW_ZOOM_LB)), + nSlotId(nSlot), + bRelease(true), + m_xDispatchProvider( rDispatchProvider ) +{ + EnableAutocomplete( false ); + sal_uInt16 aZoomValues[] = + { 25, 50, 75, 100, 150, 200 }; + for(sal_uInt16 i = 0; i < sizeof(aZoomValues)/sizeof(sal_uInt16); i++) + { + OUString sEntry = unicode::formatPercent(aZoomValues[i], + Application::GetSettings().GetUILanguageTag()); + InsertEntry(sEntry); + } +} + +SwZoomBox_Impl::~SwZoomBox_Impl() +{} + +void SwZoomBox_Impl::Select() +{ + if ( !IsTravelSelect() ) + { + OUString sEntry(comphelper::string::remove(GetText(), '%')); + sal_uInt16 nZoom = (sal_uInt16)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 = "PreviewZoom"; + aItem.QueryValue( a ); + aArgs[0].Value = a; + SfxToolBoxControl::Dispatch( + m_xDispatchProvider, + OUString( ".uno:PreviewZoom" ), + aArgs ); + } + + ReleaseFocus(); + } +} + +bool SwZoomBox_Impl::Notify( NotifyEvent& rNEvt ) +{ + bool bHandled = false; + + if ( rNEvt.GetType() == EVENT_KEYINPUT ) + { + sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); + + switch ( nCode ) + { + case KEY_RETURN: + case KEY_TAB: + { + if ( KEY_TAB == nCode ) + bRelease = false; + else + bHandled = true; + 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 bHandled || ComboBox::Notify( rNEvt ); +} + +void SwZoomBox_Impl::ReleaseFocus() +{ + if ( !bRelease ) + { + bRelease = true; + return; + } + SfxViewShell* pCurSh = SfxViewShell::Current(); + + if ( pCurSh ) + { + Window* pShellWnd = pCurSh->GetWindow(); + + if ( pShellWnd ) + pShellWnd->GrabFocus(); + } +} + +SFX_IMPL_TOOLBOX_CONTROL( SwPreviewZoomControl, SfxUInt16Item); + +SwPreviewZoomControl::SwPreviewZoomControl( + sal_uInt16 nSlotId, + sal_uInt16 nId, + ToolBox& rTbx) : + SfxToolBoxControl( nSlotId, nId, rTbx ) +{ +} + +SwPreviewZoomControl::~SwPreviewZoomControl() +{ +} + +void SwPreviewZoomControl::StateChanged( sal_uInt16 /*nSID*/, + SfxItemState eState, + const SfxPoolItem* pState ) +{ + sal_uInt16 nId = GetId(); + GetToolBox().EnableItem( nId, (GetItemState(pState) != SFX_ITEM_DISABLED) ); + SwZoomBox_Impl* pBox = (SwZoomBox_Impl*)GetToolBox().GetItemWindow( GetId() ); + if(SFX_ITEM_AVAILABLE <= eState) + { + OUString sZoom(unicode::formatPercent(((const SfxUInt16Item*)pState)->GetValue(), + Application::GetSettings().GetUILanguageTag())); + pBox->SetText(sZoom); + pBox->SaveValue(); + } +} + +Window* SwPreviewZoomControl::CreateItemWindow( Window *pParent ) +{ + SwZoomBox_Impl* pRet = new SwZoomBox_Impl( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY )); + return pRet; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/workctrl.hrc b/sw/source/uibase/ribbar/workctrl.hrc new file mode 100644 index 000000000000..07c109548e43 --- /dev/null +++ b/sw/source/uibase/ribbar/workctrl.hrc @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _WORKCTRL_HRC +#define _WORKCTRL_HRC +#include "ribbar.hrc" + +#define IL_VALUES 5 +#define FI_INFO 8 +#define FL_SEP 9 + +#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 + +// duplicate entry! hrc and hxx +// these Ids specifiy the action of the buttons below the scroll bar +#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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/ribbar/workctrl.src b/sw/source/uibase/ribbar/workctrl.src new file mode 100644 index 000000000000..f3592d0a7a8e --- /dev/null +++ b/sw/source/uibase/ribbar/workctrl.src @@ -0,0 +1,382 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <svx/svxids.hrc> +#include <svx/globlmn.hrc> +#include "workctrl.hrc" +#include "helpid.h" +#include "cmdid.h" + +Menu RID_INSERT_FIELD_CTRL +{ + ItemList = + { + MenuItem + { + Identifier = FN_INSERT_FLD_DATE ; + HelpId = CMD_FN_INSERT_FLD_DATE ; + Text [ en-US ] = "Date" ; + }; + MenuItem + { + Identifier = FN_INSERT_FLD_TIME ; + HelpId = CMD_FN_INSERT_FLD_TIME ; + Text [ en-US ] = "Time" ; + }; + MenuItem + { + Identifier = FN_INSERT_FLD_PGNUMBER ; + HelpId = CMD_FN_INSERT_FLD_PGNUMBER ; + Text [ en-US ] = "Page Number" ; + }; + MenuItem + { + Identifier = FN_INSERT_FLD_PGCOUNT ; + HelpId = CMD_FN_INSERT_FLD_PGCOUNT ; + Text [ en-US ] = "Page Count" ; + }; + MenuItem + { + Identifier = FN_INSERT_FLD_TOPIC ; + HelpId = CMD_FN_INSERT_FLD_TOPIC ; + Text [ en-US ] = "Subject" ; + }; + MenuItem + { + Identifier = FN_INSERT_FLD_TITLE ; + HelpId = CMD_FN_INSERT_FLD_TITLE ; + Text [ en-US ] = "Title" ; + }; + MenuItem + { + Identifier = FN_INSERT_FLD_AUTHOR ; + HelpId = CMD_FN_INSERT_FLD_AUTHOR ; + Text [ en-US ] = "Author" ; + }; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + Identifier = FN_INSERT_FIELD ; + HelpId = CMD_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 + }; + 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 + { + Text [ en-US ] = "Headings" ; + }; + String ST_SEL + { + Text [ en-US ] = "Selection" ; + }; + String ST_FTN + { + Text [ en-US ] = "Footnote" ; + }; + String ST_MARK + { + Text [ en-US ] = "Reminder" ; + }; + String ST_POSTIT + { + Text [ en-US ] = "Comment" ; + }; + 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" ; +}; + +// Strings for the quickhelp of the View-PgUp/Down-Buttons + +String STR_IMGBTN_NEXT_DOWN +{ + Text = "" ; +}; +String STR_IMGBTN_PREV_DOWN +{ + Text = "" ; +}; +String STR_IMGBTN_TBL_DOWN +{ + Text [ en-US ] = "Next table" ; +}; +String STR_IMGBTN_FRM_DOWN +{ + Text [ en-US ] = "Next text frame" ; +}; +String STR_IMGBTN_PGE_DOWN +{ + Text [ en-US ] = "Next page" ; +}; +String STR_IMGBTN_DRW_DOWN +{ + Text [ en-US ] = "Next drawing" ; +}; +String STR_IMGBTN_CTRL_DOWN +{ + Text [ en-US ] = "Next control" ; +}; +String STR_IMGBTN_REG_DOWN +{ + Text [ en-US ] = "Next section" ; +}; +String STR_IMGBTN_BKM_DOWN +{ + Text [ en-US ] = "Next bookmark" ; +}; +String STR_IMGBTN_GRF_DOWN +{ + Text [ en-US ] = "Next graphic" ; +}; +String STR_IMGBTN_OLE_DOWN +{ + Text [ en-US ] = "Next OLE object" ; +}; +String STR_IMGBTN_OUTL_DOWN +{ + Text [ en-US ] = "Next heading" ; +}; +String STR_IMGBTN_SEL_DOWN +{ + Text [ en-US ] = "Next selection" ; +}; +String STR_IMGBTN_FTN_DOWN +{ + Text [ en-US ] = "Next footnote" ; +}; +String STR_IMGBTN_MARK_DOWN +{ + Text [ en-US ] = "Next Reminder" ; +}; +String STR_IMGBTN_POSTIT_DOWN +{ + Text [ en-US ] = "Next Comment" ; +}; +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 +{ + Text [ en-US ] = "Previous OLE object" ; +}; +String STR_IMGBTN_OUTL_UP +{ + Text [ en-US ] = "Previous heading" ; +}; +String STR_IMGBTN_SEL_UP +{ + Text [ en-US ] = "Previous selection" ; +}; +String STR_IMGBTN_FTN_UP +{ + Text [ en-US ] = "Previous footnote" ; +}; +String STR_IMGBTN_MARK_UP +{ + Text [ en-US ] = "Previous Reminder" ; +}; +String STR_IMGBTN_POSTIT_UP +{ + Text [ en-US ] = "Previous Comment" ; +}; +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"; +}; +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 ; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |