summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2020-07-03 16:36:10 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2020-07-14 16:19:53 +0200
commita03bc509cd19011043c340b893e7b00c7937423c (patch)
tree395fc6ebb1a4d06a2310c147f0472f2b056c5fd4 /editeng
parentd52fab0e1cb80fb1be775887585fede5dfffb60f (diff)
tdf#134478 Refactor dumping of EditEngine data
- document key combinations in README - dump data into workdir as editenginedump.log - move as static function into EditEngine class - get rid of the EditDbg class and editdbg.hxx Change-Id: I965f0143a9a275a289b202f54c0ea65da63c52f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97873 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/README6
-rw-r--r--editeng/source/editeng/editdbg.cxx18
-rw-r--r--editeng/source/editeng/editdbg.hxx39
-rw-r--r--editeng/source/editeng/editeng.cxx13
-rw-r--r--editeng/source/editeng/editview.cxx2
-rw-r--r--editeng/source/editeng/impedit.hxx5
-rw-r--r--editeng/source/editeng/impedit2.cxx6
-rw-r--r--editeng/source/editeng/impedit5.cxx2
8 files changed, 26 insertions, 65 deletions
diff --git a/editeng/README b/editeng/README
index d2a1a1383506..6eab9abaee4f 100644
--- a/editeng/README
+++ b/editeng/README
@@ -4,3 +4,9 @@ In OO.o build DEV300m72 this module was split off from svx but it
has no dependencies on [[svx]] (nor on [[sfx2]]) while in turn svx depends on editeng
Read more in the mailing list post:
[http://www.mail-archive.com/dev@openoffice.org/msg13237.html]
+
+If you build LibreOffice with dbgutil, you have some extended debug keys:
+Ctrl+Alt+F1 - draws the paragraph rectangles in different colors
+Ctrl+Alt+F11 - toggles dumping the edit engine state to the
+ "editenginedump.log" on draw
+Ctrl+Alt+F12 - dumps the current edit engine state to "editenginedump.log"
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx
index b2753839fad0..720c890d2048 100644
--- a/editeng/source/editeng/editdbg.cxx
+++ b/editeng/source/editeng/editdbg.cxx
@@ -51,14 +51,13 @@
#include <editeng/editeng.hxx>
#include <editeng/editview.hxx>
#include <editdoc.hxx>
-#include "editdbg.hxx"
#include <rtl/strbuf.hxx>
#include <osl/diagnose.h>
#if defined( DBG_UTIL ) || ( OSL_DEBUG_LEVEL > 1 )
-OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem)
+static OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem)
{
OStringBuffer aDebStr;
switch ( rItem.Which() )
@@ -295,7 +294,7 @@ OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem)
return aDebStr.makeStringAndClear();
}
-void DbgOutItemSet( FILE* fp, const SfxItemSet& rSet, bool bSearchInParent, bool bShowALL )
+static void DbgOutItemSet(FILE* fp, const SfxItemSet& rSet, bool bSearchInParent, bool bShowALL)
{
for ( sal_uInt16 nWhich = EE_PARA_START; nWhich <= EE_CHAR_END; nWhich++ )
{
@@ -316,13 +315,12 @@ void DbgOutItemSet( FILE* fp, const SfxItemSet& rSet, bool bSearchInParent, bool
}
}
-void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox )
+void EditEngine::DumpData(const EditEngine* pEE, bool bInfoBox)
{
-#if defined UNX
- FILE* fp = fopen( "/tmp/debug.log", "w" );
-#else
- FILE* fp = fopen( "d:\\debug.log", "w" );
-#endif
+ if (!pEE)
+ return;
+
+ FILE* fp = fopen( "editenginedump.log", "w" );
if ( fp == nullptr )
{
OSL_FAIL( "Log file could not be created!" );
@@ -484,7 +482,7 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox )
{
std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr,
VclMessageType::Info, VclButtonsType::Ok,
- "D:\\DEBUG.LOG !" ));
+ "Dumped editenginedump.log!" ));
xInfoBox->run();
}
}
diff --git a/editeng/source/editeng/editdbg.hxx b/editeng/source/editeng/editdbg.hxx
deleted file mode 100644
index 9c2fa5004791..000000000000
--- a/editeng/source/editeng/editdbg.hxx
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- 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 .
- */
-
-#pragma once
-
-#include <rtl/string.hxx>
-#include <stdio.h>
-
-class EditEngine;
-class SfxItemSet;
-class SfxItemPool;
-class SfxPoolItem;
-
-OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem);
-void DbgOutItemSet( FILE* fp, const SfxItemSet& rSet, bool bSearchInParent, bool bShowALL );
-
-class EditDbg
-{
-public:
- static void ShowEditEngineData( EditEngine* pEditEngine, bool bInfoBox = true );
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 99b6f1e04a99..15b140cd97a3 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -32,7 +32,6 @@
#include <editeng/editeng.hxx>
#include <editeng/editview.hxx>
#include <editeng/editstat.hxx>
-#include "editdbg.hxx"
#include <editeng/eerdll.hxx>
#include <editeng/editrids.hrc>
#include <editeng/flditem.hxx>
@@ -191,7 +190,7 @@ bool EditEngine::IsForceAutoColor() const
return pImpEditEngine->IsForceAutoColor();
}
-const SfxItemSet& EditEngine::GetEmptyItemSet()
+const SfxItemSet& EditEngine::GetEmptyItemSet() const
{
return pImpEditEngine->GetEmptyItemSet();
}
@@ -228,7 +227,7 @@ void EditEngine::Draw( OutputDevice* pOutDev, const tools::Rectangle& rOutRect,
{
#if defined( DBG_UTIL ) || (OSL_DEBUG_LEVEL > 1)
if ( bDebugPaint )
- EditDbg::ShowEditEngineData( this, false );
+ DumpData(this, false);
#endif
// Align to the pixel boundary, so that it becomes exactly the same
@@ -1023,7 +1022,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v
{
switch ( nCode )
{
- #if defined( DBG_UTIL ) || (OSL_DEBUG_LEVEL > 1)
+#if defined( DBG_UTIL ) || (OSL_DEBUG_LEVEL > 1)
case KEY_F1:
{
if ( rKeyEvent.GetKeyCode().IsMod1() && rKeyEvent.GetKeyCode().IsMod2() )
@@ -1067,13 +1066,11 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v
case KEY_F12:
{
if ( rKeyEvent.GetKeyCode().IsMod1() && rKeyEvent.GetKeyCode().IsMod2() )
- {
- EditDbg::ShowEditEngineData( this );
- }
+ DumpData(this, true);
bDone = false;
}
break;
- #endif
+#endif
case KEY_UP:
case KEY_DOWN:
case KEY_LEFT:
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 9da4d6cbf8d5..d43a93505724 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -523,7 +523,7 @@ Pair EditView::Scroll( long ndX, long ndY, ScrollRangeCheck nRangeCheck )
return pImpEditView->Scroll( ndX, ndY, nRangeCheck );
}
-const SfxItemSet& EditView::GetEmptyItemSet()
+const SfxItemSet& EditView::GetEmptyItemSet() const
{
return pImpEditView->pEditEngine->GetEmptyItemSet();
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 430046ddddbf..c85e3720dbd9 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -477,7 +477,6 @@ public:
class ImpEditEngine : public SfxListener
{
friend class EditEngine;
- friend class EditDbg;
typedef EditEngine::ViewsType ViewsType;
@@ -511,7 +510,7 @@ private:
svtools::ColorConfig maColorConfig;
mutable std::unique_ptr<SvtCTLOptions> pCTLOptions;
- std::unique_ptr<SfxItemSet> pEmptyItemSet;
+ mutable std::unique_ptr<SfxItemSet> pEmptyItemSet;
EditUndoManager* pUndoManager;
std::unique_ptr<ESelection> pUndoMarkSelection;
@@ -848,7 +847,7 @@ public:
EditSelectionEngine& GetSelEngine() { return aSelEngine; }
OUString GetSelected( const EditSelection& rSel ) const;
- const SfxItemSet& GetEmptyItemSet();
+ const SfxItemSet& GetEmptyItemSet() const;
void UpdateSelections();
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index eb9ef5eca2c3..d562037cc237 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -693,11 +693,11 @@ void ImpEditEngine::SetText(const OUString& rText)
}
-const SfxItemSet& ImpEditEngine::GetEmptyItemSet()
+const SfxItemSet& ImpEditEngine::GetEmptyItemSet() const
{
if ( !pEmptyItemSet )
{
- pEmptyItemSet = std::make_unique<SfxItemSet>( aEditDoc.GetItemPool(), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{} );
+ pEmptyItemSet = std::make_unique<SfxItemSet>(const_cast<SfxItemPool&>(aEditDoc.GetItemPool()), svl::Items<EE_ITEMS_START, EE_ITEMS_END>{});
for ( sal_uInt16 nWhich = EE_ITEMS_START; nWhich <= EE_CHAR_END; nWhich++)
{
pEmptyItemSet->ClearItem( nWhich );
@@ -1968,7 +1968,7 @@ bool ImpEditEngine::IsRightToLeft( sal_Int32 nPara ) const
else
{
// Use pool default
- pFrameDirItem = &const_cast<ImpEditEngine*>(this)->GetEmptyItemSet().Get( EE_PARA_WRITINGDIR );
+ pFrameDirItem = &GetEmptyItemSet().Get(EE_PARA_WRITINGDIR);
}
}
}
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index 0e5a294e0149..cbe881c35c59 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -403,7 +403,7 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int
DBG_ASSERT( pNode, "GetAttribs - unknown paragraph!" );
DBG_ASSERT( nStart <= nEnd, "getAttribs: Start > End not supported!" );
- SfxItemSet aAttribs( const_cast<ImpEditEngine*>(this)->GetEmptyItemSet() );
+ SfxItemSet aAttribs(GetEmptyItemSet());
if ( pNode )
{