Files
libreoffice/sc/source/ui/view/drawview.cxx

986 lines
32 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by Herbert Duerr i#118735 prevent endless loop if vlookup/hlookup doesn't find anything http://svn.apache.org/viewvc?view=revision&revision=1239673 Patches contributed by Andre Fischer remove lp_solver http://svn.apache.org/viewvc?view=revision&revision=1199180 i#118160: Added external CoinMP library. http://svn.apache.org/viewvc?view=revision&revision=1233909 Patches contributed by Armin Le-Grand i#118485 - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 i#118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 Patches contributed by lihuiibm i#108860 - Fix range validation. http://svn.apache.org/viewvc?view=revision&revision=1242846 i#118954 Chart data will lost after copy to different file http://svn.apache.org/viewvc?view=revision&revision=1301345 Patches contributed by Ariel Constenla-Haile Fix Linux build breaker: extra qualification on member http://svn.apache.org/viewvc?view=revision&revision=1301591 i#118696 - i#118697 - Fix some Sheet Tab Color API issues http://svn.apache.org/viewvc?view=revision&revision=1225428 i#118697 - Fix uninitialized variable http://svn.apache.org/viewvc?view=revision&revision=1225859 i#118771 - ScUndoImportTab should preserve tab background color http://svn.apache.org/viewvc?view=revision&revision=1230356 i#118921 - Repaint linked sheet tab background color after updating link http://svn.apache.org/viewvc?view=revision&revision=1245177 i#118927 - Undo/Redo "Update Link" does not reset sheet tab color http://svn.apache.org/viewvc?view=revision&revision=1245241 i#118747 - Copy tab color when transferring sheets across documents http://svn.apache.org/viewvc?view=revision&revision=1230355 Patch contributed by Oliver Rainer-Wittman i#118012 - methods <ScBroadcastAreaSlot::AreaBroadcast(..)> and <ScBroadcastAreaSlot::AreaBroadcastInRange(..)> adapt stl-container iteration in order to avoid destroyed iterators during iteration. http://svn.apache.org/viewvc?view=revision&revision=1297916 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 Patch contributed by Daniel Rentz calc69: #i116936# fix VBA symbol Cells http://svn.apache.org/viewvc?view=revision&revision=1172135 Patches contributed by leiw: i#118546 CPU 100% on switched off AutoCalculate with Conditional Formatting on date values http://svn.apache.org/viewvc?view=revision&revision=1301380 Re-add new function documentation. Many various cleanups. Add missing calc66: #o11817313# also look at formula result number format, remove redundant binaries.
2012-11-30 12:23:25 +00:00
/*
* 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 .
*/
2000-09-18 16:07:07 +00:00
#include <com/sun/star/embed/EmbedStates.hpp>
2000-09-18 16:07:07 +00:00
#include <svx/svditer.hxx>
#include <svx/svdograf.hxx>
#include <svx/svdomedia.hxx>
2000-09-18 16:07:07 +00:00
#include <svx/svdogrp.hxx>
#include <svx/svdoole2.hxx>
#include <svx/svdouno.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdundo.hxx>
#include <svx/svdocapt.hxx>
#include <editeng/outlobj.hxx>
#include <editeng/writingmodeitem.hxx>
#include <svx/sdrpaintwindow.hxx>
2000-09-18 16:07:07 +00:00
#include <sfx2/bindings.hxx>
#include <sfx2/viewfrm.hxx>
#include <svx/sdrundomanager.hxx>
#include <svx/xbtmpit.hxx>
2000-09-18 16:07:07 +00:00
#include "drawview.hxx"
#include "global.hxx"
#include "viewdata.hxx"
#include "document.hxx"
#include "drawutil.hxx"
#include "futext.hxx"
2000-09-18 16:07:07 +00:00
#include "globstr.hrc"
#include "tabvwsh.hxx"
#include "client.hxx"
#include "scmod.hxx"
#include "drwlayer.hxx"
#include "docsh.hxx"
#include "viewuno.hxx"
#include "userdat.hxx"
#include "postit.hxx"
#include "undocell.hxx"
Sync draw object to calc grid for better alignment when zooming There can be some serious rounding errors involved when calculating where to draw the grid lines for the various row heights in a document. This can be especially true for a document that has many different row heights. This results in draw objects appearing to move relative to the grid line at different zoom levels. This patch attempts to fix this problem adjusting the position of the shapes as they are drawn to ensure their position relative to grid appears to be stable. We do this by translating the position of the shape to the corrosponding position of it's cell anchor. Of course not all shapes are cell anchored and in this case we position the shape relative a temporary synthesized cell anchor. The patch essentially does the following a) calculates the offset to be applied for each shape at the current zoom level to ensure that the shape will be drawn relative to the correct cell grid see drwlayer.cxx, drawview.cxx & gridwin3.cxx, svdobj.[ch]xx b) apply the offset in the drawing layer for each of the different drawing primitives see svx/source/sdr/contact/* c) making sure the position and size of the newly created shape ( at any zoom level ) are still as expected when zoom level is changed. see. sc/source/ui/drawfunc/fuco*.cxx & d) making sure that overlays and handles are displayed at the correct position see svx/source/svdraw/* it could also be that a full blown transform might be needed to additionally scale the object ( to ensure that the edges of the object stay stable relative to ajacent grid lines ) If necessary we could do that in a later step. Change-Id: I02232f8ba192d58dbf96b80adf66c281cd0f65e8
2012-11-27 17:56:33 +00:00
#include "gridwin.hxx"
2000-09-18 16:07:07 +00:00
#include "sc.hrc"
using namespace com::sun::star;
2000-09-18 16:07:07 +00:00
#define SC_HANDLESIZE_BIG 9
void ScDrawView::Construct()
{
EnableExtendedKeyInputDispatcher(false);
EnableExtendedMouseEventDispatcher(false);
EnableExtendedCommandEventDispatcher(false);
2000-09-18 16:07:07 +00:00
SetFrameDragSingles(true);
2000-09-18 16:07:07 +00:00
SetMinMoveDistancePixel( 2 );
SetHitTolerancePixel( 2 );
if (pViewData)
{
SCTAB nViewTab = pViewData->GetTabNo();
ShowSdrPage(GetModel()->GetPage(nViewTab));
2000-09-18 16:07:07 +00:00
bool bEx = pViewData->GetViewShell()->IsDrawSelMode();
bool bProt = pDoc->IsTabProtected( nViewTab ) ||
2000-09-18 16:07:07 +00:00
pViewData->GetSfxDocShell()->IsReadOnly();
SdrLayer* pLayer;
SdrLayerAdmin& rAdmin = GetModel()->GetLayerAdmin();
pLayer = rAdmin.GetLayerPerID(SC_LAYER_BACK);
if (pLayer)
SetLayerLocked( pLayer->GetName(), bProt || !bEx );
pLayer = rAdmin.GetLayerPerID(SC_LAYER_INTERN);
if (pLayer)
SetLayerLocked( pLayer->GetName(), true );
2000-09-18 16:07:07 +00:00
pLayer = rAdmin.GetLayerPerID(SC_LAYER_FRONT);
if (pLayer)
{
SetLayerLocked( pLayer->GetName(), bProt );
SetActiveLayer( pLayer->GetName() ); // set active layer to FRONT
2000-09-18 16:07:07 +00:00
}
pLayer = rAdmin.GetLayerPerID(SC_LAYER_CONTROLS);
if (pLayer)
SetLayerLocked( pLayer->GetName(), bProt );
pLayer = rAdmin.GetLayerPerID(SC_LAYER_HIDDEN);
if (pLayer)
{
SetLayerLocked( pLayer->GetName(), bProt );
SetLayerVisible( pLayer->GetName(), false);
}
2000-09-18 16:07:07 +00:00
SetSwapAsynchron(true);
2000-09-18 16:07:07 +00:00
}
else
{
ShowSdrPage(GetModel()->GetPage(nTab));
}
2000-09-18 16:07:07 +00:00
UpdateUserViewOptions();
RecalcScale();
UpdateWorkArea();
bInConstruct = false;
2000-09-18 16:07:07 +00:00
}
void ScDrawView::ImplClearCalcDropMarker()
{
if(pDropMarker)
{
delete pDropMarker;
pDropMarker = 0L;
}
}
2010-12-11 23:25:30 +01:00
ScDrawView::~ScDrawView()
2000-09-18 16:07:07 +00:00
{
ImplClearCalcDropMarker();
2000-09-18 16:07:07 +00:00
}
void ScDrawView::AddCustomHdl()
{
const SdrMarkList &rMrkList = GetMarkedObjectList();
const size_t nCount = rMrkList.GetMarkCount();
for(size_t nPos=0; nPos<nCount; ++nPos )
2000-09-18 16:07:07 +00:00
{
2011-01-18 18:55:56 -05:00
SdrObject* pObj = rMrkList.GetMark(nPos)->GetMarkedSdrObj();
if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjDataTab(pObj, nTab))
2000-09-18 16:07:07 +00:00
{
2011-01-18 18:55:56 -05:00
if (ScTabView* pView = pViewData->GetView())
pView->CreateAnchorHandles(maHdlList, pAnchor->maStart);
2000-09-18 16:07:07 +00:00
}
}
}
void ScDrawView::InvalidateAttribs()
{
2000-09-22 17:57:10 +00:00
if (!pViewData) return;
SfxBindings& rBindings = pViewData->GetBindings();
2000-09-18 16:07:07 +00:00
// true status values:
rBindings.InvalidateAll( true );
2000-09-18 16:07:07 +00:00
}
void ScDrawView::InvalidateDrawTextAttrs()
{
2000-09-22 17:57:10 +00:00
if (!pViewData) return;
SfxBindings& rBindings = pViewData->GetBindings();
2000-09-18 16:07:07 +00:00
// cjk/ctl font items have no configured slots,
// need no invalidate
2000-09-18 16:07:07 +00:00
rBindings.Invalidate( SID_ATTR_CHAR_FONT );
rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT );
rBindings.Invalidate( SID_ATTR_CHAR_POSTURE );
rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE );
rBindings.Invalidate( SID_ULINE_VAL_NONE );
rBindings.Invalidate( SID_ULINE_VAL_SINGLE );
rBindings.Invalidate( SID_ULINE_VAL_DOUBLE );
rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE );
2000-09-18 16:07:07 +00:00
rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
Resolves: #i121420# merge sidebar feature (cherry picked from commit 0a0a9b32aa5bf1ce2554ad37cbba3c7a105db2b5) Conflicts: chart2/source/controller/dialogs/dlg_View3D.cxx chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx chart2/source/controller/drawinglayer/ViewElementListProvider.cxx chart2/source/controller/inc/ViewElementListProvider.hxx chart2/source/controller/inc/dlg_View3D.hxx chart2/source/controller/main/ShapeController.cxx chart2/source/inc/chartview/DrawModelWrapper.hxx chart2/source/view/main/DrawModelWrapper.cxx cui/source/inc/border.hxx cui/source/inc/cuitabarea.hxx cui/source/inc/cuitabline.hxx cui/source/inc/sdrcelldlg.hxx cui/source/inc/treeopt.hxx cui/source/options/optchart.cxx cui/source/options/optchart.hxx cui/source/options/optcolor.cxx cui/source/options/treeopt.cxx cui/source/tabpages/backgrnd.cxx cui/source/tabpages/border.cxx cui/source/tabpages/chardlg.cxx cui/source/tabpages/numpages.cxx cui/source/tabpages/tpcolor.cxx cui/source/tabpages/tplneend.cxx editeng/inc/editeng/outliner.hxx extensions/source/propctrlr/standardcontrol.cxx framework/source/register/registerservices.cxx offapi/com/sun/star/ui/makefile.mk officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu officecfg/registry/data/org/openoffice/Office/UI/makefile.mk officecfg/registry/schema/org/openoffice/Office/UI/makefile.mk postprocess/packregistry/makefile.mk reportdesign/source/ui/dlg/Condition.cxx reportdesign/source/ui/misc/UITools.cxx sc/inc/document.hxx sc/inc/helpids.h sc/inc/sc.hrc sc/prj/build.lst sc/sdi/scalc.sdi sc/source/core/data/documen9.cxx sc/source/core/data/drwlayer.cxx sc/source/ui/app/scdll.cxx sc/source/ui/app/typemap.cxx sc/source/ui/dbgui/scendlg.cxx sc/source/ui/docshell/docsh2.cxx sc/source/ui/docshell/docsh4.cxx sc/source/ui/drawfunc/chartsh.cxx sc/source/ui/drawfunc/drawsh.cxx sc/source/ui/drawfunc/drawsh2.cxx sc/source/ui/drawfunc/drawsh4.cxx sc/source/ui/drawfunc/drformsh.cxx sc/source/ui/drawfunc/drtxtob.cxx sc/source/ui/drawfunc/drtxtob1.cxx sc/source/ui/drawfunc/drtxtob2.cxx sc/source/ui/drawfunc/graphsh.cxx sc/source/ui/drawfunc/oleobjsh.cxx sc/source/ui/inc/chartsh.hxx sc/source/ui/inc/formatsh.hxx sc/source/ui/miscdlgs/tabbgcolordlg.cxx sc/source/ui/navipi/navipi.cxx sc/source/ui/optdlg/opredlin.cxx sc/source/ui/optdlg/tpview.cxx sc/source/ui/sidebar/makefile.mk sc/source/ui/view/auditsh.cxx sc/source/ui/view/cellsh.cxx sc/source/ui/view/editsh.cxx sc/source/ui/view/formatsh.cxx sc/source/ui/view/pivotsh.cxx sc/source/ui/view/tabvwsh.cxx sc/util/makefile.mk sd/inc/sdabstdlg.hxx sd/prj/build.lst sd/sdi/ToolPanelViewShell.sdi sd/sdi/makefile.mk sd/source/ui/accessibility/makefile.mk sd/source/ui/animations/CustomAnimationDialog.cxx sd/source/ui/dlg/PaneChildWindows.cxx sd/source/ui/dlg/PaneShells.cxx sd/source/ui/dlg/copydlg.cxx sd/source/ui/dlg/navigatr.cxx sd/source/ui/dlg/sddlgfact.cxx sd/source/ui/dlg/sddlgfact.hxx sd/source/ui/docshell/docshel3.cxx sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx sd/source/ui/framework/factories/TaskPanelFactory.cxx sd/source/ui/framework/factories/TaskPanelFactory.hxx sd/source/ui/framework/factories/ViewShellWrapper.cxx sd/source/ui/framework/factories/makefile.mk sd/source/ui/framework/module/ImpressModule.cxx sd/source/ui/framework/module/ToolPanelModule.cxx sd/source/ui/framework/tools/FrameworkHelper.cxx sd/source/ui/func/fuolbull.cxx sd/source/ui/inc/DrawViewShell.hxx sd/source/ui/inc/PaneChildWindows.hxx sd/source/ui/inc/celltempl.hxx sd/source/ui/inc/copydlg.hxx sd/source/ui/inc/dlgpage.hxx sd/source/ui/inc/framework/FrameworkHelper.hxx sd/source/ui/inc/prltempl.hxx sd/source/ui/inc/tabtempl.hxx sd/source/ui/inc/taskpane/ILayoutableWindow.hxx sd/source/ui/inc/taskpane/PanelId.hxx sd/source/ui/inc/tpaction.hxx sd/source/ui/sidebar/AllMasterPagesSelector.cxx sd/source/ui/sidebar/AllMasterPagesSelector.hxx sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx sd/source/ui/sidebar/DocumentHelper.cxx sd/source/ui/sidebar/DocumentHelper.hxx sd/source/ui/sidebar/LayoutMenu.cxx sd/source/ui/sidebar/LayoutMenu.hxx sd/source/ui/sidebar/MasterPageContainer.cxx sd/source/ui/sidebar/MasterPageContainer.hxx sd/source/ui/sidebar/MasterPageContainerFiller.cxx sd/source/ui/sidebar/MasterPageContainerFiller.hxx sd/source/ui/sidebar/MasterPageContainerProviders.cxx sd/source/ui/sidebar/MasterPageContainerProviders.hxx sd/source/ui/sidebar/MasterPageContainerQueue.cxx sd/source/ui/sidebar/MasterPageContainerQueue.hxx sd/source/ui/sidebar/MasterPageDescriptor.cxx sd/source/ui/sidebar/MasterPageDescriptor.hxx sd/source/ui/sidebar/MasterPageObserver.cxx sd/source/ui/sidebar/MasterPagesSelector.cxx sd/source/ui/sidebar/MasterPagesSelector.hxx sd/source/ui/sidebar/PreviewValueSet.cxx sd/source/ui/sidebar/PreviewValueSet.hxx sd/source/ui/sidebar/RecentMasterPagesSelector.cxx sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx sd/source/ui/sidebar/SidebarShellManager.cxx sd/source/ui/sidebar/SlideTransitionPanel.hxx sd/source/ui/sidebar/makefile.mk sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx sd/source/ui/table/TableDesignPane.hxx sd/source/ui/toolpanel/ControlContainer.cxx sd/source/ui/toolpanel/ControlContainerDescriptor.hxx sd/source/ui/toolpanel/MethodGuard.hxx sd/source/ui/toolpanel/ScrollPanel.cxx sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx sd/source/ui/toolpanel/SubToolPanel.cxx sd/source/ui/toolpanel/TaskPaneFocusManager.cxx sd/source/ui/toolpanel/TaskPaneTreeNode.cxx sd/source/ui/toolpanel/TitleBar.cxx sd/source/ui/toolpanel/TitledControl.cxx sd/source/ui/toolpanel/ToolPanel.cxx sd/source/ui/toolpanel/ToolPanel.hxx sd/source/ui/toolpanel/ToolPanelFactory.cxx sd/source/ui/toolpanel/ToolPanelUIElement.cxx sd/source/ui/toolpanel/ToolPanelUIElement.hxx sd/source/ui/toolpanel/ToolPanelViewShell.cxx sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx sd/source/ui/toolpanel/controls/TableDesignPanel.cxx sd/source/ui/toolpanel/controls/TableDesignPanel.hxx sd/source/ui/unoidl/UnoDocumentSettings.cxx sd/source/ui/view/ViewShellBase.cxx sd/source/ui/view/drtxtob.cxx sd/source/ui/view/drviews3.cxx sd/source/ui/view/drviews7.cxx sd/source/ui/view/drviewsa.cxx sd/source/ui/view/drviewsf.cxx sd/source/ui/view/outlnvsh.cxx sd/source/ui/view/sdview.cxx sd/source/ui/view/viewshel.cxx sd/uiconfig/sdraw/menubar/menubar.xml sd/util/makefile.mk sfx2/Package_inc.mk sfx2/inc/sfx2/sfx.hrc sfx2/inc/sfx2/sfxsids.hrc sfx2/source/control/bindings.cxx sfx2/source/dialog/templdlg.cxx sfx2/source/inc/templdgi.hxx svx/AllLangResTarget_svx.mk svx/Package_inc.mk svx/inc/svx/XPropertyTable.hxx svx/inc/svx/bmpmask.hxx svx/inc/svx/colrctrl.hxx svx/inc/svx/dialogs.hrc svx/inc/svx/dlgctrl.hxx svx/inc/svx/dlgutil.hxx svx/inc/svx/drawitem.hxx svx/inc/svx/fontwork.hxx svx/inc/svx/galbrws.hxx svx/inc/svx/sdr/table/tablecontroller.hxx svx/inc/svx/svdmodel.hxx svx/inc/svx/svdstr.hrc svx/inc/svx/svxids.hrc svx/inc/svx/svxitems.hrc svx/inc/svx/xattr.hxx svx/inc/svx/xflgrit.hxx svx/inc/svx/xflhtit.hxx svx/inc/svx/xit.hxx svx/inc/svx/xlineit.hxx svx/inc/svx/xlndsit.hxx svx/inc/svx/xlnedit.hxx svx/inc/svx/xlnstit.hxx svx/inc/svx/xtable.hxx svx/sdi/svx.sdi svx/source/dialog/_bmpmask.cxx svx/source/dialog/dialcontrol.cxx svx/source/dialog/dlgctrl.cxx svx/source/dialog/dlgutil.cxx svx/source/dialog/fontwork.cxx svx/source/gallery2/galbrws.cxx svx/source/gallery2/galbrws1.cxx svx/source/gallery2/gallery1.cxx svx/source/items/drawitem.cxx svx/source/items/svxitems.src svx/source/sdr/attribute/sdrformtextattribute.cxx svx/source/sidebar/ColorPanel.hxx svx/source/sidebar/EmptyPanel.hrc svx/source/sidebar/EmptyPanel.hxx svx/source/sidebar/gallery/GalleryPanel.hxx svx/source/svdraw/svdedtv1.cxx svx/source/svdraw/svdmodel.cxx svx/source/svdraw/svdogrp.cxx svx/source/svdraw/svdstr.src svx/source/tbxctrls/tbcontrl.cxx svx/source/unodraw/XPropertyTable.cxx svx/source/unodraw/unoctabl.cxx svx/source/xoutdev/XPropertyEntry.cxx svx/source/xoutdev/xattr.cxx svx/source/xoutdev/xattr2.cxx svx/source/xoutdev/xtabbtmp.cxx svx/source/xoutdev/xtabcolr.cxx svx/source/xoutdev/xtabdash.cxx svx/source/xoutdev/xtabgrdt.cxx svx/source/xoutdev/xtabhtch.cxx svx/source/xoutdev/xtable.cxx svx/source/xoutdev/xtablend.cxx svx/util/svx.component sw/inc/cmdid.h sw/inc/docsh.hxx sw/inc/editsh.hxx sw/inc/helpid.h sw/inc/rcid.hrc sw/inc/swabstdlg.hxx sw/inc/swcommands.h sw/sdi/swriter.sdi sw/source/core/doc/docdesc.cxx sw/source/core/draw/drawdoc.cxx sw/source/ui/app/docsh2.cxx sw/source/ui/app/docshdrw.cxx sw/source/ui/app/docshini.cxx sw/source/ui/app/docst.cxx sw/source/ui/config/optpage.cxx sw/source/ui/dialog/swdlgfact.cxx sw/source/ui/dialog/swdlgfact.hxx sw/source/ui/fmtui/tmpdlg.cxx sw/source/ui/inc/tmpdlg.hxx sw/source/ui/misc/pggrid.cxx sw/source/ui/shells/annotsh.cxx sw/source/ui/shells/basesh.cxx sw/source/ui/shells/beziersh.cxx sw/source/ui/shells/drawdlg.cxx sw/source/ui/shells/drawsh.cxx sw/source/ui/shells/drformsh.cxx sw/source/ui/shells/drwbassh.cxx sw/source/ui/shells/drwtxtex.cxx sw/source/ui/shells/drwtxtsh.cxx sw/source/ui/shells/frmsh.cxx sw/source/ui/shells/grfsh.cxx sw/source/ui/shells/olesh.cxx sw/source/ui/shells/tabsh.cxx sw/source/ui/shells/textsh.cxx sw/source/ui/shells/textsh1.cxx sw/source/ui/shells/txtnum.cxx sw/source/ui/uiview/viewtab.cxx sw/source/ui/uno/unofreg.cxx sw/source/ui/utlui/navipi.cxx sw/util/sw.component vcl/inc/vcl/split.hxx vcl/inc/vcl/window.hxx vcl/inc/window.h vcl/source/window/split.cxx vcl/source/window/window.cxx vcl/source/window/window4.cxx Change-Id: Idebaff59f9d60e4e93290cefefdda4c5a1e9215e Resolves: #i122194# Adapted license text in propertypanel.hrc then renamed it to ResourceDefinitions.hrc (cherry picked from commit e952d1401c1adc41934118ba7f542611ef9da11b) Conflicts: sfx2/Package_inc.mk sfx2/source/sidebar/SidebarChildWindow.cxx svx/source/sidebar/graphic/GraphicPropertyPanel.cxx svx/source/sidebar/line/LinePropertyPanel.cxx svx/source/sidebar/possize/PosSizePropertyPanel.cxx sw/source/ui/sidebar/PagePropertyPanel.src sw/source/ui/sidebar/WrapPropertyPanel.src Change-Id: Ie009056a78ab108556717a501399c83b477b3548 Resolves: #i122194# finally I got the correct file name Change-Id: If7a075af8c9a829f6f0a69f883c5c6d4ac97ba2a More merge changes for optional sidebar: revert toolpanel removal, restore and re-enable task pane remove apparently un-used SidebarFactory module add extra visibility annotation to ItemReceiverUpdate
2013-04-10 08:20:16 +00:00
rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT );
rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT );
rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK );
rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER);
rBindings.Invalidate( SID_ALIGNLEFT );
rBindings.Invalidate( SID_ALIGNCENTERHOR );
rBindings.Invalidate( SID_ALIGNRIGHT );
rBindings.Invalidate( SID_ALIGNBLOCK );
2000-09-18 16:07:07 +00:00
rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_10 );
rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_15 );
rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_20 );
rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
rBindings.Invalidate( SID_SET_SUB_SCRIPT );
Resolves: #i121420# merge sidebar feature (cherry picked from commit 0a0a9b32aa5bf1ce2554ad37cbba3c7a105db2b5) Conflicts: chart2/source/controller/dialogs/dlg_View3D.cxx chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx chart2/source/controller/drawinglayer/ViewElementListProvider.cxx chart2/source/controller/inc/ViewElementListProvider.hxx chart2/source/controller/inc/dlg_View3D.hxx chart2/source/controller/main/ShapeController.cxx chart2/source/inc/chartview/DrawModelWrapper.hxx chart2/source/view/main/DrawModelWrapper.cxx cui/source/inc/border.hxx cui/source/inc/cuitabarea.hxx cui/source/inc/cuitabline.hxx cui/source/inc/sdrcelldlg.hxx cui/source/inc/treeopt.hxx cui/source/options/optchart.cxx cui/source/options/optchart.hxx cui/source/options/optcolor.cxx cui/source/options/treeopt.cxx cui/source/tabpages/backgrnd.cxx cui/source/tabpages/border.cxx cui/source/tabpages/chardlg.cxx cui/source/tabpages/numpages.cxx cui/source/tabpages/tpcolor.cxx cui/source/tabpages/tplneend.cxx editeng/inc/editeng/outliner.hxx extensions/source/propctrlr/standardcontrol.cxx framework/source/register/registerservices.cxx offapi/com/sun/star/ui/makefile.mk officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu officecfg/registry/data/org/openoffice/Office/UI/makefile.mk officecfg/registry/schema/org/openoffice/Office/UI/makefile.mk postprocess/packregistry/makefile.mk reportdesign/source/ui/dlg/Condition.cxx reportdesign/source/ui/misc/UITools.cxx sc/inc/document.hxx sc/inc/helpids.h sc/inc/sc.hrc sc/prj/build.lst sc/sdi/scalc.sdi sc/source/core/data/documen9.cxx sc/source/core/data/drwlayer.cxx sc/source/ui/app/scdll.cxx sc/source/ui/app/typemap.cxx sc/source/ui/dbgui/scendlg.cxx sc/source/ui/docshell/docsh2.cxx sc/source/ui/docshell/docsh4.cxx sc/source/ui/drawfunc/chartsh.cxx sc/source/ui/drawfunc/drawsh.cxx sc/source/ui/drawfunc/drawsh2.cxx sc/source/ui/drawfunc/drawsh4.cxx sc/source/ui/drawfunc/drformsh.cxx sc/source/ui/drawfunc/drtxtob.cxx sc/source/ui/drawfunc/drtxtob1.cxx sc/source/ui/drawfunc/drtxtob2.cxx sc/source/ui/drawfunc/graphsh.cxx sc/source/ui/drawfunc/oleobjsh.cxx sc/source/ui/inc/chartsh.hxx sc/source/ui/inc/formatsh.hxx sc/source/ui/miscdlgs/tabbgcolordlg.cxx sc/source/ui/navipi/navipi.cxx sc/source/ui/optdlg/opredlin.cxx sc/source/ui/optdlg/tpview.cxx sc/source/ui/sidebar/makefile.mk sc/source/ui/view/auditsh.cxx sc/source/ui/view/cellsh.cxx sc/source/ui/view/editsh.cxx sc/source/ui/view/formatsh.cxx sc/source/ui/view/pivotsh.cxx sc/source/ui/view/tabvwsh.cxx sc/util/makefile.mk sd/inc/sdabstdlg.hxx sd/prj/build.lst sd/sdi/ToolPanelViewShell.sdi sd/sdi/makefile.mk sd/source/ui/accessibility/makefile.mk sd/source/ui/animations/CustomAnimationDialog.cxx sd/source/ui/dlg/PaneChildWindows.cxx sd/source/ui/dlg/PaneShells.cxx sd/source/ui/dlg/copydlg.cxx sd/source/ui/dlg/navigatr.cxx sd/source/ui/dlg/sddlgfact.cxx sd/source/ui/dlg/sddlgfact.hxx sd/source/ui/docshell/docshel3.cxx sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx sd/source/ui/framework/factories/TaskPanelFactory.cxx sd/source/ui/framework/factories/TaskPanelFactory.hxx sd/source/ui/framework/factories/ViewShellWrapper.cxx sd/source/ui/framework/factories/makefile.mk sd/source/ui/framework/module/ImpressModule.cxx sd/source/ui/framework/module/ToolPanelModule.cxx sd/source/ui/framework/tools/FrameworkHelper.cxx sd/source/ui/func/fuolbull.cxx sd/source/ui/inc/DrawViewShell.hxx sd/source/ui/inc/PaneChildWindows.hxx sd/source/ui/inc/celltempl.hxx sd/source/ui/inc/copydlg.hxx sd/source/ui/inc/dlgpage.hxx sd/source/ui/inc/framework/FrameworkHelper.hxx sd/source/ui/inc/prltempl.hxx sd/source/ui/inc/tabtempl.hxx sd/source/ui/inc/taskpane/ILayoutableWindow.hxx sd/source/ui/inc/taskpane/PanelId.hxx sd/source/ui/inc/tpaction.hxx sd/source/ui/sidebar/AllMasterPagesSelector.cxx sd/source/ui/sidebar/AllMasterPagesSelector.hxx sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx sd/source/ui/sidebar/DocumentHelper.cxx sd/source/ui/sidebar/DocumentHelper.hxx sd/source/ui/sidebar/LayoutMenu.cxx sd/source/ui/sidebar/LayoutMenu.hxx sd/source/ui/sidebar/MasterPageContainer.cxx sd/source/ui/sidebar/MasterPageContainer.hxx sd/source/ui/sidebar/MasterPageContainerFiller.cxx sd/source/ui/sidebar/MasterPageContainerFiller.hxx sd/source/ui/sidebar/MasterPageContainerProviders.cxx sd/source/ui/sidebar/MasterPageContainerProviders.hxx sd/source/ui/sidebar/MasterPageContainerQueue.cxx sd/source/ui/sidebar/MasterPageContainerQueue.hxx sd/source/ui/sidebar/MasterPageDescriptor.cxx sd/source/ui/sidebar/MasterPageDescriptor.hxx sd/source/ui/sidebar/MasterPageObserver.cxx sd/source/ui/sidebar/MasterPagesSelector.cxx sd/source/ui/sidebar/MasterPagesSelector.hxx sd/source/ui/sidebar/PreviewValueSet.cxx sd/source/ui/sidebar/PreviewValueSet.hxx sd/source/ui/sidebar/RecentMasterPagesSelector.cxx sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx sd/source/ui/sidebar/SidebarShellManager.cxx sd/source/ui/sidebar/SlideTransitionPanel.hxx sd/source/ui/sidebar/makefile.mk sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx sd/source/ui/table/TableDesignPane.hxx sd/source/ui/toolpanel/ControlContainer.cxx sd/source/ui/toolpanel/ControlContainerDescriptor.hxx sd/source/ui/toolpanel/MethodGuard.hxx sd/source/ui/toolpanel/ScrollPanel.cxx sd/source/ui/toolpanel/SlideSorterCacheDisplay.cxx sd/source/ui/toolpanel/SubToolPanel.cxx sd/source/ui/toolpanel/TaskPaneFocusManager.cxx sd/source/ui/toolpanel/TaskPaneTreeNode.cxx sd/source/ui/toolpanel/TitleBar.cxx sd/source/ui/toolpanel/TitledControl.cxx sd/source/ui/toolpanel/ToolPanel.cxx sd/source/ui/toolpanel/ToolPanel.hxx sd/source/ui/toolpanel/ToolPanelFactory.cxx sd/source/ui/toolpanel/ToolPanelUIElement.cxx sd/source/ui/toolpanel/ToolPanelUIElement.hxx sd/source/ui/toolpanel/ToolPanelViewShell.cxx sd/source/ui/toolpanel/controls/CustomAnimationPanel.cxx sd/source/ui/toolpanel/controls/CustomAnimationPanel.hxx sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx sd/source/ui/toolpanel/controls/MasterPagesPanel.hxx sd/source/ui/toolpanel/controls/SlideTransitionPanel.cxx sd/source/ui/toolpanel/controls/SlideTransitionPanel.hxx sd/source/ui/toolpanel/controls/TableDesignPanel.cxx sd/source/ui/toolpanel/controls/TableDesignPanel.hxx sd/source/ui/unoidl/UnoDocumentSettings.cxx sd/source/ui/view/ViewShellBase.cxx sd/source/ui/view/drtxtob.cxx sd/source/ui/view/drviews3.cxx sd/source/ui/view/drviews7.cxx sd/source/ui/view/drviewsa.cxx sd/source/ui/view/drviewsf.cxx sd/source/ui/view/outlnvsh.cxx sd/source/ui/view/sdview.cxx sd/source/ui/view/viewshel.cxx sd/uiconfig/sdraw/menubar/menubar.xml sd/util/makefile.mk sfx2/Package_inc.mk sfx2/inc/sfx2/sfx.hrc sfx2/inc/sfx2/sfxsids.hrc sfx2/source/control/bindings.cxx sfx2/source/dialog/templdlg.cxx sfx2/source/inc/templdgi.hxx svx/AllLangResTarget_svx.mk svx/Package_inc.mk svx/inc/svx/XPropertyTable.hxx svx/inc/svx/bmpmask.hxx svx/inc/svx/colrctrl.hxx svx/inc/svx/dialogs.hrc svx/inc/svx/dlgctrl.hxx svx/inc/svx/dlgutil.hxx svx/inc/svx/drawitem.hxx svx/inc/svx/fontwork.hxx svx/inc/svx/galbrws.hxx svx/inc/svx/sdr/table/tablecontroller.hxx svx/inc/svx/svdmodel.hxx svx/inc/svx/svdstr.hrc svx/inc/svx/svxids.hrc svx/inc/svx/svxitems.hrc svx/inc/svx/xattr.hxx svx/inc/svx/xflgrit.hxx svx/inc/svx/xflhtit.hxx svx/inc/svx/xit.hxx svx/inc/svx/xlineit.hxx svx/inc/svx/xlndsit.hxx svx/inc/svx/xlnedit.hxx svx/inc/svx/xlnstit.hxx svx/inc/svx/xtable.hxx svx/sdi/svx.sdi svx/source/dialog/_bmpmask.cxx svx/source/dialog/dialcontrol.cxx svx/source/dialog/dlgctrl.cxx svx/source/dialog/dlgutil.cxx svx/source/dialog/fontwork.cxx svx/source/gallery2/galbrws.cxx svx/source/gallery2/galbrws1.cxx svx/source/gallery2/gallery1.cxx svx/source/items/drawitem.cxx svx/source/items/svxitems.src svx/source/sdr/attribute/sdrformtextattribute.cxx svx/source/sidebar/ColorPanel.hxx svx/source/sidebar/EmptyPanel.hrc svx/source/sidebar/EmptyPanel.hxx svx/source/sidebar/gallery/GalleryPanel.hxx svx/source/svdraw/svdedtv1.cxx svx/source/svdraw/svdmodel.cxx svx/source/svdraw/svdogrp.cxx svx/source/svdraw/svdstr.src svx/source/tbxctrls/tbcontrl.cxx svx/source/unodraw/XPropertyTable.cxx svx/source/unodraw/unoctabl.cxx svx/source/xoutdev/XPropertyEntry.cxx svx/source/xoutdev/xattr.cxx svx/source/xoutdev/xattr2.cxx svx/source/xoutdev/xtabbtmp.cxx svx/source/xoutdev/xtabcolr.cxx svx/source/xoutdev/xtabdash.cxx svx/source/xoutdev/xtabgrdt.cxx svx/source/xoutdev/xtabhtch.cxx svx/source/xoutdev/xtable.cxx svx/source/xoutdev/xtablend.cxx svx/util/svx.component sw/inc/cmdid.h sw/inc/docsh.hxx sw/inc/editsh.hxx sw/inc/helpid.h sw/inc/rcid.hrc sw/inc/swabstdlg.hxx sw/inc/swcommands.h sw/sdi/swriter.sdi sw/source/core/doc/docdesc.cxx sw/source/core/draw/drawdoc.cxx sw/source/ui/app/docsh2.cxx sw/source/ui/app/docshdrw.cxx sw/source/ui/app/docshini.cxx sw/source/ui/app/docst.cxx sw/source/ui/config/optpage.cxx sw/source/ui/dialog/swdlgfact.cxx sw/source/ui/dialog/swdlgfact.hxx sw/source/ui/fmtui/tmpdlg.cxx sw/source/ui/inc/tmpdlg.hxx sw/source/ui/misc/pggrid.cxx sw/source/ui/shells/annotsh.cxx sw/source/ui/shells/basesh.cxx sw/source/ui/shells/beziersh.cxx sw/source/ui/shells/drawdlg.cxx sw/source/ui/shells/drawsh.cxx sw/source/ui/shells/drformsh.cxx sw/source/ui/shells/drwbassh.cxx sw/source/ui/shells/drwtxtex.cxx sw/source/ui/shells/drwtxtsh.cxx sw/source/ui/shells/frmsh.cxx sw/source/ui/shells/grfsh.cxx sw/source/ui/shells/olesh.cxx sw/source/ui/shells/tabsh.cxx sw/source/ui/shells/textsh.cxx sw/source/ui/shells/textsh1.cxx sw/source/ui/shells/txtnum.cxx sw/source/ui/uiview/viewtab.cxx sw/source/ui/uno/unofreg.cxx sw/source/ui/utlui/navipi.cxx sw/util/sw.component vcl/inc/vcl/split.hxx vcl/inc/vcl/window.hxx vcl/inc/window.h vcl/source/window/split.cxx vcl/source/window/window.cxx vcl/source/window/window4.cxx Change-Id: Idebaff59f9d60e4e93290cefefdda4c5a1e9215e Resolves: #i122194# Adapted license text in propertypanel.hrc then renamed it to ResourceDefinitions.hrc (cherry picked from commit e952d1401c1adc41934118ba7f542611ef9da11b) Conflicts: sfx2/Package_inc.mk sfx2/source/sidebar/SidebarChildWindow.cxx svx/source/sidebar/graphic/GraphicPropertyPanel.cxx svx/source/sidebar/line/LinePropertyPanel.cxx svx/source/sidebar/possize/PosSizePropertyPanel.cxx sw/source/ui/sidebar/PagePropertyPanel.src sw/source/ui/sidebar/WrapPropertyPanel.src Change-Id: Ie009056a78ab108556717a501399c83b477b3548 Resolves: #i122194# finally I got the correct file name Change-Id: If7a075af8c9a829f6f0a69f883c5c6d4ac97ba2a More merge changes for optional sidebar: revert toolpanel removal, restore and re-enable task pane remove apparently un-used SidebarFactory module add extra visibility annotation to ItemReceiverUpdate
2013-04-10 08:20:16 +00:00
rBindings.Invalidate( SID_ATTR_CHAR_KERNING );
rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED );
rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
rBindings.Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
rBindings.Invalidate( SID_TABLE_VERT_NONE );
rBindings.Invalidate( SID_TABLE_VERT_CENTER );
rBindings.Invalidate( SID_TABLE_VERT_BOTTOM );
// pseudo slots for Format menu
rBindings.Invalidate( SID_ALIGN_ANY_LEFT );
rBindings.Invalidate( SID_ALIGN_ANY_HCENTER );
rBindings.Invalidate( SID_ALIGN_ANY_RIGHT );
rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED );
2000-09-18 16:07:07 +00:00
}
void ScDrawView::SetMarkedToLayer( sal_uInt8 nLayerNo )
2000-09-18 16:07:07 +00:00
{
if (AreObjectsMarked())
2000-09-18 16:07:07 +00:00
{
// #i11702# use SdrUndoObjectLayerChange for undo
// STR_UNDO_SELATTR is "Attributes" - should use a different text later
BegUndo( ScGlobal::GetRscString( STR_UNDO_SELATTR ) );
const SdrMarkList& rMark = GetMarkedObjectList();
const size_t nCount = rMark.GetMarkCount();
for (size_t i=0; i<nCount; ++i)
2000-09-18 16:07:07 +00:00
{
SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj();
if ( !pObj->ISA(SdrUnoObj) && (pObj->GetLayer() != SC_LAYER_INTERN) )
{
AddUndo( new SdrUndoObjectLayerChange( *pObj, pObj->GetLayer(), (SdrLayerID)nLayerNo) );
2000-09-18 16:07:07 +00:00
pObj->SetLayer( nLayerNo );
}
2000-09-18 16:07:07 +00:00
}
EndUndo();
// repaint is done in SetLayer
pViewData->GetDocShell()->SetDrawModified();
2011-03-02 21:32:00 +01:00
// check mark list now instead of later in a timer
CheckMarked();
MarkListHasChanged();
2000-09-18 16:07:07 +00:00
}
}
bool ScDrawView::HasMarkedControl() const
2000-09-18 16:07:07 +00:00
{
SdrObjListIter aIter( GetMarkedObjectList() );
for( SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next() )
if( pObj->ISA( SdrUnoObj ) )
return true;
return false;
}
2000-09-18 16:07:07 +00:00
bool ScDrawView::HasMarkedInternal() const
{
// internal objects should not be inside a group, but who knows...
SdrObjListIter aIter( GetMarkedObjectList() );
for( SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next() )
if( pObj->GetLayer() == SC_LAYER_INTERN )
return true;
return false;
2000-09-18 16:07:07 +00:00
}
void ScDrawView::UpdateWorkArea()
{
SdrPage* pPage = GetModel()->GetPage(static_cast<sal_uInt16>(nTab));
2000-09-18 16:07:07 +00:00
if (pPage)
{
Point aPos;
Size aPageSize( pPage->GetSize() );
Rectangle aNewArea( aPos, aPageSize );
if ( aPageSize.Width() < 0 )
{
// RTL: from max.negative (left) to zero (right)
aNewArea.Right() = 0;
aNewArea.Left() = aPageSize.Width() + 1;
}
SetWorkArea( aNewArea );
}
2000-09-18 16:07:07 +00:00
else
{
2011-03-01 19:05:02 +01:00
OSL_FAIL("Page nicht gefunden");
}
2000-09-18 16:07:07 +00:00
}
void ScDrawView::DoCut()
{
DoCopy();
BegUndo( ScGlobal::GetRscString( STR_UNDO_CUT ) );
DeleteMarked(); // auf dieser View - von der 505f Umstellung nicht betroffen
EndUndo();
}
void ScDrawView::GetScale( Fraction& rFractX, Fraction& rFractY ) const
2000-09-18 16:07:07 +00:00
{
rFractX = aScaleX;
rFractY = aScaleY;
}
void ScDrawView::RecalcScale()
{
double nPPTX;
double nPPTY;
Fraction aZoomX(1,1);
Fraction aZoomY(1,1);
2000-09-18 16:07:07 +00:00
if (pViewData)
{
nTab = pViewData->GetTabNo();
nPPTX = pViewData->GetPPTX();
nPPTY = pViewData->GetPPTY();
aZoomX = pViewData->GetZoomX();
aZoomY = pViewData->GetZoomY();
}
else
{
Point aLogic = pDev->LogicToPixel( Point(1000,1000), MAP_TWIP );
nPPTX = aLogic.X() / 1000.0;
nPPTY = aLogic.Y() / 1000.0;
//! Zoom uebergeben ???
}
SCCOL nEndCol = 0;
SCROW nEndRow = 0;
2000-09-18 16:07:07 +00:00
pDoc->GetTableArea( nTab, nEndCol, nEndRow );
if (nEndCol<20)
nEndCol = 20;
if (nEndRow<20)
nEndRow = 20;
2000-09-18 16:07:07 +00:00
ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, pDev,aZoomX,aZoomY,nPPTX,nPPTY,
aScaleX,aScaleY );
Sync draw object to calc grid for better alignment when zooming There can be some serious rounding errors involved when calculating where to draw the grid lines for the various row heights in a document. This can be especially true for a document that has many different row heights. This results in draw objects appearing to move relative to the grid line at different zoom levels. This patch attempts to fix this problem adjusting the position of the shapes as they are drawn to ensure their position relative to grid appears to be stable. We do this by translating the position of the shape to the corrosponding position of it's cell anchor. Of course not all shapes are cell anchored and in this case we position the shape relative a temporary synthesized cell anchor. The patch essentially does the following a) calculates the offset to be applied for each shape at the current zoom level to ensure that the shape will be drawn relative to the correct cell grid see drwlayer.cxx, drawview.cxx & gridwin3.cxx, svdobj.[ch]xx b) apply the offset in the drawing layer for each of the different drawing primitives see svx/source/sdr/contact/* c) making sure the position and size of the newly created shape ( at any zoom level ) are still as expected when zoom level is changed. see. sc/source/ui/drawfunc/fuco*.cxx & d) making sure that overlays and handles are displayed at the correct position see svx/source/svdraw/* it could also be that a full blown transform might be needed to additionally scale the object ( to ensure that the edges of the object stay stable relative to ajacent grid lines ) If necessary we could do that in a later step. Change-Id: I02232f8ba192d58dbf96b80adf66c281cd0f65e8
2012-11-27 17:56:33 +00:00
SdrPageView* pPV = GetSdrPageView();
if ( pViewData && pPV )
{
if ( SdrPage* pPage = pPV->GetPage() )
{
const size_t nCount = pPage->GetObjCount();
for ( size_t i = 0; i < nCount; ++i )
Sync draw object to calc grid for better alignment when zooming There can be some serious rounding errors involved when calculating where to draw the grid lines for the various row heights in a document. This can be especially true for a document that has many different row heights. This results in draw objects appearing to move relative to the grid line at different zoom levels. This patch attempts to fix this problem adjusting the position of the shapes as they are drawn to ensure their position relative to grid appears to be stable. We do this by translating the position of the shape to the corrosponding position of it's cell anchor. Of course not all shapes are cell anchored and in this case we position the shape relative a temporary synthesized cell anchor. The patch essentially does the following a) calculates the offset to be applied for each shape at the current zoom level to ensure that the shape will be drawn relative to the correct cell grid see drwlayer.cxx, drawview.cxx & gridwin3.cxx, svdobj.[ch]xx b) apply the offset in the drawing layer for each of the different drawing primitives see svx/source/sdr/contact/* c) making sure the position and size of the newly created shape ( at any zoom level ) are still as expected when zoom level is changed. see. sc/source/ui/drawfunc/fuco*.cxx & d) making sure that overlays and handles are displayed at the correct position see svx/source/svdraw/* it could also be that a full blown transform might be needed to additionally scale the object ( to ensure that the edges of the object stay stable relative to ajacent grid lines ) If necessary we could do that in a later step. Change-Id: I02232f8ba192d58dbf96b80adf66c281cd0f65e8
2012-11-27 17:56:33 +00:00
{
SdrObject* pObj = pPage->GetObj( i );
// Align objects to nearset grid position
SyncForGrid( pObj );
}
}
}
2000-09-18 16:07:07 +00:00
}
void ScDrawView::DoConnect(SdrOle2Obj* pOleObj)
{
if ( pViewData )
pViewData->GetViewShell()->ConnectObject( pOleObj );
}
void ScDrawView::MarkListHasChanged()
2000-09-18 16:07:07 +00:00
{
FmFormView::MarkListHasChanged();
ScTabViewShell* pViewSh = pViewData->GetViewShell();
// #i110829# remove the cell selection only if drawing objects are selected
if ( !bInConstruct && GetMarkedObjectList().GetMarkCount() )
2000-09-18 16:07:07 +00:00
{
pViewSh->Unmark(); // remove cell selection
2000-09-18 16:07:07 +00:00
2011-03-02 21:32:00 +01:00
// end cell edit mode if drawing objects are selected
SC_MOD()->InputEnterHandler();
2000-09-18 16:07:07 +00:00
}
// IP deaktivieren
ScModule* pScMod = SC_MOD();
bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF;
ScClient* pClient = static_cast<ScClient*>( pViewSh->GetIPClient() );
if ( pClient && pClient->IsObjectInPlaceActive() && !bUnoRefDialog )
2000-09-18 16:07:07 +00:00
{
2011-03-02 21:32:00 +01:00
// beim ViewShell::Activate aus dem Reset2Open nicht die Handles anzeigen
pClient->DeactivateObject();
2000-09-18 16:07:07 +00:00
// Image-Ole wieder durch Grafik ersetzen passiert jetzt in ScClient::UIActivate
}
// Ole-Objekt selektiert?
SdrOle2Obj* pOle2Obj = NULL;
SdrGrafObj* pGrafObj = NULL;
const SdrMarkList& rMarkList = GetMarkedObjectList();
const size_t nMarkCount = rMarkList.GetMarkCount();
2000-09-18 16:07:07 +00:00
if ( nMarkCount == 0 && !pViewData->GetViewShell()->IsDrawSelMode() && !bInConstruct )
{
// relock layers that may have been unlocked before
LockBackgroundLayer();
LockInternalLayer();
2000-09-18 16:07:07 +00:00
}
bool bSubShellSet = false;
2000-09-18 16:07:07 +00:00
if (nMarkCount == 1)
{
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
2000-09-18 16:07:07 +00:00
if (pObj->GetObjIdentifier() == OBJ_OLE2)
{
pOle2Obj = static_cast<SdrOle2Obj*>(pObj);
if (!ScDocument::IsChart(pObj) )
pViewSh->SetOleObjectShell(true);
2000-09-18 16:07:07 +00:00
else
pViewSh->SetChartShell(true);
bSubShellSet = true;
2000-09-18 16:07:07 +00:00
}
else if (pObj->GetObjIdentifier() == OBJ_GRAF)
{
pGrafObj = static_cast<SdrGrafObj*>(pObj);
pViewSh->SetGraphicShell(true);
bSubShellSet = true;
2000-09-18 16:07:07 +00:00
}
else if (pObj->GetObjIdentifier() == OBJ_MEDIA)
{
pViewSh->SetMediaShell(true);
bSubShellSet = true;
}
else if (pObj->GetObjIdentifier() != OBJ_TEXT // Verhindern, das beim Anlegen
2000-09-18 16:07:07 +00:00
|| !pViewSh->IsDrawTextShell()) // eines TextObjekts auf die
{ // DrawShell umgeschaltet wird.
pViewSh->SetDrawShell(true); //@#70206#
2000-09-18 16:07:07 +00:00
}
}
if ( nMarkCount && !bSubShellSet )
2000-09-18 16:07:07 +00:00
{
bool bOnlyControls = true;
bool bOnlyGraf = true;
for (size_t i=0; i<nMarkCount; ++i)
2000-09-18 16:07:07 +00:00
{
SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
2000-09-18 16:07:07 +00:00
if ( pObj->ISA( SdrObjGroup ) )
{
const SdrObjList *pLst = static_cast<SdrObjGroup*>(pObj)->GetSubList();
const size_t nListCount = pLst->GetObjCount();
if ( nListCount == 0 )
{
2011-03-02 21:32:00 +01:00
// An empty group (may occur during Undo) is no control or graphics object.
// Creating the form shell during undo would lead to problems with the undo manager.
bOnlyControls = false;
bOnlyGraf = false;
}
for ( size_t j = 0; j < nListCount; ++j )
2000-09-18 16:07:07 +00:00
{
SdrObject *pSubObj = pLst->GetObj( j );
if (!pSubObj->ISA(SdrUnoObj))
bOnlyControls = false;
if (pSubObj->GetObjIdentifier() != OBJ_GRAF)
bOnlyGraf = false;
2000-09-18 16:07:07 +00:00
if ( !bOnlyControls && !bOnlyGraf ) break;
}
2000-09-18 16:07:07 +00:00
}
else
2000-09-18 16:07:07 +00:00
{
if (!pObj->ISA(SdrUnoObj))
bOnlyControls = false;
if (pObj->GetObjIdentifier() != OBJ_GRAF)
bOnlyGraf = false;
2000-09-18 16:07:07 +00:00
}
if ( !bOnlyControls && !bOnlyGraf ) break;
2000-09-18 16:07:07 +00:00
}
if(bOnlyControls)
{
pViewSh->SetDrawFormShell(true); // jetzt UNO-Controls
2000-09-18 16:07:07 +00:00
}
else if(bOnlyGraf)
{
pViewSh->SetGraphicShell(true);
}
2000-09-18 16:07:07 +00:00
else if(nMarkCount>1)
{
pViewSh->SetDrawShell(true);
2000-09-18 16:07:07 +00:00
}
}
// Verben anpassen
SfxViewFrame* pViewFrame = pViewSh->GetViewFrame();
bool bOle = pViewSh->GetViewFrame()->GetFrame().IsInPlace();
uno::Sequence< embed::VerbDescriptor > aVerbs;
2000-09-18 16:07:07 +00:00
if ( pOle2Obj && !bOle )
{
uno::Reference < embed::XEmbeddedObject > xObj = pOle2Obj->GetObjRef();
OSL_ENSURE( xObj.is(), "SdrOle2Obj ohne ObjRef" );
if (xObj.is())
aVerbs = xObj->getSupportedVerbs();
2000-09-18 16:07:07 +00:00
}
pViewSh->SetVerbs( aVerbs );
2000-09-18 16:07:07 +00:00
// Image-Map Editor
if ( pOle2Obj )
UpdateIMap( pOle2Obj );
else if ( pGrafObj )
UpdateIMap( pGrafObj );
InvalidateAttribs(); // nach dem IMap-Editor Update
InvalidateDrawTextAttrs();
for(sal_uInt32 a(0L); a < PaintWindowCount(); a++)
2000-09-18 16:07:07 +00:00
{
SdrPaintWindow* pPaintWindow = GetPaintWindow(a);
OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
if(OUTDEV_WINDOW == rOutDev.GetOutDevType())
{
static_cast<vcl::Window&>(rOutDev).Update();
}
2000-09-18 16:07:07 +00:00
}
2001-10-02 17:41:42 +00:00
// uno object for view returns drawing objects as selection,
// so it must notify its SelectionChangeListeners
if (pViewFrame)
{
SfxFrame& rFrame = pViewFrame->GetFrame();
uno::Reference<frame::XController> xController = rFrame.GetController();
if (xController.is())
{
ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController );
if (pImp)
pImp->SelectionChanged();
}
}
2001-10-02 17:41:42 +00:00
// update selection transfer object
pViewSh->CheckSelectionTransfer();
2000-09-18 16:07:07 +00:00
}
bool ScDrawView::SdrBeginTextEdit(
SdrObject* pObj,
SdrPageView* pPV,
vcl::Window* pWinL,
bool bIsNewObj,
SdrOutliner* pGivenOutliner,
OutlinerView* pGivenOutlinerView,
bool bDontDeleteOutliner,
bool bOnlyOneView,
bool bGrabFocus )
{
const bool bRet = FmFormView::SdrBeginTextEdit(
pObj, pPV, pWinL, bIsNewObj,
pGivenOutliner, pGivenOutlinerView, bDontDeleteOutliner,
bOnlyOneView, bGrabFocus );
ScTabViewShell* pViewSh = pViewData->GetViewShell();
if ( pViewSh->GetViewFrame() )
{
SfxFrame& rFrame = pViewSh->GetViewFrame()->GetFrame();
uno::Reference< frame::XController > xController = rFrame.GetController();
if (xController.is())
{
ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController );
if (pImp)
pImp->SelectionChanged();
}
}
return bRet;
}
SdrEndTextEditKind ScDrawView::SdrEndTextEdit( bool bDontDeleteReally )
{
const SdrEndTextEditKind eRet = FmFormView::SdrEndTextEdit( bDontDeleteReally );
ScTabViewShell* pViewSh = pViewData->GetViewShell();
if ( pViewSh->GetViewFrame() )
{
SfxFrame& rFrame = pViewSh->GetViewFrame()->GetFrame();
uno::Reference< frame::XController > xController = rFrame.GetController();
if (xController.is())
{
ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController );
if (pImp)
pImp->SelectionChanged();
}
}
return eRet;
}
2010-12-11 23:25:30 +01:00
void ScDrawView::ModelHasChanged()
2000-09-18 16:07:07 +00:00
{
SdrObject* pEditObj = GetTextEditObject();
if ( pEditObj && !pEditObj->IsInserted() && pViewData )
{
2011-03-02 21:32:00 +01:00
// SdrObjEditView::ModelHasChanged will end text edit in this case,
// so make sure the EditEngine's undo manager is no longer used.
pViewData->GetViewShell()->SetDrawTextUndo(NULL);
SetCreateMode(); // don't leave FuText in a funny state
}
2000-09-18 16:07:07 +00:00
FmFormView::ModelHasChanged();
}
2010-12-11 23:25:30 +01:00
void ScDrawView::UpdateUserViewOptions()
2000-09-18 16:07:07 +00:00
{
if (pViewData)
{
const ScViewOptions& rOpt = pViewData->GetOptions();
const ScGridOptions& rGrid = rOpt.GetGridOptions();
SetDragStripes( rOpt.GetOption( VOPT_HELPLINES ) );
SetMarkHdlSizePixel( SC_HANDLESIZE_BIG );
2000-09-18 16:07:07 +00:00
SetGridVisible( rGrid.GetGridVisible() );
SetSnapEnabled( rGrid.GetUseGridSnap() );
SetGridSnap( rGrid.GetUseGridSnap() );
Fraction aFractX( rGrid.GetFieldDrawX(), rGrid.GetFieldDivisionX() + 1 );
Fraction aFractY( rGrid.GetFieldDrawY(), rGrid.GetFieldDivisionY() + 1 );
SetSnapGridWidth( aFractX, aFractY );
2000-09-18 16:07:07 +00:00
SetGridCoarse( Size( rGrid.GetFieldDrawX(), rGrid.GetFieldDrawY() ) );
SetGridFine( Size( rGrid.GetFieldDrawX() / (rGrid.GetFieldDivisionX() + 1),
rGrid.GetFieldDrawY() / (rGrid.GetFieldDivisionY() + 1) ) );
2000-09-18 16:07:07 +00:00
}
}
SdrObject* ScDrawView::GetObjectByName(const OUString& rName)
{
SfxObjectShell* pShell = pDoc->GetDocumentShell();
if (pShell)
{
SdrModel* pDrawLayer = GetModel();
sal_uInt16 nTabCount = pDoc->GetTableCount();
for (sal_uInt16 i=0; i<nTabCount; i++)
{
SdrPage* pPage = pDrawLayer->GetPage(i);
DBG_ASSERT(pPage,"Page ?");
if (pPage)
{
SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS );
SdrObject* pObject = aIter.Next();
while (pObject)
{
if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
{
return pObject;
}
pObject = aIter.Next();
}
}
}
}
return 0;
}
//realize multi-selection of objects
bool ScDrawView::SelectCurrentViewObject( const OUString& rName )
{
sal_uInt16 nObjectTab = 0;
SdrObject* pFound = NULL;
bool bUnMark = false;
SfxObjectShell* pShell = pDoc->GetDocumentShell();
if (pShell)
{
SdrModel* pDrawLayer = GetModel();
sal_uInt16 nTabCount = pDoc->GetTableCount();
for (sal_uInt16 i=0; i<nTabCount && !pFound; i++)
{
SdrPage* pPage = pDrawLayer->GetPage(i);
DBG_ASSERT(pPage,"Page ?");
if (pPage)
{
SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
SdrObject* pObject = aIter.Next();
while (pObject && !pFound)
{
if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
{
pFound = pObject;
nObjectTab = i;
}
pObject = aIter.Next();
}
}
}
}
if ( pFound )
{
ScTabView* pView = pViewData->GetView();
if ( nObjectTab != nTab ) // Tabelle umschalten
pView->SetTabNo( nObjectTab );
DBG_ASSERT( nTab == nObjectTab, "Tabellen umschalten hat nicht geklappt" );
pView->ScrollToObject( pFound );
if ( pFound->GetLayer() == SC_LAYER_BACK &&
!pViewData->GetViewShell()->IsDrawSelMode() &&
!pDoc->IsTabProtected( nTab ) &&
!pViewData->GetSfxDocShell()->IsReadOnly() )
{
SdrLayer* pLayer = GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_BACK);
if (pLayer)
SetLayerLocked( pLayer->GetName(), false );
}
SdrPageView* pPV = GetSdrPageView();
bUnMark = IsObjMarked(pFound);
MarkObj( pFound, pPV, bUnMark);
}
return bUnMark;
}
bool ScDrawView::SelectObject( const OUString& rName )
2000-09-18 16:07:07 +00:00
{
UnmarkAll();
SCTAB nObjectTab = 0;
2000-09-18 16:07:07 +00:00
SdrObject* pFound = NULL;
SfxObjectShell* pShell = pDoc->GetDocumentShell();
if (pShell)
{
SdrModel* pDrawLayer = GetModel();
SCTAB nTabCount = pDoc->GetTableCount();
for (SCTAB i=0; i<nTabCount && !pFound; i++)
2000-09-18 16:07:07 +00:00
{
SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(i));
OSL_ENSURE(pPage,"Page ?");
2000-09-18 16:07:07 +00:00
if (pPage)
{
SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
SdrObject* pObject = aIter.Next();
while (pObject && !pFound)
{
if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
2000-09-18 16:07:07 +00:00
{
pFound = pObject;
nObjectTab = i;
}
pObject = aIter.Next();
}
}
}
}
if ( pFound )
{
ScTabView* pView = pViewData->GetView();
if ( nObjectTab != nTab ) // Tabelle umschalten
pView->SetTabNo( nObjectTab );
OSL_ENSURE( nTab == nObjectTab, "Tabellen umschalten hat nicht geklappt" );
2000-09-18 16:07:07 +00:00
pView->ScrollToObject( pFound );
2011-03-02 21:32:00 +01:00
/* To select an object on the background layer, the layer has to
be unlocked even if exclusive drawing selection mode is not active
(this is reversed in MarkListHasChanged when nothing is selected) */
2000-09-18 16:07:07 +00:00
if ( pFound->GetLayer() == SC_LAYER_BACK &&
!pViewData->GetViewShell()->IsDrawSelMode() &&
!pDoc->IsTabProtected( nTab ) &&
!pViewData->GetSfxDocShell()->IsReadOnly() )
{
UnlockBackgroundLayer();
2000-09-18 16:07:07 +00:00
}
SdrPageView* pPV = GetSdrPageView();
2000-09-18 16:07:07 +00:00
MarkObj( pFound, pPV );
}
return ( pFound != NULL );
}
//If object is marked , return true , else return false .
bool ScDrawView::GetObjectIsMarked( SdrObject* pObject )
{
bool bisMarked = false;
if (pObject )
{
bisMarked = IsObjMarked(pObject);
}
return bisMarked;
}
2000-09-18 16:07:07 +00:00
bool ScDrawView::InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV, SdrInsertFlags nOptions)
2000-09-18 16:07:07 +00:00
{
// Markierung nicht aendern, wenn Ole-Objekt aktiv
// (bei Drop aus Ole-Objekt wuerde sonst mitten im ExecuteDrag deaktiviert!)
if (pViewData)
{
SfxInPlaceClient* pClient = pViewData->GetViewShell()->GetIPClient();
if ( pClient && pClient->IsObjectInPlaceActive() )
nOptions |= SdrInsertFlags::DONTMARK;
2000-09-18 16:07:07 +00:00
}
return InsertObjectAtView( pObj, rPV, nOptions );
2000-09-18 16:07:07 +00:00
}
SdrObject* ScDrawView::GetMarkedNoteCaption( ScDrawObjData** ppCaptData )
{
const SdrMarkList& rMarkList = GetMarkedObjectList();
if( pViewData && (rMarkList.GetMarkCount() == 1) )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
if( ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, pViewData->GetTabNo() ) )
{
if( ppCaptData ) *ppCaptData = pCaptData;
return pObj;
}
}
return 0;
}
void ScDrawView::LockCalcLayer( SdrLayerID nLayer, bool bLock )
{
SdrLayer* pLockLayer = GetModel()->GetLayerAdmin().GetLayerPerID( nLayer );
if( pLockLayer && (IsLayerLocked( pLockLayer->GetName() ) != bLock) )
SetLayerLocked( pLockLayer->GetName(), bLock );
}
void ScDrawView::MakeVisible( const Rectangle& rRect, vcl::Window& rWin )
2000-09-18 16:07:07 +00:00
{
//! rWin richtig auswerten
//! ggf Zoom aendern
if ( pViewData && pViewData->GetActiveWin() == &rWin )
pViewData->GetView()->MakeVisible( rRect );
}
void ScDrawView::DeleteMarked()
{
// try to delete a note caption object with its cell note in the Calc document
ScDrawObjData* pCaptData = 0;
if( SdrObject* pCaptObj = GetMarkedNoteCaption( &pCaptData ) )
{
(void)pCaptObj; // prevent 'unused variable' compiler warning in pro builds
ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
ScDocShell* pDocShell = pViewData ? pViewData->GetDocShell() : 0;
::svl::IUndoManager* pUndoMgr = pDocShell ? pDocShell->GetUndoManager() : 0;
bool bUndo = pDrawLayer && pDocShell && pUndoMgr && pDoc->IsUndoEnabled();
// remove the cell note from document, we are its owner now
ScPostIt* pNote = pDoc->ReleaseNote( pCaptData->maStart );
OSL_ENSURE( pNote, "ScDrawView::DeleteMarked - cell note missing in document" );
if( pNote )
{
// rescue note data for undo (with pointer to caption object)
ScNoteData aNoteData = pNote->GetNoteData();
OSL_ENSURE( aNoteData.mpCaption == pCaptObj, "ScDrawView::DeleteMarked - caption object does not match" );
// collect the drawing undo action created while deleting the note
if( bUndo )
pDrawLayer->BeginCalcUndo(false);
// delete the note (already removed from document above)
delete pNote;
// add the undo action for the note
if( bUndo )
pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, pCaptData->maStart, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
// repaint the cell to get rid of the note marker
if( pDocShell )
pDocShell->PostPaintCell( pCaptData->maStart );
// done, return now to skip call of FmFormView::DeleteMarked()
return;
}
}
FmFormView::DeleteMarked();
}
2000-09-18 16:07:07 +00:00
SdrEndTextEditKind ScDrawView::ScEndTextEdit()
{
bool bIsTextEdit = IsTextEdit();
SdrEndTextEditKind eKind = SdrEndTextEdit();
2000-09-18 16:07:07 +00:00
if ( bIsTextEdit && pViewData )
pViewData->GetViewShell()->SetDrawTextUndo(NULL); // "normaler" Undo-Manager
return eKind;
}
void ScDrawView::MarkDropObj( SdrObject* pObj )
{
if ( pDropMarkObj != pObj )
2000-09-18 16:07:07 +00:00
{
pDropMarkObj = pObj;
ImplClearCalcDropMarker();
if(pDropMarkObj)
2000-09-18 16:07:07 +00:00
{
pDropMarker = new SdrDropMarkerOverlay(*this, *pDropMarkObj);
2000-09-18 16:07:07 +00:00
}
}
}
Sync draw object to calc grid for better alignment when zooming There can be some serious rounding errors involved when calculating where to draw the grid lines for the various row heights in a document. This can be especially true for a document that has many different row heights. This results in draw objects appearing to move relative to the grid line at different zoom levels. This patch attempts to fix this problem adjusting the position of the shapes as they are drawn to ensure their position relative to grid appears to be stable. We do this by translating the position of the shape to the corrosponding position of it's cell anchor. Of course not all shapes are cell anchored and in this case we position the shape relative a temporary synthesized cell anchor. The patch essentially does the following a) calculates the offset to be applied for each shape at the current zoom level to ensure that the shape will be drawn relative to the correct cell grid see drwlayer.cxx, drawview.cxx & gridwin3.cxx, svdobj.[ch]xx b) apply the offset in the drawing layer for each of the different drawing primitives see svx/source/sdr/contact/* c) making sure the position and size of the newly created shape ( at any zoom level ) are still as expected when zoom level is changed. see. sc/source/ui/drawfunc/fuco*.cxx & d) making sure that overlays and handles are displayed at the correct position see svx/source/svdraw/* it could also be that a full blown transform might be needed to additionally scale the object ( to ensure that the edges of the object stay stable relative to ajacent grid lines ) If necessary we could do that in a later step. Change-Id: I02232f8ba192d58dbf96b80adf66c281cd0f65e8
2012-11-27 17:56:33 +00:00
// In order to counteract the effects of rounding due to the nature of how the
// grid positions are calcuated and drawn we calculate the offset needed at the
// current zoom to be applied to an SrdObject when it is drawn in order to make
// sure that it's position relative to the nearest cell anchor doesn't change.
// Of course not all shape(s)/control(s) are cell anchored, if the
// object doesn't have a cell anchor we synthesise a temporary anchor.
void ScDrawView::SyncForGrid( SdrObject* pObj )
{
// process members of a group shape separately
if ( pObj->ISA( SdrObjGroup ) )
{
SdrObjList *pLst = static_cast<SdrObjGroup*>(pObj)->GetSubList();
for ( size_t i = 0, nCount = pLst->GetObjCount(); i < nCount; ++i )
SyncForGrid( pLst->GetObj( i ) );
}
Sync draw object to calc grid for better alignment when zooming There can be some serious rounding errors involved when calculating where to draw the grid lines for the various row heights in a document. This can be especially true for a document that has many different row heights. This results in draw objects appearing to move relative to the grid line at different zoom levels. This patch attempts to fix this problem adjusting the position of the shapes as they are drawn to ensure their position relative to grid appears to be stable. We do this by translating the position of the shape to the corrosponding position of it's cell anchor. Of course not all shapes are cell anchored and in this case we position the shape relative a temporary synthesized cell anchor. The patch essentially does the following a) calculates the offset to be applied for each shape at the current zoom level to ensure that the shape will be drawn relative to the correct cell grid see drwlayer.cxx, drawview.cxx & gridwin3.cxx, svdobj.[ch]xx b) apply the offset in the drawing layer for each of the different drawing primitives see svx/source/sdr/contact/* c) making sure the position and size of the newly created shape ( at any zoom level ) are still as expected when zoom level is changed. see. sc/source/ui/drawfunc/fuco*.cxx & d) making sure that overlays and handles are displayed at the correct position see svx/source/svdraw/* it could also be that a full blown transform might be needed to additionally scale the object ( to ensure that the edges of the object stay stable relative to ajacent grid lines ) If necessary we could do that in a later step. Change-Id: I02232f8ba192d58dbf96b80adf66c281cd0f65e8
2012-11-27 17:56:33 +00:00
ScSplitPos eWhich = pViewData->GetActivePart();
ScGridWindow* pGridWin = pViewData->GetActiveWin();
ScDrawObjData* pData = ScDrawLayer::GetObjData( pObj );
Sync draw object to calc grid for better alignment when zooming There can be some serious rounding errors involved when calculating where to draw the grid lines for the various row heights in a document. This can be especially true for a document that has many different row heights. This results in draw objects appearing to move relative to the grid line at different zoom levels. This patch attempts to fix this problem adjusting the position of the shapes as they are drawn to ensure their position relative to grid appears to be stable. We do this by translating the position of the shape to the corrosponding position of it's cell anchor. Of course not all shapes are cell anchored and in this case we position the shape relative a temporary synthesized cell anchor. The patch essentially does the following a) calculates the offset to be applied for each shape at the current zoom level to ensure that the shape will be drawn relative to the correct cell grid see drwlayer.cxx, drawview.cxx & gridwin3.cxx, svdobj.[ch]xx b) apply the offset in the drawing layer for each of the different drawing primitives see svx/source/sdr/contact/* c) making sure the position and size of the newly created shape ( at any zoom level ) are still as expected when zoom level is changed. see. sc/source/ui/drawfunc/fuco*.cxx & d) making sure that overlays and handles are displayed at the correct position see svx/source/svdraw/* it could also be that a full blown transform might be needed to additionally scale the object ( to ensure that the edges of the object stay stable relative to ajacent grid lines ) If necessary we could do that in a later step. Change-Id: I02232f8ba192d58dbf96b80adf66c281cd0f65e8
2012-11-27 17:56:33 +00:00
if ( pGridWin )
{
ScAddress aOldStt;
if( pData && pData->maStart.IsValid())
Sync draw object to calc grid for better alignment when zooming There can be some serious rounding errors involved when calculating where to draw the grid lines for the various row heights in a document. This can be especially true for a document that has many different row heights. This results in draw objects appearing to move relative to the grid line at different zoom levels. This patch attempts to fix this problem adjusting the position of the shapes as they are drawn to ensure their position relative to grid appears to be stable. We do this by translating the position of the shape to the corrosponding position of it's cell anchor. Of course not all shapes are cell anchored and in this case we position the shape relative a temporary synthesized cell anchor. The patch essentially does the following a) calculates the offset to be applied for each shape at the current zoom level to ensure that the shape will be drawn relative to the correct cell grid see drwlayer.cxx, drawview.cxx & gridwin3.cxx, svdobj.[ch]xx b) apply the offset in the drawing layer for each of the different drawing primitives see svx/source/sdr/contact/* c) making sure the position and size of the newly created shape ( at any zoom level ) are still as expected when zoom level is changed. see. sc/source/ui/drawfunc/fuco*.cxx & d) making sure that overlays and handles are displayed at the correct position see svx/source/svdraw/* it could also be that a full blown transform might be needed to additionally scale the object ( to ensure that the edges of the object stay stable relative to ajacent grid lines ) If necessary we could do that in a later step. Change-Id: I02232f8ba192d58dbf96b80adf66c281cd0f65e8
2012-11-27 17:56:33 +00:00
{
aOldStt = pData->maStart;
}
else
{
// Page anchored object so...
// synthesise an anchor ( but don't attach it to
// the object as we want to maintain page anchoring )
ScDrawObjData aAnchor;
ScDrawLayer::GetCellAnchorFromPosition( *pObj, aAnchor, *pDoc, GetTab() );
aOldStt = aAnchor.maStart;
}
MapMode aDrawMode = pGridWin->GetDrawMapMode();
// find pos anchor position
Point aOldPos( pDoc->GetColOffset( aOldStt.Col(), aOldStt.Tab() ), pDoc->GetRowOffset( aOldStt.Row(), aOldStt.Tab() ) );
aOldPos.X() = sc::TwipsToHMM( aOldPos.X() );
aOldPos.Y() = sc::TwipsToHMM( aOldPos.Y() );
// find position of same point on the screen ( e.g. grid )
Point aCurPos = pViewData->GetScrPos( aOldStt.Col(), aOldStt.Row(), eWhich, true );
Sync draw object to calc grid for better alignment when zooming There can be some serious rounding errors involved when calculating where to draw the grid lines for the various row heights in a document. This can be especially true for a document that has many different row heights. This results in draw objects appearing to move relative to the grid line at different zoom levels. This patch attempts to fix this problem adjusting the position of the shapes as they are drawn to ensure their position relative to grid appears to be stable. We do this by translating the position of the shape to the corrosponding position of it's cell anchor. Of course not all shapes are cell anchored and in this case we position the shape relative a temporary synthesized cell anchor. The patch essentially does the following a) calculates the offset to be applied for each shape at the current zoom level to ensure that the shape will be drawn relative to the correct cell grid see drwlayer.cxx, drawview.cxx & gridwin3.cxx, svdobj.[ch]xx b) apply the offset in the drawing layer for each of the different drawing primitives see svx/source/sdr/contact/* c) making sure the position and size of the newly created shape ( at any zoom level ) are still as expected when zoom level is changed. see. sc/source/ui/drawfunc/fuco*.cxx & d) making sure that overlays and handles are displayed at the correct position see svx/source/svdraw/* it could also be that a full blown transform might be needed to additionally scale the object ( to ensure that the edges of the object stay stable relative to ajacent grid lines ) If necessary we could do that in a later step. Change-Id: I02232f8ba192d58dbf96b80adf66c281cd0f65e8
2012-11-27 17:56:33 +00:00
Point aCurPosHmm = pGridWin->PixelToLogic(aCurPos, aDrawMode );
Point aGridOff = ( aCurPosHmm - aOldPos );
// fdo#63878 Fix the X position for RTL Sheet
if( pDoc->IsNegativePage( GetTab() ) )
aGridOff.setX( aCurPosHmm.getX() + aOldPos.getX() );
Sync draw object to calc grid for better alignment when zooming There can be some serious rounding errors involved when calculating where to draw the grid lines for the various row heights in a document. This can be especially true for a document that has many different row heights. This results in draw objects appearing to move relative to the grid line at different zoom levels. This patch attempts to fix this problem adjusting the position of the shapes as they are drawn to ensure their position relative to grid appears to be stable. We do this by translating the position of the shape to the corrosponding position of it's cell anchor. Of course not all shapes are cell anchored and in this case we position the shape relative a temporary synthesized cell anchor. The patch essentially does the following a) calculates the offset to be applied for each shape at the current zoom level to ensure that the shape will be drawn relative to the correct cell grid see drwlayer.cxx, drawview.cxx & gridwin3.cxx, svdobj.[ch]xx b) apply the offset in the drawing layer for each of the different drawing primitives see svx/source/sdr/contact/* c) making sure the position and size of the newly created shape ( at any zoom level ) are still as expected when zoom level is changed. see. sc/source/ui/drawfunc/fuco*.cxx & d) making sure that overlays and handles are displayed at the correct position see svx/source/svdraw/* it could also be that a full blown transform might be needed to additionally scale the object ( to ensure that the edges of the object stay stable relative to ajacent grid lines ) If necessary we could do that in a later step. Change-Id: I02232f8ba192d58dbf96b80adf66c281cd0f65e8
2012-11-27 17:56:33 +00:00
pObj->SetGridOffset( aGridOff );
}
}
// support enhanced text edit for draw objects
SdrUndoManager* ScDrawView::getSdrUndoManagerForEnhancedTextEdit() const
{
return pDoc ? dynamic_cast< SdrUndoManager* >(pDoc->GetUndoManager()) : 0;
}
// #i123922# helper to apply a Graphic to an existing SdrObject
SdrObject* ScDrawView::ApplyGraphicToObject(
SdrObject& rHitObject,
const Graphic& rGraphic,
const OUString& rBeginUndoText,
const OUString& rFile,
const OUString& rFilter)
{
if(dynamic_cast< SdrGrafObj* >(&rHitObject))
{
SdrGrafObj* pNewGrafObj = static_cast<SdrGrafObj*>(rHitObject.Clone());
pNewGrafObj->SetGraphic(rGraphic);
BegUndo(rBeginUndoText);
ReplaceObjectAtView(&rHitObject, *GetSdrPageView(), pNewGrafObj);
// set in all cases - the Clone() will have copied an existing link (!)
pNewGrafObj->SetGraphicLink( rFile, ""/*TODO?*/, rFilter );
EndUndo();
return pNewGrafObj;
}
else if(rHitObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rHitObject))
{
AddUndo(new SdrUndoAttrObj(rHitObject));
SfxItemSet aSet(GetModel()->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
aSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
aSet.Put(XFillBitmapItem(OUString(), rGraphic));
rHitObject.SetMergedItemSetAndBroadcast(aSet);
return &rHitObject;
}
return NULL;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */