diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-11 13:07:15 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-02-11 22:33:34 -0500 |
commit | ec3e84c89e6abcd12cc79ed38c5148e89a7a4f35 (patch) | |
tree | f6f3992750187e47191bb93a015a51a5f55c6865 | |
parent | bc2fdbeba39aa5598d7b084481d1c4c1b291ffee (diff) |
Add Dump() method to dump content of EditTextObject.
Useful during debugging. Turned off in the default build.
Change-Id: Ia0b280337707f762b90d1d80c04671f2e8c21b01
-rw-r--r-- | editeng/Package_inc.mk | 1 | ||||
-rw-r--r-- | editeng/inc/editeng/editobj.hxx | 5 | ||||
-rw-r--r-- | editeng/inc/editeng/flditem.hxx | 2 | ||||
-rw-r--r-- | editeng/inc/editeng/macros.hxx | 17 | ||||
-rw-r--r-- | editeng/source/editeng/editobj.cxx | 42 | ||||
-rw-r--r-- | editeng/source/editeng/editobj2.hxx | 8 |
6 files changed, 75 insertions, 0 deletions
diff --git a/editeng/Package_inc.mk b/editeng/Package_inc.mk index 5b107caec225..2978ec14de02 100644 --- a/editeng/Package_inc.mk +++ b/editeng/Package_inc.mk @@ -83,6 +83,7 @@ $(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/langitem.hxx,editeng/l $(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/lcolitem.hxx,editeng/lcolitem.hxx)) $(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/lrspitem.hxx,editeng/lrspitem.hxx)) $(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/lspcitem.hxx,editeng/lspcitem.hxx)) +$(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/macros.hxx,editeng/macros.hxx)) $(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/measfld.hxx,editeng/measfld.hxx)) $(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/memberids.hrc,editeng/memberids.hrc)) $(eval $(call gb_Package_add_file,editeng_inc,inc/editeng/mutxhelp.hxx,editeng/mutxhelp.hxx)) diff --git a/editeng/inc/editeng/editobj.hxx b/editeng/inc/editeng/editobj.hxx index 985b7c4a6221..271a39b2c84f 100644 --- a/editeng/inc/editeng/editobj.hxx +++ b/editeng/inc/editeng/editobj.hxx @@ -28,6 +28,7 @@ #include <editeng/eeitem.hxx> #include <editeng/editdata.hxx> #include "editeng/editengdllapi.h" +#include "editeng/macros.hxx" #include <com/sun/star/text/textfield/Type.hpp> @@ -118,6 +119,10 @@ public: bool isWrongListEqual(const EditTextObject& rCompare) const; virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool); + +#if DEBUG_EDIT_ENGINE + void Dump() const; +#endif }; #endif // _EDITOBJ_HXX diff --git a/editeng/inc/editeng/flditem.hxx b/editeng/inc/editeng/flditem.hxx index 1ced8ecdbc56..d3f2b366d02f 100644 --- a/editeng/inc/editeng/flditem.hxx +++ b/editeng/inc/editeng/flditem.hxx @@ -28,6 +28,8 @@ #include <com/sun/star/text/textfield/Type.hpp> +#include <boost/noncopyable.hpp> + namespace com { namespace sun { namespace star { namespace text { class XTextContent; diff --git a/editeng/inc/editeng/macros.hxx b/editeng/inc/editeng/macros.hxx new file mode 100644 index 000000000000..c667cfd6e8b8 --- /dev/null +++ b/editeng/inc/editeng/macros.hxx @@ -0,0 +1,17 @@ +/* -*- 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/. + */ + +#ifndef __EDITENGINE_MACROS_HXX__ +#define __EDITENGINE_MACROS_HXX__ + +#define DEBUG_EDIT_ENGINE 0 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index 5f400be2f16d..244978781356 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -27,6 +27,7 @@ #include <tools/stream.hxx> #include "editeng/fieldupdater.hxx" +#include "editeng/macros.hxx" #include <editobj2.hxx> #include <editeng/editdata.hxx> #include <editattr.hxx> @@ -39,11 +40,18 @@ #include <editeng/bulitem.hxx> #include <editeng/numitem.hxx> #include <editeng/brshitem.hxx> + #include <vcl/graph.hxx> #include <svl/intitem.hxx> #include <unotools/fontcvt.hxx> #include <tools/tenccvt.hxx> +#if DEBUG_EDIT_ENGINE +#include <iostream> +using std::cout; +using std::endl; +#endif + using namespace com::sun::star; DBG_NAME( EE_EditTextObject ) @@ -154,6 +162,24 @@ bool ContentInfo::isWrongListEqual(const ContentInfo& rCompare) const return (*GetWrongList() == *rCompare.GetWrongList()); } +#if DEBUG_EDIT_ENGINE +void ContentInfo::Dump() const +{ + cout << "--" << endl; + cout << "text: '" << aText << "'" << endl; + cout << "style: '" << aStyle << "'" << endl; + + XEditAttributesType::const_iterator it = aAttribs.begin(), itEnd = aAttribs.end(); + for (; it != itEnd; ++it) + { + const XEditAttribute& rAttr = *it; + cout << "attribute: " << endl; + cout << " span: [begin=" << rAttr.GetStart() << ", end=" << rAttr.GetEnd() << "]" << endl; + cout << " feature: " << (rAttr.IsFeature() ? "yes":"no") << endl; + } +} +#endif + bool ContentInfo::operator==( const ContentInfo& rCompare ) const { if( (aText == rCompare.aText) && @@ -393,6 +419,13 @@ void EditTextObject::ObjectInDestruction(const SfxItemPool& rSfxItemPool) mpImpl->ObjectInDestruction(rSfxItemPool); } +#if DEBUG_EDIT_ENGINE +void EditTextObject::Dump() const +{ + mpImpl->Dump(); +} +#endif + // from SfxItemPoolUser void EditTextObjectImpl::ObjectInDestruction(const SfxItemPool& rSfxItemPool) { @@ -422,6 +455,15 @@ void EditTextObjectImpl::ObjectInDestruction(const SfxItemPool& rSfxItemPool) } } +#if DEBUG_EDIT_ENGINE +void EditTextObjectImpl::Dump() const +{ + ContentInfosType::const_iterator it = aContents.begin(), itEnd = aContents.end(); + for (; it != itEnd; ++it) + it->Dump(); +} +#endif + EditEngineItemPool* getEditEngineItemPool(SfxItemPool* pPool) { EditEngineItemPool* pRetval = dynamic_cast< EditEngineItemPool* >(pPool); diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx index 4d8923f4729a..ef213f0bfb68 100644 --- a/editeng/source/editeng/editobj2.hxx +++ b/editeng/source/editeng/editobj2.hxx @@ -149,6 +149,10 @@ public: // #i102062# bool isWrongListEqual(const ContentInfo& rCompare) const; + +#if DEBUG_EDIT_ENGINE + void Dump() const; +#endif }; class EditTextObjectImpl : boost::noncopyable @@ -245,6 +249,10 @@ public: // from SfxItemPoolUser void ObjectInDestruction(const SfxItemPool& rSfxItemPool); + +#if DEBUG_EDIT_ENGINE + void Dump() const; +#endif }; #endif // _EDITOBJ2_HXX |