diff options
-rw-r--r-- | sc/Library_sc.mk | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/gridwin.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 47 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin_dbgutil.cxx | 60 |
4 files changed, 73 insertions, 46 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index d2fd5cd345b9..c0644f865917 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -664,6 +664,12 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/xmlsource/xmlsourcedlg \ )) +ifneq (,$(gb_ENABLE_DBGUTIL)) +$(eval $(call gb_Library_add_exception_objects,sc,\ + sc/source/ui/view/gridwin_dbgutil \ +)) +endif + $(eval $(call gb_Helper_optional,OPENCL,\ $(call gb_Library_add_exception_objects,sc,\ sc/source/core/opencl/formulagroupcl \ diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index e4bb56aac1f0..ca41b94a93fd 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -438,6 +438,12 @@ protected: void ImpCreateOverlayObjects(); void ImpDestroyOverlayObjects(); +private: + +#ifdef DBG_UTIL + void dumpInformation(); +#endif + }; #endif diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 8b4c4b08c870..5ff13086bf99 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -52,7 +52,6 @@ #include <svx/svditer.hxx> #include <svx/svdocapt.hxx> #include <svx/svdpagv.hxx> -#include <svx/svdpage.hxx> #include <com/sun/star/sheet/DataPilotFieldFilter.hpp> #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> @@ -3392,20 +3391,6 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCsCOL nCellX, } } -#ifdef DBG_UTIL - -namespace { - -std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr) -{ - rStrm << "Col: " << rAddr.Col() << ", Row: " << rAddr.Row() << ", Tab: " << rAddr.Tab(); - return rStrm; -} - -} - -#endif - void ScGridWindow::KeyInput(const KeyEvent& rKEvt) { // Cursor control for ref input dialog @@ -3526,37 +3511,7 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) if (rKeyCode.IsMod1() && rKeyCode.IsShift() && rKeyCode.GetCode() == KEY_F12) { - ScDocument* pDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); - for (SCCOL nCol = 0; nCol <= 20; ++nCol) - { - sal_uInt16 nWidth = pDoc->GetColWidth(nCol, nTab, true); - long nPixel = LogicToPixel(Point(nWidth, 0), MapMode(MAP_TWIP)).getX(); - std::cout << "Column: " << nCol << ", Width: " << nPixel << "px" << std::endl; - } - - ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); - if (pDrawLayer) - { - sal_uInt16 nPageCount = pDrawLayer->GetPageCount(); - for (sal_uInt16 nPage = 0; nPage < nPageCount; ++nPage) - { - SdrPage* pPage = pDrawLayer->GetPage(nPage); - sal_uInt16 nObjCount = pPage->GetObjCount(); - for (sal_uInt16 nObj = 0; nObj < nObjCount; ++nObj) - { - SdrObject* pObj = pPage->GetObj(nObj); - std::cout << "Graphic Object"; - ScDrawObjData* pObjData = ScDrawLayer::GetObjData(pObj); - if (pObjData) - std::cout << "Start Position: " << pObjData->maStart << ", EndPosition: " << pObjData->maEnd << std::endl; - - const Rectangle& rRect = pObj->GetSnapRect(); - Rectangle aRect = LogicToPixel(rRect, MapMode(pDrawLayer->GetScaleUnit())); - std::cout << "Snap Rectangle (in pixel): " << aRect << std::endl; - } - } - } + dumpInformation(); } #endif diff --git a/sc/source/ui/view/gridwin_dbgutil.cxx b/sc/source/ui/view/gridwin_dbgutil.cxx new file mode 100644 index 000000000000..fd57e703533d --- /dev/null +++ b/sc/source/ui/view/gridwin_dbgutil.cxx @@ -0,0 +1,60 @@ +/* -*- 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/. + */ + +#include "gridwin.hxx" +#include <svx/svdpage.hxx> + +#include "userdat.hxx" + +namespace { + +std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr) +{ + rStrm << "Col: " << rAddr.Col() << ", Row: " << rAddr.Row() << ", Tab: " << rAddr.Tab(); + return rStrm; +} + +} + +void ScGridWindow::dumpInformation() +{ + ScDocument* pDoc = pViewData->GetDocument(); + SCTAB nTab = pViewData->GetTabNo(); + for (SCCOL nCol = 0; nCol <= 20; ++nCol) + { + sal_uInt16 nWidth = pDoc->GetColWidth(nCol, nTab, true); + long nPixel = LogicToPixel(Point(nWidth, 0), MapMode(MAP_TWIP)).getX(); + std::cout << "Column: " << nCol << ", Width: " << nPixel << "px" << std::endl; + } + + ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); + if (pDrawLayer) + { + sal_uInt16 nPageCount = pDrawLayer->GetPageCount(); + for (sal_uInt16 nPage = 0; nPage < nPageCount; ++nPage) + { + SdrPage* pPage = pDrawLayer->GetPage(nPage); + sal_uInt16 nObjCount = pPage->GetObjCount(); + for (sal_uInt16 nObj = 0; nObj < nObjCount; ++nObj) + { + SdrObject* pObj = pPage->GetObj(nObj); + std::cout << "Graphic Object"; + ScDrawObjData* pObjData = ScDrawLayer::GetObjData(pObj); + if (pObjData) + std::cout << "Start Position: " << pObjData->maStart << ", EndPosition: " << pObjData->maEnd << std::endl; + + const Rectangle& rRect = pObj->GetSnapRect(); + Rectangle aRect = LogicToPixel(rRect, MapMode(pDrawLayer->GetScaleUnit())); + std::cout << "Snap Rectangle (in pixel): " << aRect << std::endl; + } + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |