sc/Library_sc.mk | 6 ++ sc/README | 15 ++++++ sc/source/ui/inc/gridwin.hxx | 7 +++ sc/source/ui/view/gridwin.cxx | 14 +++--- sc/source/ui/view/gridwin_dbgutil.cxx | 75 ++++++++++++++++++++++++++++++++++ 5 files changed, 110 insertions(+), 7 deletions(-)
New commits: commit 9fe39ba54c5ff9dbbd001e77e620d62913161531 Author: Markus Mohrhard <[email protected]> Date: Fri May 22 08:48:24 2015 +0200 add information about dumping graphic object info Change-Id: I9c0b566d169262985ed6bb4c7be73cc39cd78616 diff --git a/sc/README b/sc/README index 5f898b3..e4e46e3 100644 --- a/sc/README +++ b/sc/README @@ -9,5 +9,8 @@ There is a mode to dump some information in a dbgutil build. === CTRL+SHIFT+F12 === -Dumps the column width of the first 20 column in pixel and the -pixel position and size of graphic objects. +Dumps the column width of the first 20 columns. + +=== CTRL+SHIFT+F11 === + +Dumps the graphic objects and their position and size in pixel. commit b94d86112ff6a408dc62e247dc3284bcb646aefa Author: Markus Mohrhard <[email protected]> Date: Fri May 22 08:46:45 2015 +0200 use better markup Change-Id: I01e58a0a5ce70f20c409cbe344af5f7db7635a38 diff --git a/sc/README b/sc/README index a73f3b2..5f898b3 100644 --- a/sc/README +++ b/sc/README @@ -7,7 +7,7 @@ There is a mode to dump some information in a dbgutil build. == Graphical information == -= CTRL+SHIFT+F12 = +=== CTRL+SHIFT+F12 === Dumps the column width of the first 20 column in pixel and the pixel position and size of graphic objects. commit 6b5f0a041bed594280e13fc72062235e2b285fa5 Author: Markus Mohrhard <[email protected]> Date: Fri May 22 08:43:47 2015 +0200 improve output for ScDrawObjData Change-Id: I45544532efeee1482b724f1a22525667b4be827c diff --git a/sc/source/ui/view/gridwin_dbgutil.cxx b/sc/source/ui/view/gridwin_dbgutil.cxx index e111e6c..4806c38 100644 --- a/sc/source/ui/view/gridwin_dbgutil.cxx +++ b/sc/source/ui/view/gridwin_dbgutil.cxx @@ -20,6 +20,17 @@ std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr) return rStrm; } +void dumpScDrawObjData(ScGridWindow& rWindow, ScDrawObjData& rData, MapUnit eMapUnit) +{ + const Point& rStartOffset = rData.maStartOffset; + Point aStartOffsetPixel = rWindow.LogicToPixel(rStartOffset, MapMode(eMapUnit)); + std::cout << " Start: " << rData.maStart << ", Offset: " << aStartOffsetPixel << std::endl; + + const Point& rEndOffset = rData.maEndOffset; + Point aEndOffsetPixel = rWindow.LogicToPixel(rEndOffset, MapMode(eMapUnit)); + std::cout << " End: : " << rData.maEnd << ", Offset: " << aEndOffsetPixel << std::endl; +} + } void ScGridWindow::dumpColumnInformation() @@ -51,7 +62,7 @@ void ScGridWindow::dumpGraphicInformation() std::cout << "Graphic Object" << std::endl; ScDrawObjData* pObjData = ScDrawLayer::GetObjData(pObj); if (pObjData) - std::cout << "Start Position: " << pObjData->maStart << ", EndPosition: " << pObjData->maEnd << std::endl; + dumpScDrawObjData(*this, *pObjData, pDrawLayer->GetScaleUnit()); const Rectangle& rRect = pObj->GetSnapRect(); Rectangle aRect = LogicToPixel(rRect, MapMode(pDrawLayer->GetScaleUnit())); commit 8a9758ed05cb5597df9ad56fefe146f1feff41fa Author: Markus Mohrhard <[email protected]> Date: Fri May 22 08:22:50 2015 +0200 split column info dump and graphic object dumping Change-Id: Ie78722790639f151453b4c0f6ab9e599abb4aa89 diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index ca41b94..b4d2ef7 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -441,7 +441,8 @@ protected: private: #ifdef DBG_UTIL - void dumpInformation(); + void dumpColumnInformation(); + void dumpGraphicInformation(); #endif }; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 5ff1308..f4c7010 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -3509,9 +3509,16 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) #ifdef DBG_UTIL - if (rKeyCode.IsMod1() && rKeyCode.IsShift() && rKeyCode.GetCode() == KEY_F12) + if (rKeyCode.IsMod1() && rKeyCode.IsShift()) { - dumpInformation(); + if (rKeyCode.GetCode() == KEY_F12) + { + dumpColumnInformation(); + } + else if (rKeyCode.GetCode() == KEY_F11) + { + dumpGraphicInformation(); + } } #endif diff --git a/sc/source/ui/view/gridwin_dbgutil.cxx b/sc/source/ui/view/gridwin_dbgutil.cxx index fd57e70..e111e6c 100644 --- a/sc/source/ui/view/gridwin_dbgutil.cxx +++ b/sc/source/ui/view/gridwin_dbgutil.cxx @@ -22,7 +22,7 @@ std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr) } -void ScGridWindow::dumpInformation() +void ScGridWindow::dumpColumnInformation() { ScDocument* pDoc = pViewData->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); @@ -32,7 +32,11 @@ void ScGridWindow::dumpInformation() long nPixel = LogicToPixel(Point(nWidth, 0), MapMode(MAP_TWIP)).getX(); std::cout << "Column: " << nCol << ", Width: " << nPixel << "px" << std::endl; } +} +void ScGridWindow::dumpGraphicInformation() +{ + ScDocument* pDoc = pViewData->GetDocument(); ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); if (pDrawLayer) { @@ -44,7 +48,7 @@ void ScGridWindow::dumpInformation() for (sal_uInt16 nObj = 0; nObj < nObjCount; ++nObj) { SdrObject* pObj = pPage->GetObj(nObj); - std::cout << "Graphic Object"; + std::cout << "Graphic Object" << std::endl; ScDrawObjData* pObjData = ScDrawLayer::GetObjData(pObj); if (pObjData) std::cout << "Start Position: " << pObjData->maStart << ", EndPosition: " << pObjData->maEnd << std::endl; commit 503ed2f8e3fdbb4d7583b67b0bafcaccc896a5ae Author: Markus Mohrhard <[email protected]> Date: Fri May 22 08:02:53 2015 +0200 extract calc data dump method into own file Change-Id: Ifed8bb8165189243709078770b8735675fe86dea diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index d2fd5cd..c0644f8 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 e4bb56a..ca41b94 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 8b4c4b0..5ff1308 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 0000000..fd57e70 --- /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: */ commit ca6f5b48e9f529083ec35d866c89221c5a019597 Author: Markus Mohrhard <[email protected]> Date: Fri May 22 07:42:00 2015 +0200 add information about dumping information in calc Change-Id: I6b7fcc7fc68dd00f3fff84a65438e8a491816fd3 diff --git a/sc/README b/sc/README index fb918b9..a73f3b2 100644 --- a/sc/README +++ b/sc/README @@ -1 +1,13 @@ Spreadsheet application code. + + +Debug mode: + +There is a mode to dump some information in a dbgutil build. + +== Graphical information == + += CTRL+SHIFT+F12 = + +Dumps the column width of the first 20 column in pixel and the +pixel position and size of graphic objects. commit 0619ca016b81df61890701670b07d2ce752a72f9 Author: Markus Mohrhard <[email protected]> Date: Fri May 22 07:39:44 2015 +0200 improve data dump for calc Change-Id: Iab686719efadfbb6b15edb596c3a2176ae8a8f6b diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index a30175d..8b4c4b0 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -52,6 +52,7 @@ #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> @@ -3391,6 +3392,20 @@ 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 @@ -3512,13 +3527,36 @@ 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) { - SCTAB nTab = pViewData->GetTabNo(); 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; + } + } + } } #endif _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
