diff options
-rw-r--r-- | editeng/README | 6 | ||||
-rw-r--r-- | editeng/source/editeng/editdbg.cxx | 18 | ||||
-rw-r--r-- | editeng/source/editeng/editdbg.hxx | 39 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 13 | ||||
-rw-r--r-- | editeng/source/editeng/editview.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 5 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/impedit5.cxx | 2 | ||||
-rw-r--r-- | forms/source/richtext/parametrizedattributedispatcher.cxx | 2 | ||||
-rw-r--r-- | include/editeng/editeng.hxx | 7 | ||||
-rw-r--r-- | include/editeng/editview.hxx | 2 | ||||
-rw-r--r-- | solenv/clang-format/excludelist | 1 |
12 files changed, 33 insertions, 70 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 ) { diff --git a/forms/source/richtext/parametrizedattributedispatcher.cxx b/forms/source/richtext/parametrizedattributedispatcher.cxx index b0aee41fc379..d6666e2b0262 100644 --- a/forms/source/richtext/parametrizedattributedispatcher.cxx +++ b/forms/source/richtext/parametrizedattributedispatcher.cxx @@ -75,7 +75,7 @@ namespace frm if ( !getEditView() ) return; - SfxItemSet aEmptySet( const_cast< EditView* >( getEditView() )->GetEmptyItemSet() ); + SfxItemSet aEmptySet(getEditView()->GetEmptyItemSet()); Sequence< PropertyValue > aUnoStateDescription; if ( _rState.getItem() ) { diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index e183cf81be5a..f853a017bfab 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -140,7 +140,6 @@ class EDITENG_DLLPUBLIC EditEngine { friend class EditView; friend class ImpEditView; - friend class EditDbg; friend class Outliner; friend class TextChainingUtils; @@ -199,7 +198,7 @@ public: EditEngine( SfxItemPool* pItemPool ); virtual ~EditEngine(); - const SfxItemSet& GetEmptyItemSet(); + const SfxItemSet& GetEmptyItemSet() const; void SetDefTab( sal_uInt16 nDefTab ); @@ -631,6 +630,10 @@ public: void SetLOKSpecialPaperSize(const Size& rSize); const Size& GetLOKSpecialPaperSize() const; + +#ifdef DBG_UTIL + static void DumpData(const EditEngine* pEE, bool bInfoBox); +#endif }; #endif // INCLUDED_EDITENG_EDITENG_HXX diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index 5b7f08228cff..86c88f5824b7 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -223,7 +223,7 @@ public: void MoveParagraphs( Range aParagraphs, sal_Int32 nNewPos ); void MoveParagraphs( long nDiff ); - const SfxItemSet& GetEmptyItemSet(); + const SfxItemSet& GetEmptyItemSet() const; SfxItemSet GetAttribs(); void SetAttribs( const SfxItemSet& rSet ); void RemoveAttribs( bool bRemoveParaAttribs = false, sal_uInt16 nWhich = 0 ); diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index eda629a26010..97e745d97f26 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -3876,7 +3876,6 @@ editeng/source/accessibility/AccessibleStaticTextBase.cxx editeng/source/accessibility/AccessibleStringWrap.cxx editeng/source/editeng/editattr.cxx editeng/source/editeng/editdbg.cxx -editeng/source/editeng/editdbg.hxx editeng/source/editeng/editdoc.cxx editeng/source/editeng/editeng.cxx editeng/source/editeng/editobj.cxx |